joyful 1.1.3 → 1.3.0

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.
package/README.md CHANGED
@@ -1,45 +1,222 @@
1
1
  # joyful
2
2
 
3
- Generate delightful, random word combinations for your app — perfect for project names, usernames, or unique identifiers.
3
+ Generate friendly, safe-for-work word combinations for project names, usernames, labels, demo data, and unique-looking identifiers.
4
4
 
5
- ## Installation
5
+ <div>
6
+ <img src="https://img.shields.io/npm/dy/joyful" alt="" />
7
+ <img src="https://img.shields.io/npm/v/joyful" alt="" />
8
+ <img src="https://img.shields.io/github/license/KayleeWilliams/joyful" alt="" />
9
+ </div>
10
+
11
+ ## Quick Start
6
12
 
7
13
  ```bash
8
- pnpm add joyful
14
+ bun add joyful
9
15
  ```
10
16
 
11
- ## Usage
12
-
13
17
  ```ts
14
18
  import { joyful } from "joyful";
15
19
 
16
20
  joyful(); // "amber-fox"
17
21
  joyful({ segments: 3 }); // "golden-marble-cathedral"
18
- joyful({ segments: 3, separator: "_" }); // "swift_northern_lights"
22
+ joyful({ separator: "_" }); // "swift_otter"
23
+ joyful({ omit: ["fox"] }); // excludes "fox" from generated names
24
+ ```
25
+
26
+ You can also use the CLI:
27
+
28
+ ```bash
29
+ joyful
30
+ joyful --segments 3
31
+ joyful --pattern color,nature,animal
32
+ joyful --omit fox,wolf
33
+ ```
34
+
35
+ ## Generate Names
36
+
37
+ By default, `joyful()` returns two lowercase words joined with `-`. The first word is a friendly prefix, either an adjective or a color. Later words come from the broader word lists.
38
+
39
+ ```ts
40
+ import { joyful } from "joyful";
41
+
42
+ joyful(); // "bright-dolphin"
43
+ joyful({ segments: 4 }); // "kind-river-cello-baker"
44
+ joyful({ separator: "_" }); // "golden_panda"
19
45
  joyful({ maxLength: 8 }); // "tan-elk"
20
46
  ```
21
47
 
48
+ `maxLength` filters word choices so the final string fits within the requested limit. If the limit is too short to produce a valid name, `joyful()` throws.
49
+
50
+ ## Pattern-Based Names
51
+
52
+ Use `pattern` when you want each word to come from a specific category.
53
+
54
+ ```ts
55
+ joyful({ pattern: ["adjective", "animal"] }); // "happy-dolphin"
56
+ joyful({ pattern: ["color", "nature", "animal"] }); // "amber-river-otter"
57
+ joyful({ pattern: ["city", "nature", "space"] }); // "kyoto-river-orbit"
58
+ ```
59
+
60
+ Pattern rules:
61
+
62
+ - Category names are singular, such as `animal`, `color`, `city`, and `nature`.
63
+ - The pattern length controls the number of words.
64
+ - `pattern` takes precedence over `segments`.
65
+ - `separator` and `maxLength` still apply to generated names.
66
+ - Unknown categories throw an error with the supported category names.
67
+
68
+ ## Custom Word Lists
69
+
70
+ Use `wordLists` to add named word pools that can be selected by `pattern`.
71
+ Use `omit` to exclude exact words from both built-in and custom lists.
72
+
73
+ ```ts
74
+ joyful({
75
+ pattern: ["fruit", "texture"],
76
+ wordLists: {
77
+ fruit: ["apple", "pear"],
78
+ texture: ["linen", "silk"],
79
+ },
80
+ }); // "pear-linen"
81
+
82
+ joyful({
83
+ omit: ["pear", "silk"],
84
+ pattern: ["fruit", "texture"],
85
+ wordLists: {
86
+ fruit: ["apple", "pear"],
87
+ texture: ["linen", "silk"],
88
+ },
89
+ }); // "apple-linen"
90
+ ```
91
+
92
+ Custom category names are additive. If a custom list uses a built-in category
93
+ name, such as `animal`, it replaces that built-in category for the current call.
94
+
95
+ ## CLI
96
+
97
+ The CLI supports the same core generation options:
98
+
99
+ ```bash
100
+ joyful
101
+ joyful --segments 3
102
+ joyful --separator _
103
+ joyful --max-length 12
104
+ joyful --pattern adjective,animal
105
+ joyful --pattern city,nature,space --separator _
106
+ joyful --word-list fruit=apple,pear --word-list texture=linen,silk --pattern fruit,texture
107
+ joyful --omit fox,wolf
108
+ ```
109
+
110
+ Short flags are available for common generation options:
111
+
112
+ ```bash
113
+ joyful -s 3
114
+ joyful -p _
115
+ joyful -m 12
116
+ joyful -t color,nature,animal
117
+ ```
118
+
119
+ ## Count Permutations
120
+
121
+ Use `permutations()` to count possible unbounded combinations without generating a name.
122
+
123
+ ```ts
124
+ import { permutations } from "joyful";
125
+
126
+ permutations(); // 997425
127
+ permutations({ segments: 3 }); // 2916470700
128
+ permutations({ pattern: ["adjective", "animal"] }); // 46081
129
+ permutations({ pattern: ["color", "nature", "animal"] }); // 4674684
130
+ permutations({
131
+ omit: ["pear"],
132
+ pattern: ["fruit", "texture"],
133
+ wordLists: {
134
+ fruit: ["apple", "pear"],
135
+ texture: ["linen", "silk"],
136
+ },
137
+ }); // 2
138
+ ```
139
+
140
+ The CLI can print the same counts:
141
+
142
+ ```bash
143
+ joyful --permutations
144
+ joyful --permutations --segments 3
145
+ joyful --permutations --pattern color,nature,animal
146
+ joyful --permutations --word-list fruit=apple,pear --pattern fruit,animal
147
+ ```
148
+
149
+ For automation, add `--json`:
150
+
151
+ ```bash
152
+ joyful --permutations --pattern color,nature,animal --json
153
+ ```
154
+
155
+ ```json
156
+ {
157
+ "pattern": ["color", "nature", "animal"],
158
+ "permutations": 4674684
159
+ }
160
+ ```
161
+
162
+ Permutation counts include only unique names that can be generated without repeated words. They do not account for `maxLength`, because bounded generation depends on word lengths and fitting constraints.
163
+
22
164
  ## API
23
165
 
24
166
  ### `joyful(options?)`
25
167
 
