function facetAwareSegment(text, length, facets)

Segment a string into substrings of a given grapheme length, without breaking facets.

Parameters

text: string

The string to segment.

length: number

The maximum grapheme length of each segment.

facets: AppBskyRichtextFacet.Main[]

The facets to avoid breaking.

Returns

{ facets: AppBskyRichtextFacet.AppBskyRichtextFacet.Main[]; text: string; }[]

An array of substrings and their associated facets.