slice-machine-ui 2.16.2-beta.10 → 2.16.2-beta.12

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 (61) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/HVFQKLYND23lsAflsxQCK/_buildManifest.js +1 -0
  3. package/out/_next/static/chunks/248-03446cd9e9f13730.js +1 -0
  4. package/out/_next/static/chunks/268-6a9214b97195af9c.js +1 -0
  5. package/out/_next/static/chunks/33641354.3864aefb6106ae71.js +28 -0
  6. package/out/_next/static/chunks/34-e684c5fd75cc9dd0.js +1 -0
  7. package/out/_next/static/chunks/630-a9927675acae2970.js +1 -0
  8. package/out/_next/static/chunks/647-7b9b5aa9468f9e4b.js +1 -0
  9. package/out/_next/static/chunks/882-53d88aa0b7e3ffeb.js +1 -0
  10. package/out/_next/static/chunks/pages/_app-ede31b5f88bff4a3.js +708 -0
  11. package/out/_next/static/chunks/pages/changelog-063c5e11dfc8fd55.js +1 -0
  12. package/out/_next/static/chunks/pages/changes-564336edb0ed18b0.js +1 -0
  13. package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-389d1b7a492fb3e7.js → [customTypeId]-a408f5a660e096a6.js} +1 -1
  14. package/out/_next/static/chunks/pages/{custom-types-2a5fd94ee42ba593.js → custom-types-5acd56959b60346f.js} +1 -1
  15. package/out/_next/static/chunks/pages/{index-02dd147957c8b40f.js → index-0d8cb369de720a35.js} +1 -1
  16. package/out/_next/static/chunks/pages/labs-9630bfb1005be02b.js +1 -0
  17. package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-3589bd1f9138a97b.js → [pageTypeId]-f5e851ebe35049a8.js} +1 -1
  18. package/out/_next/static/chunks/pages/settings-01f4aeb9112a1f87.js +1 -0
  19. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-5008e29008aa04f4.js +1 -0
  20. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-94c9cad9da2c3089.js +1 -0
  21. package/out/_next/static/chunks/pages/slices-4a60cd5f2c71327e.js +1 -0
  22. package/out/_next/static/chunks/webpack-b3522fdebabf510a.js +1 -0
  23. package/out/_next/static/css/cc9b10286400c2b9.css +1 -0
  24. package/out/changelog.html +1 -1
  25. package/out/changes.html +1 -1
  26. package/out/custom-types/[customTypeId].html +1 -1
  27. package/out/custom-types.html +1 -1
  28. package/out/index.html +1 -1
  29. package/out/labs.html +1 -1
  30. package/out/page-types/[pageTypeId].html +1 -1
  31. package/out/settings.html +1 -1
  32. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  33. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  34. package/out/slices.html +1 -1
  35. package/package.json +7 -7
  36. package/src/features/builder/fields/ContentRelationshipFieldPicker.tsx +1233 -0
  37. package/src/features/customTypes/customTypesTable/CustomTypesTable.tsx +2 -4
  38. package/src/features/customTypes/customTypesTable/{useCustomTypes.ts → useCustomTypesAutoRevalidation.tsx} +1 -34
  39. package/src/features/customTypes/useCustomTypes.ts +48 -0
  40. package/src/legacy/lib/models/common/widgets/ContentRelationship/Form.tsx +35 -77
  41. package/src/legacy/lib/models/common/widgets/ContentRelationship/index.ts +44 -14
  42. package/src/legacy/lib/models/common/widgets/Link/index.ts +1 -1
  43. package/src/utils/isValidObject.ts +32 -0
  44. package/out/_next/static/EvmgR0Gau-7Wz9Fnt3n3p/_buildManifest.js +0 -1
  45. package/out/_next/static/chunks/268-6d5fc7642a1b87c8.js +0 -1
  46. package/out/_next/static/chunks/34-2911c905c8a6e9d9.js +0 -1
  47. package/out/_next/static/chunks/630-93339694ef30b82d.js +0 -1
  48. package/out/_next/static/chunks/867-8164160c810122c6.js +0 -1
  49. package/out/_next/static/chunks/882-28837678beff7e51.js +0 -1
  50. package/out/_next/static/chunks/895-8c214ba470a4e23c.js +0 -1
  51. package/out/_next/static/chunks/pages/_app-80614b8c7575109c.js +0 -657
  52. package/out/_next/static/chunks/pages/changelog-80a618708f44f25f.js +0 -1
  53. package/out/_next/static/chunks/pages/changes-d40c17939854b984.js +0 -1
  54. package/out/_next/static/chunks/pages/labs-c6df252ea5d8fb6f.js +0 -1
  55. package/out/_next/static/chunks/pages/settings-170379902605f38a.js +0 -1
  56. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-063fa88ba75f483e.js +0 -1
  57. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-6de02b8ed13b680d.js +0 -1
  58. package/out/_next/static/chunks/pages/slices-071bb494907adf0f.js +0 -1
  59. package/out/_next/static/chunks/webpack-2f903acb0cccbf9e.js +0 -1
  60. package/out/_next/static/css/9c9a7de81f9ac811.css +0 -1
  61. /package/out/_next/static/{EvmgR0Gau-7Wz9Fnt3n3p → HVFQKLYND23lsAflsxQCK}/_ssgManifest.js +0 -0
@@ -29,10 +29,8 @@ import { SingleIcon } from "@/icons/SingleIcon";
29
29
 
30
30
  import { CUSTOM_TYPES_CONFIG } from "../customTypesConfig";
31
31
  import { EditDropdown } from "../EditDropdown";
32
- import {
33
- useCustomTypes,
34
- useCustomTypesAutoRevalidation,
35
- } from "./useCustomTypes";
32
+ import { useCustomTypes } from "../useCustomTypes";
33
+ import { useCustomTypesAutoRevalidation } from "./useCustomTypesAutoRevalidation";
36
34
 
37
35
  type CustomTypesTableProps = {
38
36
  format: CustomTypeFormat;
@@ -1,46 +1,13 @@
1
- import { updateData, useRequest } from "@prismicio/editor-support/Suspense";
2
1
  import type { CustomType } from "@prismicio/types-internal/lib/customtypes";
3
2
  import type { CustomTypeFormat } from "@slicemachine/manager";
4
- import { useCallback, useEffect } from "react";
3
+ import { useEffect } from "react";
5
4
  import { useSelector } from "react-redux";
6
5
 
7
6
  import { CustomTypes } from "@/legacy/lib/models/common/CustomType";
8
7
  import { hasLocal } from "@/legacy/lib/models/common/ModelData";
9
- import { managerClient } from "@/managerClient";
10
8
  import { selectAllCustomTypes } from "@/modules/availableCustomTypes";
11
9
  import type { SliceMachineStoreType } from "@/redux/type";
12
10
 
13
- type UseCustomTypesReturnType = {
14
- customTypes: CustomType[];
15
- updateCustomTypes: (customTypes: CustomType[]) => void;
16
- };
17
-
18
- export function useCustomTypes(
19
- format: CustomTypeFormat,
20
- ): UseCustomTypesReturnType {
21
- const updateCustomTypes = useCallback(
22
- (data: CustomType[]) => updateData(getCustomTypes, [format], data),
23
- [format],
24
- );
25
-
26
- return {
27
- customTypes: useRequest(getCustomTypes, [format]),
28
- updateCustomTypes,
29
- };
30
- }
31
-
32
- async function getCustomTypes(format: CustomTypeFormat): Promise<CustomType[]> {
33
- const { errors, models } = await managerClient.customTypes.readAllCustomTypes(
34
- { format },
35
- );
36
-
37
- if (errors.length > 0) {
38
- throw errors;
39
- }
40
-
41
- return models.map(({ model }) => model);
42
- }
43
-
44
11
  /**
45
12
  * TODO: DT-1363 - Update the way to have new data without Redux by revalidating
46
13
  * Suspense
@@ -0,0 +1,48 @@
1
+ import {
2
+ revalidateData,
3
+ updateData,
4
+ useRequest,
5
+ } from "@prismicio/editor-support/Suspense";
6
+ import type { CustomType } from "@prismicio/types-internal/lib/customtypes";
7
+ import type { CustomTypeFormat } from "@slicemachine/manager";
8
+ import { useCallback } from "react";
9
+
10
+ import { managerClient } from "@/managerClient";
11
+
12
+ type UseCustomTypesReturnType = {
13
+ customTypes: CustomType[];
14
+ updateCustomTypes: (customTypes: CustomType[]) => void;
15
+ };
16
+
17
+ export function useCustomTypes(
18
+ format?: CustomTypeFormat,
19
+ ): UseCustomTypesReturnType {
20
+ const updateCustomTypes = useCallback(
21
+ (data: CustomType[]) => updateData(getCustomTypes, [format], data),
22
+ [format],
23
+ );
24
+
25
+ return {
26
+ customTypes: useRequest(getCustomTypes, [format]),
27
+ updateCustomTypes,
28
+ };
29
+ }
30
+
31
+ export async function getCustomTypes(
32
+ format?: CustomTypeFormat,
33
+ ): Promise<CustomType[]> {
34
+ const { errors, models } = await managerClient.customTypes.readAllCustomTypes(
35
+ format ? { format } : undefined,
36
+ );
37
+
38
+ if (errors.length > 0) {
39
+ throw errors;
40
+ }
41
+
42
+ return models.map(({ model }) => model);
43
+ }
44
+
45
+ export function revalidateGetCustomTypes(format?: CustomTypeFormat) {
46
+ void revalidateData(getCustomTypes, []);
47
+ void revalidateData(getCustomTypes, [format]);
48
+ }
@@ -1,105 +1,63 @@
1
+ import { LinkConfig } from "@prismicio/types-internal/lib/customtypes";
1
2
  import { FormikProps } from "formik";
2
- import { useSelector } from "react-redux";
3
- import Select from "react-select";
4
- import { Box, Label } from "theme-ui";
3
+ import { Box } from "theme-ui";
5
4
  import * as yup from "yup";
6
5
 
6
+ import { ContentRelationshipFieldPicker } from "@/features/builder/fields/ContentRelationshipFieldPicker";
7
7
  import { Col, Flex as FlexGrid } from "@/legacy/components/Flex";
8
8
  import WidgetFormField from "@/legacy/lib/builders/common/EditModal/Field";
9
9
  import { createFieldNameFromKey } from "@/legacy/lib/forms";
10
10
  import { DefaultFields } from "@/legacy/lib/forms/defaults";
11
- import { selectAllCustomTypes } from "@/modules/availableCustomTypes";
12
-
13
- import { hasLocal } from "../../ModelData";
14
11
 
15
12
  const FormFields = {
16
13
  label: DefaultFields.label,
17
14
  id: DefaultFields.id,
18
15
  customtypes: {
19
- validate: () => yup.array().of(yup.string()),
16
+ validate: () => yup.array(),
20
17
  },
21
18
  };
22
19
 
23
20
  type FormProps = {
24
- config: { label: string; select: string; customtypes?: string[] };
21
+ config: {
22
+ label: string;
23
+ select: string;
24
+ customtypes?: LinkConfig["customtypes"];
25
+ };
25
26
  id: string;
26
- // type: string; // TODO: this exists in the yup schema but this doesn't seem to be validated by formik
27
+ // TODO: this exists in the yup schema but this doesn't seem to be validated by formik
27
28
  };
28
29
 
29
30
  const WidgetForm = ({
30
31
  initialValues,
31
- values: formValues,
32
- fields,
32
+ values,
33
33
  setFieldValue,
34
+ fields,
34
35
  }: FormikProps<FormProps> & { fields: Record<string, unknown> }) => {
35
- const customTypes = useSelector(selectAllCustomTypes).filter(hasLocal);
36
-
37
- const options = customTypes.map((ct) => ({
38
- value: ct.local.id,
39
- label: ct.local.label,
40
- }));
41
-
42
- const selectValues = formValues.config.customtypes
43
- ? formValues.config.customtypes.map((id) => {
44
- const ct = customTypes.find(
45
- (frontendCustomType) => frontendCustomType.local.id === id,
46
- );
47
- return { value: ct?.local.id, label: ct?.local.label };
48
- })
49
- : null;
50
-
51
36
  return (
52
- <FlexGrid>
53
- {Object.entries(FormFields)
54
- .filter((e) => e[0] !== "customtypes")
55
- .map(([key, field]) => (
56
- <Col key={key}>
57
- <WidgetFormField
58
- fieldName={createFieldNameFromKey(key)}
59
- formField={field}
60
- fields={fields}
61
- initialValues={initialValues}
62
- />
63
- </Col>
64
- ))}
65
- <Col>
66
- <Box
67
- sx={{
68
- mt: 2,
69
- alignItems: "center",
37
+ <>
38
+ <FlexGrid>
39
+ {Object.entries(FormFields)
40
+ .filter((e) => e[0] !== "customtypes")
41
+ .map(([key, field]) => (
42
+ <Col key={key}>
43
+ <WidgetFormField
44
+ fieldName={createFieldNameFromKey(key)}
45
+ formField={field}
46
+ fields={fields}
47
+ initialValues={initialValues}
48
+ />
49
+ </Col>
50
+ ))}
51
+ </FlexGrid>
52
+ <Box mt={20}>
53
+ <ContentRelationshipFieldPicker
54
+ value={values.config.customtypes}
55
+ onChange={(fields) => {
56
+ void setFieldValue("config.customtypes", fields);
70
57
  }}
71
- >
72
- <Label htmlFor="origin" mb="1">
73
- Types
74
- </Label>
75
- <Select
76
- isMulti
77
- name="origin"
78
- options={options}
79
- onChange={(v) => {
80
- // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
81
- if (v) {
82
- void setFieldValue(
83
- "config.customtypes",
84
- v.map(({ value }) => value),
85
- );
86
- }
87
- }}
88
- value={selectValues}
89
- theme={(theme) => {
90
- return {
91
- ...theme,
92
- colors: {
93
- ...theme.colors,
94
- text: "text",
95
- primary: "background",
96
- },
97
- };
98
- }}
99
- />
100
- </Box>
101
- </Col>
102
- </FlexGrid>
58
+ />
59
+ </Box>
60
+ </>
103
61
  );
104
62
  };
105
63
 
@@ -7,17 +7,44 @@ import { Widget } from "../Widget";
7
7
  import Form, { FormFields } from "./Form";
8
8
 
9
9
  /**
10
+ * Legacy:
11
+ * {
12
+ * "type": "Link",
13
+ * "config": {
14
+ * "select": "document",
15
+ * "label": "relationship"
16
+ * "customtypes": [
17
+ * "page"
18
+ * ],
19
+ * }
20
+ * }
21
+ *
22
+ * Current format (field picking):
10
23
  * {
11
- "type": "Link",
12
- "config": {
13
- "select": "document",
14
- "customtypes": [
15
- "page"
16
- ],
17
- "label": "relationship"
18
- }
19
- }
20
- */
24
+ * "type": "Link",
25
+ * "config": {
26
+ * "select": "document",
27
+ * "label": "relationship"
28
+ * "customtypes": [
29
+ * {
30
+ * "id": "page",
31
+ * "fields": [
32
+ * "category",
33
+ * {
34
+ * "id": "countryRelation",
35
+ * "customtypes": [
36
+ * {
37
+ * "id": "country",
38
+ * "fields": ["name"]
39
+ * }
40
+ * ]
41
+ * }
42
+ * ]
43
+ * }
44
+ * ],
45
+ * }
46
+ * }
47
+ */
21
48
 
