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: "@atcute/client/lexicons".AppBskyRichtextFacet.Main[]

The facets to avoid breaking.

Returns

{ facets: "@atcute/client/lexicons".AppBskyRichtextFacet.Main[]; text: string; }[]

An array of substrings and their associated facets.