@fern-api/fdr-sdk 1.2.62-4bbcb763ed → 1.2.63-e20fc4549e

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.
@@ -5778,6 +5778,46 @@ var ManifestSegmentSchema = z33.object({
5778
5778
  variant: SegmentDetailSchema.nullable(),
5779
5779
  tab: SegmentDetailSchema.nullable()
5780
5780
  });
5781
+ function detailSlug(metadata) {
5782
+ if (metadata == null || typeof metadata !== "object" || !("slug" in metadata)) {
5783
+ return void 0;
5784
+ }
5785
+ const slug = metadata.slug;
5786
+ return typeof slug === "string" ? slug : void 0;
5787
+ }
5788
+ function detailIdentity(dimension, detail) {
5789
+ if (detail == null) {
5790
+ return `${dimension}:none`;
5791
+ }
5792
+ const slug = detailSlug(detail.metadata);
5793
+ if (slug != null && slug !== "") {
5794
+ return `${dimension}:slug:${slug}`;
5795
+ }
5796
+ return detail.sortOrder != null ? `${dimension}:sort-order:${detail.sortOrder}` : `${dimension}:id:${detail.id ?? ""}`;
5797
+ }
5798
+ function ledgerSegmentIdentity(segment) {
5799
+ return [
5800
+ segment.section,
5801
+ segment.sortOrder,
5802
+ detailIdentity("product", segment.product),
5803
+ detailIdentity("version", segment.version),
5804
+ detailIdentity("variant", segment.variant),
5805
+ detailIdentity("tab", segment.tab)
5806
+ ].join("|");
5807
+ }
5808
+ function selectLedgerSegmentsForLocale(segments, locale, defaultLocale) {
5809
+ const byIdentity = /* @__PURE__ */ new Map();
5810
+ for (const segment of segments) {
5811
+ const identity = ledgerSegmentIdentity(segment);
5812
+ const existing = byIdentity.get(identity);
5813
+ const prefersRequestedLocale = segment.locale === locale && existing?.locale !== locale;
5814
+ const prefersDefaultLocale = segment.locale === defaultLocale && existing?.locale !== locale && existing?.locale !== defaultLocale;
5815
+ if (existing == null || prefersRequestedLocale || prefersDefaultLocale) {
5816
+ byIdentity.set(identity, segment);
5817
+ }
5818
+ }
5819
+ return [...byIdentity.values()];
5820
+ }
5781
5821
  var ManifestNavRouteSchema = LedgerNavRouteSchema;
5782
5822
  var ManifestRouteBaseSchema = z33.object({
5783
5823
  segmentHash: z33.string(),
@@ -6679,10 +6719,12 @@ export {
6679
6719
  getGraphqlOperationIds,
6680
6720
  gitContract,
6681
6721
  isFernFileRef,
6722
+ ledgerSegmentIdentity,
6682
6723
  libraryDocsContract,
6683
6724
  organizationContract,
6684
6725
  pdfExportContract,
6685
6726
  sdksContract,
6727
+ selectLedgerSegmentsForLocale,
6686
6728
  slugsContract,
6687
6729
  snippetsContract,
6688
6730
  snippetsFactoryContract,