22
49
  const Meta = {
23
50
  icon: MdSettingsEthernet,
@@ -30,7 +57,7 @@ const contentRelationShipConfigSchema = linkConfigSchema.shape({
30
57
  .string()
31
58
  .required()
32
59
  .matches(/^document$/, { excludeEmptyString: true }),
33
- customtypes: yup.array(yup.string()).strict().optional(),
60
+ customtypes: yup.array().optional(),
34
61
  });
35
62
 
36
63
  const schema = yup.object().shape({
@@ -65,9 +92,12 @@ export const ContentRelationshipWidget: Widget<Link, typeof schema> = {
65
92
  return {
66
93
  ...initialValues,
67
94
  customtypes: initialValues.customtypes.filter((ct) =>
68
- customTypes.find(
69
- (frontendCustomType) => frontendCustomType.local.id === ct,
70
- ),
95
+ customTypes.find((frontendCustomType) => {
96
+ if (typeof ct === "string") {
97
+ return frontendCustomType.local.id === ct;
98
+ }
99
+ return frontendCustomType.local.id === ct.id;
100
+ }),
71
101
  ),
72
102
  };
73
103
  },
@@ -72,7 +72,7 @@ export const linkConfigSchema = yup
72
72
  .optional()
73
73
  .oneOf(["media", "document", "web", null])
74
74
  .nullable(),
75
- customtypes: yup.array(yup.string()).strict().optional(),
75
+ customtypes: yup.array().strict().optional(),
76
76
  masks: yup.array(yup.string()).optional(),
77
77
  tags: yup.array(yup.string()).optional(),
78
78
  allowTargetBlank: yup.boolean().strict().optional(),
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Ensure that the value is an record/object with string keys and existing
3
+ * properties. Accepts empty objects and objects created with
4
+ * `Object.create(null)`.
5
+ */
6
+ export function isValidObject(
7
+ value: unknown,
8
+ ): value is Record<string, unknown> {
9
+ if (typeof value !== "object" || value === null) return false;
10
+
11
+ if (Array.isArray(value)) return false;
12
+
13
+ if (
14
+ value instanceof Date ||
15
+ value instanceof RegExp ||
16
+ value instanceof Error
17
+ ) {
18
+ return false;
19
+ }
20
+
21
+ // Check if all keys are strings and all values are valid
22
+ for (const key in value) {
23
+ if (
24
+ typeof key !== "string" ||
25
+ !Object.prototype.hasOwnProperty.call(value, key)
26
+ ) {
27
+ return false;
28
+ }
29
+ }
30
+
31
+ return true;
32
+ }
@@ -1 +0,0 @@
1
- self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,n,d,u,f,h,l,k,j,p,g,o,r,m){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[s,e,p,g,"static/chunks/pages/index-02dd147957c8b40f.js"],"/_error":["static/chunks/pages/_error-fedd2c6ebd3d27b9.js"],"/changelog":[c,t,"static/chunks/870-a72b74312773efea.js","static/chunks/pages/changelog-80a618708f44f25f.js"],"/changes":[c,i,"static/chunks/8eec4907-b712959d9f984b68.js","static/chunks/918-fa4f2563cb5fd014.js",a,n,"static/css/d98ebc475f8423a3.css","static/chunks/pages/changes-d40c17939854b984.js"],"/custom-types":[s,e,p,g,"static/chunks/pages/custom-types-2a5fd94ee42ba593.js"],"/custom-types/[customTypeId]":[c,d,u,f,h,s,t,b,l,o,a,e,k,j,r,m,"static/chunks/pages/custom-types/[customTypeId]-389d1b7a492fb3e7.js"],"/labs":["static/chunks/pages/labs-c6df252ea5d8fb6f.js"],"/page-types/[pageTypeId]":[c,d,u,f,h,s,t,b,l,o,a,e,k,j,r,m,"static/chunks/pages/page-types/[pageTypeId]-3589bd1f9138a97b.js"],"/settings":[s,"static/css/e5f781f20e24a5ea.css","static/chunks/pages/settings-170379902605f38a.js"],"/slices":[c,i,s,b,a,n,j,"static/css/efa5152b7c0f35c0.css","static/chunks/pages/slices-071bb494907adf0f.js"],"/slices/[lib]/[sliceName]/[variation]":[c,i,d,u,f,h,s,t,b,l,a,k,n,"static/css/cdee5b195444f185.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-6de02b8ed13b680d.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[i,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/157-54b8336d20b41933.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-063fa88ba75f483e.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/settings","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/397-e6c340070a3bcb41.js","static/chunks/59b4e022-ef680789f7cc9b11.js","static/chunks/34-2911c905c8a6e9d9.js","static/chunks/867-8164160c810122c6.js","static/chunks/183-4ea255b867ff171b.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/44-a2056f993381ad0f.js","static/chunks/658-8231c0b729e0124a.js","static/chunks/f36c6662-1f3a854183168b10.js","static/chunks/4c744e84-480e426e4b1cfef3.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-09fb3b997ad1eb70.js","static/chunks/349-7118116b93278f73.js","static/chunks/630-93339694ef30b82d.js","static/chunks/268-6d5fc7642a1b87c8.js","static/chunks/895-8c214ba470a4e23c.js","static/css/4e475d945cf8a890.css","static/chunks/385-b949173dfa03dd3e.js","static/chunks/882-28837678beff7e51.js","static/css/56f2a6684a524374.css"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[268],{22654:function(e,t,a){a.d(t,{l:function(){return n}});var r=a(96317);function n(){let e=(0,r.L)("slicemachine-image-to-slice");return{eligible:(null==e?void 0:e.value)==="on"}}},91589:function(e,t,a){a.d(t,{S:function(){return x}});var r=a(52322),n=a(7729),i=a(2784),l=a(88932),s=a(94160),c=a(34166),o=a(63470),u=a(98250),d=a(68968),m=a(80148),g=a(54597),p=a(31860),h=a(62434);function f(e){let{slice:t}=e,a="uploading"===t.status||"generating"===t.status,i="uploadError"===t.status||"generateError"===t.status,l="generateError"===t.status||"generating"===t.status||"success"===t.status;return(0,r.jsxs)(h.Zb,{disabled:a,children:[l?(0,r.jsx)(h.ZB,{src:t.thumbnailUrl}):(0,r.jsx)(h.ZB,{component:"div"}),(0,r.jsx)(h.eW,{loading:a,startIcon:function(e){switch(e){case"uploadError":case"generateError":return"close";case"success":return"check";default:return}}(t.status),title:"success"===t.status?t.model.name:t.image.name,subtitle:function(e){switch(e){case"uploading":return"Uploading...";case"uploadError":return"Unable to upload image";case"generating":return"Generating...";case"generateError":return"Something went wrong";case"success":return"Generated"}}(t.status),error:i,action:i?(0,r.jsx)(n.zxk,{startIcon:"refresh",color:"grey",onClick:t.onRetry,children:"Retry"}):void 0})]})}function x(e){let{open:t,location:a,onSuccess:h,onClose:x}=e,[w,b]=(0,i.useState)([]),[C,A]=(0,i.useState)(!1),{syncChanges:I}=(0,d.g)(),{createSliceSuccess:k}=(0,g.Z)(),{completeStep:E}=(0,u.k)(),U=(0,o.k)(),L=(0,i.useRef)(crypto.randomUUID()),N=e=>{let{index:t,slice:a}=e;b(e=>e.map((e,r)=>r===t?a(e):e))},Z=e=>{if(e.length>10){l.Am.error("You can only upload ".concat(10," images at a time."));return}b(e.map(e=>({status:"uploading",image:e}))),e.forEach((e,t)=>_({index:t,image:e}))},_=e=>{let{index:t,image:a}=e,r=L.current;N({index:t,slice:e=>({...e,status:"uploading"})}),v({image:a}).then(e=>{r===L.current&&D({index:t,imageUrl:e})},()=>{r===L.current&&N({index:t,slice:e=>({...e,status:"uploadError",onRetry:()=>_({index:t,image:a})})})})},z=function(e){let{open:t}=e,a=(0,i.useRef)([]);return(0,i.useEffect)(()=>{t&&(a.current=[],m.managerClient.slices.readAllSlices().then(e=>{a.current=e.models.map(e=>{let{model:t}=e;return t})}).catch(()=>null))},[t]),a}({open:t}),D=e=>{let{index:t,imageUrl:a}=e,r=L.current;N({index:t,slice:e=>({...e,status:"generating",thumbnailUrl:a})}),m.managerClient.customTypes.inferSlice({imageUrl:a}).then(e=>{let{slice:n,langSmithUrl:i}=e;r===L.current&&b(e=>e.map((r,l)=>l===t?{...r,status:"success",thumbnailUrl:a,model:function(e){let{existingSlices:t,newSlices:a,slice:r}=e,n=new Set,i=new Set;for(let{id:e,name:a}of t)n.add(e),i.add(a.toLowerCase());for(let e of a)"success"===e.status&&(n.add(e.model.id),i.add(e.model.name.toLowerCase()));let l=r.id,s=2;for(;n.has(l);)l="".concat(r.id,"_").concat(s),s++;let c=r.name;for(s=2;i.has(c.toLowerCase());)c="".concat(r.name).concat(s),s++;return{...r,id:l,name:c}}({existingSlices:z.current,newSlices:e,slice:n}),langSmithUrl:i}:r))},()=>{r===L.current&&N({index:t,slice:e=>({...e,status:"generateError",thumbnailUrl:a,onRetry:()=>D({index:t,imageUrl:a})})})})},F=w.some(e=>"uploading"===e.status||"generating"===e.status),R=w.filter(e=>"success"===e.status),B=R.length>0;return(0,r.jsxs)(n.VqE,{open:t,onOpenChange:e=>{e||C||(x(),L.current=crypto.randomUUID(),b([]))},children:[(0,r.jsx)(n.fKu,{title:"Generate from image"}),(0,r.jsxs)(n.cZJ,{gap:0,children:[(0,r.jsxs)(n.BeV,{hidden:!0,children:["Upload images to generate ",(0,p._)(U.value)," ","with AI"]}),0===w.length?(0,r.jsx)(n.xuv,{padding:16,height:"100%",children:(0,r.jsx)(n.Zzl,{onFilesSelected:Z,assetType:"image",maxFiles:10,overlay:(0,r.jsx)(y,{onFilesSelected:Z,droppingFiles:!0}),children:(0,r.jsx)(y,{onFilesSelected:Z})})}):(0,r.jsx)(n.xrM,{stableScrollbar:!1,children:(0,r.jsx)(n.xuv,{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:16,children:w.map((e,t)=>(0,r.jsx)(f,{slice:e},"slice-".concat(t)))})}),(0,r.jsxs)(n.kXR,{children:[(0,r.jsx)(n.POh,{disabled:C}),(0,r.jsxs)(n._dX,{disabled:!B||F,loading:C,onClick:()=>{let e=w.reduce((e,t)=>("success"===t.status&&e.push(t),e),[]);if(!e.length)return;let t=L.current;A(!0),j(e).then(async e=>{let{slices:r,library:n}=e;if(t===L.current)for(let{model:e,langSmithUrl:t}of(k((await (0,s.y0)()).libraries),I(),h({slices:r,library:n}),A(!1),L.current=crypto.randomUUID(),b([]),E("createSlice"),r))s.Xe.track({event:"slice:created",id:e.id,name:e.name,library:n,location:a,mode:"ai",langSmithUrl:t}),(0,c.nZ)({type:"model",library:n,sliceId:e.id,variationId:e.variations[0].id,langSmithUrl:t})}).catch(()=>{t===L.current&&(A(!1),l.Am.error("An unexpected error happened while adding slices."))})},children:[S({location:a,sectionsNamingExperiment:U})," (",R.length,")"]})]})]})]})}function y(e){let t=(0,o.k)(),{droppingFiles:a=!1,onFilesSelected:i}=e;return(0,r.jsx)(n.xuv,{justifyContent:"center",flexDirection:"column",height:"100%",backgroundColor:a?"purple2":"grey2",border:!0,borderStyle:"dashed",borderColor:a?"purple9":"grey6",children:(0,r.jsxs)(n.R$c,{children:[(0,r.jsx)(n.avq,{lineColor:"purple11",backgroundColor:"purple5",name:"cloudUpload",size:"large"}),(0,r.jsx)(n._T6,{children:"Upload your design images."}),(0,r.jsxs)(n.nfr,{children:["Once uploaded, you can generate"," ",(0,p._)(t.value)," automatically using AI."]}),(0,r.jsx)(n.QjJ,{children:(0,r.jsx)(n.KH,{startIcon:"attachFile",onFilesSelected:i,color:"grey",children:"Add images"})})]})})}async function v(e){let{image:t}=e,a=[await m.managerClient.project.getResolvedRepositoryName(),"shared-slices","prismic-inferred-slices",crypto.randomUUID()].join("/");await m.managerClient.screenshots.initS3ACL();let{url:r}=await m.managerClient.screenshots.uploadScreenshot({keyPrefix:a,data:t});return r}async function j(e){let{libraries:t=[]}=await m.managerClient.project.getSliceMachineConfig(),a=t[0];if(!a)throw Error("No library found in the config.");for(let{model:t}of e){let{errors:e}=await m.managerClient.slices.createSlice({libraryID:a,model:t});if(e.length)throw Error("Failed to create slice ".concat(t.id,"."))}let r=await Promise.all(e.map(async e=>{let{model:t,image:r,langSmithUrl:n}=e;return await m.managerClient.slices.updateSliceScreenshot({libraryID:a,sliceID:t.id,variationID:t.variations[0].id,data:r}),{model:t,langSmithUrl:n}}));return{library:a,slices:r}}let S=e=>{let{location:t,sectionsNamingExperiment:a}=e;switch(t){case"custom_type":return"Add to type";case"page_type":return"Add to page";case"slices":return"Add to ".concat((0,p._)(a.value))}}},27213:function(e,t,a){a.d(t,{F:function(){return l}});var r=a(52322),n=a(7729),i=a(31860);let l=e=>{let{menuType:t,sectionsNamingExperiment:a}=e;return{fromImage:{BackgroundIcon:(0,r.jsx)(n.AZf,{name:"autoFixHigh",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"purple",variant:"solid",radius:6}),title:"Generate from image",description:"Build a ".concat(a.value," based on your design image.")},fromScratch:{BackgroundIcon:(0,r.jsx)(n.AZf,{name:"add",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Start from scratch",description:"Build a custom ".concat(a.value," your way.")},fromTemplate:{BackgroundIcon:(0,r.jsx)(n.AZf,{name:"contentCopy",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Use a template",description:"Choose from ready-made examples."},fromExisting:{BackgroundIcon:(0,r.jsx)(n.AZf,{name:"folder",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Reuse an existing ".concat(a.value),description:"Select from your created ".concat((0,i._)(a.value))}}}},6256:function(e,t,a){a.d(t,{c:function(){return S}});var r=a(52322),n=a(2784),i=a(36131),l=a(75289),s=a(94160),c=a(63470),o=a(98250),u=a(88932),d=a(63908),m=a(358),g=a(80148);async function p(e){let{sliceName:t,libraryName:a,location:r,onSuccess:n}=e;try{let e=(0,d.fo)(t),{errors:i}=await g.managerClient.slices.createSlice({libraryID:a,model:e});if(i.length>0)throw i;s.Xe.track({event:"slice:created",id:(0,m.MP)(t),name:t,library:a,location:r,mode:"manual"}),await n(e)}catch(a){let e="An unexpected error happened while creating slice ".concat(t,".");console.error(e,a),u.Am.error(e)}}var h=a(68968),f=a(59532),x=a(54597),y=a(31860),v=a(46999),j=a(63019);let S=e=>{let{onClose:t,onSuccess:a,localLibraries:u,location:d,remoteSlices:m}=e,{createSliceSuccess:g}=(0,x.Z)(),[S,w]=(0,n.useState)(!1),{syncChanges:b}=(0,h.g)(),{completeStep:C}=(0,o.k)(),A=(0,c.k)(),I=async e=>{let t=e.sliceName,r=e.from;w(!0),await p({sliceName:t,libraryName:r,location:d,onSuccess:async e=>{g((await (0,s.y0)()).libraries),a(e,r),b(),C("createSlice")}})};return(0,r.jsx)(f.Z,{testId:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:S,formId:"create-new-slice",close:t,buttonLabel:"Create",onSubmit:e=>{I(e)},initialValues:{sliceName:"",from:u[0].name},validate:e=>(0,j.h)(e,u,m),content:{title:"Create a new ".concat(A.value)},children:e=>{let{touched:t,values:a,setFieldValue:n,errors:s}=e;return(0,r.jsxs)(l.xu,{children:[(0,r.jsx)(v.W,{name:"sliceName",label:"".concat((0,y.f)(A.value)," name"),placeholder:"Pascalised ".concat(A.value," API ID (e.g. TextBlock)"),error:t.sliceName?s.sliceName:void 0,testId:"slice-name-input"}),(0,r.jsx)(l.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,r.jsx)(i.ZP,{name:"from",options:u.map(e=>({value:e.name,label:e.name})),onChange:e=>e?void n("from",e.value):null,defaultValue:{value:a.from,label:a.from},styles:{option:e=>({...e,color:"#161618"})},theme:e=>({...e,colors:{...e.colors,primary:"#E9E8EA"}}),menuPortalTarget:document.body})]})}})}},63019:function(e,t,a){a.d(t,{h:function(){return c}});var r=a(96009),n=a.n(r),i=a(74600),l=a.n(i),s=a(7974);function c(e,t,a){let{sliceName:r}=e;return r?s.lS.includes(r.toLowerCase())?{sliceName:'Name "'.concat(r,'" is reserved for Slice Machine use.')}:s.xo.exec(r)?l()(n()(r)).replace(/\s/gm,"")!==r.trim()?{sliceName:"Value has to be PascalCased."}:r.match(/^\d/)?{sliceName:"Value cannot start with a number."}:[...t.flatMap(e=>e.components.map(e=>e.model.name)),...a.map(e=>e.name)].includes(r)?{sliceName:"Slice name is already taken."}:void 0:{sliceName:"No special characters allowed."}:{sliceName:"Cannot be empty"}}},21151:function(e,t,a){var r=a(52322),n=a(75289);t.Z=function(e){let{elems:t,renderElem:a,defineElementKey:i,gridTemplateMinPx:l="320px",gridGap:s="16px",sx:c}=e;return(0,r.jsx)(n.xu,{as:"section",sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(l,", 1fr))"),gridGap:s,pt:2,...c},children:t.map((e,t)=>e?(0,r.jsx)("span",{children:a(e,t)},"".concat(i(e),"-").concat(t+1)):null)})}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[34],{62434:function(e,t,n){"use strict";n.d(t,{Zb:function(){return c},T$:function(){return m},eW:function(){return _},ZB:function(){return u},Lm:function(){return h}});var o=n(52322),r=n(50002),i=n(7729),a=n(6277),l=n(2784),d=n(67968),s=n.n(d);let c=e=>{let{checked:t=!1,size:n="medium",variant:i="solid",interactive:d,disabled:c,onClick:u,href:m,component:_="a",replace:h,...C}=e,x={...C,className:(0,a.W)(s().root,s()["size-".concat(n)],s()[i],{[s().interactive]:e.interactive}),"data-state":!0===t?"checked":void 0,"data-disabled":!0===e.disabled?"":void 0};return!0===e.interactive&&void 0===e.href?(0,o.jsx)("div",{...x,onClick:t=>{if(!0===e.disabled||void 0===e.onClick)return;let n=t.target;(0,r.JY)(n)===t.currentTarget&&e.onClick(t)},tabIndex:!0===e.disabled?void 0:0}):!0===e.interactive?(0,l.createElement)(_,{...x,href:e.href,onClick:e=>{let t=e.target;(0,r.JY)(t)!==e.currentTarget&&e.preventDefault()},..."a"===_?{}:{replace:e.replace}}):(0,o.jsx)("div",{...x})},u=e=>{let{className:t,component:n="img",overlay:r,...i}=e;return(0,o.jsxs)("div",{className:s().media,children:[(0,l.createElement)(n,{...i,className:(0,a.W)(s()["mediaComponent-".concat(n)],t)}),r?(0,o.jsx)("div",{className:s().mediaOverlay,children:r}):void 0]})},m=e=>(0,o.jsx)("div",{...e,className:s().actions}),_=e=>{let{action:t,loading:n=!1,startIcon:r,subtitle:a,title:l,error:d=!1,...c}=e,u=d?"tomato11":"grey11";return(0,o.jsxs)("div",{...c,className:s().footer,children:[(r||n)&&(0,o.jsxs)("div",{className:s().startIconBox,children:[n&&(0,o.jsx)(i._3P,{color:"grey11"}),!n&&r&&(0,o.jsx)(i.JO$,{name:r,size:"small",color:u})]}),(0,o.jsxs)("div",{className:s().footerTexts,children:[(0,o.jsx)(i.xvT,{component:"span",noWrap:!0,variant:"bold",children:l}),(0,o.jsx)(i.xvT,{color:u,component:"span",noWrap:!0,variant:"small",children:a})]}),t]})},h=e=>{let{children:t,...n}=e;return(0,o.jsx)("div",{...n,className:s().status,children:(0,o.jsx)(i.xvT,{align:"center",color:"inherit",component:"span",noWrap:!0,variant:"smallBold",children:t})})}},99195:function(e,t,n){"use strict";n.d(t,{O:function(){return l}});var o=n(52322),r=n(7729),i=n(56448),a=n(93671);let l=e=>{let{badgeColor:t,badgeTitle:n,tooltipContent:l}=function(e){let t=d[e.modelType];switch(e.modelStatus){case i.GJ.New:return{badgeColor:"green",badgeTitle:"New",tooltipContent:"This ".concat(t," exists only locally. Upon sync, it will be pushed to your remote repository.")};case i.GJ.Modified:return{badgeColor:"amber",badgeTitle:"Modified",tooltipContent:"This ".concat(t," has been modified locally. Upon sync, changes will be pushed to your remote repository.")};case i.GJ.Synced:return{badgeColor:"purple",badgeTitle:"Synced",tooltipContent:"This ".concat(t," is in sync with the remote repository.")};case i.GJ.Deleted:return{badgeColor:"tomato",badgeTitle:"Deleted",tooltipContent:"This ".concat(t," has been deleted locally.")};case i.GJ.Unknown:if(!e.isOnline)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (no internet connection)."};if(e.authStatus===a.t.UNAUTHORIZED)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (not connected to Prismic)."};if(e.authStatus===a.t.FORBIDDEN)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (you don't have access to the repository)."};default:return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (unknown error)."}}}(e);return(0,o.jsx)(r.ua7,{content:l,side:"bottom",children:(0,o.jsx)(r.Cts,{color:t,title:n})})},d={CustomType:"type",Slice:"slice"}},51507:function(e,t,n){"use strict";n.d(t,{b:function(){return C}});var o=n(52322),r=n(7729),i=n(39097),a=n.n(i),l=n(62434),d=n(63908),s=n(99195),c=n(27763);let u=e=>(0,o.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 5.5C4 4.67157 4.67157 4 5.5 4H18.5C19.3284 4 20 4.67157 20 5.5V12.4413C20 12.4512 19.9997 12.461 19.9991 12.4707C20.0072 12.6083 19.9586 12.7485 19.8536 12.8536C19.6583 13.0488 19.3417 13.0488 19.1464 12.8536L16.3536 10.0607C16.1583 9.8654 15.8417 9.8654 15.6464 10.0607L11.8536 13.8536C11.6583 14.0488 11.3417 14.0488 11.1464 13.8536L9.35355 12.0607C9.15829 11.8654 8.84171 11.8654 8.64645 12.0607L5 15.7071V18.5C5 18.7761 5.22386 19 5.5 19H12.5C12.7761 19 13 19.2239 13 19.5C13 19.7761 12.7761 20 12.5 20H5.5C4.67157 20 4 19.3284 4 18.5V15.5003V15.4997V5.5ZM11.5 12.7929L14.9393 9.35355C15.5251 8.76777 16.4749 8.76777 17.0607 9.35355L19 11.2929V5.5C19 5.22386 18.7761 5 18.5 5H5.5C5.22386 5 5 5.22386 5 5.5V14.2929L7.93934 11.3536C8.52513 10.7678 9.47487 10.7678 10.0607 11.3536L11.5 12.7929ZM16.5 13C16.7761 13 17 13.2239 17 13.5V16H19.5C19.7761 16 20 16.2239 20 16.5C20 16.7761 19.7761 17 19.5 17H17V19.5C17 19.7761 16.7761 20 16.5 20C16.2239 20 16 19.7761 16 19.5V17H13.5C13.2239 17 13 16.7761 13 16.5C13 16.2239 13.2239 16 13.5 16H16V13.5C16 13.2239 16.2239 13 16.5 13Z",fill:"currentColor"})}),m=e=>({hash:e.hash}),_=e=>e?Object.entries(e).reduce((e,t)=>{let[n,o]=t;return o.hash?{...e,[n]:{...o,...m(o)}}:e},{}):{},h={build:e=>({...e,screenshots:_(e.screenshots)}),variation(e,t){if(e.model.variations.length)return t?e.model.variations.find(e=>e.id===t):e.model.variations[0]}},C=e=>{let t;let{action:n,isComingSoon:i=!1,isDeleted:m=!1,onUpdateScreenshot:_,selected:C=!1,slice:p,variant:b,variationId:f}=e,g=h.variation(p,f);if(!g)return null;let j=(0,d.d7)(p,g),y=i||m,k=!y&&!!_,S="outlined"===b,T=void 0!==f;return t="selection"===e.mode?{disabled:y,interactive:!0,onClick:()=>{e.onSelectedChange(!C)}}:y?{interactive:!1}:{component:a(),href:c.Y.getBuilderPagePathname({libraryName:p.href,sliceName:p.model.name,variationId:g.id}),interactive:!0,replace:e.replace},(0,o.jsxs)(l.Zb,{"aria-label":"".concat(p.model.name," ").concat(g.name," slice card"),checked:C,"data-testid":"shared-slice-card",...t,..."outlined"===b?{size:"small",variant:"outlined"}:{},children:[void 0!==j?(0,o.jsx)(l.ZB,{alt:"Preview image",overlay:k&&!S?(0,o.jsx)(r.xuv,{alignItems:"center",justifyContent:"center",children:(0,o.jsx)(x,{onClick:_})}):void 0,src:j}):(0,o.jsx)(l.ZB,{component:"div",children:(0,o.jsxs)(r.xuv,{alignItems:"center",flexDirection:"column",gap:8,justifyContent:"center",children:[(0,o.jsx)(r.xvT,{color:"grey11",component:"span",children:"No screenshot available"}),k&&!S?(0,o.jsx)(x,{onClick:_}):void 0]})}),(0,o.jsx)(l.eW,{action:"checkbox"===n.type&&"selection"===e.mode?(0,o.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,o.jsx)(r.XZJ,{checked:C,disabled:y,onCheckedChange:e.onSelectedChange})}):"menu"===n.type?(0,o.jsxs)(r.h_2,{modal:!0,children:[(0,o.jsx)(r.$FS,{disabled:y,children:(0,o.jsx)(r.hU,{hiddenLabel:"Slice actions",icon:"moreVert"})}),(0,o.jsxs)(r.AWV,{align:"end","data-testid":"slice-action-icon-dropdown",children:[k&&S?(0,o.jsx)(r.Xiv,{onSelect:_,startIcon:(0,o.jsx)(u,{}),children:"Update screenshot"}):void 0,(0,o.jsx)(r.Xiv,{onSelect:n.onRename,startIcon:(0,o.jsx)(r.JO$,{name:"edit"}),children:"Rename"}),!0===n.removeDisabled&&T?(0,o.jsx)(r.ua7,{content:"The slice needs to have at least one variation.",side:"bottom",stableMount:!0,children:(0,o.jsx)(v,{disabled:!0,onSelect:n.onRemove})}):(0,o.jsx)(v,{disabled:!0===n.removeDisabled,onSelect:n.onRemove})]})]}):"remove"===n.type?(0,o.jsx)(r.hU,{icon:"close",onClick:()=>!y&&n.onRemove(),hiddenLabel:"Remove slice"}):"status"===n.type?(0,o.jsx)(s.O,{authStatus:n.authStatus,isOnline:n.isOnline,modelStatus:n.modelStatus,modelType:"Slice"}):void 0,subtitle:(0,o.jsxs)(o.Fragment,{children:[T?g.id:"".concat(p.model.variations.length," variation").concat(p.model.variations.length>1?"s":""),i?(0,o.jsxs)(r.xvT,{color:"purple11",component:"span",variant:"small",children:[" ","• (coming soon)"]}):void 0]}),title:T?g.name:p.model.name}),k&&!T&&(0,d.cx)(p)>0?(0,o.jsx)(l.Lm,{children:"Missing screenshot"}):void 0]})},x=e=>(0,o.jsx)(r.zxk,{onClick:e.onClick,renderStartIcon:()=>(0,o.jsx)(u,{color:r.rSc.color.grey11}),color:"grey",children:"Update screenshot"}),v=e=>(0,o.jsx)(r.Xiv,{...e,color:"tomato",startIcon:(0,o.jsx)(r.JO$,{name:"delete"}),children:"Delete"})},27763:function(e,t,n){"use strict";n.d(t,{Y:function(){return o}});let o={getBuilderPagePathname:e=>"/slices/".concat(e.libraryName.replaceAll("/","--"),"/").concat(e.sliceName,"/").concat(e.variationId)}},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},W:function(){return d}});var o=n(52322),r=n(2784),i=n(75289);let a=e=>{let{bg:t,background:n,sx:r,withRadius:a,radius:l,children:d}=e;return(0,o.jsx)(i.xu,{sx:{p:4,bg:t||n,...a?{borderBottomLeftRadius:l,borderBottomRightRadius:l}:null,...r},children:d})},l=(0,r.createContext)("6px"),d=()=>(0,r.useContext)(l),s=e=>{let{Header:t=null,SubHeader:n=null,Body:r=null,Footer:d=null,borderFooter:s=!1,radius:c="6px",bodySx:u={},footerSx:m={},sx:_=null,bg:h,background:C,children:x,...v}=e;return(0,o.jsx)(l.Provider,{value:c,children:(0,o.jsxs)(i.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:c,..._},...v,children:[t||null,n||null,(0,o.jsxs)(a,{bg:h,background:C,sx:u,withRadius:!d,children:[r?(0,o.jsx)(r,{}):null,x||null]}),d?(0,o.jsx)(a,{bg:h,background:C,sx:{...s?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...m},radius:c,withRadius:!0,children:"object"==typeof d?d:(0,o.jsx)(d,{})}):null]})})}},7974:function(e,t,n){"use strict";n.d(t,{Sn:function(){return l},lS:function(){return o},nG:function(){return r},pq:function(){return d},rd:function(){return a},xo:function(){return i}});let o=["components","update","insert"],r=["png","jpg","jpeg"],i=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,a="placeholders/What_are_Slices_mrvome",l="SM_HELP_VIDEOS/mock_data",d="slice-machine-simulator"},67968:function(e){e.exports={flex:"Card_flex__opby1",grid:"Card_grid__VAvIS",column:"Card_column__W4ACG Card_flex__opby1",root:"Card_root__YVuvU Card_column__W4ACG Card_flex__opby1","size-small":"Card_size-small__aIlxd","size-medium":"Card_size-medium__xegz0",solid:"Card_solid__GNGar",outlined:"Card_outlined__W_dxI",interactive:"Card_interactive__rXw5L",media:"Card_media__l0kHL Card_column__W4ACG Card_flex__opby1","mediaComponent-div":"Card_mediaComponent-div__Y2_PZ Card_grid__VAvIS","mediaComponent-img":"Card_mediaComponent-img__ezOTu",mediaOverlay:"Card_mediaOverlay__Aa__Q Card_grid__VAvIS",nonMedia:"Card_nonMedia__Fv3Mz Card_flex__opby1",actions:"Card_actions__XdhOt Card_nonMedia__Fv3Mz Card_flex__opby1",footer:"Card_footer__U0HS1 Card_nonMedia__Fv3Mz Card_flex__opby1",footerTexts:"Card_footerTexts__rTXup Card_column__W4ACG Card_flex__opby1",status:"Card_status__PNN2a Card_column__W4ACG Card_flex__opby1",startIconBox:"Card_startIconBox__1_L4u"}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[630],{35289:function(e,t,n){"use strict";n.d(t,{aV:function(){return s},Bu:function(){return d}});var i=n(52322),l=n(7729),r=n(6277),o=n(13834),a=n.n(o);let s=e=>{let{border:t=!0,...n}=e;return(0,i.jsx)("div",{...n,className:(0,r.Z)(a().root,t&&a()["root-border"])})},d=e=>{let{actions:t,children:n,toggle:r,...o}=e;return(0,i.jsxs)("div",{...o,className:a().header,children:[(0,i.jsx)(l.xvT,{color:"grey11",component:"span",noWrap:!0,variant:"bold",children:n}),r,t?(0,i.jsx)("div",{className:a().headerActions,children:t}):null]})}},6882:function(e,t,n){"use strict";n.d(t,{J9:function(){return i},U:function(){return r},XU:function(){return a},fF:function(){return l}});let i=[{name:"Image",description:"A responsive image.",icon:"image",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295520/DEV_TOOLS/SM_FIELDS/Type_Image_zyatxy.png",type:"Image"},{name:"Text",description:"A text string without formatting.",icon:"title",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295529/DEV_TOOLS/SM_FIELDS/Type_Key_Text_xrqf45.png",type:"Text"},{name:"Rich Text",description:"Text with formatting options.",icon:"textFields",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295530/DEV_TOOLS/SM_FIELDS/Type_Rich_Text_fxdyar.png",type:"StructuredText"},{name:"Boolean",description:"A true or false toggle.",icon:"toggleOff",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295526/DEV_TOOLS/SM_FIELDS/Type_Boolean_cbwg8k.png",type:"Boolean"},{name:"Number",description:"An integer or float.",icon:"pin",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295522/DEV_TOOLS/SM_FIELDS/Type_Number_o3olop.png",type:"Number"},{name:"Select",description:"A dropdown of options.",icon:"arrowDropDownCircle",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295527/DEV_TOOLS/SM_FIELDS/Type_Select_bedjei.png",type:"Select"},{name:"Link",description:"A link to a website, asset, or document.",icon:"link",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295528/DEV_TOOLS/SM_FIELDS/Type_Link_bgslgy.png",type:"Link"},{name:"Link To Media",description:"A link to a media asset.",icon:"attachFile",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295519/DEV_TOOLS/SM_FIELDS/Type_LinkToMedia_m2p0ce.png",type:"Link",variant:"LinkToMedia"},{name:"Color",description:"A color in hex format.",icon:"colorLens",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295521/DEV_TOOLS/SM_FIELDS/Type_Color_nyoeit.png",type:"Color"},{name:"Date",description:"A date without time.",icon:"dateRange",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295525/DEV_TOOLS/SM_FIELDS/Type_Date_dsuaeq.png",type:"Date"},{name:"Table",description:"A structured table.",icon:"table",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1737381854/FIELDS_SM/Table_f47jnq.png",type:"Table"},{name:"Timestamp",description:"A date and time.",icon:"schedule",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295524/DEV_TOOLS/SM_FIELDS/Type_Timestamp_fkr5iw.png",type:"Timestamp"},{name:"Embed",description:"A video, song, or oEmbed link.",icon:"code",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295523/DEV_TOOLS/SM_FIELDS/Type_Embed_wwssvd.png",type:"Embed"},{name:"Geopoint",description:"A geographical coordinate.",icon:"place",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295522/DEV_TOOLS/SM_FIELDS/Type_GeoPoint_lpq0sm.png",type:"GeoPoint"},{name:"Content Relationship",description:"A reference to a Prismic document.",icon:"settingsEthernet",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295527/DEV_TOOLS/SM_FIELDS/Type_Content_RelationShip_s4z4nh.png",type:"Link",variant:"ContentRelationship"}],l={name:"UID",description:"Unique Identifier",icon:"tag",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295519/DEV_TOOLS/SM_FIELDS/Type_UID_hrwzug.png",type:"UID"},r={name:"Repeatable Group",description:"A set of fields that editors can repeat.",icon:"createNewFolder",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721314577/DEV_TOOLS/SM_FIELDS/Type_Group_uwwco0.png",type:"Group"},o={...r,variant:"NestedGroup"},a=[...i,l,r,o]},34166:function(e,t,n){"use strict";n.d(t,{nZ:function(){return c},rT:function(){return p},tB:function(){return u}});var i=n(52322),l=n(7729),r=n(2784),o=n(30195),a=n(94160),s=n(76611),d=n(5683);function c(e){let{type:t,library:n,sliceId:i,variationId:l,langSmithUrl:r}=e,o=(0,d.i)({type:t,library:n,sliceId:i,variationId:l}),a=JSON.stringify({langSmithUrl:r});localStorage.setItem(o,a)}function u(e){let{type:t,library:n,sliceId:i,variationId:l}=e,r=(0,d.i)({type:t,library:n,sliceId:i,variationId:l});localStorage.removeItem(r)}function p(e){let{type:t,library:n,sliceId:c,variationId:u}=e,{key:p,value:m,done:x}=function(e){let{type:t,library:n,sliceId:i,variationId:l}=e,r=(0,d.i)({type:t,library:n,sliceId:i,variationId:l}),[a,c]=(0,s.V)(r,void 0,{schema:o.z.object({langSmithUrl:o.z.string().url().optional()})});return{key:r,value:a,done:()=>c(void 0)}}({type:t,library:n,sliceId:c,variationId:u}),[h,f]=(0,r.useState)(),g=e=>()=>{m&&(f(p),a.Xe.track({event:"slice-generation-feedback",type:t,sliceId:c,variationId:u,feedback:e,langSmithUrl:m.langSmithUrl}),x())};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.h_i,{children:(0,i.jsx)(l.FNi,{anchor:(0,i.jsx)(l.xuv,{width:"100%",justifyContent:"center",position:"absolute",bottom:64}),icon:"check",title:"Thanks for your feedback!",seconds:2,open:!!h,onOpenChange:e=>{e||f(void 0)}},h)}),(0,i.jsx)(l.FpX,{children:m&&(0,i.jsxs)(l.xuv,{flexDirection:"row",justifyContent:"end",gap:8,alignItems:"center",children:[(0,i.jsx)(l.xvT,{color:"grey11",children:"Did the AI get it right?"}),(0,i.jsxs)(l.xuv,{flexDirection:"row",gap:4,children:[(0,i.jsx)(l.ua7,{side:"bottom",sideOffset:4,variant:"text",content:"Looks good",children:(0,i.jsx)(l.hU,{variant:"solid",size:"small",icon:"thumbUp",onClick:g("up")})}),(0,i.jsx)(l.ua7,{side:"bottom",sideOffset:4,variant:"text",content:"Needs improvement",children:(0,i.jsx)(l.hU,{variant:"solid",size:"small",icon:"thumbDown",onClick:g("down")})})]})]})})]})}},23094:function(e,t,n){"use strict";n.d(t,{X:function(){return r}});var i=n(52322),l=n(7729);let r=e=>{let t;let{status:n}=e;switch(n){case"pending":t={icon:(0,i.jsx)(l._3P,{color:"grey11"}),text:"Saving..."};break;case"failed":t={icon:(0,i.jsx)(l.JO$,{name:"close",color:"tomato11",size:"medium"}),text:"Failed to save"};break;case"done":t={icon:(0,i.jsx)(l.JO$,{name:"check",color:"green11",size:"medium"}),text:"Auto-saved"}}return(0,i.jsxs)(l.xuv,{gap:8,alignItems:"center",children:[t.icon,(0,i.jsx)(l.xvT,{color:"grey11",children:t.text})]})}},6609:function(e,t,n){"use strict";n.d(t,{S:function(){return o}});var i=n(52322),l=n(7729),r=n(6882);function o(e){let{open:t,onOpenChange:n,disabled:o=!1,onSelectField:s,fields:d,triggerDataTestId:c="add-field",trigger:u}=e,p=d.filter(e=>r.J9.some(t=>t.name===e.name)||e.name===r.fF.name),m=d.find(e=>e.name===r.U.name);return(0,i.jsxs)(l.h_2,{open:t,onOpenChange:n,children:[(0,i.jsx)(l.$FS,{disabled:o,children:null!=u?u:(0,i.jsx)(l.zxk,{startIcon:"add",color:"grey","data-testid":c,children:"Add a field"})}),(0,i.jsxs)(l.AWV,{align:"end",maxHeight:400,collisionPadding:8,children:[(0,i.jsx)(l.Juw,{children:"Single fields"}),p.map(e=>(0,i.jsx)(a,{field:e,onSelectField:s},e.name)),m&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.Juw,{children:"Set of fields"}),(0,i.jsx)(a,{field:m,onSelectField:s})]})]})]})}function a(e){let{field:t,onSelectField:n}=e,{type:r,variant:o,name:a,icon:s,description:d,thumbnail:c}=t;return(0,i.jsx)(l.Xiv,{startIcon:(0,i.jsx)(l.JO$,{name:s,size:"large"}),description:d,onSelect:()=>n(null!=o?o:r),renderTooltip:e=>(0,i.jsx)(l.ua7,{visible:!0,variant:"custom",content:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.Eep,{src:c,borderRadius:4,sx:{height:170,width:278},animateOnLoad:!1}),(0,i.jsx)(l.xvT,{color:"white",children:"How it will look for content editors."})]}),align:"start",side:"left",sideOffset:4,animation:"none",children:e}),children:a},"".concat(r).concat(o?"-".concat(o):""))}},76611:function(e,t,n){"use strict";n.d(t,{V:function(){return l}});var i=n(2784);function l(e,t,n){let{schema:l}=null!=n?n:{},r=()=>{try{let n=localStorage.getItem(e);if(null==n)return t;if(!l)return JSON.parse(n);return l.parse(JSON.parse(n))}catch(e){return t}},[o,a]=(0,i.useState)(r),[s,d]=(0,i.useState)(e);return s!==e&&(d(e),a(r())),[o,(0,i.useCallback)(n=>{a(i=>{let l;if(void 0===(l="function"==typeof n?n(i):n)){try{localStorage.removeItem(e)}catch(e){return i}return t}try{localStorage.setItem(e,JSON.stringify(l))}catch(e){return i}return l})},[e,t])]}},38193:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var i=n(52322),l=n(61183);n(2784);var r=n(59326),o=n(75289);l.Z.registerLanguage("svelte",e=>({subLanguage:"xml",contains:[e.COMMENT("<!--","-->",{relevance:10}),{begin:/^(\s*)(<script(\s*context="module")?>)/gm,end:/^(\s*)(<\/script>)/gm,subLanguage:"javascript",excludeBegin:!0,excludeEnd:!0,contains:[{begin:/^(\s*)(\$:)/gm,end:/(\s*)/gm,className:"keyword"}]},{begin:/^(\s*)(<style.*>)/gm,end:/^(\s*)(<\/style>)/gm,subLanguage:"css",excludeBegin:!0,excludeEnd:!0},{begin:/\{/gm,end:/\}/gm,subLanguage:"javascript",contains:[{begin:/[\{]/,end:/[\}]/,skip:!0},{begin:/([#:\/@])(if|else|each|await|then|catch|debug|html)/gm,className:"keyword",relevance:10}]}]}));let a=["javascript","bash","xml","html","json"];var s=e=>{var t;let{children:n,lang:s,sx:d,codeStyle:c,codeClass:u,Header:p}=e,{theme:m}=(0,r.B7)(),x=s?l.Z.highlight(n,{language:"vue"===s?"html":s}).value:l.Z.highlightAuto(n,a).value;return(0,i.jsxs)(o.kC,{as:"pre",sx:d,children:[p?(0,i.jsx)(p,{}):null,(0,i.jsx)("code",{className:"hljs".concat(u?" ".concat(u):""),style:{overflowX:"auto",padding:"3px 5px",borderRadius:"6px",border:"1px solid",borderColor:String(null===(t=m.colors)||void 0===t?void 0:t.textClear),...c},dangerouslySetInnerHTML:{__html:x}})]})}},80575:function(e,t,n){"use strict";n.d(t,{J:function(){return o},k:function(){return r}});var i=n(52322);n(2784);var l=n(75289);let r=e=>{let{children:t,sx:n,...r}=e;return(0,i.jsx)(l.xu,{sx:{display:["block","block","flex"],flexWrap:"wrap",justifyContent:"space-between",...n},...r,children:t})},o=e=>{let{children:t,cols:n=2}=e;return(0,i.jsx)(l.xu,{sx:{flex:"0 ".concat(100/n-1,"%"),mb:1},children:t})}},90167:function(e,t,n){"use strict";n.d(t,{kp:function(){return d},sP:function(){return c},w8:function(){return u},Hq:function(){return m}});var i,l,r=n(52322),o=n(63397),a=n(2784),s=n(75289),d=e=>{let{field:t,meta:n,fieldName:i,label:l,focusOnNewEntry:d=!0,inputPlaceholder:c,buttonLabel:u}=e,[p,m]=(0,a.useState)(n.value.length),x=(0,a.useRef)(Array(n.value.length));return(0,a.useEffect)(()=>{x.current=x.current.slice(0,n.value.length)},[n.value.length]),(0,a.useEffect)(()=>{let e=x.current.length;d&&e>p&&x.current[e-1].focus(),m(e)},[x.current.length,d,p]),(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)(s.__,{variant:"label.primary",htmlFor:i,children:[l,n.touched&&n.error?(0,r.jsx)(s.xv,{as:"span",variant:"text.labelError",children:n.error}):null]}),(0,r.jsx)(o.F2,{name:i,id:i,...t,render:e=>(0,r.jsxs)("div",{children:[t.value&&t.value.length>0?t.value.map((t,n)=>(0,r.jsxs)(s.kC,{my:2,children:[(0,r.jsx)(s.II,{placeholder:c,name:"".concat(i,".").concat(n),value:t,ref:e=>x.current[n]=e,onChange:t=>{let{target:{value:i}}=t;return e.replace(n,i)}}),(0,r.jsx)(s.zx,{ml:2,type:"button",variant:"secondary",onClick:()=>e.remove(n),children:"-"})]},"".concat(i,"-").concat(+n+1))):null,(0,r.jsx)(s.zx,{type:"button",onClick:()=>e.insert(t.value.length,""),children:u})]})})]})},c=e=>{let{initialValues:t,meta:n,label:i,fieldName:l,onChange:a,...d}=e;return(0,r.jsxs)(s.__,{variant:"label.border",...d,children:[(0,r.jsx)(o.gN,{as:s.XZ,type:"checkbox",name:l,onChange:()=>a(!n.value),checked:n.value}),i]})},u=e=>{let{field:t,label:n,defaultValue:i,onChange:l,controlledValue:o,setControlledValue:s,buildControlledValue:d}=e,[u,p]=(0,a.useState)(i||t.defaultValue||!1);return(0,a.useEffect)(()=>{d?s(d(o,u)):s(d)},[u,o,d]),(0,r.jsx)(c,{meta:{value:u},fieldName:t.name,onChange:e=>p(e)&&l&&l(e),label:"function"==typeof n?n(o,u):n})};(i=l||(l={}))[i.ERROR=0]="ERROR",i[i.DISABLED=1]="DISABLED",i[i.WARNING=2]="WARNING";let p=e=>{let t={"&::placeholder":{color:"#C9D0D8"}};switch(e){case 1:return{...t,border:"1px solid #E6E6EA",backgroundColor:"#F3F5F7"};case 0:return{...t,border:"1px solid #E26049","&:focus":{outline:"none",borderColor:"#E26049",boxShadow:"0 0 0 3px rgba(226, 96, 73, 0.2), inset 0 1px 2px rgba(226, 96, 73, 0.2)"}};case 2:return{...t,border:"1px solid orange","&:focus":{outline:"none",borderColor:"orange",boxShadow:"0 0 0 3px rgba(255, 165, 0, 0.2), inset 0 1px 2px rgba(255, 165, 0, 0.2)"}};default:return t}},m=e=>{let{sx:t={},field:n,meta:i,formField:l,fieldName:a,fields:d,initialValues:c,isDisabled:u,autoFocus:m}=e,x=i.error?0:u||l.disabled?1:void 0;return(0,r.jsxs)(s.xu,{sx:t,children:[(0,r.jsxs)(s.__,{variant:"label.primary",htmlFor:a,children:[l.label||a,i.touched&&i.error?(0,r.jsx)(s.xv,{as:"span",variant:"text.labelError",children:i.error}):null]}),(0,r.jsx)(o.gN,{id:a,name:a,type:"text",placeholder:l.placeholder||l.label||a,...l.fieldLevelValidation&&c?{validate:e=>l.fieldLevelValidation&&l.fieldLevelValidation({value:e,fields:d,initialId:c.id})}:null,...n,as:s.II,sx:p(x),disabled:u||l.disabled,autoFocus:null!=m?m:l.autoFocus})]})}},70705:function(e,t,n){"use strict";var i=n(52322),l=n(2784),r=n(75289);let o=(0,l.forwardRef)((e,t)=>{let{children:n,Component:l=r.kC,sx:o={},...a}=e;return(0,i.jsx)(l,{as:"li",sx:{p:3,mx:3,alignItems:"center",variant:"styles.listItem",...o},ref:t,...a,children:n})});t.Z=o},86355:function(e,t,n){"use strict";n.d(t,{Z:function(){return j}});var i=n(52322),l=n(7729),r=n(5446),o=n(2784),a=n(40023),s=n(951),d=n(8799),c=n(18978),u=n(59326),p=n(75289),m=n(70705),x=n(66770),h=n(33710),f=n(28316),g=n(65077);let v=e=>{let{children:t}=e;return(0,f.createPortal)((0,i.jsx)(g.xR,{children:t}),document.body)},b=e=>{let{text:t,as:n,sx:l={},...r}=e,a=(0,o.useRef)(null),[s,d]=(0,o.useState)(null),c=()=>{d(a.current&&a.current.offsetWidth<a.current.scrollWidth)};return(0,o.useEffect)(()=>(c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}),[]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p.xv,{"data-for":t,"data-tip":!0,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...l},as:n,ref:a,...r,children:t}),s&&(0,i.jsx)(v,{children:(0,i.jsx)(h.Z,{id:t,type:"dark",multiline:!0,border:!0,borderColor:"black",place:"bottom",effect:"solid",children:t})})]})};var y=e=>{var t,n;let{text:l,sliceFieldName:r,theme:o,WidgetIcon:a}=e;return(0,i.jsxs)(p.kC,{sx:{alignItems:"center",position:"relative"},children:[(0,i.jsx)(a,{size:28,style:{color:null===(t=o.colors)||void 0===t?void 0:t.primary,marginRight:"8px",borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(n=o.colors)||void 0===n?void 0:n.primary,flexShrink:0}}),(0,i.jsx)(b,{text:l,as:"p",sx:{py:0,px:1,fontWeight:"label",fontSize:"15px"},"data-testid":"field-name"}),(0,i.jsx)(p.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear",overflow:"hidden",textOverflow:"ellipsis"},"data-testid":"field-id",children:r})]})},j=function(e){let{item:t,index:n,deleteItem:h,enterEditMode:f,modelFieldName:g,renderFieldAccessor:v,HintElement:b,CustomEditElement:j,CustomEditElements:k,widget:S,draggableId:_,testId:T,isRepeatableCustomType:I,children:F}=e,{theme:C}=(0,u.B7)(),{key:E,value:{config:w,type:L}}=t,O=!!(("Link"===L||"Group"===L)&&(null==w?void 0:w.repeat));return(0,i.jsx)(o.Fragment,{children:(0,i.jsx)(a._l,{draggableId:_,index:n,children:e=>{var a,u,_,M,D;return(0,i.jsx)(o.Fragment,{children:(0,i.jsxs)(m.Z,{"data-testid":T,ref:e.innerRef,...e.draggableProps,Component:p.xu,sx:{p:0,mx:0,my:3},children:[(0,i.jsxs)(p.kC,{sx:{width:"100%"},children:[(0,i.jsx)(x.Z,{label:"Reorder slice field (drag and drop)",Icon:c.Fm7,color:null===(a=C.colors)||void 0===a?void 0:a.icons,mr:1,mt:3,...e.dragHandleProps}),(0,i.jsxs)(p.xu,{sx:{bg:"headSection",width:"100%",borderRadius:"3px",border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,i.jsxs)(p.kC,{sx:{p:3,alignItems:"center",justifyContent:"space-between",width:"100%"},children:[(0,i.jsx)(y,{theme:C,text:(null==w?void 0:w.label)||E,sliceFieldName:v&&v(E),WidgetIcon:S.Meta.icon}),(0,i.jsxs)(p.kC,{sx:{flex:"0 0 auto"},children:[O&&(0,i.jsx)(l.Cts,{title:"Repeatable",color:"purple",size:"medium",sx:{alignSelf:"center",marginInline:16}}),k||null,j||(0,i.jsx)(x.Z,{size:22,Icon:s.$iz,label:"Edit field",sx:{cursor:"pointer",color:null===(u=C.colors)||void 0===u?void 0:u.icons,flexShrink:0},onClick:()=>f([E,t.value],g,n)}),!(!0===I&&"UID"==L)&&(0,i.jsxs)(r.v2,{children:[(0,i.jsx)(r.j2,{className:"sliceMenuButton","data-testid":"field-menu-button",style:{padding:"0",cursor:"pointer",width:"32px",height:"32px",border:"none",background:"transparent",outline:"0"},children:(0,i.jsx)(d.FQA,{size:20,color:null===(_=C.colors)||void 0===_?void 0:_.icons,style:{pointerEvents:"none"}})}),(0,i.jsx)(r.qy,{style:{background:null===(M=C.colors)||void 0===M?void 0:M.gray,border:"1px solid",borderRadius:"3px",borderColor:null===(D=C.colors)||void 0===D?void 0:D.borders,outline:"0"},children:(0,i.jsx)(r.sN,{style:{padding:"6px",cursor:"pointer"},onSelect:()=>h(E),children:"Delete field"})})]})]})]}),b||null]})]}),F]})})}})})}},66770:function(e,t,n){"use strict";var i=n(52322),l=n(75289);let r=(e,t)=>t?{border:e=>{let{colors:t}=e;return"1px solid ".concat(t.error)}}:e?{border:e=>{let{colors:t}=e;return"1px solid ".concat(t.primary)}}:{border:e=>{let{colors:t}=e;return"1px solid ".concat(t.borders)}};t.Z=e=>{let{sx:t=null,onClick:n=()=>null,label:o,Icon:a,error:s=null,size:d=16,fitButton:c=!1,active:u=!1,useActive:p=!1,activeSx:m=r,...x}=e;return(0,i.jsx)(l.hU,{onClick:n,"aria-label":o,type:"button",sx:{...c?{width:d,height:d}:null,...p&&m(u,s),...t},...x,children:(0,i.jsx)(a,{size:d})})}},89280:function(e,t,n){"use strict";var i=n(52322),l=n(63397),r=n(2784),o=n(75289),a=n(90167),s=n(79256);t.Z=e=>{let{fieldName:t,formField:n,fields:d,initialValues:c,autoFocus:u}=e,[p,m,x]=(0,l.U$)(t),h=n.component;return(0,i.jsx)(o.xu,{sx:{mt:2,alignItems:"center",...n.type===s.h.CHECKBOX?{display:"flex",height:"130%"}:null},children:h?(0,i.jsx)(h,{meta:m,field:p,helpers:x,fieldName:t,formField:n,initialValues:c}):(0,i.jsxs)(r.Fragment,{children:[n.type===s.h.INPUT?(0,i.jsx)(a.Hq,{meta:m,field:p,fields:d,formField:n,fieldName:t,initialValues:c,autoFocus:u}):null,n.type===s.h.CHECKBOX&&(0,i.jsx)(a.sP,{meta:m,label:n.label,fieldName:t,initialValues:c,onChange:e=>x.setValue(e)})]})})}},3285:function(e,t,n){"use strict";n.d(t,{Z:function(){return A}});var i=n(52322),l=n(37149),r=n.n(l),o=n(56580),a=n(59326),s=n(75289),d=n(65413),c=n(30527),u=n(2784),p=n(92928);let m=e=>{let{children:t,...n}=e;return(0,i.jsx)(s.xu,{as:"ul",sx:{p:0,m:0,px:e=>"calc(".concat(e.space[3],"px + 8px)"),borderBottom:"1px solid #DFE1E5",position:"relative"},...n,children:t})};m.tabsRole="TabList";let x=e=>{let{children:t,...n}=e,{theme:l}=(0,a.B7)();return(0,i.jsx)(p.OK,{...n,style:{margin:"0 32px 0 0",top:"0",padding:"8px 0px",border:"none",bottom:"-1px",opacity:"0.8",transition:"all 150ms cubic-bezier(0.215,0.60,0.355,1)",borderRadius:"0",...n.selected?{borderBottom:"3px solid ".concat(l.colors.primary),color:l.colors.text,fontWeight:"500",opacity:"1",backgroundColor:"transparent"}:{borderBottom:"3px solid transparent"}},children:t})};x.tabsRole="Tab";var h=(0,u.memo)(e=>{let{children:t,Footer:n,Header:l,tabs:r,bodySx:o,footerSx:a,defaultIndex:d=0}=e,[h,f]=(0,u.useState)(d);return(0,i.jsx)(c.Z,{borderFooter:!0,footerSx:{p:0,...a},bodySx:{p:0,...o},sx:{border:"none"},Header:l,Footer:n,children:(0,i.jsxs)(p.mQ,{defaultIndex:d,onSelect:e=>f(e),children:[(0,i.jsx)(m,{children:(r||[]).map(e=>(0,i.jsx)(x,{children:e},e))}),u.Children.map(t,(e,t)=>(0,i.jsx)(s.xu,{sx:{p:e=>"calc(".concat(e.space[3],"px + 8px)"),display:t===h?"block":"none"},children:(0,i.jsx)(p.x4,{children:e})}))]})})}),f=n(80575),g=e=>{var t,n;let{text:l,sliceFieldName:r,theme:o,WidgetIcon:a}=e;return(0,i.jsxs)(s.kC,{sx:{alignItems:"center"},children:[(0,i.jsx)(a,{size:28,style:{color:null===(t=o.colors)||void 0===t?void 0:t.primary,marginRight:"8px",borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(n=o.colors)||void 0===n?void 0:n.primary}}),(0,i.jsx)(s.xv,{as:"p","data-testid":"item-header-text",sx:{py:0,px:1,fontWeight:"label",fontSize:"15px"},children:l}),(0,i.jsx)(s.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear"},children:r})]})},v=n(55862),b=n(68169),y=n(5632),j=n(65186),k=n(7974);let S=()=>{let e=(0,y.useRouter)();return(0,i.jsxs)(s.xu,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"60px"},children:[(0,i.jsx)(j.wr$,{size:48,color:"#C9D0D8"}),(0,i.jsx)(s.xu,{sx:{height:"12px"}}),(0,i.jsx)(s.xv,{color:"text",sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",textAlign:"center"},children:"Your mock data has moved"}),(0,i.jsx)(s.xu,{sx:{height:"8px"}}),(0,i.jsx)(s.xv,{color:"text",sx:{fontWeight:400,fontSize:"14px",lineHeight:"24px",textAlign:"center"},children:"You can now edit directly your mock data in the new Slice Simulator."}),(0,i.jsx)(s.xu,{sx:{height:"24px"}}),(0,i.jsx)(s.zx,{onClick:t=>{t.preventDefault(),window.open("".concat(e.asPath,"/simulator"),k.pq)},children:"Go to the Slice Simulator"})]})};var _=n(16442),T=n(45440),I=n(16086),F=n(78254),C=n(23134),E=n(89280),w=n(63397),L=n(358);function O(){let[{value:e}]=(0,w.U$)("config.label"),[{value:t},n,i]=(0,w.U$)("id"),l=(0,u.useRef)(null!=n.initialValue&&n.initialValue.length>0);(0,u.useEffect)(()=>{l.current||null==e||i.setValue((0,L.lV)(e),!1)},[e]),(0,u.useEffect)(()=>{let n=null==t||0===t.length;if(l.current){if(!n)return;l.current=!1}else n||null!=e&&t===(0,L.lV)(e)||(l.current=!0)},[t])}var M=(0,u.memo)(e=>{let{formId:t,initialValues:n,validationSchema:l,onSave:r,FormFields:o,children:a}=e;return(0,i.jsx)(s.xu,{children:(0,i.jsx)(w.J9,{initialValues:n,validationSchema:l,onSubmit:(e,t)=>{let{id:n,...i}=e;r({newKey:n,value:Object.entries(i).reduce((e,t)=>{let[n,i]=t;if(typeof i!==Boolean&&!i){var l;let t=null===(l=o[n])||void 0===l?void 0:l.defaultValue;if(void 0!==t)return{...e,[n]:t}}return{...e,[n]:i}},{})})},children:e=>(0,i.jsxs)(w.l0,{id:t,children:[(0,i.jsx)(O,{}),a({...e,initialValues:n})]})})})});function D(e){let{children:t}=e,n=(0,c.W)();return(0,i.jsx)(s.kC,{sx:{position:"sticky",zIndex:1,top:0,p:3,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n},children:t})}r().setAppElement("#__next");var A=e=>{let{close:t,data:n,fields:l,onSave:r,zoneType:c}=e,{theme:u}=(0,a.B7)(),p=(0,o.v9)(F.Ch).filter(_.TG);if(!n.isOpen)return null;let{field:[m,x]}=n,y=(0,C.t)(T.C,x.config,x.type);if(!y)return(0,i.jsxs)("div",{children:[x.type," not found"]});let{Meta:{icon:j},FormFields:k,Form:w,schema:L}=y,O={...(0,b.f7)((0,I.B9)(k,"id")),...y.prepareInitialValues?y.prepareInitialValues(p,x.config):x.config},{res:A,err:N}=(()=>{try{return{res:L.validateSync({type:x.type,config:O},{stripUnknown:!0})}}catch(e){return{err:e}}})();N&&(console.error("[EditModal] Failed to validate field of type ".concat(x.type,".\n Please update model.json accordingly.")),console.error(N));let q={id:m,config:A?A.config:O},[R,V]=k.id.validate.matches,z=d.object().shape({id:d.string().matches(R,V).min(3).max(35).required(),config:L.fields.config}),P="".concat("edit-modal-form","-").concat(Math.random().toString());return(0,i.jsx)(v.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:"Widget Form Modal",children:(0,i.jsx)(M,{apiId:m,formId:P,initialValues:q,validationSchema:z,FormFields:k,onSave:e=>{let{newKey:n,value:i}=e;r({apiId:m,newKey:n,value:{...x,...i},updateMeta:{fieldIdChanged:{previousPath:[m],newPath:[n]}}}),t()},children:e=>{let{values:{id:n,config:{label:r}},isValid:o,isSubmitting:a,initialValues:d}=e,p=w?(0,i.jsx)(w,{...e,fields:l},"field-model-tab-content"):(0,i.jsx)(f.k,{children:Object.entries(k).map(e=>{let[t,n]=e;return(0,i.jsx)(f.J,{children:(0,i.jsx)(E.Z,{fieldName:(0,b.lm)(t),formField:n,fields:l,initialValues:d,autoFocus:""===m&&void 0})},t)})},"field-model-tab-content"),x=["Field Model"],v=[p];if("slice"===c){let e=(0,i.jsx)(s.xu,{children:(0,i.jsx)(S,{})},"mock-data-tab-content");x.push("Mock Data"),v.push(e)}return(0,i.jsx)(h,{borderFooter:!0,footerSx:{position:"sticky",bottom:0,p:0},tabs:x,Header:(0,i.jsxs)(D,{children:[(0,i.jsx)(g,{theme:u,text:r||n,WidgetIcon:j}),(0,i.jsx)(s.x8,{onClick:t,type:"button"})]}),Footer:(0,i.jsxs)(s.kC,{sx:{position:"sticky",bottom:0,alignItems:"space-between",bg:"headSection",p:3},children:[(0,i.jsx)(s.xu,{sx:{ml:"auto"}}),(0,i.jsx)(s.zx,{mr:2,type:"button",onClick:t,variant:"secondary",children:"Cancel"}),(0,i.jsx)(s.zx,{form:P,type:"submit",disabled:!o&&a,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"},children:"Done"})]}),children:v})}})})}},95215:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var i=n(52322),l=n(2784),r=n(49857),o=n(80148),a=n(77245),s=n(8799),d=n(65186),c=n(59326),u=n(75289),p=n(38193);let m={position:"relative",top:"3px"};var x=e=>{var t,n,r;let{code:o,lang:x}=e,{theme:h}=(0,c.B7)(),[f,g]=(0,l.useState)(!1);return o?(0,i.jsxs)(u.kC,{sx:{p:2,px:3,alignItems:"center",borderTop:"1px solid",borderColor:"borders",justifyContent:"space-between"},children:[(0,i.jsxs)(u.kC,{sx:{alignItems:"center",display:["none","none","flex"],maxWidth:"80%"},children:[(0,i.jsx)(s.vcz,{size:26,color:null==h?void 0:null===(t=h.colors)||void 0===t?void 0:t.icons,style:{border:"1px solid",borderColor:null==h?void 0:null===(n=h.colors)||void 0===n?void 0:n.borders,borderRadius:"3px",padding:"4px",marginRight:"2px"}}),(0,i.jsx)(p.Z,{sx:{margin:"0px 8px",border:"none",borderRadius:"3px",fontSize:"13px"},lang:x,children:o})]}),(0,i.jsx)(u.xu,{children:(0,i.jsxs)(u.zx,{"aria-label":f?"Code snippet copied":"Copy code snippet",onClick:()=>{o&&navigator.clipboard.writeText(o).then(()=>{g(!0),setTimeout(()=>{g(!1)},1200)})},variant:"textButton",children:[f?(0,i.jsx)(d.HhX,{size:16,color:null==h?void 0:null===(r=h.colors)||void 0===r?void 0:r.success,style:m}):(0,i.jsx)(a.LhG,{size:16,style:m}),(0,i.jsx)(u.xv,{as:"span",sx:{display:["none","inline","none","inline"]},children:"\xa0Copy"})]})})]}):null},h=e=>{let{show:t,renderHintBase:n,item:l,hintItemName:a}=e,s=n({item:l}),d=[s];if("Link"===l.value.type){var c,u,p,m,h;null!==(m=null===(c=l.value.config)||void 0===c?void 0:c.allowText)&&void 0!==m&&m&&d.push("allowText"),null!==(h=null===(u=l.value.config)||void 0===u?void 0:u.repeat)&&void 0!==h&&h&&d.push("repeat"),(null===(p=l.value.config)||void 0===p?void 0:p.variants)&&d.push("variants")}let{data:f,error:g}=(0,r.ZP)(d.join("$"),async()=>await o.managerClient.snippets.readSnippets({fieldPath:s.split("."),model:l.value,itemName:a}));if(g&&console.error(g),!f||g)return null;let v=f.snippets||[];return v[0]?(0,i.jsx)("div",{style:{display:t?"initial":"none"},children:(0,i.jsx)(x,{code:v[0].code,lang:v[0].language})}):null}},40141:function(e,t,n){"use strict";n.d(t,{Z:function(){return D}});var i=n(52322),l=n(7729),r=n(13980),o=n(2784),a=n(65077),s=n(94160),d=n(35289),c=n(6882),u=n(6609);function p(e){let{open:t,onOpenChange:n,onConfirm:r}=e;return(0,i.jsxs)(l.VqE,{open:t,onOpenChange:n,size:"small",children:[(0,i.jsx)(l.fKu,{title:"Static zone"}),(0,i.jsx)(l.cZJ,{children:(0,i.jsx)(l.xrM,{children:(0,i.jsxs)(l.xuv,{as:"article",flexDirection:"column",padding:16,gap:4,children:[(0,i.jsx)(l.xvT,{sx:{marginBottom:4},color:"purple9",variant:"smallBold",children:"About"}),(0,i.jsx)(l.xvT,{variant:"h3",children:"What is the static zone?"}),(0,i.jsx)(l.xvT,{color:"grey11",children:"The static zone in Prismic page types contain fields that are always present on the page. Use it for essential information like a page's title, page design settings, or metadata. Unlike slices, which can be added or removed, static zone fields remain fixed."}),(0,i.jsx)(l.nkn,{src:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1723540305/DEV_TOOLS/STATES/Explication_vide%CC%81o_zone_statique_phibeq.mp4",sizing:"contain",autoPlay:!0,loop:!0})]})})}),(0,i.jsx)(l.kXR,{children:(0,i.jsx)(l._dX,{size:"medium",sx:{flexGrow:1},onClick:()=>{r(),n(!1)},children:"Got it"})})]})}var m=n(76611),x=n(5683);let h=(0,o.forwardRef)((e,t)=>{var n;return(0,i.jsx)(l.zxk,{...e,ref:t,startIcon:"add",color:"grey","aria-label":"Add a field","data-testid":null!==(n=e["data-testid"])&&void 0!==n?n:"add-field"})});function f(e){let{zoneTypeFormat:t,...n}=e;return"page"===t?(0,i.jsx)(v,{...n}):(0,i.jsx)(b,{...n})}let g=(0,i.jsx)("div",{style:{position:"absolute",bottom:0,right:0}});function v(e){let{disabled:t,fields:n,triggerDataTestId:r,onSelectField:a}=e,[s,d]=(0,o.useState)(!1),[c,f]=(0,o.useState)(!1),[v,b]=(0,m.V)(x.v,!1);return(0,i.jsxs)(l.xuv,{position:"relative",children:[(0,i.jsx)(h,{onClick:()=>{v?d(!0):f(!0)},"data-testid":r}),(0,i.jsx)(p,{open:c,onOpenChange:e=>{f(e),e||d(!0)},onConfirm:()=>b(!0)}),(0,i.jsx)(u.S,{open:s,onOpenChange:d,disabled:t,onSelectField:a,fields:n,trigger:g})]})}function b(e){let{disabled:t,fields:n,triggerDataTestId:l,onSelectField:r}=e;return(0,i.jsx)(u.S,{disabled:t,onSelectField:r,fields:n,trigger:(0,i.jsx)(h,{"data-testid":l})})}var y=n(45440),j=n(49919),k=n(40023),S=n(75289),_=n(70705),T=n(86355),I=n(23134),F=n(95215),C=e=>{let{fields:t,title:n,tabId:l,enterEditMode:r,enterSelectMode:o,onDragEnd:a,renderFieldAccessor:s,onDeleteItem:d,onSave:c,showHints:u,renderHintBase:p,isRepeatable:m,testId:x,isRepeatableCustomType:h}=e;return(0,i.jsx)(k.Z5,{onDragEnd:a,children:(0,i.jsx)(k.bK,{droppableId:n,children:(e,n)=>(0,i.jsxs)(S.xu,{as:"ul",ref:e.innerRef,...e.droppableProps,"data-testid":x,sx:{paddingInline:"16px !important"},children:[t.map((e,t)=>{let{value:{config:a,type:x}}=e,f=(0,I.t)(y.C,a,x);if(!f)return(0,i.jsx)(_.Z,{children:(0,i.jsxs)(S.xv,{children:['Field type "',x,'" not supported']})});let g={item:e,index:t,tabId:l,widget:f,showHints:u,key:e.key,enterSelectMode:o,renderFieldAccessor:s,enterEditMode:r,parentSnapshot:n,deleteItem:d,saveItem:c,draggableId:"list-item-".concat(e.key),isRepeatableCustomType:h,testId:"list-item-".concat(e.key)},v=(0,i.jsx)(F.Z,{item:e,show:u,isRepeatable:m,renderHintBase:p,hintItemName:f.hintItemName,Widgets:y.C,typeName:f.CUSTOM_NAME||f.TYPE_NAME});if(f.CustomListItem){let{CustomListItem:e}=f;return(0,i.jsx)(e,{...g,HintElement:v})}return(0,i.jsx)(T.Z,{...g,HintElement:v})}),e.placeholder]})})})},E=n(63470),w=n(644),L=n.n(w);let O=e=>{let t=(0,E.k)(),n="slice"===e.zoneType?t.value:e.zoneType,{heading:r="Your ".concat(n," has no fields yet"),action:o}=e;return(0,i.jsxs)("div",{className:L().root,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(l.xvT,{variant:"bold",children:r}),(0,i.jsx)(l.xvT,{color:"grey11",children:"A field is an input for content (e.g. text, images, links)."})]}),o]})},M=e=>{let t,{zoneType:n,zoneTypeFormat:r,tabId:p,title:m,fields:x,poolOfFieldsToCheck:h,widgetsArray:g,isRepeatable:v,onDeleteItem:b,onDragEnd:k,EditModal:S,onSave:_,dataTip:T,renderHintBase:I,renderFieldAccessor:F,testId:E,isRepeatableCustomType:w,emptyStateHeading:L}=e,M=(()=>{let e=!!Object.entries(h).find(e=>{let[,{value:t}]=e;return"UID"===t.type}),t=g.filter(e=>{let{TYPE_NAME:t}=e;return"UID"!==t});return e?t:[...t,g.find(e=>{let{TYPE_NAME:t}=e;return"UID"===t})]})(),[D,A]=(0,o.useState)(!1),[N,q]=(0,o.useState)({isOpen:!1}),R={onSelectField:e=>{q({isOpen:!0,field:["",y.C[e].create("")]})},fields:M.filter(Boolean).map(e=>{let{TYPE_NAME:t,CUSTOM_NAME:n}=e;return c.XU.find(e=>e.type===t&&(void 0===n||e.variant===n))}),triggerDataTestId:v?"add-field-in-items":void 0};return"slice"===n&&x.length>0?t=(0,i.jsx)(u.S,{...R}):"customType"===n&&(t=(0,i.jsx)(f,{...R,zoneTypeFormat:r})),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.Bu,{actions:(0,i.jsxs)(i.Fragment,{children:[x.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.xvT,{color:"grey11",component:"span",noWrap:!0,children:"Show code snippets?"}),(0,i.jsx)(l.rsf,{checked:D,onCheckedChange:A,size:"small",style:{flexShrink:0},"data-testid":"code-snippets-switch"})]}),t]}),children:m}),0===x.length&&"slice"===n?(0,i.jsx)(O,{zoneType:"customType"===n?"page"===r?"page type":"custom type":n,heading:L,action:(0,i.jsx)(u.S,{...R})}):x.length>0?(0,i.jsx)(a.xR,{children:(0,i.jsx)(C,{tabId:p,isRepeatable:v,fields:x,showHints:D,dataTip:T,title:m,renderFieldAccessor:F,renderHintBase:I,enterEditMode:e=>{q({isOpen:!0,field:e});let[t,n]=e;s.Xe.track({event:"field:settings-opened",id:t,name:n.config.label,type:n.type,isInAGroup:!1,contentType:(0,j.T)(window.location.pathname)})},onDragEnd:k,onDeleteItem:b,onSave:_,testId:E,isRepeatableCustomType:w})}):void 0,(0,i.jsx)(S,{data:N,close:()=>{q({isOpen:!1})},onSave:_,fields:h,zoneType:n})]})};M.propTypes={isRepeatable:r.bool,title:r.string.isRequired,dataTip:r.string.isRequired,onSave:r.func.isRequired,onDragEnd:r.func.isRequired,onDeleteItem:r.func.isRequired,poolOfFieldsToCheck:(0,r.arrayOf)((0,r.shape)({key:r.string,value:r.object})),renderHintBase:r.func.isRequired,renderFieldAccessor:r.func.isRequired,widgetsArray:r.array.isRequired,fields:(0,r.arrayOf)((0,r.shape)({key:r.string.isRequired,value:(0,r.shape)({config:r.object,fields:r.array,type:r.string.isRequired})}))};var D=M},23134:function(e,t,n){"use strict";n.d(t,{t:function(){return l}});var i=n(59050);let l=(e,t,n)=>{if("Link"===n)switch(null==t?void 0:t.select){case"document":return e.ContentRelationship;case"media":return e.LinkToMedia;default:return e.Link}if(n===i.GroupFieldType){var l;return null!==(l=e.Group)&&void 0!==l?l:e.NestedGroup}return e[n]}},9889:function(e,t,n){"use strict";n.d(t,{Jp:function(){return o},OR:function(){return r}});var i=n(7974),l=n(49046);let r={label:(0,l.II)("Label",{required:"This field is required",max:!0},void 0,void 0,"Label for content creators (defaults to field type)",!0),id:(0,l.II)("API ID*",{min:!0,max:!0,required:"This field is required",matches:[i.xo,"No special characters allowed (except _)"]},e=>{let{value:t,fields:n,initialId:i}=e;return t?n.find(e=>{let{key:n}=e;return n===t})&&t!==i?'Field "'.concat(t,'" already exists.'):void 0:"Field is required"},void 0,"A unique identifier for the field (e.g. buttonLink)")},o={...r,placeholder:(0,l.II)("Placeholder",{required:"This field is required",max:[100,"String is too long. Max: 100"]},void 0,void 0,"Placeholder text for content creators")}},49046:function(e,t,n){"use strict";n.d(t,{II:function(){return d},Jg:function(){return r}});var i=n(68169),l=n(79256);let r=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return{type:l.h.CHECKBOX,validate:{required:(0,i.MJ)(t,s)},required:t,label:e,defaultValue:n,yupType:"boolean"}},o=[3,"String is too short. Min: 3"],a=[35,"String is too long. Max: 35"],s=["Field is required"],d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{min:o,max:a,required:s},n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,d=arguments.length>4?arguments[4]:void 0,c=arguments.length>5&&void 0!==arguments[5]&&arguments[5],{min:u,max:p,required:m,matches:x}=t||{};return{type:l.h.INPUT,label:e,validate:{required:(0,i.MJ)(m,s),min:(0,i.MJ)(u,o),max:(0,i.MJ)(p,a),matches:x},defaultValue:r,fieldLevelValidation:n,yupType:"string",placeholder:d,autoFocus:c}}},68169:function(e,t,n){"use strict";n.d(t,{MJ:function(){return a},f7:function(){return s},gc:function(){return d},lm:function(){return o}});var i=n(65413),l=n(79256);let r=e=>null===e.defaultValue?void 0:void 0!==e.defaultValue?e.defaultValue:e.type===l.h.CHECKBOX||(e.type===l.h.INPUT?"":e.type===l.h.SELECT?[]:void 0),o=e=>"id"===e?"id":"config.".concat(e),a=(e,t)=>Array.isArray(e)?e:"boolean"==typeof e&&e?t:null,s=e=>Object.entries(e).reduce((e,t)=>{let[n,i]=t,l=r(i);return void 0!==l?{...e,[n]:l}:e},{}),d=e=>i.object().shape(Object.entries(e).filter(e=>e).reduce((e,t)=>{let[n,l]=t,{validate:r,yupType:o}=l;if(!r)return e;if("function"==typeof r)return{...e,[n]:r(n,l)};let a=i[o]();return Object.entries(r).filter(e=>e&&e[1]).forEach(e=>{let[t,i]=e;if(i&&a[t]){a=a[t](...Array.isArray(i)?i:[i]);return}console.warn('Invalid Yup validator for field "'.concat(n,'"'))}),{...e,[n]:a}},{})).required().default(void 0).noUnknown(!0)},79256:function(e,t,n){"use strict";var i,l;n.d(t,{h:function(){return i}}),(l=i||(i={})).CHECKBOX="checkbox",l.INPUT="input",l.SELECT="select"},45440:function(e,t,n){"use strict";n.d(t,{C:function(){return th}});var i=n(52322),l=n(96317),r=n(65186),o=n(65413),a=n(75289),s=n(80575),d=n(89280),c=n(68169),u=n(9889),p=n(49046);let m={...u.OR,repeat:(0,p.Jg)("Repeatable",!1,!0)};var x=e=>{let{initialValues:t,fields:n,values:l,setFieldValue:r}=e,{config:{repeat:o}}=l;return(0,i.jsxs)(s.k,{children:[Object.entries(m).filter(e=>{let[t]=e;return"repeat"!==t}).map(e=>{let[l,r]=e;return(0,i.jsx)(s.J,{children:(0,i.jsx)(d.Z,{fieldName:(0,c.lm)(l),formField:r,fields:n,initialValues:t})},l)}),(0,i.jsx)(s.J,{children:(0,i.jsx)(a.xu,{sx:{mt:2,alignItems:"center",display:"flex",height:"130%"},children:(0,i.jsxs)(a.__,{variant:"label.border",sx:{mb:0},children:[(0,i.jsx)(a.XZ,{checked:o,onChange:()=>r("config.repeat",!o)}),"Repeatable"]})})})]})};let h={icon:r.iy3},f=e=>o.object().shape({type:o.string().matches(e,{excludeEmptyString:!0}).required(),config:o.object().shape({fields:o.array(),label:o.string(),repeat:o.boolean().optional()})});function g(e){let{schemaTypeRegex:t,customListItem:n,customName:i,hintItemName:l}=e;return{Meta:h,Form:x,FormFields:m,schema:f(t),create:e=>({type:"Group",config:{label:e,repeat:!0,fields:[]}}),CustomListItem:n,TYPE_NAME:"Group",CUSTOM_NAME:i,hintItemName:l}}var v=n(59050),b=n(2784),y=n(40023),j=n(28316),k=n(94160),S=n(6882),_=n(6609),T=n(86355),I=n(3285),F=n(95215),C=n(23134),E=n(49219),w=n(16086),L=n(358),O=n(49919),M=n(5495),D=n(39302);let A=e=>{let{tabId:t,widget:n,Widgets:l,widgetsArray:r,hintBase:o,parentSnapshot:s,showHints:d,isRepeatable:c,item:u,draggableId:p,saveItem:m,HintElement:x,...h}=e,[f,g]=(0,b.useState)({isOpen:!1}),A=e=>{var t;let{apiId:n,value:i}=e;null===(t=i.config)||void 0===t||t.label;let l=function(e){var t,n,i;let l=structuredClone(e.group);return null!==(n=l.config)&&void 0!==n||(l.config={}),null!==(i=(t=l.config).fields)&&void 0!==i||(t.fields={}),l.config.fields[e.fieldId]=e.field,l}({group:E.Fl.fromSM(u.value),fieldId:n,field:i});m({apiId:u.key,newKey:u.key,value:E.Fl.toSM(l),inGroupFieldAction:"add"}),(0,M.V)({id:n,field:i,isInAGroup:!0})},N=e=>{let{apiId:t,newKey:n,value:i}=e,l=i.type===v.GroupFieldType?E.Fl.fromSM(i):i,r=function(e){var t,n;let i=structuredClone(e.group);if(!(null===(t=i.config)||void 0===t?void 0:t.fields)||!(null===(n=e.group.config)||void 0===n?void 0:n.fields))return i;for(let t in i.config.fields={},e.group.config.fields)t===e.previousFieldId?i.config.fields[e.newFieldId]=e.field:i.config.fields[t]=e.group.config.fields[t];return i}({group:E.Fl.fromSM(u.value),previousFieldId:t,newFieldId:n,field:l});m({apiId:u.key,newKey:u.key,value:E.Fl.toSM(r),inGroupFieldAction:"update",updateMeta:{fieldIdChanged:{previousPath:[u.key,t],newPath:[u.key,n]}}}),(0,D.Z)({previousId:t,id:n,field:l,isInAGroup:!0})},q=e=>{let t=function(e){var t,n;let i=structuredClone(e.group);return null===(n=i.config)||void 0===n||null===(t=n.fields)||void 0===t||delete t[e.fieldId],i}({group:E.Fl.fromSM(u.value),fieldId:e});m({apiId:u.key,newKey:u.key,value:E.Fl.toSM(t)})},R=e=>{g({isOpen:!0,field:e});let[t,n]=e;k.Xe.track({event:"field:settings-opened",id:t,name:n.config.label,type:n.type,isInAGroup:!0,contentType:(0,O.T)(window.location.pathname)})};return(0,i.jsxs)(b.Fragment,{children:[(0,i.jsx)(T.Z,{item:u,widget:n,draggableId:p,...h,HintElement:x,CustomEditElements:[(0,i.jsx)(_.S,{onSelectField:e=>{g({isOpen:!0,field:["",l[e].create("")]})},fields:r.filter(Boolean).map(e=>{let{TYPE_NAME:t,CUSTOM_NAME:n}=e,i=S.XU.find(e=>e.type===t&&(void 0===n||e.variant===n));if(!i)throw Error("Field not found for widget: ".concat(t," - ").concat(n));return i})},"add-field-dropdown")],children:(0,i.jsx)(a.xu,{sx:{ml:4},children:(0,i.jsx)(y.Z5,{onDragEnd:e=>{if((0,w.uS)(e))return;let{source:t,destination:n}=e;if(!n)return;let{index:i}=t,{index:l}=n,r=function(e){var t;let n=structuredClone(e.group);if(!(null===(t=n.config)||void 0===t?void 0:t.fields))return n;let i=Object.entries(n.config.fields),[l]=i.splice(e.sourceIndex,1);return i.splice(e.destinationIndex,0,l),n.config.fields=Object.fromEntries(i),n}({group:E.Fl.fromSM(u.value),sourceIndex:i,destinationIndex:l});(0,j.flushSync)(()=>{m({apiId:u.key,newKey:u.key,value:E.Fl.toSM(r)})})},children:(0,i.jsx)(y.bK,{droppableId:"".concat(t,"-").concat(u.key,"-zone"),children:e=>(0,i.jsxs)("ul",{ref:e.innerRef,...e.droppableProps,children:[u.value.config.fields.map((e,t)=>{let{value:{config:n,type:r}}=e,a=(0,C.t)(l,n,r);if(!a)return null;let s={item:e,index:t,widget:a,key:e.key,enterEditMode:R,deleteItem:q,saveItem:N,showHints:d,renderFieldAccessor:t=>"item".concat((0,L.Ti)(e.key)),draggableId:"group-".concat(u.key,"-").concat(e.key,"-").concat(t),testId:"list-item-group-".concat(u.key,"-").concat(e.key)},p=(0,i.jsx)(F.Z,{item:e,show:d,isRepeatable:c,renderHintBase:e=>{let{item:t}=e;return"".concat(o).concat((0,L.Ti)(t.key))},hintItemName:a.hintItemName,Widgets:l,typeName:a.CUSTOM_NAME||a.TYPE_NAME});if(a.CustomListItem){let{CustomListItem:e}=a;return(0,i.jsx)(e,{...s,HintElement:p})}return(0,i.jsx)(T.Z,{...s,HintElement:p})}),e.placeholder]})})})})}),(0,i.jsx)(I.Z,{data:f,close:()=>{g({isOpen:!1})},onSave:e=>""===e.apiId?A({...e,apiId:e.newKey}):N(e),fields:u.value.config.fields})]})},N={icon:r.hs8},q={label:u.Jp.label,id:u.Jp.id,placeholder_false:(0,p.II)("False Placeholder",{required:!1},null,"false","Value the content creator sees (Output as 'false' in the API)."),placeholder_true:(0,p.II)("True Placeholder",{required:!1},null,"true","Value the content creator sees (Output as 'true' in the API)"),default_value:(0,p.Jg)("Default to true")},R=o.object().shape({type:o.string().matches(/^Boolean$/,{excludeEmptyString:!0}).required(),config:(0,c.gc)((0,w.B9)(q,"id"))}),V={icon:r.U8L},{TYPE_NAME:z,FormFields:P,schema:B}=(0,w.zg)("Color");var J=n(7729),U=n(63397);function Z(e){let{checked:t,height:n=130,setFieldValue:l}=e,[r,o]=(0,b.useState)(null);return(0,i.jsx)(s.J,{children:(0,i.jsx)(a.kC,{sx:{mt:2,alignItems:"center",height:"".concat(n,"%")},children:(0,i.jsx)(a.__,{variant:"label.border",children:(0,i.jsxs)(J.xuv,{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",ref:o,children:[(0,i.jsxs)(a.kC,{children:[(0,i.jsx)(a.XZ,{checked:t,onChange:e=>{l("config.allowText",e.target.checked)}}),"Allow display text"]}),(0,i.jsx)(J.ua7,{container:r,align:"end",content:"Allow editors to customize the link display text",children:(0,i.jsx)(J.JO$,{name:"alert",size:"medium",color:"grey11"})})]})})})})}function G(e){let{checked:t,setFieldValue:n}=e;return(0,i.jsxs)(J.xuv,{flexDirection:"column",children:[(0,i.jsx)(a.__,{htmlFor:"repeat",variant:"label.primary",children:"Repeatable"}),(0,i.jsxs)(a.__,{variant:"label.border",sx:{display:"flex"},children:[(0,i.jsx)(a.XZ,{name:"repeat",checked:t,onChange:e=>{n("config.repeat",e.target.checked)}}),"Make this link repeatable (allows editors to create lists of links)"]}),(0,i.jsxs)(J.xuv,{alignItems:"center",gap:4,children:[(0,i.jsx)(J.JO$,{name:"alert",size:"medium",color:"grey11"}),(0,i.jsxs)(J.xvT,{variant:"normal",color:"grey11",children:["Repeatable link fields are returned as an array of links by the API."," ",(0,i.jsx)("a",{href:"https://prismic.io/docs/field",style:{textDecoration:"none"},target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(J.xvT,{variant:"normal",color:"indigo11",children:"See documentation."})})]})]})]})}function H(e){var t,n;let{variants:l,onVariantsChange:r,error:o}=e,a=!!l,s=a?"Enabled":"Disabled",d="Options (".concat(null!==(t=null==l?void 0:l.length)&&void 0!==t?t:0,")"),c=(null!==(n=null==l?void 0:l.length)&&void 0!==n?n:0)>2,u=(0,b.useRef)();return(0,i.jsxs)(J.xuv,{overflow:"hidden",flexDirection:"column",border:!0,borderRadius:6,children:[(0,i.jsxs)(J.xuv,{border:{bottom:!0},padding:12,flexDirection:"column",gap:8,children:[(0,i.jsx)(J.xvT,{variant:"h4",color:"grey12",children:"Variants"}),(0,i.jsx)(J.xvT,{color:"grey12",children:'Add variants like "Primary" and "Secondary" to allow editors to choose the link\'s style by selecting one of them.'}),(0,i.jsxs)(J.xuv,{gap:8,children:[(0,i.jsx)(J.rsf,{checked:a,onCheckedChange:e=>{r(e?["Primary","Secondary"]:void 0)}}),(0,i.jsx)(J.xvT,{color:"grey11",children:s})]})]}),a&&(0,i.jsxs)(J.xuv,{border:{bottom:!0},padding:12,flexDirection:"column",gap:8,children:[(0,i.jsxs)(J.xvT,{variant:"h5",color:"grey11",children:[d,!!o&&(0,i.jsx)(J.xvT,{variant:"inherit",color:"tomato9",children:" ".concat(o)})]}),null==l?void 0:l.map((e,t)=>(0,i.jsxs)(J.xuv,{gap:4,alignItems:"center",children:[(0,i.jsx)(J.xuv,{flexGrow:1,backgroundColor:"white",padding:{inline:12,block:8},flexDirection:"column",border:!0,borderRadius:4,children:(0,i.jsx)(J.oil,{ref:e=>{u.current===t&&(u.current=void 0,null==e||e.focus())},placeholder:"Variant option (e.g. Primary)",value:e,onValueChange:e=>r(null==l?void 0:l.map((n,i)=>i===t?e:n))})}),c&&(0,i.jsx)(J.hU,{type:"button",icon:"delete",onClick:()=>r(null==l?void 0:l.filter((e,n)=>n!==t))})]},t)),(0,i.jsx)(J.xuv,{children:(0,i.jsx)(J.zxk,{invisible:!0,startIcon:"add",onClick:()=>{u.current=null==l?void 0:l.length,r([...null!=l?l:[],""])},children:"Add option"})})]}),(0,i.jsx)(J.xuv,{backgroundColor:"white",flexDirection:"column",padding:12,children:(0,i.jsxs)(J.xvT,{variant:"normal",color:"grey11",children:['Need additional properties similar to "Variants"?'," ",(0,i.jsx)("a",{href:"https://community.prismic.io/t/link-field-use-cases-share-your-requests-and-feedback/18146",target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"},children:"Please provide your feedback here."})]})})]})}let $={...u.Jp};function W(e){var t;let{variants:n,setFieldValue:l}=e,r="config.variants",[o,a]=(0,U.U$)(r),s=null===(t=a.error)||void 0===t?void 0:t.find(e=>e);return(0,i.jsx)(H,{variants:n,onVariantsChange:e=>l(r,e),error:s})}let X={icon:r.$l_},K=o.object().shape({label:o.string().optional(),useAsTitle:o.boolean().optional(),placeholder:o.string().optional(),select:o.string().optional().oneOf(["media","document","web",null]).nullable(),customtypes:o.array(o.string()).strict().optional(),masks:o.array(o.string()).optional(),tags:o.array(o.string()).optional(),allowTargetBlank:o.boolean().strict().optional(),allowText:o.boolean().strict().optional(),repeat:o.boolean().strict().optional(),variants:o.array(o.string().trim().required("Values can't be empty")).optional()}).required().default(void 0).noUnknown(!0),Y=o.object().shape({type:o.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:K.optional()});var Q=n(56580),ee=n(36131),et=n(78254),en=n(16442);let ei={label:u.Jp.label,id:u.Jp.id,customtypes:{validate:()=>o.array().of(o.string())}},el={icon:r.I2R},er=K.shape({label:o.string().max(35,"String is too long. Max: 35"),select:o.string().required().matches(/^document$/,{excludeEmptyString:!0}),customtypes:o.array(o.string()).strict().optional()}),eo=o.object().shape({type:o.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:er}),{FormFields:ea,schema:es}=(0,w.zg)("Date"),ed={icon:r.f$3},{FormFields:ec,schema:eu}=(0,w.zg)("Embed"),ep={icon:r.xoN},em={label:u.Jp.label,id:u.Jp.id},ex=o.object().shape({type:o.string().matches(/^GeoPoint$/,{excludeEmptyString:!0}).required(),config:o.object().shape({label:o.string()}).required().default(void 0).noUnknown(!0)}),eh={icon:r.lPv};var ef=n(8799),eg=n(90167),ev=n(66770);let eb=e=>{let{onClick:t,error:n,onDelete:l,active:o,text:s,sx:d}=e;return(0,i.jsx)(ev.Z,{useActive:!0,fitButton:!0,error:n,onClick:t,active:o,sx:{position:"relative",width:"64px",height:"64px",...d},Icon:()=>(0,i.jsxs)(b.Fragment,{children:[(0,i.jsxs)(a.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[(0,i.jsx)(ef.jnY,{size:22}),(0,i.jsx)(a.xv,{mt:1,children:s})]}),l?(0,i.jsx)(a.Ct,{onClick:l,variant:"circle-right",children:(0,i.jsx)(r.B4e,{})}):null]})})},ey=e=>{let{onClick:t}=e;return(0,i.jsx)(ev.Z,{fitButton:!0,onClick:t,sx:{width:"64px",height:"64px",border:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}},Icon:()=>(0,i.jsx)(a.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center"},children:(0,i.jsx)(ef.iTs,{size:34,color:"#5263BA","aria-label":"Add a thumbnail"})})})},ej=e=>{let{prefix:t,required:n=!1,display:l}=e,[r,o]=(0,U.U$)(t),a=n?"*":"";return l?(0,i.jsxs)(b.Fragment,{children:[(0,i.jsx)(ek,{name:"".concat(t,".name"),label:"Name".concat(a),placeholder:"main",sx:{mb:3},isConstraint:"config.constraint"===t,meta:o}),(0,i.jsx)(eS,{name:"".concat(t,".width"),label:"Width (px)".concat(a),placeholder:" ",sx:{mb:3}}),(0,i.jsx)(eS,{name:"".concat(t,".height"),label:"Height (px)".concat(a),placeholder:" "})]}):null},ek=e=>{let{name:t,label:n,placeholder:l,meta:r,isConstraint:o,...a}=e,[s]=(0,U.U$)(t);return(0,i.jsx)(eg.Hq,{...a,fieldName:t,meta:r,formField:{label:n,placeholder:l},field:o?{value:"main",readOnly:!0}:{value:s.value},variant:o?"disabled":"primary"})},eS=e=>{let{name:t,label:n,placeholder:l,...r}=e,[o,a]=(0,U.U$)(t);return(0,i.jsx)(eg.Hq,{...r,fieldName:t,formField:{label:n,placeholder:l},meta:a,field:{min:0,type:"number",value:o.value||"",onKeyDown:e=>{("e"===e.key||"-"===e.key||"+"===e.key)&&e.preventDefault()}}})},e_=()=>o.number().nullable().transform((e,t)=>""===t?null:e),eT={label:u.Jp.label,id:u.Jp.id,constraint:{validate:()=>o.object().defined().shape({width:e_(),height:e_()})},thumbnails:{validate:()=>o.array().of(o.object().test({name:"Thumbnails",message:"Must set name and width or height at minimum",test:function(e){if(!e.name)return!1;let t="number"==typeof e.width&&e.width,n="number"==typeof e.height&&e.height;return e.name&&(t||n)}}))}},eI={name:"",width:"",height:""},eF=function(){let{width:e,height:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!n||e||t?e||t?"".concat(e||"auto","x").concat(t||"auto"):"...":"auto"},eC=o.object().shape({type:o.string().matches(/^Image$/,{excludeEmptyString:!0}).required(),config:(0,c.gc)((0,w.B9)(eT,"id"))}),eE={icon:r.Fwj},ew={...u.Jp},eL={icon:r._b$},eO=K.shape({select:o.string().required().matches(/^media$/,{excludeEmptyString:!0})}),eM=o.object().shape({type:o.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:eO.optional()}),{FormFields:eD,schema:eA}=(0,w.zg)("Number"),eN={icon:r.KZU};var eq=n(79256);let eR=e=>"use first value as default ".concat(e?'("'.concat(e,'")'):""),eV=(e,t)=>t?e:void 0,ez={...u.Jp,default_value:{type:eq.h.CHECKBOX,yupType:"string",defaultValue:null,validate:function(){return o.string().test({name:"default_value",message:'Default value is not part of field "options" in Select',test:function(e){return void 0===e||this.parent&&this.parent.options&&this.parent.options.find(t=>t===e)}})},component:e=>{var t;let{values:n}=(0,U.u6)(),l=null===(t=n.config)||void 0===t?void 0:t.options[0];return(0,i.jsx)(eg.w8,{...e,defaultValue:e.field.value,controlledValue:l,setControlledValue:e.helpers.setValue,buildControlledValue:eV,label:eR})}},options:{yupType:"array",defaultValue:["1","2"],validate:{required:["Select requires a minimum of 2 options"],min:[2,"Choose at least 2 options"],test:{name:"non-empty values",message:"Values cannot be empty",test:e=>!e.some(e=>!e||!e.length)}},component:e=>(0,i.jsx)(eg.kp,{label:"Options",inputPlaceholder:"Select option output in API (e.g. 'blueTheme')",buttonLabel:"Add option",...e})}},eP={icon:r.nwY},eB=o.object().shape({type:o.string().matches(/^Select$/,{excludeEmptyString:!0}).required(),config:(0,c.gc)((0,w.B9)(ez,"id"))});var eJ=n(47927),eU=n(29259),eZ=n.n(eU),eG=n(85505),eH=n.n(eG),e$=n(34543);let eW=e=>t=>{let{size:n}=t;return(0,i.jsx)("span",{style:{fontSize:n},children:e})},eX=[{value:"paragraph",label:"P",icon:eW("p")},{value:"preformatted",label:"PRE",icon:eW("pre")},{value:"heading1",label:"H1",icon:eW("h1")},{value:"heading2",label:"H2",icon:eW("h2")},{value:"heading3",label:"H3",icon:eW("h3")},{value:"heading4",label:"H4",icon:eW("h4")},{value:"heading5",label:"H5",icon:eW("h5")},{value:"heading6",label:"H6",icon:eW("h6")},{value:"strong",label:"Strong",icon:eW((0,i.jsx)("b",{children:"b"}))},{value:"em",label:"em",icon:eW((0,i.jsx)("em",{style:{fontFamily:"serif"},children:"I"}))},{value:"hyperlink",label:"hyperlink",icon:eW((0,i.jsx)(e$.eR7,{}))},{value:"image",label:"image",icon:eW((0,i.jsx)(e$.LFN,{}))},{value:"embed",label:"embed",icon:eW((0,i.jsx)(e$.xqv,{}))},{value:"list-item",label:"list",icon:eW((0,i.jsx)(e$.SnF,{}))},{value:"o-list-item",label:"o",icon:eW((0,i.jsx)(ef.KyO,{}))},{value:"rtl",label:"rtl",icon:eW("rtl")}],eK=eX.map(e=>e.value),eY=e=>!eK.find(t=>!e.includes(t)),eQ=e=>{let t=e.split(",");return eX.reduce((e,n)=>{let{value:i}=n;return t.includes(i)?[...e,i]:e},[])};function e0(e,t){return(0,eJ.has)("parent",e)&&eZ()(e.parent)&&(0,eJ.has)(t,e.parent)&&eH()(e.parent[t])?e.parent[t]:null}function e1(e){return()=>o.string().test({name:e,message:"Options cannot be empty",test:function(t,n){let i="single"===e?"multi":"single",l=e0(n,e),r=e0(n,i);return!!r&&"string"==typeof r||!("string"!=typeof l||(!l||!l.length)&&(!r||!r.length)||l.split(",").find(e=>!eK.includes(e)))}})}let e2={...u.Jp,allowTargetBlank:(0,p.Jg)("Allow target blank for links"),single:{validate:e1("single")},multi:{validate:e1("multi")}},e5=["config.single","config.multi"],e9={icon:r.BAW},e3=o.object().shape({type:o.string().matches(/^StructuredText$/,{excludeEmptyString:!0}).required(),config:(0,c.gc)((0,w.B9)({...e2,labels:{yupType:"array",validate:{}}},"id"))});var e6=n(18978);let e7={label:u.Jp.label,id:u.Jp.id},e4=o.object().shape({type:o.string().matches(/^Table$/,{excludeEmptyString:!0}).required(),config:o.object().shape({label:o.string()}).required().default(void 0).noUnknown(!0)}),e8={icon:e6.WHV},te=u.Jp,tt=o.object().shape({type:o.string().matches(/^Text$/,{excludeEmptyString:!0}).required(),config:(0,c.gc)((0,w.B9)(te,"id"))}),tn={icon:r.SQS},ti=u.Jp,tl=o.object().shape({type:o.string().matches(/^Timestamp$/,{excludeEmptyString:!0}).required(),config:(0,c.gc)((0,w.B9)(ti,"id"))}),tr={icon:r.k71},to={label:u.Jp.label,id:{...u.Jp.id,validate:{required:"This field is required",matches:[/^uid$/,"Api ID must be 'uid' for this field."]},disabled:!0},placeholder:u.Jp.placeholder},ta=o.object().shape({type:o.string().matches(/^UID$/,{excludeEmptyString:!0}).required(),config:(0,c.gc)((0,w.B9)(to,"id"))}),ts={Boolean:{TYPE_NAME:"Boolean",create:e=>({type:"Boolean",config:{label:e,default_value:!1,placeholder_true:"true",placeholder_false:"false"}}),Meta:N,schema:R,FormFields:q},Color:{create:e=>({type:"Color",config:{label:e,placeholder:""}}),FormFields:P,TYPE_NAME:z,schema:B,Meta:V},ContentRelationship:{create:e=>({type:"Link",config:{label:e,select:"document",repeat:!1}}),Meta:el,schema:eo,TYPE_NAME:"Link",FormFields:ei,CUSTOM_NAME:"ContentRelationship",Form:e=>{let{initialValues:t,values:n,fields:l,setFieldValue:r}=e,o=(0,Q.v9)(et.Ch).filter(en.TG),u=o.map(e=>({value:e.local.id,label:e.local.label})),p=n.config.customtypes?n.config.customtypes.map(e=>{let t=o.find(t=>t.local.id===e);return{value:null==t?void 0:t.local.id,label:null==t?void 0:t.local.label}}):null;return(0,i.jsxs)(s.k,{children:[Object.entries(ei).filter(e=>"customtypes"!==e[0]).map(e=>{let[n,r]=e;return(0,i.jsx)(s.J,{children:(0,i.jsx)(d.Z,{fieldName:(0,c.lm)(n),formField:r,fields:l,initialValues:t})},n)}),(0,i.jsx)(s.J,{children:(0,i.jsxs)(a.xu,{sx:{mt:2,alignItems:"center"},children:[(0,i.jsx)(a.__,{htmlFor:"origin",mb:"1",children:"Types"}),(0,i.jsx)(ee.ZP,{isMulti:!0,name:"origin",options:u,onChange:e=>{e&&r("config.customtypes",e.map(e=>{let{value:t}=e;return t}))},value:p,theme:e=>({...e,colors:{...e.colors,text:"text",primary:"background"}})})]})})]})},prepareInitialValues:(e,t)=>(null==t?void 0:t.customtypes)?{...t,customtypes:t.customtypes.filter(t=>e.find(e=>e.local.id===t))}:t},Date:{create:e=>({type:"Date",config:{label:e,placeholder:""}}),FormFields:ea,TYPE_NAME:"Date",schema:es,Meta:ed},Embed:{create:e=>({type:"Embed",config:{label:e,placeholder:""}}),FormFields:ec,TYPE_NAME:"Embed",schema:eu,Meta:ep},GeoPoint:{create:e=>({type:"GeoPoint",config:{label:e}}),FormFields:em,TYPE_NAME:"GeoPoint",schema:ex,Meta:eh},Image:{Meta:eE,Form:e=>{let{initialValues:t,values:n,errors:l,fields:r,touched:o}=e,[u,p]=(0,b.useState)(0),{config:{thumbnails:m=[],constraint:x}}=n;return(0,b.useEffect)(()=>{p(m.length)},[m.length]),(0,i.jsxs)(s.k,{children:[Object.entries(eT).map(e=>{let[n,l]=e;return(0,i.jsx)(s.J,{children:(0,i.jsx)(d.Z,{fieldName:(0,c.lm)(n),formField:l,fields:r,initialValues:t})},n)}),(0,i.jsxs)(s.J,{children:[(0,i.jsx)(a.__,{htmlFor:"thumbnails",variant:"label.primary",sx:{mt:1,display:"flex",alignItems:"center"},children:"Responsive views*"}),(0,i.jsx)(a.Zb,{p:3,children:(0,i.jsx)(U.F2,{name:"config.thumbnails",render:t=>{let{push:n,remove:r}=t;return(0,i.jsxs)(b.Fragment,{children:[(0,i.jsxs)(a.kC,{mb:3,children:[(0,i.jsx)(eb,{active:0===u,text:eF(x,!0),sx:{mr:2},onClick:()=>p(0)}),m.map((e,t)=>(0,i.jsx)(eb,{sx:{mr:3},active:u===+t+1,text:eF(e),error:!!l.thumbnails&&!!o.thumbnails&&!!o.thumbnails[t]&&!!l.thumbnails&&!!l.thumbnails[t],onDelete:()=>r(t),onClick:()=>p(+t+1)},"thumbnail-button-".concat(+t+1))),(0,i.jsx)(ey,{onClick:()=>{n(eI)}})]}),(0,i.jsx)(ej,{...e,display:0===u,prefix:"config.constraint"}),m.map((t,n)=>(0,b.createElement)(ej,{...e,required:!0,key:"thumbnail-".concat(+n+1),display:u===+n+1,prefix:"config.thumbnails[".concat(n,"]")}))]})}})})]})]})},schema:eC,create:e=>({type:"Image",config:{label:e,constraint:{},thumbnails:[]}}),FormFields:eT,TYPE_NAME:"Image"},Link:{Meta:X,FormFields:$,schema:Y,Form:e=>{let{initialValues:t,values:n,fields:l,setFieldValue:r}=e,{config:{allowText:o,repeat:u,variants:m}}=n;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.k,{children:[Object.entries($).map(e=>{let[n,r]=e;return(0,i.jsx)(s.J,{children:(0,i.jsx)(d.Z,{fieldName:(0,c.lm)(n),formField:r,fields:l,initialValues:t})},n)}),(0,i.jsx)(s.J,{children:(0,i.jsxs)(a.kC,{sx:{gap:2,marginTop:3},style:{paddingTop:"1px"},children:[(0,i.jsx)(s.J,{children:(0,i.jsx)(d.Z,{fieldName:(0,c.lm)("allowTargetBlank"),formField:(0,p.Jg)("Allow target blank",!1,!0),fields:l,initialValues:t})}),(0,i.jsx)(Z,{checked:o,setFieldValue:r})]})},"allowTargetBlank")]}),(0,i.jsx)(J.xuv,{height:8}),(0,i.jsxs)(J.xuv,{flexDirection:"column",gap:16,children:[(0,i.jsx)(G,{checked:u,setFieldValue:r}),(0,i.jsx)(W,{variants:m,setFieldValue:r})]})]})},create:e=>({type:"Link",config:{label:e,placeholder:"",select:null,allowTargetBlank:!0,allowText:!0,repeat:!1}}),TYPE_NAME:"Link"},LinkToMedia:{Meta:eL,FormFields:ew,schema:eM,Form:e=>{let{initialValues:t,values:n,fields:l,setFieldValue:r}=e,{config:{allowText:o,variants:a}}=n;return(0,i.jsxs)(J.xuv,{flexDirection:"column",gap:16,children:[(0,i.jsxs)(s.k,{children:[Object.entries(ew).map(e=>{let[n,r]=e;return(0,i.jsx)(s.J,{children:(0,i.jsx)(d.Z,{fieldName:(0,c.lm)(n),formField:r,fields:l,initialValues:t})},n)}),(0,i.jsx)(Z,{checked:o,setFieldValue:r})]}),(0,i.jsx)(W,{variants:a,setFieldValue:r})]})},create:e=>({type:"Link",config:{label:e,placeholder:"",select:"media",allowText:!0}}),TYPE_NAME:"Link",CUSTOM_NAME:"LinkToMedia"},Number:{create:e=>({type:"Number",config:{label:e,placeholder:""}}),FormFields:eD,TYPE_NAME:"Number",schema:eA,Meta:eN},Select:{FormFields:ez,create:e=>({type:"Select",config:{label:e,placeholder:"",options:["1","2"]}}),schema:eB,Meta:eP,TYPE_NAME:"Select"},StructuredText:{create:e=>({type:"StructuredText",config:{label:e,placeholder:"",allowTargetBlank:!0,multi:eK.join(",")}}),FormFields:e2,Meta:e9,schema:e3,TYPE_NAME:"StructuredText",Form:e=>{var t;let{initialValues:n,values:l,errors:r,fields:o,setFieldValue:u}=e,{config:{single:p,multi:m}}=l,x=p?eQ(p):m?eQ(m):eK,[h,f]=(0,b.useState)(!p),[g,v]=(0,b.useState)(x);return(0,b.useEffect)(()=>{let e=h?1:0;u(e5[e],g.join(",")),setTimeout(()=>{u(e5[1-e],void 0)},100)},[h,g]),(0,i.jsxs)(s.k,{children:[Object.entries(e2).map(e=>{let[t,l]=e;return(0,i.jsx)(s.J,{children:(0,i.jsx)(d.Z,{fieldName:(0,c.lm)(t),formField:l,fields:o,initialValues:n})},t)}),(0,i.jsxs)(s.J,{children:[(0,i.jsxs)(a.__,{htmlFor:"accept",variant:"label.primary",sx:{mt:1,display:"flex",alignItems:"center"},children:["Accept*",(0,i.jsx)(a.zx,{type:"button",variant:"buttons.textButton",onClick:()=>{if(eY(g))return v([]);v(eK)},children:eY(g)?"Unselect All":"Select all"})]}),eX.map(e=>(0,i.jsx)(ev.Z,{fitButton:!0,useActive:!0,label:e.label,size:14,Icon:e.icon,sx:{p:"16px",mb:2,mr:2,variant:"buttons.selectIcon"},active:g.includes(e.value),onClick:()=>{if(g.find(t=>t===e.value))return v(g.filter(t=>t!==e.value));v([...g,e.value])}},e.value)),(null===(t=r.config)||void 0===t?void 0:t[h?"multi":"single"])?(0,i.jsx)(a.xu,{sx:{position:"absolute"},children:(0,i.jsx)(a.xv,{as:"span",variant:"text.labelError",pl:0,children:r.config[h?"multi":"single"]})}):null]}),(0,i.jsx)(s.J,{children:(0,i.jsx)(a.kC,{sx:{mt:2,alignItems:"center",height:"100%"},children:(0,i.jsxs)(a.__,{variant:"label.border",children:[(0,i.jsx)(a.XZ,{checked:h,onChange:()=>f(!h)}),"Allow multiple paragraphs"]})})})]})}},Table:{create:e=>({type:"Table",config:{label:e}}),FormFields:e7,TYPE_NAME:"Table",schema:e4,Meta:e8},Text:{create:e=>({type:"Text",config:{label:e,placeholder:""}}),Meta:tn,schema:tt,TYPE_NAME:"Text",FormFields:te},Timestamp:{create:e=>({type:"Timestamp",config:{label:e,placeholder:""}}),schema:tl,FormFields:ti,TYPE_NAME:"Timestamp",Meta:tr},UID:{create:e=>({type:"UID",config:{label:e,placeholder:""}}),Meta:{icon:r.XN7},schema:ta,TYPE_NAME:"UID",FormFields:to}},td=[ts.Image,ts.Text,ts.StructuredText,ts.Link,ts.Select,ts.Boolean,ts.Number,ts.Color,ts.Date,ts.Table,ts.Embed,ts.Timestamp,ts.GeoPoint,ts.ContentRelationship,ts.LinkToMedia],tc="subItem",tu=g({schemaTypeRegex:/^NestedGroup$/,customListItem:e=>(0,i.jsx)(A,{Widgets:ts,widgetsArray:td,hintBase:tc,...e}),customName:"NestedGroup",hintItemName:tc}),tp={...ts,NestedGroup:tu},tm=[tp.Image,tp.Text,tp.StructuredText,tp.Link,tp.Select,tp.Boolean,tp.Number,tp.Color,tp.Date,tp.Table,tp.Embed,tp.Timestamp,tp.GeoPoint,tp.ContentRelationship,tp.LinkToMedia,tp.NestedGroup],tx="item",th={Group:g({schemaTypeRegex:/^Group$/,customListItem:e=>{let t=function(){let e=(0,l.L)("slicemachine-nested-groups");return{eligible:(null==e?void 0:e.value)==="on"}}(),n=tm.filter(e=>!!t.eligible||"NestedGroup"!==e.CUSTOM_NAME);return(0,i.jsx)(A,{Widgets:tp,widgetsArray:n,hintBase:tx,...e})},hintItemName:tx}),NestedGroup:tu,...ts}},16086:function(e,t,n){"use strict";n.d(t,{B9:function(){return o},Ss:function(){return s},uS:function(){return a},zg:function(){return d}});var i=n(65413),l=n(68169),r=n(9889);let o=(e,t)=>{let{[t]:n,...i}=e;return i},a=e=>!e.destination||e.source.index===e.destination.index||e.source.droppableId!==e.destination.droppableId,s=(e,t)=>!e[t]&&(console.log('Could not find widget with type name "'.concat(t,'".')),!0),d=e=>({TYPE_NAME:e,FormFields:r.Jp,schema:i.object().shape({type:i.string().test({name:"type",test:function(t){return t===e}}),config:(0,l.gc)(o(r.Jp,"id"))}),create:()=>({type:e,config:(0,l.f7)(o(r.Jp,"id"))})})},5683:function(e,t,n){"use strict";n.d(t,{i:function(){return r},v:function(){return l}});let i=e=>"slice-machine_".concat(e),l=i("staticFieldsInfoDialogDismissed");function r(e){let{type:t,library:n,sliceId:l,variationId:r}=e;return i(["ai-feedback",t,n,l,r].join("#"))}},49919:function(e,t,n){"use strict";function i(e){if(e.startsWith("/slices/"))return"slice";if(e.startsWith("/custom-types/"))return"custom type";if(e.startsWith("/page-types/"))return"page type";throw Error("Did not detect a content type from: ".concat(e))}n.d(t,{T:function(){return i}})},5495:function(e,t,n){"use strict";n.d(t,{V:function(){return r}});var i=n(94160),l=n(49919);function r(e){var t,n,r,o,a;let{id:s,field:d,isInAGroup:c=!1}=e;i.Xe.track({event:"field:added",id:s,name:null!==(a=null===(t=d.config)||void 0===t?void 0:t.label)&&void 0!==a?a:"",type:d.type,isInAGroup:c,contentType:(0,l.T)(window.location.pathname),..."Link"===d.type&&{allowText:null===(n=d.config)||void 0===n?void 0:n.allowText,repeat:null===(r=d.config)||void 0===r?void 0:r.repeat,variants:null===(o=d.config)||void 0===o?void 0:o.variants}})}},39302:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});var i=n(94160),l=n(49919);function r(e){var t,n,r,o,a;let{id:s,previousId:d=s,field:c,isInAGroup:u=!1}=e;i.Xe.track({event:"field:updated",previousId:d,id:s,idUpdated:d!==s,name:null!==(a=null===(t=c.config)||void 0===t?void 0:t.label)&&void 0!==a?a:"",type:c.type,isInAGroup:u,contentType:(0,l.T)(window.location.pathname),..."Link"===c.type&&{allowText:null===(n=c.config)||void 0===n?void 0:n.allowText,repeat:null===(r=c.config)||void 0===r?void 0:r.repeat,variants:null===(o=c.config)||void 0===o?void 0:o.variants}})}},13834:function(e){e.exports={flex:"List_flex__b6acG",row:"List_row__zKnOI List_flex__b6acG",root:"List_root__m_SiQ List_flex__b6acG","root-border":"List_root-border__UW3vp",child:"List_child__MJ49i List_row__zKnOI List_flex__b6acG",header:"List_header__T0WM5 List_child__MJ49i List_row__zKnOI List_flex__b6acG",headerActions:"List_headerActions__mNgLY List_row__zKnOI List_flex__b6acG",item:"List_item__LMBx4 List_child__MJ49i List_row__zKnOI List_flex__b6acG"}},644:function(e){e.exports={root:"ZoneEmptyState_root__DAfG2"}}}]);