26
- | Option | Type | Default | Description |
27
- | ----------- | -------- | ------- | ------------------------------------- |
28
- | `segments` | `number` | `2` | Number of words to generate |
29
- | `separator` | `string` | `"-"` | Character(s) between words |
30
- | `maxLength` | `number` | — | Maximum length of the returned string |
168
+ Returns a generated name as a `string`.
31
169
 
32
- Returns a `string` of random words joined by the separator.
170
+ | Option | Type | Default | Description |
171
+ | ----------- | --------------------------------------- | ------- | ------------------------------------- |
172
+ | `segments` | `number` | `2` | Number of words to generate |
173
+ | `pattern` | `JoyfulCategory[]` or custom `string[]` | none | Category pattern for each word |
174
+ | `wordLists` | `Record<string, readonly string[]>` | none | Custom named word lists |
175
+ | `omit` | `readonly string[]` | none | Exact words to exclude |
176
+ | `separator` | `string` | `"-"` | Character(s) between words |
177
+ | `maxLength` | `number` | none | Maximum length of the returned string |
33
178
 
34
- When `maxLength` is set, words are filtered to fit within the constraint. Throws if the limit is too short to produce a valid result.
179
+ ### `permutations(options?)`
35
180
 
36
- ## SFW Guarantee
181
+ Returns the number of possible unbounded combinations as a `number`.
37
182
 
38
- All word lists are manually curated to be safe for work and family-friendly. Every category has been audited to exclude profanity, slurs, and negative or distressing terms. You can use joyful-generated names in any context without worry.
183
+ | Option | Type | Default | Description |
184
+ | ----------- | --------------------------------------- | ------- | ------------------------------ |
185
+ | `segments` | `number` | `2` | Number of words to count |
186
+ | `pattern` | `JoyfulCategory[]` or custom `string[]` | none | Category pattern for each word |
187
+ | `wordLists` | `Record<string, readonly string[]>` | none | Custom named word lists |
188
+ | `omit` | `readonly string[]` | none | Exact words to exclude |
189
+
190
+ ### `JoyfulCategory`
39
191
 
40
- ## Word Categories
192
+ Supported pattern categories:
41
193
 
42
- The first word is always a prefix (adjective or color). Subsequent words are drawn from:
194
+ ```ts
195
+ type JoyfulCategory =
196
+ | "adjective"
197
+ | "animal"
198
+ | "architecture"
199
+ | "art"
200
+ | "city"
201
+ | "color"
202
+ | "emotion"
203
+ | "fashion"
204
+ | "food"
205
+ | "history"
206
+ | "literature"
207
+ | "music"
208
+ | "mythology"
209
+ | "nature"
210
+ | "profession"
211
+ | "science"
212
+ | "space"
213
+ | "sport"
214
+ | "transportation";
215
+ ```
216
+
217
+ ## Word Lists
218
+
219
+ All words are lowercase, single-token, safe-for-work terms.
43
220
 
44
221
  | Category | Words |
45
222
  | -------------- | ----- |
@@ -47,6 +224,7 @@ The first word is always a prefix (adjective or color). Subsequent words are dra
47
224
  | Animals | 203 |
48
225
  | Architecture | 184 |
49
226
  | Art | 186 |
227
+ | Cities | 73 |
50
228
  | Colors | 114 |
51
229
  | Emotions | 89 |
52
230
  | Fashion | 169 |
@@ -62,19 +240,43 @@ The first word is always a prefix (adjective or color). Subsequent words are dra
62
240
  | Sports | 154 |
63
241
  | Transportation | 183 |
64
242
 
65
- ## Permutations
243
+ ## Default Permutations
244
+
245
+ Default generation starts with an adjective or color, then draws each later word from the non-prefix lists.
66
246
 
67
247
  | Segments | Combinations |
68
248
  | -------- | ---------------------- |
69
- | 2 | 673,282 |
70
- | 3 | 1,996,954,412 |
71
- | 4 | 5,922,966,785,992 |
72
- | 5 | 17,567,519,487,252,272 |
249
+ | 2 | 997,425 |
250
+ | 3 | 2,916,470,700 |
251
+ | 4 | 8,524,843,856,100 |
252
+ | 5 | 24,909,593,747,524,200 |
253
+
254
+ ## Errors And Constraints
255
+
256
+ - `segments` must be at least `2`.
257
+ - `separator` cannot be an empty string.
258
+ - `maxLength` must be a positive integer when provided.
259
+ - Unknown pattern categories throw an error.
260
+ - Custom word list names cannot be empty.
261
+ - CLI `--json` is only supported with `--permutations`.
262
+ - CLI `--permutations` does not support `--max-length`.
263
+
264
+ ## SFW Guarantee
265
+
266
+ All word lists are manually curated to be safe for work and family-friendly. Every category has been audited to exclude profanity, slurs, and negative or distressing terms. You can use joyful-generated names in any context without worry.
267
+
268
+ ## Benchmarks
269
+
270
+ Run `bun run perf` to generate the runtime, startup, package size, and consumer
271
+ bundle size report. See [BENCHMARKS.md](./BENCHMARKS.md) for what the report
272
+ measures and how to interpret it.
73
273
 
74
274
  ## Credits
75
275
 
