@timardex/cluemart-shared 1.5.591 → 1.5.596

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.
@@ -28,7 +28,7 @@ __export(sharing_exports, {
28
28
  RELATION_SHARE_RESOURCE_TYPES: () => RELATION_SHARE_RESOURCE_TYPES,
29
29
  RESOURCE_SHARE_TYPES: () => RESOURCE_SHARE_TYPES,
30
30
  RESOURCE_SHARE_TYPES_FOR_URL: () => RESOURCE_SHARE_TYPES_FOR_URL,
31
- SHARE_COMPACT_SECTION_SEPARATOR: () => SHARE_COMPACT_SECTION_SEPARATOR,
31
+ SHARE_DESCRIPTION_SECTION_BREAK: () => SHARE_DESCRIPTION_SECTION_BREAK,
32
32
  SHARE_DESCRIPTION_SECTION_SEPARATOR: () => SHARE_DESCRIPTION_SECTION_SEPARATOR,
33
33
  SHARE_RESOURCE_LABEL: () => SHARE_RESOURCE_LABEL,
34
34
  SHARE_SITE_URL: () => SHARE_SITE_URL,
@@ -41,6 +41,8 @@ __export(sharing_exports, {
41
41
  buildShareUrl: () => buildShareUrl,
42
42
  formatCategoryLabel: () => formatCategoryLabel,
43
43
  formatShareSectionsForCompactDisplay: () => formatShareSectionsForCompactDisplay,
44
+ formatShareSectionsForMultilineDisplay: () => formatShareSectionsForMultilineDisplay,
45
+ formatStallCapacityLabel: () => formatStallCapacityLabel,
44
46
  isPostShareResourceType: () => isPostShareResourceType,
45
47
  isRelationShareResourceType: () => isRelationShareResourceType,
46
48
  joinShareDescriptionSections: () => joinShareDescriptionSections,
@@ -60,9 +62,9 @@ function formatCategoryLabel(category) {
60
62
 
61
63
  // src/sharing/joinShareDescriptionSections.ts
62
64
  var SHARE_DESCRIPTION_SECTION_SEPARATOR = " \xB7 ";
63
- var SHARE_COMPACT_SECTION_SEPARATOR = SHARE_DESCRIPTION_SECTION_SEPARATOR;
65
+ var SHARE_DESCRIPTION_SECTION_BREAK = "\n\n";
64
66
  function joinShareDescriptionSections(sections) {
65
- return sections.filter((section) => Boolean(section)).join(SHARE_DESCRIPTION_SECTION_SEPARATOR);
67
+ return sections.filter((section) => Boolean(section)).join(SHARE_DESCRIPTION_SECTION_BREAK);
66
68
  }
67
69
 
68
70
  // src/sharing/buildRelationShareDescription.ts
@@ -77,6 +79,9 @@ function formatShareDate(isoDate) {
77
79
  return isoDate;
78
80
  }
79
81
  }
82
+ function formatStallCapacityLabel(stallCapacity) {
83
+ return stallCapacity > 0 ? ` (${stallCapacity} spaces available)` : " - Full";
84
+ }
80
85
  function buildInvitationShareDescription(event, eventInfo) {
81
86
  const stallTypes = eventInfo?.dateTime?.flatMap((date) => date.stallTypes) ?? [];
82
87
  if (!eventInfo || stallTypes.length === 0) {
@@ -87,12 +92,11 @@ function buildInvitationShareDescription(event, eventInfo) {
87
92
  event.location.fullAddress,
88
93
  ...event.dateTime.map((date) => {
89
94
  const start = formatShareDate(date.startDate);
90
- const end = date.endDate ? ` \u2013 ${formatShareDate(date.endDate)}` : "";
91
- return `Market date: ${start}${end}`;
95
+ return `Market date: ${start}`;
92
96
  }),
93
97
  `Application deadline: vendors must apply at least ${eventInfo.applicationDeadlineHours} hours before each market date.`,
94
98
  ...stallTypes.map(
95
- (stall) => `Stall: ${stall.label} \u2014 $${stall.price} (${stall.stallCapacity} spaces)`
99
+ (stall) => `Stall: ${stall.label} \u2014 $${stall.price}${formatStallCapacityLabel(stall.stallCapacity)}`
96
100
  ),
97
101
  requirementLabels.length > 0 && `Requirements: ${requirementLabels.join(", ")}`
98
102
  ];
@@ -179,49 +183,63 @@ function buildShareUrl(type, id) {
179
183
  }
180
184
 
181
185
  // src/sharing/normalizeShareDescription.ts
186
+ var LEGACY_BULLET_PREFIX = "\u2022 ";
182
187
  function normalizeShareSection(value) {
183
188
  if (value == null) {
184
189
  return "";
185
190
  }
186
191
  return value.trim().split("\n").map((line) => line.trim().replace(/[ \t]+/g, " ")).join("\n").replace(/\n{3,}/g, "\n\n");
187
192
  }
188
- function normalizeShareOgDescription(value) {
193
+ function stripLegacyBulletPrefix(section) {
194
+ return section.startsWith(LEGACY_BULLET_PREFIX) ? section.slice(LEGACY_BULLET_PREFIX.length) : section;
195
+ }
196
+ function splitShareDescriptionSections(value) {
189
197
  const trimmed = value.trim();
190
198
  if (!trimmed) {
191
- return "";
199
+ return [];
200
+ }
201
+ if (trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {
202
+ return trimmed.split(SHARE_DESCRIPTION_SECTION_SEPARATOR).map((section) => stripLegacyBulletPrefix(normalizeShareSection(section))).filter((section) => section.length > 0);
192
203
  }
193
204
  if (/\n\n/.test(trimmed)) {
194
- return trimmed.split(/\n\n+/).map((section) => section.replace(/\s+/g, " ").trim()).filter(Boolean).join(SHARE_DESCRIPTION_SECTION_SEPARATOR);
205
+ return trimmed.split(/\n\n+/).map((section) => stripLegacyBulletPrefix(normalizeShareSection(section))).filter((section) => section.length > 0);
195
206
  }
196
- return trimmed.replace(/\s+/g, " ").trim();
207
+ if (/\n/.test(trimmed)) {
208
+ return trimmed.split(/\n+/).map((section) => stripLegacyBulletPrefix(normalizeShareSection(section))).filter((section) => section.length > 0);
209
+ }
210
+ return [stripLegacyBulletPrefix(normalizeShareSection(trimmed))];
211
+ }
212
+ function collapseExcessiveBlankLines(value) {
213
+ return value.replace(/\n{4,}/g, "\n\n\n").trim();
214
+ }
215
+ function formatShareSectionsForMultilineDisplay(value) {
216
+ return collapseExcessiveBlankLines(
217
+ splitShareDescriptionSections(value).join(SHARE_DESCRIPTION_SECTION_BREAK)
218
+ );
197
219
  }
198
220
  function formatShareSectionsForCompactDisplay(value) {
221
+ return splitShareDescriptionSections(value).join(
222
+ SHARE_DESCRIPTION_SECTION_SEPARATOR
223
+ );
224
+ }
225
+ function normalizeShareOgDescription(value) {
199
226
  const trimmed = value.trim();
200
227
  if (!trimmed) {
201
228
  return "";
202
229
  }
203
- if (trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {
204
- return normalizeShareSection(trimmed);
205
- }
206
- if (/\n\n/.test(trimmed)) {
207
- return trimmed.split(/\n\n+/).map((section) => normalizeShareSection(section)).filter((section) => section.length > 0).join(SHARE_DESCRIPTION_SECTION_SEPARATOR);
230
+ if (/\n\n/.test(trimmed) || trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {
231
+ return formatShareSectionsForCompactDisplay(trimmed);
208
232
  }
209
- if (/\n/.test(trimmed)) {
210
- return trimmed.split(/\n+/).map((section) => normalizeShareSection(section)).filter((section) => section.length > 0).join(SHARE_DESCRIPTION_SECTION_SEPARATOR);
211
- }
212
- return normalizeShareSection(trimmed);
233
+ return trimmed.replace(/\s+/g, " ").trim();
213
234
  }
214
- function buildFacebookShareQuote(title, description) {
215
- const titlePart = normalizeShareSection(title);
216
- const descriptionPart = normalizeShareSection(description);
217
- const bodyPart = descriptionPart ? formatShareSectionsForCompactDisplay(descriptionPart) : "";
218
- const parts = [titlePart, bodyPart].filter((part) => part.length > 0);
219
- return parts.length > 0 ? parts.join(SHARE_DESCRIPTION_SECTION_SEPARATOR) : void 0;
235
+ function buildFacebookShareQuote(_title, description) {
236
+ const body = formatShareSectionsForMultilineDisplay(description);
237
+ return body.length > 0 ? body : void 0;
220
238
  }
221
- function buildShareOgDescription(title, description) {
222
- const quote = buildFacebookShareQuote(title, description);
223
- if (quote) {
224
- return quote;
239
+ function buildShareOgDescription(_title, description) {
240
+ const multiline = formatShareSectionsForMultilineDisplay(description);
241
+ if (multiline) {
242
+ return multiline;
225
243
  }
226
244
  return normalizeShareOgDescription(description);
227
245
  }
@@ -247,7 +265,7 @@ function buildSharePagePath(resourceType, rawId) {
247
265
  RELATION_SHARE_RESOURCE_TYPES,
248
266
  RESOURCE_SHARE_TYPES,
249
267
  RESOURCE_SHARE_TYPES_FOR_URL,
250
- SHARE_COMPACT_SECTION_SEPARATOR,
268
+ SHARE_DESCRIPTION_SECTION_BREAK,
251
269
  SHARE_DESCRIPTION_SECTION_SEPARATOR,
252
270
  SHARE_RESOURCE_LABEL,
253
271
  SHARE_SITE_URL,
@@ -260,6 +278,8 @@ function buildSharePagePath(resourceType, rawId) {
260
278
  buildShareUrl,
261
279
  formatCategoryLabel,
262
280
  formatShareSectionsForCompactDisplay,
281
+ formatShareSectionsForMultilineDisplay,
282
+ formatStallCapacityLabel,
263
283
  isPostShareResourceType,
264
284
  isRelationShareResourceType,
265
285
  joinShareDescriptionSections,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/sharing/index.ts","../../src/sharing/formatCategoryLabel.ts","../../src/sharing/joinShareDescriptionSections.ts","../../src/sharing/buildRelationShareDescription.ts","../../src/sharing/relationShareTypes.ts","../../src/sharing/constants.ts","../../src/sharing/buildShareUrl.ts","../../src/sharing/normalizeShareDescription.ts","../../src/sharing/normalizeShareRouteId.ts"],"sourcesContent":["export * from \"./buildRelationShareDescription\";\nexport * from \"./shareRelationTypes\";\nexport * from \"./buildShareUrl\";\nexport * from \"./constants\";\nexport * from \"./formatCategoryLabel\";\nexport * from \"./joinShareDescriptionSections\";\nexport * from \"./normalizeShareDescription\";\nexport * from \"./normalizeShareRouteId\";\nexport * from \"./relationShareTypes\";\n","import type { ShareVendorCategory } from \"./shareRelationTypes\";\n\nexport function formatCategoryLabel(category: ShareVendorCategory): string {\n const subcategoryNames = category.subcategories\n .map((subcategory) => subcategory.name)\n .filter(Boolean);\n\n if (subcategoryNames.length === 0) {\n return category.name;\n }\n\n return `${category.name} (${subcategoryNames.join(\", \")})`;\n}\n","/** Visible separator for multi-block share text (OG, Facebook quote, crawlers collapse newlines). */\nexport const SHARE_DESCRIPTION_SECTION_SEPARATOR = \" · \";\n\n/** @deprecated Use {@link SHARE_DESCRIPTION_SECTION_SEPARATOR}. */\nexport const SHARE_COMPACT_SECTION_SEPARATOR =\n SHARE_DESCRIPTION_SECTION_SEPARATOR;\n\nexport function joinShareDescriptionSections(\n sections: ReadonlyArray<string | false | null | undefined>,\n): string {\n return sections\n .filter((section): section is string => Boolean(section))\n .join(SHARE_DESCRIPTION_SECTION_SEPARATOR);\n}\n","import { formatCategoryLabel } from \"./formatCategoryLabel\";\nimport { joinShareDescriptionSections } from \"./joinShareDescriptionSections\";\nimport type {\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareVendorForApplication,\n ShareVendorInfoForApplication,\n} from \"./shareRelationTypes\";\n\nexport type {\n ShareEventDateTime,\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareStallType,\n ShareVendorCategory,\n ShareVendorForApplication,\n ShareVendorInfoForApplication,\n} from \"./shareRelationTypes\";\n\nfunction formatShareDate(isoDate: string): string {\n try {\n return new Intl.DateTimeFormat(\"en-NZ\", {\n day: \"numeric\",\n month: \"short\",\n year: \"numeric\",\n }).format(new Date(isoDate));\n } catch {\n return isoDate;\n }\n}\n\nexport function buildInvitationShareDescription(\n event: ShareEventForInvitation,\n eventInfo: ShareEventInfoForInvitation | null | undefined,\n): string {\n const stallTypes =\n eventInfo?.dateTime?.flatMap((date) => date.stallTypes) ?? [];\n\n if (!eventInfo || stallTypes.length === 0) {\n return event.description?.trim() || \"\";\n }\n\n const requirementLabels = (eventInfo.requirements ?? [])\n .filter((item) => item.value)\n .map((item) => item.label);\n\n const sections = [\n event.location.fullAddress,\n ...event.dateTime.map((date) => {\n const start = formatShareDate(date.startDate);\n const end = date.endDate ? ` – ${formatShareDate(date.endDate)}` : \"\";\n return `Market date: ${start}${end}`;\n }),\n `Application deadline: vendors must apply at least ${eventInfo.applicationDeadlineHours} hours before each market date.`,\n ...stallTypes.map(\n (stall) =>\n `Stall: ${stall.label} — $${stall.price} (${stall.stallCapacity} spaces)`,\n ),\n requirementLabels.length > 0 &&\n `Requirements: ${requirementLabels.join(\", \")}`,\n ];\n\n return joinShareDescriptionSections(sections);\n}\n\nexport function buildApplicationShareDescription(\n vendor: ShareVendorForApplication,\n vendorInfo: ShareVendorInfoForApplication | null | undefined,\n): string {\n const categoryLabels = vendor.categories.map((category) =>\n formatCategoryLabel(category),\n );\n\n if (!vendorInfo) {\n return vendor.description?.trim() || \"\";\n }\n\n const compliance = vendorInfo.compliance;\n const complianceLabels = [\n compliance?.liabilityInsurance && \"Liability insurance\",\n compliance?.foodBeverageLicense && \"Food & beverage licence\",\n ].filter(Boolean);\n\n const profileDescription = vendor.description?.trim();\n\n const sections = [\n categoryLabels.length > 0 && `Categories: ${categoryLabels.join(\", \")}`,\n `Stall size: ${vendorInfo.stallInfo.size.width}m × ${vendorInfo.stallInfo.size.depth}m`,\n `Compliance: ${complianceLabels.length > 0 ? complianceLabels.join(\", \") : \"Not specified\"}`,\n `Price range: $${vendorInfo.product.priceRange.min} – $${vendorInfo.product.priceRange.max}`,\n profileDescription,\n ];\n\n return joinShareDescriptionSections(sections);\n}\n","/** Path segments for relation share URLs — must match mobile `RelationTitle` values. */\nexport const RELATION_SHARE_INVITATION = \"invitation\" as const;\nexport const RELATION_SHARE_APPLICATION = \"application\" as const;\n\nexport const RELATION_SHARE_RESOURCE_TYPES = [\n RELATION_SHARE_INVITATION,\n RELATION_SHARE_APPLICATION,\n] as const;\n\nexport type RelationShareResourceType =\n (typeof RELATION_SHARE_RESOURCE_TYPES)[number];\n\nexport function isRelationShareResourceType(\n resourceType: string,\n): resourceType is RelationShareResourceType {\n return (RELATION_SHARE_RESOURCE_TYPES as readonly string[]).includes(\n resourceType,\n );\n}\n","import {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n type RelationShareResourceType,\n} from \"./relationShareTypes\";\n\nexport {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n RELATION_SHARE_RESOURCE_TYPES,\n isRelationShareResourceType,\n type RelationShareResourceType,\n} from \"./relationShareTypes\";\n\nexport const SHARE_SITE_URL = \"https://cluemart.co.nz\";\n\nexport const DEFAULT_SHARE_OG_IMAGE = `${SHARE_SITE_URL}/assets/logo.webp`;\n\nexport const RESOURCE_SHARE_TYPES = [\n \"market\",\n \"stallholder\",\n \"partner\",\n] as const;\n\nexport type ResourceShareType = (typeof RESOURCE_SHARE_TYPES)[number];\n\nexport const POST_SHARE_RESOURCE_TYPES = [\n \"daily_meets\",\n \"daily_tips\",\n \"daily_games\",\n] as const;\n\nexport type PostShareResourceType = (typeof POST_SHARE_RESOURCE_TYPES)[number];\n\nexport type ShareResourceType =\n | ResourceShareType\n | PostShareResourceType\n | RelationShareResourceType;\n\nexport const SHARE_RESOURCE_LABEL: Record<ShareResourceType, string> = {\n [RELATION_SHARE_APPLICATION]: \"Application\",\n [RELATION_SHARE_INVITATION]: \"Invitation\",\n daily_games: \"Daily Game\",\n daily_meets: \"Daily Meet\",\n daily_tips: \"Daily Tip\",\n market: \"Market\",\n partner: \"Partner\",\n stallholder: \"Stallholder\",\n};\n\nexport function isPostShareResourceType(\n resourceType: ShareResourceType,\n): resourceType is PostShareResourceType {\n return (POST_SHARE_RESOURCE_TYPES as readonly string[]).includes(\n resourceType,\n );\n}\n","import {\n POST_SHARE_RESOURCE_TYPES,\n RESOURCE_SHARE_TYPES,\n SHARE_SITE_URL,\n} from \"./constants\";\nimport {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n} from \"./relationShareTypes\";\n\n/** Path segments for public resource share URLs (markets, posts, etc.). */\nexport const PUBLIC_SHARE_PATH_TYPES = [\n ...RESOURCE_SHARE_TYPES,\n ...POST_SHARE_RESOURCE_TYPES,\n] as const;\n\nexport type PublicSharePathType = (typeof PUBLIC_SHARE_PATH_TYPES)[number];\n\n/** @deprecated Use {@link PUBLIC_SHARE_PATH_TYPES} — kept for mobile deep-link helpers. */\nexport const RESOURCE_SHARE_TYPES_FOR_URL = PUBLIC_SHARE_PATH_TYPES;\n\nexport type RelationSharePathType =\n | typeof RELATION_SHARE_INVITATION\n | typeof RELATION_SHARE_APPLICATION;\n\nexport type ShareType = PublicSharePathType | RelationSharePathType;\n\n/** Alternation for deep-link regexes — keep in sync with {@link ShareType}. */\nexport const SHARE_TYPE_PATH_REGEX = [\n ...PUBLIC_SHARE_PATH_TYPES,\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n].join(\"|\");\n\nexport function buildShareUrl(type: ShareType, id: string): string {\n return `${SHARE_SITE_URL}/share/${type}/${encodeURIComponent(id)}`;\n}\n","import { SHARE_DESCRIPTION_SECTION_SEPARATOR } from \"./joinShareDescriptionSections\";\n\n/** Trims a share section and collapses spaces per line; preserves line breaks. */\nfunction normalizeShareSection(value: string | null | undefined): string {\n if (value == null) {\n return \"\";\n }\n return value\n .trim()\n .split(\"\\n\")\n .map((line) => line.trim().replace(/[ \\t]+/g, \" \"))\n .join(\"\\n\")\n .replace(/\\n{3,}/g, \"\\n\\n\");\n}\n\n/**\n * Formats share descriptions for Open Graph / Twitter meta tags.\n * Legacy `\\n\\n` sections are joined with {@link SHARE_DESCRIPTION_SECTION_SEPARATOR}\n * because Facebook and others collapse line breaks into spaces.\n */\nexport function normalizeShareOgDescription(value: string): string {\n const trimmed = value.trim();\n if (!trimmed) {\n return \"\";\n }\n\n if (/\\n\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n\\n+/)\n .map((section) => section.replace(/\\s+/g, \" \").trim())\n .filter(Boolean)\n .join(SHARE_DESCRIPTION_SECTION_SEPARATOR);\n }\n\n return trimmed.replace(/\\s+/g, \" \").trim();\n}\n\n/**\n * Formats multiline share copy for UIs that strip line breaks (Facebook SDK quote).\n */\nexport function formatShareSectionsForCompactDisplay(value: string): string {\n const trimmed = value.trim();\n if (!trimmed) {\n return \"\";\n }\n\n if (trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {\n return normalizeShareSection(trimmed);\n }\n\n if (/\\n\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n\\n+/)\n .map((section) => normalizeShareSection(section))\n .filter((section) => section.length > 0)\n .join(SHARE_DESCRIPTION_SECTION_SEPARATOR);\n }\n\n if (/\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n+/)\n .map((section) => normalizeShareSection(section))\n .filter((section) => section.length > 0)\n .join(SHARE_DESCRIPTION_SECTION_SEPARATOR);\n }\n\n return normalizeShareSection(trimmed);\n}\n\n/**\n * Quote text for Facebook ShareDialog — avoids `\\n\\n` which Meta renders as a single space.\n */\nexport function buildFacebookShareQuote(\n title: string,\n description: string,\n): string | undefined {\n const titlePart = normalizeShareSection(title);\n const descriptionPart = normalizeShareSection(description);\n const bodyPart = descriptionPart\n ? formatShareSectionsForCompactDisplay(descriptionPart)\n : \"\";\n\n const parts = [titlePart, bodyPart].filter((part) => part.length > 0);\n return parts.length > 0\n ? parts.join(SHARE_DESCRIPTION_SECTION_SEPARATOR)\n : undefined;\n}\n\n/**\n * Open Graph / Twitter description — same compact section layout as\n * {@link buildFacebookShareQuote} so link previews match mobile Facebook share text.\n */\nexport function buildShareOgDescription(\n title: string,\n description: string,\n): string {\n const quote = buildFacebookShareQuote(title, description);\n if (quote) {\n return quote;\n }\n return normalizeShareOgDescription(description);\n}\n","import type { ShareResourceType } from \"./constants\";\n\nexport function normalizeShareRouteId(id: string): string {\n try {\n return decodeURIComponent(id);\n } catch {\n return id;\n }\n}\n\nexport function buildSharePagePath(\n resourceType: ShareResourceType,\n rawId: string,\n): string {\n return `/share/${resourceType}/${encodeURIComponent(normalizeShareRouteId(rawId))}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,SAAS,oBAAoB,UAAuC;AACzE,QAAM,mBAAmB,SAAS,cAC/B,IAAI,CAAC,gBAAgB,YAAY,IAAI,EACrC,OAAO,OAAO;AAEjB,MAAI,iBAAiB,WAAW,GAAG;AACjC,WAAO,SAAS;AAAA,EAClB;AAEA,SAAO,GAAG,SAAS,IAAI,KAAK,iBAAiB,KAAK,IAAI,CAAC;AACzD;;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AAY,QAAQ,SAAS,CAAC,EACtC,KAAK,mCAAmC;AAAA,EAC7C;AAEA,MAAI,KAAK,KAAK,OAAO,GAAG;AACtB,WAAO,QACJ,MAAM,KAAK,EACX,IAAI,CAAC,YAAY,sBAAsB,OAAO,CAAC,EAC/C,OAAO,CAAC,YAAY,QAAQ,SAAS,CAAC,EACtC,KAAK,mCAAmC;AAAA,EAC7C;AAEA,SAAO,sBAAsB,OAAO;AACtC;AAKO,SAAS,wBACd,OACA,aACoB;AACpB,QAAM,YAAY,sBAAsB,KAAK;AAC7C,QAAM,kBAAkB,sBAAsB,WAAW;AACzD,QAAM,WAAW,kBACb,qCAAqC,eAAe,IACpD;AAEJ,QAAM,QAAQ,CAAC,WAAW,QAAQ,EAAE,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC;AACpE,SAAO,MAAM,SAAS,IAClB,MAAM,KAAK,mCAAmC,IAC9C;AACN;AAMO,SAAS,wBACd,OACA,aACQ;AACR,QAAM,QAAQ,wBAAwB,OAAO,WAAW;AACxD,MAAI,OAAO;AACT,WAAO;AAAA,EACT;AACA,SAAO,4BAA4B,WAAW;AAChD;;;ACnGO,SAAS,sBAAsB,IAAoB;AACxD,MAAI;AACF,WAAO,mBAAmB,EAAE;AAAA,EAC9B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,mBACd,cACA,OACQ;AACR,SAAO,UAAU,YAAY,IAAI,mBAAmB,sBAAsB,KAAK,CAAC,CAAC;AACnF;","names":[]}
1
+ {"version":3,"sources":["../../src/sharing/index.ts","../../src/sharing/formatCategoryLabel.ts","../../src/sharing/joinShareDescriptionSections.ts","../../src/sharing/buildRelationShareDescription.ts","../../src/sharing/relationShareTypes.ts","../../src/sharing/constants.ts","../../src/sharing/buildShareUrl.ts","../../src/sharing/normalizeShareDescription.ts","../../src/sharing/normalizeShareRouteId.ts"],"sourcesContent":["export * from \"./buildRelationShareDescription\";\nexport * from \"./shareRelationTypes\";\nexport * from \"./buildShareUrl\";\nexport * from \"./constants\";\nexport * from \"./formatCategoryLabel\";\nexport * from \"./joinShareDescriptionSections\";\nexport * from \"./normalizeShareDescription\";\nexport * from \"./normalizeShareRouteId\";\nexport * from \"./relationShareTypes\";\n","import type { ShareVendorCategory } from \"./shareRelationTypes\";\n\nexport function formatCategoryLabel(category: ShareVendorCategory): string {\n const subcategoryNames = category.subcategories\n .map((subcategory) => subcategory.name)\n .filter(Boolean);\n\n if (subcategoryNames.length === 0) {\n return category.name;\n }\n\n return `${category.name} (${subcategoryNames.join(\", \")})`;\n}\n","/** Visible separator for multi-block share text when line breaks are stripped (legacy OG). */\nexport const SHARE_DESCRIPTION_SECTION_SEPARATOR = \" · \";\n\n/** Blank line between share sections — title, address, dates, URL, etc. */\nexport const SHARE_DESCRIPTION_SECTION_BREAK = \"\\n\\n\";\n\nexport function joinShareDescriptionSections(\n sections: ReadonlyArray<string | false | null | undefined>,\n): string {\n return sections\n .filter((section): section is string => Boolean(section))\n .join(SHARE_DESCRIPTION_SECTION_BREAK);\n}\n","import { formatCategoryLabel } from \"./formatCategoryLabel\";\nimport { joinShareDescriptionSections } from \"./joinShareDescriptionSections\";\nimport type {\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareVendorForApplication,\n ShareVendorInfoForApplication,\n} from \"./shareRelationTypes\";\n\nexport type {\n ShareEventDateTime,\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareStallType,\n ShareVendorCategory,\n ShareVendorForApplication,\n ShareVendorInfoForApplication,\n} from \"./shareRelationTypes\";\n\nfunction formatShareDate(isoDate: string): string {\n try {\n return new Intl.DateTimeFormat(\"en-NZ\", {\n day: \"numeric\",\n month: \"short\",\n year: \"numeric\",\n }).format(new Date(isoDate));\n } catch {\n return isoDate;\n }\n}\n\nexport function formatStallCapacityLabel(stallCapacity: number): string {\n return stallCapacity > 0 ? ` (${stallCapacity} spaces available)` : \" - Full\";\n}\n\nexport function buildInvitationShareDescription(\n event: ShareEventForInvitation,\n eventInfo: ShareEventInfoForInvitation | null | undefined,\n): string {\n const stallTypes =\n eventInfo?.dateTime?.flatMap((date) => date.stallTypes) ?? [];\n\n if (!eventInfo || stallTypes.length === 0) {\n return event.description?.trim() || \"\";\n }\n\n const requirementLabels = (eventInfo.requirements ?? [])\n .filter((item) => item.value)\n .map((item) => item.label);\n\n const sections = [\n event.location.fullAddress,\n ...event.dateTime.map((date) => {\n const start = formatShareDate(date.startDate);\n // DO NOT share end date for now, we will add it later if needed\n return `Market date: ${start}`;\n }),\n `Application deadline: vendors must apply at least ${eventInfo.applicationDeadlineHours} hours before each market date.`,\n ...stallTypes.map(\n (stall) =>\n `Stall: ${stall.label} — $${stall.price}${formatStallCapacityLabel(stall.stallCapacity)}`,\n ),\n requirementLabels.length > 0 &&\n `Requirements: ${requirementLabels.join(\", \")}`,\n ];\n\n return joinShareDescriptionSections(sections);\n}\n\nexport function buildApplicationShareDescription(\n vendor: ShareVendorForApplication,\n vendorInfo: ShareVendorInfoForApplication | null | undefined,\n): string {\n const categoryLabels = vendor.categories.map((category) =>\n formatCategoryLabel(category),\n );\n\n if (!vendorInfo) {\n return vendor.description?.trim() || \"\";\n }\n\n const compliance = vendorInfo.compliance;\n const complianceLabels = [\n compliance?.liabilityInsurance && \"Liability insurance\",\n compliance?.foodBeverageLicense && \"Food & beverage licence\",\n ].filter(Boolean);\n\n const profileDescription = vendor.description?.trim();\n\n const sections = [\n categoryLabels.length > 0 && `Categories: ${categoryLabels.join(\", \")}`,\n `Stall size: ${vendorInfo.stallInfo.size.width}m × ${vendorInfo.stallInfo.size.depth}m`,\n `Compliance: ${complianceLabels.length > 0 ? complianceLabels.join(\", \") : \"Not specified\"}`,\n `Price range: $${vendorInfo.product.priceRange.min} – $${vendorInfo.product.priceRange.max}`,\n profileDescription,\n ];\n\n return joinShareDescriptionSections(sections);\n}\n","/** Path segments for relation share URLs — must match mobile `RelationTitle` values. */\nexport const RELATION_SHARE_INVITATION = \"invitation\" as const;\nexport const RELATION_SHARE_APPLICATION = \"application\" as const;\n\nexport const RELATION_SHARE_RESOURCE_TYPES = [\n RELATION_SHARE_INVITATION,\n RELATION_SHARE_APPLICATION,\n] as const;\n\nexport type RelationShareResourceType =\n (typeof RELATION_SHARE_RESOURCE_TYPES)[number];\n\nexport function isRelationShareResourceType(\n resourceType: string,\n): resourceType is RelationShareResourceType {\n return (RELATION_SHARE_RESOURCE_TYPES as readonly string[]).includes(\n resourceType,\n );\n}\n","import {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n type RelationShareResourceType,\n} from \"./relationShareTypes\";\n\nexport {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n RELATION_SHARE_RESOURCE_TYPES,\n isRelationShareResourceType,\n type RelationShareResourceType,\n} from \"./relationShareTypes\";\n\nexport const SHARE_SITE_URL = \"https://cluemart.co.nz\";\n\nexport const DEFAULT_SHARE_OG_IMAGE = `${SHARE_SITE_URL}/assets/logo.webp`;\n\nexport const RESOURCE_SHARE_TYPES = [\n \"market\",\n \"stallholder\",\n \"partner\",\n] as const;\n\nexport type ResourceShareType = (typeof RESOURCE_SHARE_TYPES)[number];\n\nexport const POST_SHARE_RESOURCE_TYPES = [\n \"daily_meets\",\n \"daily_tips\",\n \"daily_games\",\n] as const;\n\nexport type PostShareResourceType = (typeof POST_SHARE_RESOURCE_TYPES)[number];\n\nexport type ShareResourceType =\n | ResourceShareType\n | PostShareResourceType\n | RelationShareResourceType;\n\nexport const SHARE_RESOURCE_LABEL: Record<ShareResourceType, string> = {\n [RELATION_SHARE_APPLICATION]: \"Application\",\n [RELATION_SHARE_INVITATION]: \"Invitation\",\n daily_games: \"Daily Game\",\n daily_meets: \"Daily Meet\",\n daily_tips: \"Daily Tip\",\n market: \"Market\",\n partner: \"Partner\",\n stallholder: \"Stallholder\",\n};\n\nexport function isPostShareResourceType(\n resourceType: ShareResourceType,\n): resourceType is PostShareResourceType {\n return (POST_SHARE_RESOURCE_TYPES as readonly string[]).includes(\n resourceType,\n );\n}\n","import {\n POST_SHARE_RESOURCE_TYPES,\n RESOURCE_SHARE_TYPES,\n SHARE_SITE_URL,\n} from \"./constants\";\nimport {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n} from \"./relationShareTypes\";\n\n/** Path segments for public resource share URLs (markets, posts, etc.). */\nexport const PUBLIC_SHARE_PATH_TYPES = [\n ...RESOURCE_SHARE_TYPES,\n ...POST_SHARE_RESOURCE_TYPES,\n] as const;\n\nexport type PublicSharePathType = (typeof PUBLIC_SHARE_PATH_TYPES)[number];\n\n/** @deprecated Use {@link PUBLIC_SHARE_PATH_TYPES} — kept for mobile deep-link helpers. */\nexport const RESOURCE_SHARE_TYPES_FOR_URL = PUBLIC_SHARE_PATH_TYPES;\n\nexport type RelationSharePathType =\n | typeof RELATION_SHARE_INVITATION\n | typeof RELATION_SHARE_APPLICATION;\n\nexport type ShareType = PublicSharePathType | RelationSharePathType;\n\n/** Alternation for deep-link regexes — keep in sync with {@link ShareType}. */\nexport const SHARE_TYPE_PATH_REGEX = [\n ...PUBLIC_SHARE_PATH_TYPES,\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n].join(\"|\");\n\nexport function buildShareUrl(type: ShareType, id: string): string {\n return `${SHARE_SITE_URL}/share/${type}/${encodeURIComponent(id)}`;\n}\n","import {\n SHARE_DESCRIPTION_SECTION_BREAK,\n SHARE_DESCRIPTION_SECTION_SEPARATOR,\n} from \"./joinShareDescriptionSections\";\n\nconst LEGACY_BULLET_PREFIX = \"• \";\n\n/** Trims a share section and collapses spaces per line; preserves line breaks. */\nfunction normalizeShareSection(value: string | null | undefined): string {\n if (value == null) {\n return \"\";\n }\n return value\n .trim()\n .split(\"\\n\")\n .map((line) => line.trim().replace(/[ \\t]+/g, \" \"))\n .join(\"\\n\")\n .replace(/\\n{3,}/g, \"\\n\\n\");\n}\n\nfunction stripLegacyBulletPrefix(section: string): string {\n return section.startsWith(LEGACY_BULLET_PREFIX)\n ? section.slice(LEGACY_BULLET_PREFIX.length)\n : section;\n}\n\nfunction splitShareDescriptionSections(value: string): string[] {\n const trimmed = value.trim();\n if (!trimmed) {\n return [];\n }\n\n if (trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {\n return trimmed\n .split(SHARE_DESCRIPTION_SECTION_SEPARATOR)\n .map((section) => stripLegacyBulletPrefix(normalizeShareSection(section)))\n .filter((section) => section.length > 0);\n }\n\n if (/\\n\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n\\n+/)\n .map((section) => stripLegacyBulletPrefix(normalizeShareSection(section)))\n .filter((section) => section.length > 0);\n }\n\n if (/\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n+/)\n .map((section) => stripLegacyBulletPrefix(normalizeShareSection(section)))\n .filter((section) => section.length > 0);\n }\n\n return [stripLegacyBulletPrefix(normalizeShareSection(trimmed))];\n}\n\nfunction collapseExcessiveBlankLines(value: string): string {\n return value.replace(/\\n{4,}/g, \"\\n\\n\\n\").trim();\n}\n\n/**\n * Share copy with a blank line between each section (all apps, Facebook quote, OG body).\n */\nexport function formatShareSectionsForMultilineDisplay(value: string): string {\n return collapseExcessiveBlankLines(\n splitShareDescriptionSections(value).join(SHARE_DESCRIPTION_SECTION_BREAK),\n );\n}\n\n/**\n * Formats multiline share copy for UIs that strip line breaks (legacy OG one-liners).\n */\nexport function formatShareSectionsForCompactDisplay(value: string): string {\n return splitShareDescriptionSections(value).join(\n SHARE_DESCRIPTION_SECTION_SEPARATOR,\n );\n}\n\n/**\n * Formats share descriptions for Open Graph / Twitter meta tags when crawlers\n * collapse line breaks.\n */\nexport function normalizeShareOgDescription(value: string): string {\n const trimmed = value.trim();\n if (!trimmed) {\n return \"\";\n }\n\n if (/\\n\\n/.test(trimmed) || trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {\n return formatShareSectionsForCompactDisplay(trimmed);\n }\n\n return trimmed.replace(/\\s+/g, \" \").trim();\n}\n\n/**\n * Quote text for Facebook ShareDialog. Body only — the link card shows the title.\n */\nexport function buildFacebookShareQuote(\n _title: string,\n description: string,\n): string | undefined {\n const body = formatShareSectionsForMultilineDisplay(description);\n return body.length > 0 ? body : undefined;\n}\n\n/**\n * Open Graph / Twitter description — multiline body without repeating `og:title`.\n */\nexport function buildShareOgDescription(\n _title: string,\n description: string,\n): string {\n const multiline = formatShareSectionsForMultilineDisplay(description);\n if (multiline) {\n return multiline;\n }\n return normalizeShareOgDescription(description);\n}\n","import type { ShareResourceType } from \"./constants\";\n\nexport function normalizeShareRouteId(id: string): string {\n try {\n return decodeURIComponent(id);\n } catch {\n return id;\n }\n}\n\nexport function buildSharePagePath(\n resourceType: ShareResourceType,\n rawId: string,\n): string {\n return `/share/${resourceType}/${encodeURIComponent(normalizeShareRouteId(rawId))}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,SAAS,oBAAoB,UAAuC;AACzE,QAAM,mBAAmB,SAAS,cAC/B,IAAI,CAAC,gBAAgB,YAAY,IAAI,EACrC,OAAO,OAAO;AAEjB,MAAI,iBAAiB,WAAW,GAAG;AACjC,WAAO,SAAS;AAAA,EAClB;AAEA,SAAO,GAAG,SAAS,IAAI,KAAK,iBAAiB,KAAK,IAAI,CAAC;AACzD;;;ACXO,IAAM,sCAAsC;AAG5C,IAAM,kCAAkC;AAExC,SAAS,6BACd,UACQ;AACR,SAAO,SACJ,OAAO,CAAC,YAA+B,QAAQ,OAAO,CAAC,EACvD,KAAK,+BAA+B;AACzC;;;ACOA,SAAS,gBAAgB,SAAyB;AAChD,MAAI;AACF,WAAO,IAAI,KAAK,eAAe,SAAS;AAAA,MACtC,KAAK;AAAA,MACL,OAAO;A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QAAQ,EAAE,KAAK;AACjD;AAKO,SAAS,uCAAuC,OAAuB;AAC5E,SAAO;AAAA,IACL,8BAA8B,KAAK,EAAE,KAAK,+BAA+B;AAAA,EAC3E;AACF;AAKO,SAAS,qCAAqC,OAAuB;AAC1E,SAAO,8BAA8B,KAAK,EAAE;AAAA,IAC1C;AAAA,EACF;AACF;AAMO,SAAS,4BAA4B,OAAuB;AACjE,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,KAAK,OAAO,KAAK,QAAQ,SAAS,mCAAmC,GAAG;AACjF,WAAO,qCAAqC,OAAO;AAAA,EACrD;AAEA,SAAO,QAAQ,QAAQ,QAAQ,GAAG,EAAE,KAAK;AAC3C;AAKO,SAAS,wBACd,QACA,aACoB;AACpB,QAAM,OAAO,uCAAuC,WAAW;AAC/D,SAAO,KAAK,SAAS,IAAI,OAAO;AAClC;AAKO,SAAS,wBACd,QACA,aACQ;AACR,QAAM,YAAY,uCAAuC,WAAW;AACpE,MAAI,WAAW;AACb,WAAO;AAAA,EACT;AACA,SAAO,4BAA4B,WAAW;AAChD;;;ACpHO,SAAS,sBAAsB,IAAoB;AACxD,MAAI;AACF,WAAO,mBAAmB,EAAE;AAAA,EAC9B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,mBACd,cACA,OACQ;AACR,SAAO,UAAU,YAAY,IAAI,mBAAmB,sBAAsB,KAAK,CAAC,CAAC;AACnF;","names":[]}
@@ -57,6 +57,7 @@ type ShareVendorInfoForApplication = {
57
57
  };
58
58
  };
59
59
 
60
+ declare function formatStallCapacityLabel(stallCapacity: number): string;
60
61
  declare function buildInvitationShareDescription(event: ShareEventForInvitation, eventInfo: ShareEventInfoForInvitation | null | undefined): string;
61
62
  declare function buildApplicationShareDescription(vendor: ShareVendorForApplication, vendorInfo: ShareVendorInfoForApplication | null | undefined): string;
62
63
 
@@ -90,33 +91,35 @@ declare function isPostShareResourceType(resourceType: ShareResourceType): resou
90
91
 
91
92
  declare function formatCategoryLabel(category: ShareVendorCategory): string;
92
93
 
93
- /** Visible separator for multi-block share text (OG, Facebook quote, crawlers collapse newlines). */
94
+ /** Visible separator for multi-block share text when line breaks are stripped (legacy OG). */
94
95
  declare const SHARE_DESCRIPTION_SECTION_SEPARATOR = " \u00B7 ";
95
- /** @deprecated Use {@link SHARE_DESCRIPTION_SECTION_SEPARATOR}. */
96
- declare const SHARE_COMPACT_SECTION_SEPARATOR = " \u00B7 ";
96
+ /** Blank line between share sections — title, address, dates, URL, etc. */
97
+ declare const SHARE_DESCRIPTION_SECTION_BREAK = "\n\n";
97
98
  declare function joinShareDescriptionSections(sections: ReadonlyArray<string | false | null | undefined>): string;
98
99
 
99
100
  /**
100
- * Formats share descriptions for Open Graph / Twitter meta tags.
101
- * Legacy `\n\n` sections are joined with {@link SHARE_DESCRIPTION_SECTION_SEPARATOR}
102
- * because Facebook and others collapse line breaks into spaces.
101
+ * Share copy with a blank line between each section (all apps, Facebook quote, OG body).
103
102
  */
104
- declare function normalizeShareOgDescription(value: string): string;
103
+ declare function formatShareSectionsForMultilineDisplay(value: string): string;
105
104
  /**
106
- * Formats multiline share copy for UIs that strip line breaks (Facebook SDK quote).
105
+ * Formats multiline share copy for UIs that strip line breaks (legacy OG one-liners).
107
106
  */
108
107
  declare function formatShareSectionsForCompactDisplay(value: string): string;
109
108
  /**
110
- * Quote text for Facebook ShareDialog avoids `\n\n` which Meta renders as a single space.
109
+ * Formats share descriptions for Open Graph / Twitter meta tags when crawlers
110
+ * collapse line breaks.
111
+ */
112
+ declare function normalizeShareOgDescription(value: string): string;
113
+ /**
114
+ * Quote text for Facebook ShareDialog. Body only — the link card shows the title.
111
115
  */
112
- declare function buildFacebookShareQuote(title: string, description: string): string | undefined;
116
+ declare function buildFacebookShareQuote(_title: string, description: string): string | undefined;
113
117
  /**
114
- * Open Graph / Twitter description — same compact section layout as
115
- * {@link buildFacebookShareQuote} so link previews match mobile Facebook share text.
118
+ * Open Graph / Twitter description — multiline body without repeating `og:title`.
116
119
  */
117
- declare function buildShareOgDescription(title: string, description: string): string;
120
+ declare function buildShareOgDescription(_title: string, description: string): string;
118
121
 
119
122
  declare function normalizeShareRouteId(id: string): string;
120
123
  declare function buildSharePagePath(resourceType: ShareResourceType, rawId: string): string;
121
124
 
122
- export { DEFAULT_SHARE_OG_IMAGE, POST_SHARE_RESOURCE_TYPES, PUBLIC_SHARE_PATH_TYPES, type PostShareResourceType, type PublicSharePathType, RELATION_SHARE_APPLICATION, RELATION_SHARE_INVITATION, RELATION_SHARE_RESOURCE_TYPES, RESOURCE_SHARE_TYPES, RESOURCE_SHARE_TYPES_FOR_URL, type RelationSharePathType, type RelationShareResourceType, type ResourceShareType, SHARE_COMPACT_SECTION_SEPARATOR, SHARE_DESCRIPTION_SECTION_SEPARATOR, SHARE_RESOURCE_LABEL, SHARE_SITE_URL, SHARE_TYPE_PATH_REGEX, type ShareEventDateTime, type ShareEventForInvitation, type ShareEventInfoForInvitation, type ShareResourceType, type ShareStallType, type ShareType, type ShareVendorCategory, type ShareVendorForApplication, type ShareVendorInfoForApplication, buildApplicationShareDescription, buildFacebookShareQuote, buildInvitationShareDescription, buildShareOgDescription, buildSharePagePath, buildShareUrl, formatCategoryLabel, formatShareSectionsForCompactDisplay, isPostShareResourceType, isRelationShareResourceType, joinShareDescriptionSections, normalizeShareOgDescription, normalizeShareRouteId };
125
+ export { DEFAULT_SHARE_OG_IMAGE, POST_SHARE_RESOURCE_TYPES, PUBLIC_SHARE_PATH_TYPES, type PostShareResourceType, type PublicSharePathType, RELATION_SHARE_APPLICATION, RELATION_SHARE_INVITATION, RELATION_SHARE_RESOURCE_TYPES, RESOURCE_SHARE_TYPES, RESOURCE_SHARE_TYPES_FOR_URL, type RelationSharePathType, type RelationShareResourceType, type ResourceShareType, SHARE_DESCRIPTION_SECTION_BREAK, SHARE_DESCRIPTION_SECTION_SEPARATOR, SHARE_RESOURCE_LABEL, SHARE_SITE_URL, SHARE_TYPE_PATH_REGEX, type ShareEventDateTime, type ShareEventForInvitation, type ShareEventInfoForInvitation, type ShareResourceType, type ShareStallType, type ShareType, type ShareVendorCategory, type ShareVendorForApplication, type ShareVendorInfoForApplication, buildApplicationShareDescription, buildFacebookShareQuote, buildInvitationShareDescription, buildShareOgDescription, buildSharePagePath, buildShareUrl, formatCategoryLabel, formatShareSectionsForCompactDisplay, formatShareSectionsForMultilineDisplay, formatStallCapacityLabel, isPostShareResourceType, isRelationShareResourceType, joinShareDescriptionSections, normalizeShareOgDescription, normalizeShareRouteId };
@@ -57,6 +57,7 @@ type ShareVendorInfoForApplication = {
57
57
  };
58
58
  };
59
59
 
60
+ declare function formatStallCapacityLabel(stallCapacity: number): string;
60
61
  declare function buildInvitationShareDescription(event: ShareEventForInvitation, eventInfo: ShareEventInfoForInvitation | null | undefined): string;
61
62
  declare function buildApplicationShareDescription(vendor: ShareVendorForApplication, vendorInfo: ShareVendorInfoForApplication | null | undefined): string;
62
63
 
@@ -90,33 +91,35 @@ declare function isPostShareResourceType(resourceType: ShareResourceType): resou
90
91
 
91
92
  declare function formatCategoryLabel(category: ShareVendorCategory): string;
92
93
 
93
- /** Visible separator for multi-block share text (OG, Facebook quote, crawlers collapse newlines). */
94
+ /** Visible separator for multi-block share text when line breaks are stripped (legacy OG). */
94
95
  declare const SHARE_DESCRIPTION_SECTION_SEPARATOR = " \u00B7 ";
95
- /** @deprecated Use {@link SHARE_DESCRIPTION_SECTION_SEPARATOR}. */
96
- declare const SHARE_COMPACT_SECTION_SEPARATOR = " \u00B7 ";
96
+ /** Blank line between share sections — title, address, dates, URL, etc. */
97
+ declare const SHARE_DESCRIPTION_SECTION_BREAK = "\n\n";
97
98
  declare function joinShareDescriptionSections(sections: ReadonlyArray<string | false | null | undefined>): string;
98
99
 
99
100
  /**
100
- * Formats share descriptions for Open Graph / Twitter meta tags.
101
- * Legacy `\n\n` sections are joined with {@link SHARE_DESCRIPTION_SECTION_SEPARATOR}
102
- * because Facebook and others collapse line breaks into spaces.
101
+ * Share copy with a blank line between each section (all apps, Facebook quote, OG body).
103
102
  */
104
- declare function normalizeShareOgDescription(value: string): string;
103
+ declare function formatShareSectionsForMultilineDisplay(value: string): string;
105
104
  /**
106
- * Formats multiline share copy for UIs that strip line breaks (Facebook SDK quote).
105
+ * Formats multiline share copy for UIs that strip line breaks (legacy OG one-liners).
107
106
  */
108
107
  declare function formatShareSectionsForCompactDisplay(value: string): string;
109
108
  /**
110
- * Quote text for Facebook ShareDialog avoids `\n\n` which Meta renders as a single space.
109
+ * Formats share descriptions for Open Graph / Twitter meta tags when crawlers
110
+ * collapse line breaks.
111
+ */
112
+ declare function normalizeShareOgDescription(value: string): string;
113
+ /**
114
+ * Quote text for Facebook ShareDialog. Body only — the link card shows the title.
111
115
  */
112
- declare function buildFacebookShareQuote(title: string, description: string): string | undefined;
116
+ declare function buildFacebookShareQuote(_title: string, description: string): string | undefined;
113
117
  /**
114
- * Open Graph / Twitter description — same compact section layout as
115
- * {@link buildFacebookShareQuote} so link previews match mobile Facebook share text.
118
+ * Open Graph / Twitter description — multiline body without repeating `og:title`.
116
119
  */
117
- declare function buildShareOgDescription(title: string, description: string): string;
120
+ declare function buildShareOgDescription(_title: string, description: string): string;
118
121
 
119
122
  declare function normalizeShareRouteId(id: string): string;
120
123
  declare function buildSharePagePath(resourceType: ShareResourceType, rawId: string): string;
121
124
 
122
- export { DEFAULT_SHARE_OG_IMAGE, POST_SHARE_RESOURCE_TYPES, PUBLIC_SHARE_PATH_TYPES, type PostShareResourceType, type PublicSharePathType, RELATION_SHARE_APPLICATION, RELATION_SHARE_INVITATION, RELATION_SHARE_RESOURCE_TYPES, RESOURCE_SHARE_TYPES, RESOURCE_SHARE_TYPES_FOR_URL, type RelationSharePathType, type RelationShareResourceType, type ResourceShareType, SHARE_COMPACT_SECTION_SEPARATOR, SHARE_DESCRIPTION_SECTION_SEPARATOR, SHARE_RESOURCE_LABEL, SHARE_SITE_URL, SHARE_TYPE_PATH_REGEX, type ShareEventDateTime, type ShareEventForInvitation, type ShareEventInfoForInvitation, type ShareResourceType, type ShareStallType, type ShareType, type ShareVendorCategory, type ShareVendorForApplication, type ShareVendorInfoForApplication, buildApplicationShareDescription, buildFacebookShareQuote, buildInvitationShareDescription, buildShareOgDescription, buildSharePagePath, buildShareUrl, formatCategoryLabel, formatShareSectionsForCompactDisplay, isPostShareResourceType, isRelationShareResourceType, joinShareDescriptionSections, normalizeShareOgDescription, normalizeShareRouteId };
125
+ export { DEFAULT_SHARE_OG_IMAGE, POST_SHARE_RESOURCE_TYPES, PUBLIC_SHARE_PATH_TYPES, type PostShareResourceType, type PublicSharePathType, RELATION_SHARE_APPLICATION, RELATION_SHARE_INVITATION, RELATION_SHARE_RESOURCE_TYPES, RESOURCE_SHARE_TYPES, RESOURCE_SHARE_TYPES_FOR_URL, type RelationSharePathType, type RelationShareResourceType, type ResourceShareType, SHARE_DESCRIPTION_SECTION_BREAK, SHARE_DESCRIPTION_SECTION_SEPARATOR, SHARE_RESOURCE_LABEL, SHARE_SITE_URL, SHARE_TYPE_PATH_REGEX, type ShareEventDateTime, type ShareEventForInvitation, type ShareEventInfoForInvitation, type ShareResourceType, type ShareStallType, type ShareType, type ShareVendorCategory, type ShareVendorForApplication, type ShareVendorInfoForApplication, buildApplicationShareDescription, buildFacebookShareQuote, buildInvitationShareDescription, buildShareOgDescription, buildSharePagePath, buildShareUrl, formatCategoryLabel, formatShareSectionsForCompactDisplay, formatShareSectionsForMultilineDisplay, formatStallCapacityLabel, isPostShareResourceType, isRelationShareResourceType, joinShareDescriptionSections, normalizeShareOgDescription, normalizeShareRouteId };
@@ -7,7 +7,7 @@ import {
7
7
  RELATION_SHARE_RESOURCE_TYPES,
8
8
  RESOURCE_SHARE_TYPES,
9
9
  RESOURCE_SHARE_TYPES_FOR_URL,
10
- SHARE_COMPACT_SECTION_SEPARATOR,
10
+ SHARE_DESCRIPTION_SECTION_BREAK,
11
11
  SHARE_DESCRIPTION_SECTION_SEPARATOR,
12
12
  SHARE_RESOURCE_LABEL,
13
13
  SHARE_SITE_URL,
@@ -20,12 +20,14 @@ import {
20
20
  buildShareUrl,
21
21
  formatCategoryLabel,
22
22
  formatShareSectionsForCompactDisplay,
23
+ formatShareSectionsForMultilineDisplay,
24
+ formatStallCapacityLabel,
23
25
  isPostShareResourceType,
24
26
  isRelationShareResourceType,
25
27
  joinShareDescriptionSections,
26
28
  normalizeShareOgDescription,
27
29
  normalizeShareRouteId
28
- } from "../chunk-EHSQWIQV.mjs";
30
+ } from "../chunk-5TWV6IFM.mjs";
29
31
  export {
30
32
  DEFAULT_SHARE_OG_IMAGE,
31
33
  POST_SHARE_RESOURCE_TYPES,
@@ -35,7 +37,7 @@ export {
35
37
  RELATION_SHARE_RESOURCE_TYPES,
36
38
  RESOURCE_SHARE_TYPES,
37
39
  RESOURCE_SHARE_TYPES_FOR_URL,
38
- SHARE_COMPACT_SECTION_SEPARATOR,
40
+ SHARE_DESCRIPTION_SECTION_BREAK,
39
41
  SHARE_DESCRIPTION_SECTION_SEPARATOR,
40
42
  SHARE_RESOURCE_LABEL,
41
43
  SHARE_SITE_URL,
@@ -48,6 +50,8 @@ export {
48
50
  buildShareUrl,
49
51
  formatCategoryLabel,
50
52
  formatShareSectionsForCompactDisplay,
53
+ formatShareSectionsForMultilineDisplay,
54
+ formatStallCapacityLabel,
51
55
  isPostShareResourceType,
52
56
  isRelationShareResourceType,
53
57
  joinShareDescriptionSections,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timardex/cluemart-shared",
3
- "version": "1.5.591",
3
+ "version": "1.5.596",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/sharing/formatCategoryLabel.ts","../src/sharing/joinShareDescriptionSections.ts","../src/sharing/buildRelationShareDescription.ts","../src/sharing/relationShareTypes.ts","../src/sharing/constants.ts","../src/sharing/buildShareUrl.ts","../src/sharing/normalizeShareDescription.ts","../src/sharing/normalizeShareRouteId.ts"],"sourcesContent":["import type { ShareVendorCategory } from \"./shareRelationTypes\";\n\nexport function formatCategoryLabel(category: ShareVendorCategory): string {\n const subcategoryNames = category.subcategories\n .map((subcategory) => subcategory.name)\n .filter(Boolean);\n\n if (subcategoryNames.length === 0) {\n return category.name;\n }\n\n return `${category.name} (${subcategoryNames.join(\", \")})`;\n}\n","/** Visible separator for multi-block share text (OG, Facebook quote, crawlers collapse newlines). */\nexport const SHARE_DESCRIPTION_SECTION_SEPARATOR = \" · \";\n\n/** @deprecated Use {@link SHARE_DESCRIPTION_SECTION_SEPARATOR}. */\nexport const SHARE_COMPACT_SECTION_SEPARATOR =\n SHARE_DESCRIPTION_SECTION_SEPARATOR;\n\nexport function joinShareDescriptionSections(\n sections: ReadonlyArray<string | false | null | undefined>,\n): string {\n return sections\n .filter((section): section is string => Boolean(section))\n .join(SHARE_DESCRIPTION_SECTION_SEPARATOR);\n}\n","import { formatCategoryLabel } from \"./formatCategoryLabel\";\nimport { joinShareDescriptionSections } from \"./joinShareDescriptionSections\";\nimport type {\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareVendorForApplication,\n ShareVendorInfoForApplication,\n} from \"./shareRelationTypes\";\n\nexport type {\n ShareEventDateTime,\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareStallType,\n ShareVendorCategory,\n ShareVendorForApplication,\n ShareVendorInfoForApplication,\n} from \"./shareRelationTypes\";\n\nfunction formatShareDate(isoDate: string): string {\n try {\n return new Intl.DateTimeFormat(\"en-NZ\", {\n day: \"numeric\",\n month: \"short\",\n year: \"numeric\",\n }).format(new Date(isoDate));\n } catch {\n return isoDate;\n }\n}\n\nexport function buildInvitationShareDescription(\n event: ShareEventForInvitation,\n eventInfo: ShareEventInfoForInvitation | null | undefined,\n): string {\n const stallTypes =\n eventInfo?.dateTime?.flatMap((date) => date.stallTypes) ?? [];\n\n if (!eventInfo || stallTypes.length === 0) {\n return event.description?.trim() || \"\";\n }\n\n const requirementLabels = (eventInfo.requirements ?? [])\n .filter((item) => item.value)\n .map((item) => item.label);\n\n const sections = [\n event.location.fullAddress,\n ...event.dateTime.map((date) => {\n const start = formatShareDate(date.startDate);\n const end = date.endDate ? ` – ${formatShareDate(date.endDate)}` : \"\";\n return `Market date: ${start}${end}`;\n }),\n `Application deadline: vendors must apply at least ${eventInfo.applicationDeadlineHours} hours before each market date.`,\n ...stallTypes.map(\n (stall) =>\n `Stall: ${stall.label} — $${stall.price} (${stall.stallCapacity} spaces)`,\n ),\n requirementLabels.length > 0 &&\n `Requirements: ${requirementLabels.join(\", \")}`,\n ];\n\n return joinShareDescriptionSections(sections);\n}\n\nexport function buildApplicationShareDescription(\n vendor: ShareVendorForApplication,\n vendorInfo: ShareVendorInfoForApplication | null | undefined,\n): string {\n const categoryLabels = vendor.categories.map((category) =>\n formatCategoryLabel(category),\n );\n\n if (!vendorInfo) {\n return vendor.description?.trim() || \"\";\n }\n\n const compliance = vendorInfo.compliance;\n const complianceLabels = [\n compliance?.liabilityInsurance && \"Liability insurance\",\n compliance?.foodBeverageLicense && \"Food & beverage licence\",\n ].filter(Boolean);\n\n const profileDescription = vendor.description?.trim();\n\n const sections = [\n categoryLabels.length > 0 && `Categories: ${categoryLabels.join(\", \")}`,\n `Stall size: ${vendorInfo.stallInfo.size.width}m × ${vendorInfo.stallInfo.size.depth}m`,\n `Compliance: ${complianceLabels.length > 0 ? complianceLabels.join(\", \") : \"Not specified\"}`,\n `Price range: $${vendorInfo.product.priceRange.min} – $${vendorInfo.product.priceRange.max}`,\n profileDescription,\n ];\n\n return joinShareDescriptionSections(sections);\n}\n","/** Path segments for relation share URLs — must match mobile `RelationTitle` values. */\nexport const RELATION_SHARE_INVITATION = \"invitation\" as const;\nexport const RELATION_SHARE_APPLICATION = \"application\" as const;\n\nexport const RELATION_SHARE_RESOURCE_TYPES = [\n RELATION_SHARE_INVITATION,\n RELATION_SHARE_APPLICATION,\n] as const;\n\nexport type RelationShareResourceType =\n (typeof RELATION_SHARE_RESOURCE_TYPES)[number];\n\nexport function isRelationShareResourceType(\n resourceType: string,\n): resourceType is RelationShareResourceType {\n return (RELATION_SHARE_RESOURCE_TYPES as readonly string[]).includes(\n resourceType,\n );\n}\n","import {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n type RelationShareResourceType,\n} from \"./relationShareTypes\";\n\nexport {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n RELATION_SHARE_RESOURCE_TYPES,\n isRelationShareResourceType,\n type RelationShareResourceType,\n} from \"./relationShareTypes\";\n\nexport const SHARE_SITE_URL = \"https://cluemart.co.nz\";\n\nexport const DEFAULT_SHARE_OG_IMAGE = `${SHARE_SITE_URL}/assets/logo.webp`;\n\nexport const RESOURCE_SHARE_TYPES = [\n \"market\",\n \"stallholder\",\n \"partner\",\n] as const;\n\nexport type ResourceShareType = (typeof RESOURCE_SHARE_TYPES)[number];\n\nexport const POST_SHARE_RESOURCE_TYPES = [\n \"daily_meets\",\n \"daily_tips\",\n \"daily_games\",\n] as const;\n\nexport type PostShareResourceType = (typeof POST_SHARE_RESOURCE_TYPES)[number];\n\nexport type ShareResourceType =\n | ResourceShareType\n | PostShareResourceType\n | RelationShareResourceType;\n\nexport const SHARE_RESOURCE_LABEL: Record<ShareResourceType, string> = {\n [RELATION_SHARE_APPLICATION]: \"Application\",\n [RELATION_SHARE_INVITATION]: \"Invitation\",\n daily_games: \"Daily Game\",\n daily_meets: \"Daily Meet\",\n daily_tips: \"Daily Tip\",\n market: \"Market\",\n partner: \"Partner\",\n stallholder: \"Stallholder\",\n};\n\nexport function isPostShareResourceType(\n resourceType: ShareResourceType,\n): resourceType is PostShareResourceType {\n return (POST_SHARE_RESOURCE_TYPES as readonly string[]).includes(\n resourceType,\n );\n}\n","import {\n POST_SHARE_RESOURCE_TYPES,\n RESOURCE_SHARE_TYPES,\n SHARE_SITE_URL,\n} from \"./constants\";\nimport {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n} from \"./relationShareTypes\";\n\n/** Path segments for public resource share URLs (markets, posts, etc.). */\nexport const PUBLIC_SHARE_PATH_TYPES = [\n ...RESOURCE_SHARE_TYPES,\n ...POST_SHARE_RESOURCE_TYPES,\n] as const;\n\nexport type PublicSharePathType = (typeof PUBLIC_SHARE_PATH_TYPES)[number];\n\n/** @deprecated Use {@link PUBLIC_SHARE_PATH_TYPES} — kept for mobile deep-link helpers. */\nexport const RESOURCE_SHARE_TYPES_FOR_URL = PUBLIC_SHARE_PATH_TYPES;\n\nexport type RelationSharePathType =\n | typeof RELATION_SHARE_INVITATION\n | typeof RELATION_SHARE_APPLICATION;\n\nexport type ShareType = PublicSharePathType | RelationSharePathType;\n\n/** Alternation for deep-link regexes — keep in sync with {@link ShareType}. */\nexport const SHARE_TYPE_PATH_REGEX = [\n ...PUBLIC_SHARE_PATH_TYPES,\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n].join(\"|\");\n\nexport function buildShareUrl(type: ShareType, id: string): string {\n return `${SHARE_SITE_URL}/share/${type}/${encodeURIComponent(id)}`;\n}\n","import { SHARE_DESCRIPTION_SECTION_SEPARATOR } from \"./joinShareDescriptionSections\";\n\n/** Trims a share section and collapses spaces per line; preserves line breaks. */\nfunction normalizeShareSection(value: string | null | undefined): string {\n if (value == null) {\n return \"\";\n }\n return value\n .trim()\n .split(\"\\n\")\n .map((line) => line.trim().replace(/[ \\t]+/g, \" \"))\n .join(\"\\n\")\n .replace(/\\n{3,}/g, \"\\n\\n\");\n}\n\n/**\n * Formats share descriptions for Open Graph / Twitter meta tags.\n * Legacy `\\n\\n` sections are joined with {@link SHARE_DESCRIPTION_SECTION_SEPARATOR}\n * because Facebook and others collapse line breaks into spaces.\n */\nexport function normalizeShareOgDescription(value: string): string {\n const trimmed = value.trim();\n if (!trimmed) {\n return \"\";\n }\n\n if (/\\n\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n\\n+/)\n .map((section) => section.replace(/\\s+/g, \" \").trim())\n .filter(Boolean)\n .join(SHARE_DESCRIPTION_SECTION_SEPARATOR);\n }\n\n return trimmed.replace(/\\s+/g, \" \").trim();\n}\n\n/**\n * Formats multiline share copy for UIs that strip line breaks (Facebook SDK quote).\n */\nexport function formatShareSectionsForCompactDisplay(value: string): string {\n const trimmed = value.trim();\n if (!trimmed) {\n return \"\";\n }\n\n if (trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {\n return normalizeShareSection(trimmed);\n }\n\n if (/\\n\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n\\n+/)\n .map((section) => normalizeShareSection(section))\n .filter((section) => section.length > 0)\n .join(SHARE_DESCRIPTION_SECTION_SEPARATOR);\n }\n\n if (/\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n+/)\n .map((section) => normalizeShareSection(section))\n .filter((section) => section.length > 0)\n .join(SHARE_DESCRIPTION_SECTION_SEPARATOR);\n }\n\n return normalizeShareSection(trimmed);\n}\n\n/**\n * Quote text for Facebook ShareDialog — avoids `\\n\\n` which Meta renders as a single space.\n */\nexport function buildFacebookShareQuote(\n title: string,\n description: string,\n): string | undefined {\n const titlePart = normalizeShareSection(title);\n const descriptionPart = normalizeShareSection(description);\n const bodyPart = descriptionPart\n ? formatShareSectionsForCompactDisplay(descriptionPart)\n : \"\";\n\n const parts = [titlePart, bodyPart].filter((part) => part.length > 0);\n return parts.length > 0\n ? parts.join(SHARE_DESCRIPTION_SECTION_SEPARATOR)\n : undefined;\n}\n\n/**\n * Open Graph / Twitter description — same compact section layout as\n * {@link buildFacebookShareQuote} so link previews match mobile Facebook share text.\n */\nexport function buildShareOgDescription(\n title: string,\n description: string,\n): string {\n const quote = buildFacebookShareQuote(title, description);\n if (quote) {\n return quote;\n }\n return normalizeShareOgDescription(description);\n}\n","import type { ShareResourceType } from \"./constants\";\n\nexport function normalizeShareRouteId(id: string): string {\n try {\n return decodeURIComponent(id);\n } catch {\n return id;\n }\n}\n\nexport function buildSharePagePath(\n resourceType: ShareResourceType,\n rawId: string,\n): string {\n return `/share/${resourceType}/${encodeURIComponent(normalizeShareRouteId(rawId))}`;\n}\n"],"mappings":";AAEO,SAAS,oBAAoB,UAAuC;AACzE,QAAM,mBAAmB,SAAS,cAC/B,IAAI,CAAC,gBAAgB,YAAY,IAAI,EACrC,OAAO,OAAO;AAEjB,MAAI,iBAAiB,WAAW,GAAG;AACjC,WAAO,SAAS;AAAA,EAClB;AAEA,SAAO,GAAG,SAAS,IAAI,KAAK,iBAAiB,KAAK,IAAI,CAAC;AACzD;;;ACXO,IAAM,sCAAsC;AAG5C,IAAM,kCACX;AAEK,SAAS,6BACd,UACQ;AACR,SAAO,SACJ,OAAO,CAAC,YAA+B,QAAQ,OAAO,CAAC,EACvD,KAAK,mCAAmC;AAC7C;;;ACMA,SAAS,gBAAgB,SAAyB;AAChD,MAAI;AACF,WAAO,IAAI,KAAK,eAAe,SAAS;AAAA,MACtC,KAAK;AAAA,MACL,OAAO;AAAA,MACP,MAAM;AAAA,IACR,CAAC,EAAE,OAAO,IAAI,KAAK,OAAO,CAAC;AAAA,EAC7B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,gCACd,OACA,WACQ;AACR,QAAM,aACJ,WAAW,UAAU,QAAQ,CAAC,SAAS,KAAK,UAAU,KAAK,CAAC;AAE9D,MAAI,CAAC,aAAa,WAAW,WAAW,GAAG;AACzC,WAAO,MAAM,aAAa,KAAK,KAAK;AAAA,EACtC;AAEA,QAAM,qBAAqB,UAAU,gBAAgB,CAAC,GACnD,OAAO,CAAC,SAAS,KAAK,KAAK,EAC3B,IAAI,CAAC,SAAS,KAAK,KAAK;AAE3B,QAAM,WAAW;AAAA,IACf,MAAM,SAAS;AAAA,IACf,GAAG,MAAM,SAAS,IAAI,CAAC,SAAS;AAC9B,YAAM,QAAQ,gBAAgB,KAAK,SAAS;AAC5C,YAAM,MAAM,KAAK,UA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