276
+ Originally created by [Hayden Bleasel](https://github.com/haydenbleasel).
277
+
76
278
  Based on [friendly-words](https://github.com/glitchdotcom/friendly-words) by Glitch, with curated word lists and additional categories.
77
279
 
78
280
  ## License
79
281
 
80
- ISC
282
+ MIT
@@ -0,0 +1 @@
1
+ var g=["accommodating","admirable","adored","adventurous","affable","affectionate","agreeable","alluring","amiable","amicable","amusing","appreciable","appreciated","appreciative","attentive","authentic","balanced","beautiful","benevolent","blessed","blissful","bounteous","bountiful","bright","brilliant","bubbly","calm","caring","charitable","charming","cheerful","cheery","cherished","comforting","committed","compassionate","complimentary","confident","considerate","content","contented","cordial","courageous","creative","credible","dedicated","delighted","delightful","dependable","determined","devoted","diligent","dreamy","eager","earnest","easygoing","ebullient","elated","empowering","encouraging","endearing","energetic","engaging","enthusiastic","exciting","exquisite","extraordinary","exuberant","fabulous","faithful","fervent","festive","forgiving","friendly","funny","generous","gentle","genuine","giggling","giving","gleeful","glowing","good","graceful","gracious","grateful","gratified","gratifying","happy","harmonious","heartening","heartfelt","heartwarming","helpful","honest","honorable","hopeful","hospitable","humorous","illuminating","imaginative","impartial","inclusive","innocent","innovative","inspiring","invigorating","inviting","jolly","jovial","joyful","joyfully","joyous","jubilant","keen","kind","kindhearted","kindly","laughing","liberating","lighthearted","likeable","liked","lively","lovable","lovely","loving","loyal","lucid","luminous","magnanimous","mellow","merry","mindful","mirthful","modest","nice","noble","nourishing","nurturing","obliging","open","openhearted","openminded","optimistic","outgoing","passionate","patient","peaceful","personable","playful","pleasant","pleasing","polite","positive","productive","prosperous","radiant","reassuring","refreshing","rejoicing","relaxed","reliable","resilient","respectable","respectful","responsive","revered","reverent","satisfied","secure","sensational","sensitive","serene","sincere","smiling","sociable","soft","sparkling","spirited","stable","sunny","supportive","sweet","sympathetic","tactful","tenacious","thankful","thoughtful","tolerant","tranquil","true","trusting","trustworthy","truthful","understanding","unique","unselfish","untroubled","upbeat","uplifting","valuable","valued","versatile","vibrant","vigorous","virtuous","vital","vivacious","warm","warmhearted","welcoming","wholehearted","wholesome","willing","winsome","wise","witty","wonderful","xenial","yearning","youthful","yummy","zealous","zestful","zesty","zippy"];var h=["aardvark","albatross","ant","antelope","ape","armadillo","badger","bat","bear","bison","bumblebee","butterfly","camel","capybara","caribou","cassowary","cat","caterpillar","cheetah","chicken","chimpanzee","chinchilla","chipmunk","cougar","cow","coyote","crab","cricket","crow","deer","dingo","dog","dolphin","donkey","dove","duck","eagle","echidna","elephant","falcon","ferret","finch","fish","flamingo","fly","fox","frog","gazelle","gerbil","giraffe","goat","goldfish","goose","gorilla","grasshopper","hamster","hare","hedgehog","heron","hippopotamus","horse","hummingbird","hyena","iguana","impala","jackal","jaguar","jellyfish","kangaroo","kitten","koala","kudu","ladybug","leopard","lion","llama","lobster","locust","lynx","magpie","marten","meerkat","mink","mockingbird","mole","mongoose","monkey","moose","mouse","mynah","narwhal","newt","nuthatch","ocelot","octopus","opossum","orangutan","osprey","ostrich","otter","owl","ox","oyster","panda","pangolin","panther","parakeet","parrot","peacock","pelican","penguin","pheasant","pig","pigeon","pika","platypus","plover","polecat","porcupine","puffin","quail","quokka","rabbit","raccoon","ragdoll","ram","rat","raven","reindeer","rhea","rhinoceros","roo","rooster","saiga","salamander","sambar","sandpiper","sardine","scorpion","seahorse","seal","serval","sheep","shelduck","shrew","shrimp","siskin","skunk","sloth","snail","snapper","sora","sparrow","spoonbill","squirrel","starling","stingray","stork","swan","tadpole","tamarin","tanager","tapir","tarpon","tarsier","tetra","thrush","tiger","toad","toucan","toucanet","towhee","trogon","turaco","turtle","uakari","umbrellabird","urchin","vaquita","vicuna","vireo","vole","vulture","wagtail","wallaby","wallaroo","walrus","warthog","waxwing","whale","whippet","wilddog","wildebeest","wolf","wolverine","wombat","woodpecker","wrasse","xerus","yaffle","yak","zebra","zebu"];var y=["abacus","acroterion","aedicule","aisle","alcove","ambulatory","annex","antechamber","apse","arcade","arch","architrave","archivolt","archway","astragal","atrium","attic","balcony","baldachin","baluster","balustrade","bargeboard","baseboard","basilica","bay","bead","beam","belfry","belvedere","billet","blueprint","bracket","breezeway","brise","buttress","campanile","canopy","cantilever","capital","cartouche","caryatid","casement","casing","castellated","chamfer","chevron","chimney","cladding","clerestory","cloister","colonnade","column","console","coping","corbel","cornice","courtyard","crenellation","cresting","crown","cupola","curtain","cyma","dado","dais","dentil","dome","domed","doric","dormer","dripstone","eaves","echinus","elevation","ell","engaged","entablature","entresol","entryway","facade","fanlight","fascia","fenestration","finial","fluting","foundation","foyer","fresco","frieze","gable","gallery","gargoyle","grille","hall","hammerbeam","hearth","hip","hyphen","impost","inglenook","interior","ionic","jamb","joist","keystone","lancet","lantern","lintel","lobby","loggia","louver","lunette","mansard","metope","mezzanine","minaret","modillion","molding","mullion","muntins","narthex","nave","newel","niche","obelisk","oculus","ogee","oriel","parapet","pavilion","pedestal","pediment","pendentive","pilaster","pillar","pinnacle","plinth","porte","portico","quatrefoil","quoin","rafter","raking","reredos","reveal","ridge","riser","roof","rosette","rotunda","roundel","sash","sconce","sill","skylight","soffit","spandrel","spire","stanchion","steeple","stoa","stucco","stylobate","terrace","tracery","transept","transom","tread","trellis","triforium","triglyph","truss","turret","tympanum","undercroft","vault","veranda","vestibule","volute","voussoir","wainscot","wall","window","ziggurat"];var b=["abstract","acanthus","acrylic","adornment","aesthetic","airbrush","amphora","animation","antiquity","applique","aquarelle","arabesque","armature","artifact","artisan","artistry","artwork","assemblage","atelier","balance","baroque","batik","biennale","blending","bricolage","brushstroke","bust","calligraphy","cameo","canvas","carving","casting","ceramics","charcoal","chasing","chiaroscuro","chisel","chromatic","classical","cloisonne","collage","composition","connoisseur","contour","contrast","craftsmanship","crayon","creativity","critique","cubism","curator","dada","decorative","decoupage","design","diorama","diptych","drapery","drawing","easel","embellishment","embossing","enamel","encaustic","engraving","ensemble","etching","expressionism","fauvism","filigree","fine","finesse","firing","folio","foreshortening","form","gauche","gesso","gilding","glyptic","gouache","graffiti","harmony","hatching","hue","iconography","illustration","impasto","impressionism","ink","installation","intaglio","interpretation","kiln","kilnwork","kinetic","lacquer","landscape","linocut","lithography","luminism","lyrical","mannequin","marbling","masterpiece","medallion","medium","memento","miniature","miniaturist","mobile","modernism","mosaic","mural","museum","naturalism","neoclassicism","neon","nuance","oil","origami","ornament","painting","palette","pastel","patina","pencil","pentimento","perspective","photography","pictorial","pigment","plaster","pointillism","polychrome","portfolio","portrait","print","proportion","provenance","relief","renaissance","rendering","replica","representation","restoration","retrospective","rococo","romanticism","salon","sanguine","saturation","sculpture","sepia","serif","sfumato","sgraffito","shade","shadow","silhouette","simulacrum","sketch","stencil","stippling","stoneware","studio","study","surrealism","symmetry","tableau","technique","tempera","tessellation","texture","tint","triptych","typography","underpainting","varnish","vernissage","virtuoso","visionary","visual","watercolor","weaving","woodcut"];var f=["amsterdam","athens","atlanta","auckland","austin","barcelona","basel","bergen","berlin","bilbao","bogota","boston","bristol","brussels","budapest","cairo","calgary","canberra","cardiff","chicago","copenhagen","dakar","denver","dublin","edinburgh","florence","geneva","glasgow","helsinki","hobart","honolulu","istanbul","jakarta","kyoto","leipzig","lisbon","london","lucerne","madrid","malaga","melbourne","memphis","milan","montreal","munich","nairobi","naples","osaka","oslo","ottawa","palermo","porto","prague","quito","reykjavik","rotterdam","sapporo","savannah","seattle","seoul","stockholm","sydney","taipei","tallinn","tbilisi","toronto","toulouse","tunis","valencia","vienna","warsaw","zagreb","zurich"];var v=["alabaster","amber","aqua","auburn","azure","beige","bisque","black","blonde","blue","blush","bone","bordeaux","brick","brown","buff","burgundy","cadet","canary","cappuccino","cardinal","carmine","carnelian","celadon","cerulean","champagne","chartreuse","claret","cobalt","cognac","copper","cornflower","crimson","cyan","daffodil","ebony","ecru","eggshell","electric","espresso","fawn","flax","fuchsia","glaucous","gold","goldenrod","graphite","gray","green","gunmetal","heliotrope","hunter","indigo","ivory","jade","jasper","khaki","lapis","lava","magenta","mahogany","maize","malachite","mandarin","maroon","mauve","midnight","mocha","mulberry","navy","obsidian","ochre","onyx","paprika","pearl","periwinkle","pewter","pink","platinum","powder","puce","purple","red","rosewood","ruby","russet","rust","sable","saffron","sangria","scarlet","seafoam","sienna","silver","slate","smoke","snow","steel","tan","taupe","tawny","teal","terracotta","titanium","turquoise","ultramarine","umber","verdigris","vermilion","viridian","white","yellow","zinc","zircon"];var w=["acceptance","admiration","adoration","affection","amazement","amusement","anticipation","astonishment","awe","bashfulness","belonging","bewilderment","bliss","caution","cheerfulness","compassion","concern","confidence","confusion","contentment","courage","curiosity","delight","determination","distraction","eagerness","elation","empathy","enchantment","enjoyment","enlightenment","enthusiasm","euphoria","excitement","exhilaration","expectation","fascination","fondness","fulfillment","gladness","glee","gratification","gratitude","happiness","heartache","hesitation","homesickness","hope","infatuation","inspiration","interest","intoxication","joy","jubilation","kindness","longing","love","nervousness","optimism","overwhelm","patience","peace","pensiveness","perplexity","positivity","pride","puzzlement","rapture","reassurance","relaxation","reverence","satisfaction","security","serenity","shyness","solidarity","surprise","sympathy","tenderness","thankfulness","thrill","tranquility","triumph","valor","vigilance","warmth","wonder","zeal","zest"];var k=["accessory","apparel","asymmetrical","attire","ballet","bandana","beaded","belt","bespoke","blazer","blouse","bodysuit","boho","bolero","boots","boutique","bracelet","brocade","brooch","button","cape","capri","cardigan","cashmere","casual","chic","chiffon","classic","cloche","clutch","cocktail","collar","collection","corduroy","cotton","couture","cravat","cuff","culottes","dapper","denim","drape","dress","earrings","edgy","elegant","embroidery","empire","epaulette","eyelet","fabric","fashion","faux","fedora","fitted","flair","flannel","flapper","floral","formal","fringe","fur","garment","garter","glamorous","gloves","gown","halter","handbag","haute","headband","heel","hemline","iridescent","jacket","jewelry","jumpsuit","kaftan","kimono","knit","lace","lapel","leather","linen","loafers","luxurious","material","merino","moccasin","modern","mule","necklace","outfit","oxford","palazzo","pants","pashmina","patent","pattern","pearls","peplum","plaid","platform","pleat","pleated","pocket","poncho","preppy","puff","pumps","purse","quilted","retro","robe","ruched","ruffle","sandals","sartorial","satin","scarf","seamstress","sequin","shawl","sheath","shift","shirt","shoes","shorts","silk","skirt","sleek","sleeve","slippers","sneakers","socks","sophisticated","stiletto","stole","strappy","striped","stylish","suede","suit","sundress","sunglasses","sweater","taffeta","textile","tiara","tie","tote","trend","trim","trousers","tulle","tunic","turtleneck","tweed","uniform","velvet","vest","vintage","vogue","wardrobe","watch","wedge","wool","woven","wrap"];var x=["almond","apple","apricot","artichoke","asparagus","avocado","bacon","bagel","barley","basil","bean","beef","beet","berry","biscuit","blueberry","bread","broccoli","brusselsprout","bun","butter","cabbage","cake","candy","cantaloupe","caramel","carrot","cashew","cauliflower","caviar","celery","cheese","chickpea","chili","chocolate","chutney","cider","cinnamon","citrus","clam","cocoa","coconut","coffee","cookie","corn","cranberry","cupcake","currant","curry","date","dill","doughnut","egg","eggplant","endive","fennel","fig","flour","garlic","gelatin","ginger","grape","grapefruit","gravy","greenbean","guava","halibut","ham","hamburger","hazelnut","honey","honeydew","horseradish","iceberg","jalapeno","jam","jelly","kale","ketchup","kiwi","lamb","leek","lemon","lentil","lettuce","lime","lychee","macadamia","macaroni","mango","maple","margarine","mayonnaise","milk","mint","molasses","muffin","mushroom","mustard","nectarine","noodle","nutmeg","oat","olive","onion","orange","oregano","pancake","papaya","parsley","parsnip","pasta","peach","peanut","pear","pecan","pepper","persimmon","pickle","pie","pineapple","pistachio","plum","pomegranate","popcorn","pork","potato","pretzel","prune","pudding","pumpkin","quince","radicchio","radish","raisin","raspberry","ravioli","relish","rhubarb","rice","rosemary","rye","sage","salad","salami","salmon","salsa","salt","sandwich","scallop","seaweed","slaw","sorbet","soy","spaghetti","spinach","squash","steak","strawberry","sundae","sushi","taco","tangerine","tart","tea","thyme","toast","tomato","trout","tuna","turkey","turnip","vanilla","veal","venison","vinegar","waffle","walnut","watercress","watermelon","wheat","whipped","wine","yam","yogurt","zucchini"];var j=["academia","accomplishment","achievement","advancement","ancestor","ancient","anthropology","antiquarian","antique","archaeology","archive","aristocracy","bronze","bygone","calendar","cartography","castle","cathedral","century","ceremony","chronicle","chronographer","citadel","civilization","coins","commemoration","compilation","conquest","conservation","coronation","culture","cuneiform","customs","decade","decree","deeds","diplomacy","discovery","document","dynasty","edict","encyclopedia","eon","epoch","era","events","excavation","exhibit","expedition","exploration","feudal","fossil","founder","genealogy","generation","golden","governance","heraldry","heritage","hieratic","hieroglyphs","history","imperial","inscription","institute","invention","journal","kingdom","knowledge","landmark","legacy","lineage","lore","medieval","memorabilia","memorial","memories","methodology","migration","millennium","monarchy","monastery","monument","mummy","mythology","nation","nobility","nostalgia","origin","palace","paleography","paleontology","papyrus","parchment","past","patriarch","periodization","pharaoh","pilgrimage","prehistoric","preservation","primary","progeny","progress","pyramid","realm","reconstruction","record","reign","relic","remembrance","repository","research","revolution","royal","ruins","scholar","scroll","secondary","settlement","society","stone","storytelling","tapestry","temple","throne","timeline","tradition","treaty","university","vellum"];var z=["allegory","alliteration","allusion","almanac","analogy","anecdote","annotation","antagonist","anthology","antihero","aphorism","appendix","archetype","assonance","autobiography","ballad","bibliography","bildungsroman","biography","blurb","bookmark","canon","canto","caricature","catharsis","chapter","characterization","chronology","cliche","codex","comedy","commentary","conflict","connotation","consonance","couplet","dedication","denouement","deus","dialect","dialogue","diary","diction","didactic","drama","dramatis","dystopia","editorial","elegy","ellipsis","enigma","enjambment","epilogue","epiphany","epistolary","epitaph","epithet","essay","euphemism","excerpt","exposition","fable","fairytale","fantasy","farce","fiction","figurative","flashback","flashforward","foil","folklore","footnote","foreshadowing","foreword","frame","genre","glossary","haiku","hardcover","heroine","hubris","hyperbole","idiom","imagery","index","intertextuality","introduction","invective","irony","jargon","juxtaposition","legend","leitmotif","libretto","limerick","literary","literature","litotes","lyric","manuscript","memoir","metaphor","meter","metonymy","monograph","monologue","mood","motif","mystery","narration","narrative","narrator","nonfiction","novella","ode","omniscient","onomatopoeia","opus","oxymoron","parable","paradox","paragraph","parody","passage","pastiche","pastoral","pathetic","pentameter","persona","personification","plot","poem","poetics","poetry","point","postscript","preface","premise","prologue","propaganda","prose","protagonist","pseudonym","publisher","quatrain","quest","quotation","reader","realism","refrain","resolution","rhetoric","rhyme","rhythm","romance","saga","sarcasm","satire","scene","scribe","sequel","serial","setting","simile","soliloquy","sonnet","stanza","storyline","stream","structure","style","subplot","subtext","summary","suspense","symbol","symbolism","synopsis","syntax","tale","tanka","text","theme","thesis","thriller","title","tome","tone","tragedy","trope","understatement","utopia","verse","vignette","villain","voice","wordplay"];var q=["accordion","acoustic","adagio","allegro","alto","amplifier","andante","anthem","aria","arpeggio","arrangement","band","banjo","baritone","bass","bassoon","baton","beat","bell","blues","bongo","brass","cadence","cantata","capriccio","cello","chimes","chorale","chord","chorus","clarinet","clef","coda","composer","concert","concerto","conductor","counterpoint","crescendo","cymbal","decrescendo","ditty","drum","duet","dynamics","etude","euphonium","falsetto","fanfare","fermata","fiddler","flute","folk","forte","fortissimo","fretboard","fugue","glissando","glockenspiel","gospel","groove","guitar","harmonica","harmonics","harp","harpsichord","horn","hymn","improvisation","instrument","interlude","interval","jazz","jingle","key","keyboard","legato","lullaby","lute","madrigal","maestro","major","mandolin","march","measure","melody","metronome","microphone","minuet","musical","musicianship","nocturne","oboe","octave","opera","oratorio","orchestra","orchestration","organ","ostinato","overture","panpipes","percussion","piano","piccolo","pitch","pizzicato","polka","prelude","quartet","quintet","recital","recorder","requiem","rhapsody","riff","rondo","samba","scale","score","serenade","sharp","singer","solfege","solo","sonata","song","sonorous","soprano","staccato","staff","strings","suite","symphony","syncopation","tambourine","tango","tempo","tenor","timbre","tonality","treble","triad","trill","trio","trombone","trumpet","tune","tuner","ukulele","unison","variation","vibrato","viola","violin","vivace","vocalise","waltz","woodwind","xylophone","yodel","zither"];var W=["achilles","aeolus","aesculapius","aether","agamemnon","ajax","amalthea","ambrosia","amphitrite","andromeda","antaeus","antigone","apollo","aquilo","ares","argo","argus","ariadne","artemis","asclepius","athena","atlas","atropos","aurora","bacchus","bellerophon","bellona","boreas","briseis","cadmus","calliope","calypso","cassandra","cassiopeia","castor","centaurs","cerberus","ceres","chaos","charon","charybdis","chimera","clio","clotho","cupid","cybele","cynthia","daedalus","daphne","diana","dido","diomedes","dionysus","dryads","egeria","electra","elysium","endymion","eos","eris","europa","eurydice","euterpe","fates","faunus","flora","fortuna","gaea","galatea","ganymede","gorgons","graces","griffin","hector","helios","hephaestus","hera","hercules","hermes","hero","hestia","hydra","hyperion","icarus","io","iris","janus","jason","juno","jupiter","lachesis","leda","leto","liber","maenads","mars","medea","medusa","melampus","memnon","mercury","midas","minerva","minos","minotaur","moirae","momus","morpheus","muses","nemesis","neptune","nereus","nike","nymphs","odysseus","olympus","orion","orpheus","pallas","pan","pandora","paris","pegasus","penelope","persephone","perseus","phaedra","phaeton","phoebe","phoenix","pluto","pollux","polyphemus","poseidon","priam","prometheus","proserpina","proteus","psyche","pygmalion","python","romulus","saturn","scylla","selene","sibyl","silenus","sol","sphinx","styx","tartarus","terpsichore","theseus","thetis","thisbe","tiresias","titan","triton","troy","venus","vesta","vulcan","zephyr","zeus"];var L=["acacia","acorn","alder","alpine","amaryllis","amethyst","anemone","aquamarine","arboretum","aspen","autumn","avalanche","azalea","bamboo","banyan","baobab","bark","basalt","beach","beech","birch","blossom","bluff","bog","boulder","bracken","branch","breeze","briar","brook","buckeye","bud","butte","cactus","camellia","canyon","carnation","cascade","cave","cedar","chamomile","chestnut","chrysanthemum","citrine","cliff","cloud","clover","coast","conifer","coral","cove","creek","crystal","cypress","dahlia","dandelion","dawn","delta","desert","dew","driftwood","dune","earth","eclipse","ecosystem","elm","emerald","eucalyptus","everglades","evergreen","fern","firefly","fjord","flint","flower","fog","foothill","forest","galaxy","garden","geyser","ginkgo","glacier","glade","gorge","granite","grass","grotto","grove","harbor","harvest","haze","hazel","heath","heather","hemlock","hibiscus","hill","holly","honeysuckle","horizon","hyacinth","island","ivy","jasmine","jungle","juniper","kelp","lagoon","lake","lavender","leaf","lichen","lighthouse","lilac","lily","lotus","magnolia","mangrove","marigold","marsh","meadow","meteor","mimosa","mist","monsoon","moon","moonstone","moss","mountain","nest","oak","oasis","ocean","opal","orchard","orchid","palm","pampas","pebble","peony","petal","phlox","pine","planet","plateau","pond","poppy","prairie","primrose","quartz","rainbow","raindrop","rainforest","redwood","reef","rhododendron","river","rock","rose","sand","sapphire","savanna","sea","seashell","seed","sequoia","shore","sky","snapdragon","snowdrop","snowflake","spring","sprout","spruce","star","steppe","summit","sun","sunbeam","sunflower","sunrise","sunset","sycamore","taiga","thistle","tide","topaz","tree","tulip","tundra","valley","violet","volcano","waterfall","wave","willow","wind","wisteria","woodland","yucca","zinnia"];var O=["accountant","acrobat","actuary","administrator","advisor","advocate","agronomist","analyst","animator","anthropologist","appraiser","apprentice","arbitrator","archaeologist","architect","archivist","astronomer","attorney","auctioneer","auditor","author","baker","banker","barber","barista","bartender","biologist","blacksmith","blogger","bookkeeper","botanist","brewer","broadcaster","broker","builder","butcher","buyer","cabinetmaker","calligrapher","caregiver","carpenter","cartographer","cashier","caterer","chemist","chiropractor","cinematographer","clerk","cobbler","columnist","comedian","commissioner","consultant","contractor","copywriter","coroner","correspondent","counselor","courier","craftsman","critic","cryptographer","custodian","dancer","dealer","dentist","dermatologist","designer","detective","developer","dietitian","diplomat","director","dispatcher","diver","doctor","doorman","drafter","dramatist","driver","ecologist","economist","editor","educator","electrician","embalmer","engineer","engraver","entrepreneur","epidemiologist","essayist","estimator","ethnographer","evangelist","examiner","executive","explorer","exporter","fabricator","facilitator","farmer","financier","firefighter","fisherman","florist","foreman","forester","fundraiser","gamekeeper","gardener","gemologist","geneticist","geographer","geologist","glazier","goldsmith","governor","grocer","groundskeeper","guide","hairdresser","handyman","herbalist","historian","host","housekeeper","illustrator","importer","inspector","instructor","interpreter","interviewer","inventor","investigator","ironworker","jeweler","journalist","judge","laborer","landscaper","lawyer","lecturer","librarian","lifeguard","linguist","lithographer","lobbyist","locksmith","machinist","magician","magistrate","manager","manufacturer","marketer","mason","mathematician","mechanic","mediator","meteorologist","midwife","milliner","miner","minister","model","mortician","musician","nanny","navigator","negotiator","neurologist","notary","novelist","nurse","nutritionist","obstetrician","oceanographer","oncologist","operator","ophthalmologist","optician","optometrist","orator","ornithologist","orthodontist","painter","paleontologist","paralegal","paramedic","pathologist","pediatrician","perfumer","pharmacist","philosopher","photographer","physician","physicist","physiotherapist","pilot","plasterer","playwright","plumber","podiatrist","poet","politician","porter","potter","preacher","principal","printer","producer","professor","programmer","promoter","proofreader","prosecutor","prosthetist","psychiatrist","psychologist","publicist","puppeteer","rabbi","radiologist","rancher","realtor","receptionist","recruiter","registrar","reporter","researcher","retailer","roofer","sailor","salesperson","sanitarian","scientist","screenwriter","sculptor","secretary","senator","server","shepherd","sheriff","sociologist","soldier","sommelier","speechwriter","spokesperson","statistician","stockbroker","stonemason","strategist","stylist","superintendent","supervisor","supplier","surgeon","surveyor","tailor","taxidermist","teacher","technician","therapist","tiler","toxicologist","trader","translator","treasurer","tutor","typist","underwriter","upholsterer","urologist","usher","valet","vendor","veterinarian","videographer","vintner","virologist","volunteer","waiter","warden","weaver","welder","wholesaler","woodworker","writer","zoologist"];var P=["acceleration","acid","alkaline","allele","alloy","amoeba","amplitude","anatomy","antibiotic","antibody","antigen","antioxidant","aqueous","assay","atom","atomic","bacteria","barometer","base","beaker","biome","biopsy","biosynthesis","bond","botany","calibration","capillary","carbohydrate","carbon","catalyst","cathode","cell","cellular","centrifuge","chlorophyll","chromosome","circuit","coagulation","coefficient","colloid","combustion","compound","condensation","conductivity","covalent","cytoplasm","data","decay","decomposition","density","diffusion","dilution","dipole","dissection","dissolution","distillation","dna","electrode","electrolyte","electron","element","embryo","emission","endothermic","enzyme","equation","equilibrium","evaporation","evolution","exothermic","experiment","exponential","fermentation","filament","filtration","fission","flask","formula","frequency","friction","fungus","fusion","gamete","gas","gene","genome","geology","geothermal","germ","glucose","gradient","gravitational","halogen","heredity","hormone","hybrid","hydrogen","hydrolysis","hypothesis","immunity","induction","inertia","inoculation","insulation","ion","isomer","laboratory","laser","latent","lattice","lens","lipid","liquid","locus","magnet","magnetic","magnetism","mass","membrane","metabolism","metallurgy","microscope","mitochondria","mitosis","molecular","molecule","momentum","monomer","morphology","mutation","neuron","neutralization","nitrogen","nutrient","observation","optics","orbital","organic","oscillation","osmosis","oxidation","oxygen","ozone","parasite","particle","pathogen","peptide","periodic","permeability","petri","phenotype","phosphate","photosynthesis","physics","pipette","plankton","polymer","potential","precipitate","pressure","prism","prokaryote","protein","quantum","radioactive","reactant","reaction","reagent","receptor","recessive","reduction","reflection","refraction","replication","resistance","resonance","respiration","ribosome","rna","salinity","saturated","sediment","semiconductor","serum","solid","solubility","solute","solution","solvent","speciation","specimen","spectrometer","spore","stimulus","stoichiometry","substrate","suspension","symbiosis","synthesis","taxonomy","temperature","theorem","theory","thermal","thermodynamics","titration","tissue","toxin","transcription","translation","transmitter","ultraviolet","valence","vapor","variable","vector","velocity","virus","viscosity","voltage","volume","wavelength","zoology"];var E=["aperture","apogee","asterism","asteroid","astrology","astronaut","astronomy","atmosphere","axis","betelgeuse","bigbang","binary","bolide","canopus","capsule","celestial","centauri","centaurus","cepheid","cetus","chiron","cluster","comet","constellation","copernicus","corona","cosmic","cosmonaut","crater","cygnus","draco","dwarf","einstein","equinox","eridanus","exoplanet","fermi","galactic","galileo","gemini","gravity","hades","halley","heliocentric","hubble","hypernova","infrared","interstellar","isotope","jansky","kbo","kepler","kuiper","laplace","larissa","libration","lightyear","lunar","lyra","magnetar","messier","meteorite","meteoroid","milkyway","mimas","nadir","naiad","nebula","nereid","neutron","nix","nova","nucleus","oberon","occultation","oort","orbit","parsec","perigee","perihelion","perseid","phobos","photon","pioneer","plasma","polar","polaris","proton","puck","pulsar","quasar","radar","radiation","radioscope","retrograde","rocket","sagittarius","satellite","satyr","sideral","sirius","skylab","solar","solstice","space","spaceship","spectrum","starlight","starship","stellar","supernova","taurid","telescope","tethys","thule","titania","ufo","ulysses","umbra","universe","uranus","ursa","vacuum","vega","vernal","voyager","wormhole","xenon","yttrium","zenith","zodiac"];var N=["aerobics","archery","athlete","backstroke","badminton","baseball","basketball","bench","biathlon","billiards","birdie","bobsled","bocce","bogey","bowling","boxing","captain","champion","cheerleading","cleats","climbing","competition","court","crawl","croquet","curling","cycling","darts","decathlon","defense","diving","dodgeball","dribble","dugout","dunk","equestrian","fairway","fencing","field","fitness","football","freestyle","futsal","goal","goalie","goalkeeper","golf","gymnastics","halftime","handball","heptathlon","hiking","hockey","hurdles","javelin","jersey","jogging","judo","karate","kickball","kickboxing","lacrosse","league","luge","marathon","medal","medalist","medley","midfielder","netball","offense","olympics","overtime","paddleboarding","paintball","par","parkour","passing","penalty","pentathlon","pickleball","pilates","pingpong","playoff","podium","polo","qualifier","racket","racquetball","rally","rebounding","referee","relay","rink","rowing","rugby","running","sailing","scoreboard","scoring","scrimmage","serve","shot","sideline","skating","skeleton","skiing","slalom","sled","snooker","snowboarding","soccer","softball","sparring","speedskating","spike","sprint","stadium","steeplechase","striker","surfing","swimming","table","tackling","taekwondo","teammate","tennis","throwing","timeout","tournament","track","trainer","trampolining","triathlete","triathlon","trophy","tryout","tumbling","umpire","varsity","victory","volleyball","wakeboarding","walking","warmup","waterpolo","weightlifting","wicket","windsurfing","workout","wrestling","yoga","zone","zumba"];var C=["aircraft","airliner","airplane","airport","ambulance","amphibious","armored","autobus","automobile","aviation","balloon","barge","biplane","boat","boxcar","buggy","bullet","bus","cab","cable","caboose","camper","canoe","caravan","cargo","carriage","carrier","cart","catamaran","chairlift","chariot","chopper","clipper","coach","cockpit","commuter","convertible","coupe","cruiser","deckboat","delivery","diesel","dinghy","dirigible","dolly","draisine","dray","drifter","engine","express","ferry","flatbed","fleet","floatplane","flyover","freighter","fuselage","galleon","galley","glider","gondola","gunboat","gyrocopter","hangar","hatchback","hauler","hearse","helicopter","highway","hopper","houseboat","hovercraft","hydrofoil","hydroplane","icebreaker","inflatable","interstate","jet","jetliner","jetpack","jetski","jitney","junction","kayak","ketch","landau","landing","launch","lifeboat","limousine","liner","locomotive","maglev","metro","minibus","minivan","moped","monorail","mooring","motorbike","motorboat","motorcycle","motorhome","narrowboat","outboard","outrigger","paddleboat","parachute","parasail","passenger","patrol","pedalo","pickup","pier","pontoon","propeller","pullman","quadcopter","raft","railcar","railroad","railway","rickshaw","roadster","ropeway","rotorcraft","rowboat","runway","sailboat","schooner","scooter","seaplane","sedan","semitrailer","ship","shuttle","skateboard","skiff","sleigh","snowmobile","speedboat","station","steamboat","steamer","steamship","streetcar","submarine","subwaycar","tandem","tanker","taxi","taxicab","tender","terminal","tiller","toboggan","tractor","trailer","train","tram","tramcar","tramway","transport","trawler","tricycle","trolley","trolleybus","truck","tugboat","turboprop","ultralight","unicycle","van","vehicle","vessel","wagon","watercraft","wharf","wheelbarrow","windjammer","yacht","yawl","zeppelin"];var J={adjective:g,animal:h,architecture:y,art:b,city:f,color:v,emotion:w,fashion:k,food:x,history:j,literature:z,music:q,mythology:W,nature:L,profession:O,science:P,space:E,sport:N,transportation:C},ce=Object.keys(J),ue=[h,y,b,f,w,k,x,j,z,q,W,L,O,P,E,N,C],pe=ue.flat(),me=[...g,...v],m={categoryNames:ce,categoryWordLists:J,categoryWords:pe,prefixes:me},u=e=>e[Math.floor(Math.random()*e.length)],de=e=>Array.isArray(e)&&e.every(r=>typeof r=="string"),p=e=>[...new Set(e)],ge=e=>{if(e)for(let[r,t]of Object.entries(e)){if(!r)throw new Error("Custom word list names cannot be empty");if(!de(t))throw new Error(`Custom word list "${r}" must contain strings`)}},he=(e,r)=>p(e).filter(t=>!r.has(t)),D=(e,r=[])=>{var s,l;if(ge(e),!e&&r.length===0)return m;let t=new Set(r),a={...J,...e},o={};for(let[c,M]of Object.entries(a))o[c]=he(M,t);let i=Object.keys(o),n=Object.entries(o).filter(([c])=>c!=="adjective"&&c!=="color").map(([,c])=>c);return{categoryNames:i,categoryWordLists:o,categoryWords:p(n.flat()),prefixes:p([...(s=o.adjective)!=null?s:[],...(l=o.color)!=null?l:[]])}},A=(e,r,t)=>{if(t){for(let a of t)if(!Object.hasOwn(r,a))throw new Error(`Unknown pattern category "${a}". Expected one of: ${e.join(", ")}`)}},R=e=>{if(e<2)throw new Error("Need at least 2 words")},ye=(e,r,t,a,o=m)=>{var n;let i=(n=a==null?void 0:a.length)!=null?n:e;if(R(i),!r)throw new Error("Need a separator");if(t!==void 0&&(!Number.isInteger(t)||t<=0))throw new Error("maxLength must be a positive integer");A(o.categoryNames,o.categoryWordLists,a)},$=(e,r)=>{if(e<r)return 0;let t=1;for(let a=0;a<r;a+=1)t*=e-a;return t},be=(e,r=m)=>{R(e);let t=0,a=new Set(r.categoryWords);for(let o of r.prefixes){let i=r.categoryWords.length-(a.has(o)?1:0);t+=$(i,e-1)}return t},fe=(e,r)=>{if(e.length!==r.length)return!1;let t=new Set(e);return r.every(a=>t.has(a))},ve=e=>{let r=new Set;for(let t of e)for(let a of t){if(r.has(a))return!1;r.add(a)}return!0},we=e=>{if(e.some(a=>a.length===0))return 0;if(ve(e))return e.reduce((a,o)=>a*o.length,1);if(e.every(a=>fe(a,e[0])))return $(e[0].length,e.length);let r=e.toSorted((a,o)=>a.length-o.length),t=(a,o)=>{if(a>=r.length)return 1;let i=0;for(let n of r[a])o.includes(n)||(i+=t(a+1,[...o,n]));return i};return t(0,[])},ke=(e,r=m)=>{R(e.length),A(r.categoryNames,r.categoryWordLists,e);let t=e.map(a=>{var o;return p((o=r.categoryWordLists[a])!=null?o:[])});return we(t)},xe=(e,r,t)=>{if(t===void 0){if(e.length>=r.length&&r.every(i=>e.includes(i)))return;let o=u(r);for(;e.includes(o);)o=u(r);return o}let a=r.filter(o=>!e.includes(o)&&o.length<=t);return a.length===0?void 0:u(a)},U=(e,r,t)=>xe(e,r,t),F=(e,r,t,a)=>{if(r>=e.length)return!0;for(let o of e[r])if(!(a!==void 0&&o.length>a)&&!t.includes(o)&&F(e,r+1,[...t,o],a===void 0?void 0:a-o.length))return!0;return!1},I=(e,r,t,a)=>{let o=e[r].filter(i=>!t.includes(i)&&(a===void 0||i.length<=a)&&F(e,r+1,[...t,i],a===void 0?void 0:a-i.length));return o.length===0?void 0:u(o)},B=()=>new Error("Not enough unique words to generate a result"),je=(e,r,t)=>{if(t.prefixes.length===0)throw B();let a=[u(t.prefixes)];for(let o=1;o<e;o+=1){let i=U(a,t.categoryWords);if(!i)throw B();a.push(i)}return a.join(r)},ze=(e,r,t)=>{let a=e.map(i=>{var n;return(n=t[i])!=null?n:[]}),o=[];for(let[i,n]of e.entries()){let s=I(a,i,o);if(!s)throw new Error(`Not enough unique words in pattern category "${n}"`);o.push(s)}return o.join(r)},d=(e,r,t)=>new Error(`maxLength ${e} is too short to generate ${r} segments with separator "${t}"`),S=e=>{let r=Number.POSITIVE_INFINITY;for(let t of e)r=Math.min(r,t.length);return r},qe=(e,r,t)=>{let a=S(t.categoryWords),o=e-(r-1)*a,i=t.prefixes.filter(n=>n.length<=o);return i.length===0?void 0:u(i)},We=(e,r,t,a)=>{let o=S(a.categoryWords),i=r-t*o;return U(e,a.categoryWords,i)},Le=(e,r,t,a,o,i)=>{let n=t;for(let s=1;s<r;s+=1){let l=We(e,n,r-s-1,i);if(!l)throw d(a,r,o);e.push(l),n-=l.length}return n},Oe=(e,r)=>{let t=0;for(let a=r;a<e.length;a+=1)t+=S(e[a]);return t},Pe=(e,r,t,a)=>{let o=t-(e-1)*r.length,i=qe(o,e,a);if(!i)throw d(t,e,r);let n=[i];return Le(n,e,o-i.length,t,r,a),n.join(r)},Ee=(e,r,t,a,o)=>{let i=t;for(let n=0;n<r.length;n+=1){let s=I(r,n,e,i);if(!s)throw d(a,r.length,o);e.push(s),i-=s.length}},Ne=(e,r,t,a)=>{let o=e.map(s=>{var l;return(l=a[s])!=null?l:[]}),i=t-(e.length-1)*r.length;if(i<Oe(o,0))throw d(t,e.length,r);let n=[];return Ee(n,o,i,t,r),n.join(r)},yr=(e={})=>{let{maxLength:r,omit:t=[],pattern:a,segments:o=2,separator:i="-",wordLists:n}=e,s=D(n,t);return ye(o,i,r,a,s),a?r===void 0?ze(a,i,s.categoryWordLists):Ne(a,i,r,s.categoryWordLists):r===void 0?je(o,i,s):Pe(o,i,r,s)},br=(e={})=>{let{omit:r=[],pattern:t,segments:a=2,wordLists:o}=e,i=D(o,r);return t?ke(t,i):be(a,i)};export{yr as a,br as b};