@liiift-studio/sanity-font-manager 2.3.19 → 2.5.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.
Files changed (62) hide show
  1. package/README.md +437 -437
  2. package/dist/UploadModal-6LIX7XOK.js +6 -0
  3. package/dist/UploadModal-NME2W53V.mjs +6 -0
  4. package/dist/chunk-646WCBRR.mjs +7276 -0
  5. package/dist/chunk-FH4QKHOH.js +7276 -0
  6. package/dist/index.js +747 -1675
  7. package/dist/index.mjs +400 -1237
  8. package/package.json +85 -85
  9. package/src/components/BatchUploadFonts.jsx +653 -639
  10. package/src/components/BulkActions.jsx +99 -0
  11. package/src/components/ExistingDocumentResolver.jsx +152 -0
  12. package/src/components/FontReviewCard.jsx +415 -0
  13. package/src/components/FontScriptUploaderComponent.jsx +463 -463
  14. package/src/components/GenerateCollectionsPairsComponent.jsx +259 -259
  15. package/src/components/KeyValueInput.jsx +95 -95
  16. package/src/components/KeyValueReferenceInput.jsx +254 -254
  17. package/src/components/NestedObjectArraySelector.jsx +146 -146
  18. package/src/components/PriceInput.jsx +26 -26
  19. package/src/components/PrimaryCollectionGeneratorTypeface.jsx +116 -116
  20. package/src/components/RegenerateSubfamiliesComponent.jsx +185 -185
  21. package/src/components/SetOTF.jsx +87 -87
  22. package/src/components/SingleUploaderTool.jsx +672 -673
  23. package/src/components/StatusDisplay.jsx +26 -26
  24. package/src/components/StyleCountInput.jsx +16 -16
  25. package/src/components/UpdateScriptsComponent.jsx +76 -76
  26. package/src/components/UploadButton.jsx +43 -43
  27. package/src/components/UploadModal.jsx +268 -0
  28. package/src/components/UploadScriptsComponent.jsx +539 -537
  29. package/src/components/UploadStep1Settings.jsx +272 -0
  30. package/src/components/UploadStep2Review.jsx +472 -0
  31. package/src/components/UploadStep3Execute.jsx +234 -0
  32. package/src/components/UploadSummary.jsx +196 -0
  33. package/src/components/VariableInstanceReferencesInput.jsx +190 -190
  34. package/src/hooks/useNestedObjects.js +92 -92
  35. package/src/hooks/useSanityClient.js +9 -9
  36. package/src/index.js +115 -70
  37. package/src/schema/openTypeField.js +1945 -1945
  38. package/src/schema/styleCountField.js +12 -12
  39. package/src/schema/stylesField.js +268 -268
  40. package/src/schema/stylisticSetField.js +301 -301
  41. package/src/utils/buildUploadPlan.js +325 -0
  42. package/src/utils/executeUploadPlan.js +437 -0
  43. package/src/utils/executionReducer.js +56 -0
  44. package/src/utils/fontHelpers.js +267 -0
  45. package/src/utils/generateCssFile.js +207 -205
  46. package/src/utils/generateFontData.js +98 -145
  47. package/src/utils/generateFontFile.js +38 -38
  48. package/src/utils/generateKeywords.js +185 -185
  49. package/src/utils/generateSubset.js +45 -45
  50. package/src/utils/getEmptyFontKit.js +101 -99
  51. package/src/utils/parseFont.js +55 -0
  52. package/src/utils/parseVariableFontInstances.js +211 -211
  53. package/src/utils/planReducer.js +517 -0
  54. package/src/utils/planTypes.js +183 -0
  55. package/src/utils/processFontFiles.js +529 -477
  56. package/src/utils/regenerateFontData.js +146 -146
  57. package/src/utils/resolveExistingFont.js +87 -0
  58. package/src/utils/sanitizeForSanityId.js +65 -65
  59. package/src/utils/updateFontPrices.js +94 -94
  60. package/src/utils/updateTypefaceDocument.js +149 -160
  61. package/src/utils/uploadFontFiles.js +405 -316
  62. package/src/utils/utils.js +24 -24
package/dist/index.mjs CHANGED
@@ -1,6 +1,69 @@
1
+ import {
2
+ BulkActions,
3
+ EXECUTION_STATUS,
4
+ ExistingDocumentResolver,
5
+ FONT_STATUS,
6
+ FontReviewCard_default,
7
+ PLAN_PHASE,
8
+ PLAN_VERSION,
9
+ PriceInput_default,
10
+ RECOMMENDATION,
11
+ UploadModal,
12
+ UploadStep1Settings,
13
+ UploadStep2Review,
14
+ UploadStep3Execute,
15
+ UploadSummary,
16
+ addItalicToFontTitle,
17
+ buildUploadPlan,
18
+ createEmptyPlan,
19
+ createFontDecisions,
20
+ createFontObject,
21
+ createInitialExecutionState,
22
+ determineWeight,
23
+ escapeCssFontName,
24
+ executeUploadPlan,
25
+ executionReducer,
26
+ expandAbbreviations,
27
+ extractFontMetadata,
28
+ extractWeightFromFullName,
29
+ extractWeightName,
30
+ formatFontTitle,
31
+ generateCssFile,
32
+ generateFontData,
33
+ generateStyleKeywords,
34
+ getAllFeatureTags,
35
+ getCharacterSet,
36
+ getFamilyClass,
37
+ getFontMetadata,
38
+ getFontMetrics,
39
+ getFsSelection,
40
+ getGlyphCount,
41
+ getItalicAngle,
42
+ getMacStyle,
43
+ getNameString,
44
+ getNamedInstances,
45
+ getVariationAxes,
46
+ getWeightClass,
47
+ logFontInfo,
48
+ parseFont,
49
+ parseVariableFontInstances,
50
+ parseVariableFontInstances_default,
51
+ planReducer,
52
+ processFontFiles,
53
+ processItalicKeywords,
54
+ processSubfamilyName,
55
+ readFontFile,
56
+ removeWeightNames,
57
+ resolveExistingFont,
58
+ reverseSpellingLookup,
59
+ sanitizeForSanityId,
60
+ sortFontObjects,
61
+ updateTypefaceDocument
62
+ } from "./chunk-646WCBRR.mjs";
63
+
1
64
  // src/components/BatchUploadFonts.jsx
2
- import React4, { useCallback, useState as useState2, useMemo as useMemo2, useRef, useEffect } from "react";
3
- import { Card, Box as Box2, Flex as Flex3, Grid, Text as Text4, Label, Switch, Button as Button2, Spinner, Tooltip, Stack as Stack2 } from "@sanity/ui";
65
+ import React3, { useCallback, useState as useState2, useMemo as useMemo2, useRef, useEffect, lazy, Suspense } from "react";
66
+ import { Card, Box as Box2, Flex as Flex2, Grid, Text as Text3, Label, Switch, Button as Button2, Spinner, Tooltip, Stack as Stack2 } from "@sanity/ui";
4
67
  import { ControlsIcon, InfoOutlineIcon, TrashIcon, UploadIcon, WarningOutlineIcon } from "@sanity/icons";
5
68
  import { useFormValue as useFormValue2 } from "sanity";
6
69
 
@@ -12,904 +75,9 @@ function useSanityClient() {
12
75
  return useMemo(() => client, [client]);
13
76
  }
14
77
 
15
- // src/utils/processFontFiles.js
16
- import * as fontkit from "fontkit";
17
- import { nanoid } from "nanoid";
18
-
19
- // src/utils/generateKeywords.js
20
- var coreWeights = ["Hairline", "ExtraThin", "Thin", "Mager", "Maigre", "ExtraLight", "Light", "Chiaro", "Lite", "Leicht", "Demi", "Book", "Buch", "Regular", "Normal", "Medium", "Stark", "Thick", "Kr\xE4ftig", "Viertelfett", "Halbfett", "Dreiviertelfett", "Dark", "Bold", "Neretto", "Gras", "Fett", "Extrafett", "Black", "Nero", "Heavy", "Nerissimo", "Ultra", "Fat", "Poster"];
21
- var modifiers = ["Demi", "Semi", "Extra", "Ultra", "Super", "Plus"];
22
- var coreItalics = ["Italic", "Slant", "Oblique", "Cursive", "Rotalic", "Reverse", "Crab Claw", "Crabclaw", "South Paw", "Southpaw", "Backwards", "Backslant", "Backslanted", "Back Slant"];
23
- var alternativeSpelling = {
24
- Backslant: ["Bsl"],
25
- Backwards: ["Bck"],
26
- Black: ["Blak", "Blk"],
27
- Bold: ["Bd", "Bld"],
28
- // B omitted — too ambiguous
29
- Condensed: ["Cond", "Cnd"],
30
- Crabclaw: ["Crab", "Claw"],
31
- Cursive: ["Cur"],
32
- Dark: ["Drk"],
33
- Expanded: ["Exp"],
34
- Extra: ["Xt", "Xtra", "Xtr", "X"],
35
- // X omitted as standalone — too ambiguous
36
- ExtraBlack: ["Xblk", "XBlk", "Xblck", "XBlck"],
37
- ExtraBold: ["Xbd", "XBd", "Xbld", "XBld", "Xbold", "XBold", "ExBold", "Exbold", "Exbd", "ExBd", "Exbld", "ExBld"],
38
- ExtraCondensed: ["XCond", "Xcnd"],
39
- ExtraExpanded: ["XExp"],
40
- ExtraLight: ["Xlight", "XLight", "Xlt", "XLt", "Xlgt", "XLgt", "Xl", "XL", "Xlght", "XLght"],
41
- ExtraThin: ["Xthin", "Xthn", "Xth", "XThin", "XThn", "XTh", "XT"],
42
- Extended: ["Ext"],
43
- Hairline: ["Hl", "Hln", "Hlnn", "Hlnne", "Hlnnne"],
44
- Italic: ["Ital", "It"],
45
- Light: ["Lt", "Lght"],
46
- Medium: ["Med", "Md", "md", "med"],
47
- Oblique: ["Obl"],
48
- Plus: ["Pls"],
49
- Regular: ["Reg", "Rg"],
50
- Reverse: ["Rev"],
51
- Rotalic: ["Rot"],
52
- SemiBold: ["SmBd", "Sb", "Sbd", "Sbld", "Sbold", "Semibd", "SemiBd", "Semibld", "SemiBld", "semiBd", "semiBld"],
53
- Slant: ["Sl"],
54
- Southpaw: ["South", "Paw"],
55
- Super: ["Supr"],
56
- Thin: ["Thn"],
57
- Ultra: ["Ult", "Ultre", "Ul", "Ulta"],
58
- XX: ["XXt", "XXtra", "XXtr", "XX"],
59
- XXBlack: ["XXblk", "XXBlk", "XXblck", "XXBlck"],
60
- XXLight: ["XXlight", "XXLight", "XXlt", "XXLt", "XXlgt", "XXLgt", "XXl", "XXL", "XXlght", "XXLght"],
61
- XXX: ["XXXt", "XXXtra", "XXXtr", "XXX"],
62
- XXXLight: ["XXXlight", "XXXLight", "XXXlt", "XXXLt", "XXXlgt", "XXXLgt", "XXXl", "XXXL", "XXXlght", "XXXLght"]
63
- };
64
- function reverseSpellingLookup(str) {
65
- let exactMatch = "";
66
- Object.keys(alternativeSpelling).forEach(function(key) {
67
- alternativeSpelling[key].forEach(function(alternative) {
68
- if (str === alternative) {
69
- exactMatch = key;
70
- }
71
- });
72
- });
73
- if (exactMatch) return exactMatch;
74
- let result = "";
75
- let longestMatch = 0;
76
- Object.keys(alternativeSpelling).forEach(function(key) {
77
- alternativeSpelling[key].forEach(function(alternative) {
78
- const regex = new RegExp(`\\b${alternative}\\b`);
79
- if (regex.test(str) && alternative.length > longestMatch) {
80
- result = key;
81
- longestMatch = alternative.length;
82
- }
83
- });
84
- });
85
- return result;
86
- }
87
- function expandAbbreviations(str) {
88
- if (!str) return str;
89
- return str.split(" ").map((word) => {
90
- const expanded = reverseSpellingLookup(word);
91
- return expanded || word;
92
- }).join(" ");
93
- }
94
- function removeWeightNames(str) {
95
- if (!str) return str;
96
- return str.split(" ").map((word) => {
97
- coreWeights.forEach((weight) => {
98
- if (word === weight) word = "";
99
- modifiers.forEach((modifier) => {
100
- if (word === modifier || modifier + weight === word) word = "";
101
- });
102
- });
103
- const expanded = reverseSpellingLookup(word);
104
- if (expanded) return "";
105
- return word;
106
- }).join(" ").trim();
107
- }
108
- function generateStyleKeywords() {
109
- let weightKeywordList = [];
110
- let italicKeywordList = [];
111
- weightKeywordList = [...coreWeights];
112
- modifiers.forEach((modifier) => {
113
- coreWeights.forEach((weight) => {
114
- weightKeywordList.push(modifier + weight);
115
- });
116
- });
117
- weightKeywordList = [...weightKeywordList, ...modifiers];
118
- italicKeywordList = [...coreItalics];
119
- weightKeywordList = weightKeywordList.map(function(el) {
120
- var newEls = [];
121
- Object.keys(alternativeSpelling).forEach(function(key) {
122
- if (el.indexOf(key) !== -1) {
123
- alternativeSpelling[key].forEach(function(alternative) {
124
- let newSpelling = el.replace(key, alternative);
125
- newEls.push(newSpelling);
126
- Object.keys(alternativeSpelling).forEach(function(key2) {
127
- if (newSpelling.indexOf(key2) !== -1) {
128
- alternativeSpelling[key2].forEach(function(alternative2) {
129
- let newSpelling2 = newSpelling.replace(key2, alternative2);
130
- newEls.push(newSpelling2);
131
- Object.keys(alternativeSpelling).forEach(function(key3) {
132
- if (newSpelling2.indexOf(key3) !== -1) {
133
- alternativeSpelling[key3].forEach(function(alternative3) {
134
- newEls.push(newSpelling2.replace(key3, alternative3));
135
- });
136
- }
137
- });
138
- });
139
- }
140
- });
141
- });
142
- }
143
- });
144
- newEls.push(el);
145
- return newEls;
146
- }).reduce(function(a, b) {
147
- return a.concat(b);
148
- });
149
- italicKeywordList = italicKeywordList.map(function(el) {
150
- var newEls = [];
151
- Object.keys(alternativeSpelling).forEach(function(key) {
152
- if (el.indexOf(key) !== -1) {
153
- alternativeSpelling[key].forEach(function(alternative) {
154
- newEls.push(el.replace(key, alternative));
155
- });
156
- }
157
- });
158
- newEls.push(el);
159
- return newEls;
160
- }).reduce(function(a, b) {
161
- return a.concat(b);
162
- });
163
- weightKeywordList = weightKeywordList.sort((a, b) => b.length - a.length);
164
- italicKeywordList = italicKeywordList.sort((a, b) => b.length - a.length);
165
- weightKeywordList = weightKeywordList.filter((item, pos) => weightKeywordList.indexOf(item) === pos);
166
- italicKeywordList = italicKeywordList.filter((item, pos) => italicKeywordList.indexOf(item) === pos);
167
- return { weightKeywordList, italicKeywordList };
168
- }
169
-
170
- // src/utils/sanitizeForSanityId.js
171
- import slugify from "slugify";
172
- function sanitizeForSanityId(str) {
173
- if (!str || typeof str !== "string") {
174
- return "font-" + Date.now();
175
- }
176
- let sanitized = str.toLowerCase().trim();
177
- sanitized = sanitized.replace(/\+/g, "plus");
178
- sanitized = sanitized.replace(/&/g, "and");
179
- sanitized = sanitized.replace(/@/g, "at");
180
- sanitized = slugify(sanitized, {
181
- replacement: "-",
182
- remove: /[^\w\s-]/g,
183
- lower: true,
184
- strict: true,
185
- locale: "en",
186
- trim: true
187
- });
188
- sanitized = sanitized.replace(/[^a-z0-9\-_]/g, "-");
189
- sanitized = sanitized.replace(/-+/g, "-");
190
- sanitized = sanitized.replace(/^[-_]+|[-_]+$/g, "");
191
- if (sanitized && !/^[a-z_]/.test(sanitized)) {
192
- sanitized = "font_" + sanitized;
193
- }
194
- if (!sanitized) {
195
- sanitized = "font_" + Date.now();
196
- }
197
- if (sanitized.length > 128) {
198
- const hash = Math.random().toString(36).substring(2, 8);
199
- sanitized = sanitized.substring(0, 120) + "_" + hash;
200
- }
201
- if (!/^[a-z_][a-z0-9\-_]*$/.test(sanitized)) {
202
- console.warn(`ID sanitization produced invalid result: "${sanitized}", using fallback`);
203
- sanitized = "font_" + Date.now();
204
- }
205
- return sanitized;
206
- }
207
-
208
- // src/utils/processFontFiles.js
209
- var readFontFile = (file) => {
210
- return new Promise((resolve, reject) => {
211
- const reader = new FileReader();
212
- reader.onload = (event) => {
213
- resolve(new Uint8Array(event.target.result));
214
- };
215
- reader.onerror = (error) => {
216
- reject(error);
217
- };
218
- reader.readAsArrayBuffer(file);
219
- });
220
- };
221
- var processFontFiles = async (files, title, weightKeywordList, italicKeywordList, setStatus, preserveShortenedNames = false, preserveFileNames = false) => {
222
- let failedFiles = [];
223
- let subfamilies = {};
224
- let fontsObjects = {};
225
- let newPreferredStyle = { weight: -100, style: "Italic", _ref: "" };
226
- for (let i = 0; i < files.length; i++) {
227
- const file = files[i];
228
- const fontBuffer = await readFontFile(file);
229
- const font = fontkit.create(fontBuffer);
230
- console.log("File name: ", file.name);
231
- if (file.name.endsWith(".woff2") || file.name.endsWith(".woff")) {
232
- await handleWebfontMetadata(file, font, files);
233
- }
234
- const { weightName, subfamilyName, fontTitle, style, italicKW, variableFont } = extractFontMetadata(
235
- font,
236
- title,
237
- weightKeywordList,
238
- italicKeywordList,
239
- preserveShortenedNames
240
- );
241
- const id = sanitizeForSanityId(fontTitle);
242
- let originalFilename = null;
243
- if (preserveFileNames) {
244
- originalFilename = file.name.replace(/\.(ttf|otf|woff2?|eot|svg)$/i, "");
245
- }
246
- logFontInfo(id, fontTitle, font, file.name, subfamilyName, style, weightName, variableFont, italicKW);
247
- subfamilies[id] = subfamilyName;
248
- if (fontsObjects[id]) {
249
- fontsObjects[id].files = [...fontsObjects[id].files, file];
250
- if (preserveFileNames && originalFilename) {
251
- fontsObjects[id].originalFilename = originalFilename;
252
- }
253
- } else {
254
- fontsObjects[id] = createFontObject(
255
- id,
256
- fontTitle,
257
- title,
258
- font,
259
- variableFont,
260
- weightName,
261
- subfamilyName,
262
- file,
263
- preserveFileNames ? originalFilename : null
264
- );
265
- }
266
- }
267
- fontsObjects = sortFontObjects(fontsObjects);
268
- const uniqueSubfamilies = [...new Set(Object.values(subfamilies))];
269
- console.log("Subfamilies:", subfamilies);
270
- console.log("Unique subfamilies:", uniqueSubfamilies, uniqueSubfamilies.length);
271
- console.log("Font objects:", fontsObjects);
272
- return { fontsObjects, subfamilies, uniqueSubfamilies, newPreferredStyle, failedFiles };
273
- };
274
- var handleWebfontMetadata = async (file, font, files) => {
275
- var _a, _b, _c, _d, _e, _f, _g;
276
- if (!((_b = (_a = font == null ? void 0 : font.name) == null ? void 0 : _a.records) == null ? void 0 : _b.fullName) || ((_d = (_c = font == null ? void 0 : font.name) == null ? void 0 : _c.records) == null ? void 0 : _d.fullName) === "" || !/^[A-Z0-9]+$/.test((_f = (_e = font == null ? void 0 : font.name) == null ? void 0 : _e.records) == null ? void 0 : _f.fullName)) {
277
- const ttfFile = files.find((f) => f.name === file.name.replace(".woff2", ".ttf").replace(".woff", ".ttf"));
278
- if (ttfFile) {
279
- const ttfFileBuffer = await readFontFile(ttfFile);
280
- const ttfFileData = fontkit.create(ttfFileBuffer);
281
- if (ttfFileData) font.name.records = (_g = ttfFileData == null ? void 0 : ttfFileData.name) == null ? void 0 : _g.records;
282
- }
283
- }
284
- };
285
- var extractFontMetadata = (font, title, weightKeywordList, italicKeywordList, preserveShortenedNames = false) => {
286
- var _a, _b, _c, _d, _e, _f;
287
- let weightName = extractWeightName(font, italicKeywordList);
288
- if (!preserveShortenedNames) {
289
- weightName = expandAbbreviations(weightName);
290
- }
291
- if ((weightName === "" || weightName.toLowerCase() === "roman") && ((_b = (_a = font == null ? void 0 : font.name) == null ? void 0 : _a.records) == null ? void 0 : _b.fullName)) {
292
- weightName = extractWeightFromFullName(font, title);
293
- if (!preserveShortenedNames) {
294
- weightName = expandAbbreviations(weightName);
295
- }
296
- }
297
- const variableFont = (font == null ? void 0 : font.variationAxes) && Object.keys(font.variationAxes).length > 0;
298
- let subfamilyName = ((_f = (_e = (_d = (_c = font == null ? void 0 : font.name) == null ? void 0 : _c.records) == null ? void 0 : _d.fullName) == null ? void 0 : _e.en) == null ? void 0 : _f.replace(title.trim(), "").trim()) || font.subfamilyName.trim().replace(title.trim(), "").trim();
299
- if (!preserveShortenedNames) {
300
- subfamilyName = expandAbbreviations(subfamilyName);
301
- }
302
- let fontTitle = font == null ? void 0 : font.fullName.trim();
303
- let style = (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular";
304
- const italicKW = processItalicKeywords(font, fontTitle, italicKeywordList);
305
- subfamilyName = processSubfamilyName(subfamilyName, weightKeywordList, italicKW, preserveShortenedNames);
306
- fontTitle = formatFontTitle(fontTitle, preserveShortenedNames);
307
- subfamilyName = subfamilyName === "" ? "Regular" : subfamilyName.replace(/\s+/g, " ").trim();
308
- if (subfamilyName !== "") {
309
- weightName = weightName.replace(`${subfamilyName} `, "").replace(` ${subfamilyName}`, "").trim();
310
- }
311
- if (variableFont) {
312
- if (!fontTitle.toLowerCase().includes("vf")) {
313
- fontTitle = fontTitle + " VF";
314
- }
315
- subfamilyName = "";
316
- }
317
- if (!(variableFont && fontTitle.toLowerCase().includes("italic"))) {
318
- fontTitle = addItalicToFontTitle(font, fontTitle, italicKW, style, preserveShortenedNames);
319
- }
320
- return { weightName, subfamilyName, fontTitle, style, italicKW, variableFont };
321
- };
322
- var extractWeightName = (font, italicKW) => {
323
- var _a, _b, _c, _d;
324
- let weightName = ((_b = (_a = font == null ? void 0 : font.name) == null ? void 0 : _a.records) == null ? void 0 : _b.preferredSubfamily) || ((_d = (_c = font == null ? void 0 : font.name) == null ? void 0 : _c.records) == null ? void 0 : _d.fontSubfamily);
325
- if (typeof weightName === "object") {
326
- weightName = (weightName == null ? void 0 : weightName.en) || (weightName.constructor === Object ? weightName[Object.keys(weightName)[0]] : null);
327
- }
328
- if ((font == null ? void 0 : font.variationAxes) && Object.keys(font.variationAxes).length > 0) {
329
- return "Variable";
330
- }
331
- if (italicKW) {
332
- italicKW.forEach((keyword) => {
333
- const kwRegex = new RegExp(`\\b${keyword.trim()}\\b`, "i");
334
- if (kwRegex.test(weightName)) {
335
- weightName = weightName.replace(kwRegex, "").trim();
336
- }
337
- });
338
- }
339
- return weightName == null ? void 0 : weightName.toString().replace("Italic", "").replace("It", "").replace("Slanted", "").replace("Slant", "").replace("Backslant", "").trim();
340
- };
341
- var extractWeightFromFullName = (font, title) => {
342
- var _a, _b;
343
- let weightName = (_b = (_a = font == null ? void 0 : font.name) == null ? void 0 : _a.records) == null ? void 0 : _b.fullName;
344
- weightName = (weightName == null ? void 0 : weightName.en) ? weightName.en : (weightName == null ? void 0 : weightName.constructor) === Object ? weightName[Object.keys(weightName)[0]] : weightName;
345
- weightName = weightName == null ? void 0 : weightName.replace(title + " ", "").replace(title, "").trim();
346
- weightName = weightName == null ? void 0 : weightName.replace("Italic", "").replace("It", "").replace("Slanted", "").replace("Slant", "").trim();
347
- return weightName;
348
- };
349
- var processSubfamilyName = (subfamilyName, weightKeywordList, italicKeywordList, preserveShortenedNames = false) => {
350
- weightKeywordList.forEach((keyword) => {
351
- const kwRegex = new RegExp(`\\b${keyword.trim()}\\b`, "i");
352
- if (kwRegex.test(subfamilyName)) {
353
- subfamilyName = subfamilyName.replace(kwRegex, "").trim();
354
- }
355
- subfamilyName = removeWeightNames(subfamilyName) || subfamilyName;
356
- if (!preserveShortenedNames) {
357
- subfamilyName = expandAbbreviations(subfamilyName);
358
- }
359
- });
360
- italicKeywordList.forEach((keyword) => {
361
- const kwRegex = new RegExp(`\\b${keyword.trim()}\\b`, "i");
362
- if (kwRegex.test(subfamilyName)) {
363
- subfamilyName = subfamilyName.replace(kwRegex, "").trim();
364
- }
365
- });
366
- return subfamilyName;
367
- };
368
- var processItalicKeywords = (font, fontTitle, italicKeywordList) => {
369
- let italicKW = [];
370
- italicKeywordList.forEach((keyword) => {
371
- const kw = keyword.trim();
372
- const kwRegex = new RegExp(`\\b${kw}\\b`, "i");
373
- if (kwRegex.test(fontTitle)) {
374
- fontTitle = fontTitle.replace(kwRegex, "").trim();
375
- italicKW.push(kw);
376
- }
377
- if ((font == null ? void 0 : font.fullName) && typeof font.fullName === "string" && font.fullName.toLowerCase().includes(kw.toLowerCase())) {
378
- if (!italicKW.includes(kw)) italicKW.push(kw);
379
- }
380
- });
381
- return italicKW;
382
- };
383
- var formatFontTitle = (fontTitle, preserveShortenedNames = false) => {
384
- const hasItalic = fontTitle.toLowerCase().includes("italic");
385
- fontTitle = fontTitle.replace(/-/g, " ");
386
- return fontTitle.replace(/\s+/g, " ").trim().split(" ").map((word) => {
387
- if (hasItalic && word.toLowerCase() === "italic") return "Italic";
388
- let fullWord = word;
389
- if (!preserveShortenedNames) {
390
- fullWord = reverseSpellingLookup(word) || word;
391
- }
392
- return fullWord[0].toUpperCase() + fullWord.slice(1);
393
- }).join(" ");
394
- };
395
- var addItalicToFontTitle = (font, fontTitle, italicKW, style, preserveShortenedNames = false) => {
396
- const hasItalicAngle = (font == null ? void 0 : font.italicAngle) !== 0;
397
- const hasItalicInName = font == null ? void 0 : font.fullName.toLowerCase().includes("italic");
398
- if (italicKW.length > 0 || hasItalicAngle || hasItalicInName) {
399
- italicKW = [...new Set(italicKW)];
400
- if (italicKW.length === 0 && (hasItalicAngle || hasItalicInName)) {
401
- italicKW = ["Italic"];
402
- }
403
- if (!preserveShortenedNames) {
404
- italicKW = italicKW.map((item) => reverseSpellingLookup(item) || item);
405
- }
406
- italicKW = [...new Set(italicKW)];
407
- if (italicKW.length > 1 && italicKW.includes("Italic")) {
408
- italicKW = ["Italic"];
409
- }
410
- const fontTitleLower = fontTitle.toLowerCase();
411
- italicKW = italicKW.filter((keyword) => {
412
- const keywordLower = keyword.toLowerCase();
413
- const kwRegex = new RegExp(`\\b${keywordLower}\\b`);
414
- const isSubstring = fontTitleLower.split(" ").some(
415
- (word) => word.includes(keywordLower) || keywordLower.includes(word)
416
- );
417
- return !kwRegex.test(fontTitleLower) && !isSubstring;
418
- });
419
- if (italicKW.length > 0) {
420
- fontTitle = fontTitle.trim() + " " + italicKW.join(" ");
421
- }
422
- }
423
- return fontTitle;
424
- };
425
- var createFontObject = (id, fontTitle, title, font, variableFont, weightName, subfamilyName, file, originalFilename = null) => {
426
- const fontObject = {
427
- _key: nanoid(),
428
- _id: id,
429
- title: fontTitle,
430
- slug: { _type: "slug", current: id },
431
- typefaceName: title,
432
- style: (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular",
433
- variableFont,
434
- weightName,
435
- subfamily: subfamilyName,
436
- normalWeight: true,
437
- weight: Number(determineWeight(font, weightName)),
438
- fileInput: {},
439
- files: [file],
440
- fontKit: font
441
- };
442
- if (originalFilename) {
443
- fontObject.originalFilename = originalFilename;
444
- }
445
- return fontObject;
446
- };
447
- var determineWeight = (font, weightName) => {
448
- var _a;
449
- if ((_a = font["OS/2"]) == null ? void 0 : _a.usWeightClass) {
450
- return Number(font["OS/2"].usWeightClass);
451
- }
452
- const wn = (weightName == null ? void 0 : weightName.toLowerCase()) || "";
453
- if (/hairline|extra thin|extrathin/.test(wn)) return 100;
454
- if (/thin|extra light|extralight/.test(wn)) return 200;
455
- if (/light|book/.test(wn)) return 300;
456
- if (/regular|normal/.test(wn)) return 400;
457
- if (/medium/.test(wn)) return 500;
458
- if (/semi bold|semibold/.test(wn)) return 600;
459
- if (/extra bold|extrabold/.test(wn)) return 800;
460
- if (/bold/.test(wn)) return 700;
461
- if (/black|ultra/.test(wn)) return 900;
462
- return 400;
463
- };
464
- var sortFontObjects = (fontsObjects) => {
465
- return Object.fromEntries(
466
- Object.entries(fontsObjects).sort((a, b) => {
467
- const weightA = Number(a[1].weight);
468
- const weightB = Number(b[1].weight);
469
- if (weightA === weightB) {
470
- if (a[1].style === "Regular" && b[1].style === "Italic") return -1;
471
- if (a[1].style === "Italic" && b[1].style === "Regular") return 1;
472
- return 0;
473
- }
474
- return weightA - weightB;
475
- })
476
- );
477
- };
478
- var logFontInfo = (id, fontTitle, font, fileName, subfamilyName, style, weightName, variableFont, italicKW) => {
479
- console.log("=== Font Info ====");
480
- console.log("Font id: ", id);
481
- console.log("Font title: ", fontTitle);
482
- console.log("Fontkit fullName: ", font.fullName);
483
- console.log("Fontkit family name: ", font.familyName);
484
- console.log("File name: ", fileName);
485
- console.log("Subfamily: ", subfamilyName);
486
- console.log("Style: ", style);
487
- console.log("Weight: ", weightName);
488
- console.log("Variable: ", variableFont);
489
- console.log("italicKW: ", italicKW);
490
- console.log("Font italic angle: ", (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular");
491
- console.log("=======");
492
- };
493
-
494
78
  // src/utils/uploadFontFiles.js
495
- import { nanoid as nanoid3 } from "nanoid";
496
-
497
- // src/utils/generateCssFile.js
498
- import base64 from "base-64";
499
- import { Buffer } from "buffer";
500
- import * as fontkit2 from "fontkit";
501
- function _arrayBufferToBase64(buffer) {
502
- var binary = "";
503
- var bytes = new Uint8Array(buffer);
504
- var len = bytes.byteLength;
505
- for (var i = 0; i < len; i++) {
506
- binary += String.fromCharCode(bytes[i]);
507
- }
508
- return base64.encode(binary);
509
- }
510
- function buildVFDescriptors(font) {
511
- const cssAxes = {};
512
- const skipped = [];
513
- try {
514
- const va = font.variationAxes;
515
- if (!va) return { descriptors: "", skipped: [] };
516
- for (const [tag, axis] of Object.entries(va)) {
517
- const lo = Math.min(axis.min, axis.max);
518
- const hi = Math.max(axis.min, axis.max);
519
- if (lo === hi) {
520
- skipped.push(tag);
521
- continue;
522
- }
523
- if (tag === "wght") {
524
- cssAxes["font-weight"] = `${lo} ${hi}`;
525
- } else if (tag === "wdth") {
526
- cssAxes["font-stretch"] = `${lo}% ${hi}%`;
527
- } else if (tag === "slnt") {
528
- cssAxes["font-style"] = `oblique ${lo}deg ${hi}deg`;
529
- } else if (tag === "ital" && !cssAxes["font-style"]) {
530
- if (hi > 0) cssAxes["font-style"] = "italic";
531
- else skipped.push(tag);
532
- } else {
533
- skipped.push(tag);
534
- }
535
- }
536
- } catch (_) {
537
- }
538
- const descriptors = Object.entries(cssAxes).map(([k, v]) => `${k}:${v}`).join(";") + (Object.keys(cssAxes).length ? ";" : "");
539
- return { descriptors, skipped };
540
- }
541
- var FALLBACK_STACKS = {
542
- "sans-serif": "local('Arial'), local('Helvetica Neue'), local('Roboto'), local('Liberation Sans')",
543
- "serif": "local('Georgia'), local('Times New Roman'), local('Times')",
544
- "monospace": "local('Courier New'), local('Courier'), local('Menlo'), local('Monaco')",
545
- // Display and script fonts have no universally suitable system fallback; default to sans-serif
546
- "default": "local('Arial'), local('Helvetica Neue'), local('Roboto'), local('Liberation Sans')"
547
- };
548
- var FAMILY_CLASS_MAP = {
549
- 1: "serif",
550
- 2: "serif",
551
- 3: "serif",
552
- 4: "serif",
553
- 5: "serif",
554
- 7: "serif",
555
- 8: "sans-serif"
556
- };
557
- var SERIF_NAMES = /jubilat|corundum|dapifer|birra|daith/i;
558
- var SANS_NAMES = /halyard|gamay|omnes|kit/i;
559
- function detectFontCategory(font, fontName) {
560
- var _a;
561
- if (fontName && SERIF_NAMES.test(fontName)) return "serif";
562
- if (fontName && SANS_NAMES.test(fontName)) return "sans-serif";
563
- try {
564
- const familyClass = ((_a = font["OS/2"]) == null ? void 0 : _a.sFamilyClass) ?? 0;
565
- const highByte = familyClass >> 8 & 255;
566
- return FAMILY_CLASS_MAP[highByte] ?? "default";
567
- } catch {
568
- return "default";
569
- }
570
- }
571
- function calcFallbackData(arrayBuffer, fontName) {
572
- try {
573
- let font = fontkit2.create(Buffer.from(arrayBuffer));
574
- let upm = font.unitsPerEm;
575
- let category = detectFontCategory(font, fontName);
576
- return {
577
- fallbackSrc: FALLBACK_STACKS[category],
578
- ascentOverride: `${(font.ascent / upm * 100).toFixed(2)}%`,
579
- descentOverride: `${(Math.abs(font.descent) / upm * 100).toFixed(2)}%`,
580
- lineGapOverride: `${(font.lineGap / upm * 100).toFixed(2)}%`
581
- };
582
- } catch (err) {
583
- console.error("Failed to extract fallback font data:", err);
584
- return {
585
- fallbackSrc: FALLBACK_STACKS["default"],
586
- ascentOverride: "100%",
587
- descentOverride: "0%",
588
- lineGapOverride: "0%"
589
- };
590
- }
591
- }
592
- async function generateCssFile({
593
- woff2File,
594
- fileInput,
595
- language = null,
596
- fileName,
597
- fontName,
598
- variableFont,
599
- weight,
600
- style = "Normal",
601
- client
602
- }) {
603
- try {
604
- let arrayBuffer = await woff2File.arrayBuffer();
605
- let b64 = _arrayBufferToBase64(arrayBuffer);
606
- let fontkitFont = fontkit2.create(Buffer.from(arrayBuffer));
607
- let { fallbackSrc, ascentOverride, descentOverride, lineGapOverride } = calcFallbackData(arrayBuffer, fontName);
608
- let cssString;
609
- if (variableFont) {
610
- let { descriptors, skipped } = buildVFDescriptors(fontkitFont);
611
- let skipComment = skipped.length ? `/* axes present but have no @font-face descriptor: ${skipped.join(", ")}` + (skipped.includes("opsz") ? " \u2014 add font-optical-sizing:auto to your element CSS" : "") + " */" : "";
612
- cssString = `${skipComment}@font-face{font-family:'${fontName}';src:url(data:application/font-woff2;charset=utf-8;base64,${b64})format('woff2-variations');${descriptors}font-display:swap;}`;
613
- } else {
614
- let fontStyle = style === "Italic" ? "italic" : "normal";
615
- cssString = `@font-face{font-family:'${fontName}';src:url(data:application/font-woff2;charset=utf-8;base64,${b64})format('woff2');font-weight:${weight};font-style:${fontStyle};font-display:swap;}`;
616
- }
617
- let fallbackCssString = `@font-face{font-family:'${fontName} Fallback';src:${fallbackSrc};ascent-override:${ascentOverride};descent-override:${descentOverride};line-gap-override:${lineGapOverride};}`;
618
- let uploadBuffer = Buffer.from(cssString + fallbackCssString, "utf-8");
619
- let doc = await client.assets.upload("file", uploadBuffer, { filename: fileName + ".css" });
620
- let newFileInput = language == null ? {
621
- ...fileInput,
622
- css: {
623
- _type: "file",
624
- asset: {
625
- _type: "reference",
626
- _ref: doc._id
627
- }
628
- }
629
- } : {
630
- ...fileInput,
631
- [language]: {
632
- ...fileInput[language],
633
- css: {
634
- _type: "file",
635
- asset: {
636
- _type: "reference",
637
- _ref: doc._id
638
- }
639
- }
640
- }
641
- };
642
- return newFileInput;
643
- } catch (err) {
644
- console.error(err);
645
- throw err;
646
- }
647
- }
648
-
649
- // src/utils/generateFontData.js
650
- import { Buffer as Buffer2 } from "buffer";
651
- import * as fontkit3 from "fontkit";
652
- async function generateFontData({ fileInput, url, fontKit, fontId, client, commit = true }) {
653
- var _a;
654
- if (fontId.startsWith("drafts.")) {
655
- fontId = fontId.replace("drafts.", "");
656
- }
657
- console.log("generate-font-data ", fontId, commit);
658
- let srcUrl;
659
- if (!url || url == null) {
660
- srcUrl = await client.fetch(`*[_id == $id]{url}`, { id: fileInput.ttf.asset._ref });
661
- console.log("src url ", srcUrl);
662
- srcUrl = srcUrl[0].url;
663
- } else {
664
- srcUrl = url;
665
- }
666
- let font = fontKit;
667
- if (!fontKit || fontKit == null) {
668
- let buffer = await fetch(srcUrl);
669
- buffer = await buffer.arrayBuffer();
670
- buffer = Buffer2.from(buffer);
671
- font = fontkit3.create(buffer);
672
- }
673
- let variableAxes;
674
- try {
675
- variableAxes = font.variationAxes;
676
- } catch (err) {
677
- console.error("err: ", err);
678
- }
679
- let variableInstances;
680
- try {
681
- variableInstances = font.namedVariations;
682
- } catch (e) {
683
- console.log("variable instances 2 error : ", e.message);
684
- let fvar = (_a = font == null ? void 0 : font.fvar) == null ? void 0 : _a.instance;
685
- fvar == null ? void 0 : fvar.forEach((fv) => {
686
- var _a2, _b, _c, _d, _e, _f;
687
- if ((fv == null ? void 0 : fv.nameID) === 2) fv.name = (_c = (_b = (_a2 = font == null ? void 0 : font._tables) == null ? void 0 : _a2.name) == null ? void 0 : _b.records) == null ? void 0 : _c.fontSubfamily;
688
- if ((fv == null ? void 0 : fv.nameID) === 17) fv.name = (_f = (_e = (_d = font == null ? void 0 : font._tables) == null ? void 0 : _d.name) == null ? void 0 : _e.records) == null ? void 0 : _f.preferredSubfamily;
689
- });
690
- variableInstances = {};
691
- fvar.forEach((v) => {
692
- let key = v.name;
693
- if (typeof key === "object") {
694
- key = Object.values(key)[0];
695
- }
696
- let coordKeys = Object.keys(variableAxes);
697
- let coord = {};
698
- coordKeys.forEach((ck, ckIndex) => {
699
- coord[ck] = v.coord[ckIndex];
700
- });
701
- variableInstances[key] = coord;
702
- });
703
- }
704
- console.log("font : ", font);
705
- console.log("variable instances : ", variableInstances);
706
- console.log("variable axes : ", variableAxes);
707
- let opentypeFeatures = font.availableFeatures;
708
- let glyphCount = font.numGlyphs;
709
- let characterSet = font.characterSet;
710
- let metaData = {
711
- postscriptName: font.postscriptName,
712
- fullName: font.fullName,
713
- familyName: font.familyName,
714
- subfamilyName: font.subfamilyName,
715
- copyright: font.copyright,
716
- version: font.version.replaceAll("Version ", ""),
717
- genDate: (/* @__PURE__ */ new Date()).toISOString()
718
- };
719
- let metrics = {
720
- unitsPerEm: font.unitsPerEm,
721
- ascender: font.ascent,
722
- descender: font.descent,
723
- lineGap: font.lineGap,
724
- underlinePosition: font.underlinePosition,
725
- underlineThickness: font.underlineThickness,
726
- italicAngle: font.italicAngle,
727
- capHeight: font.capHeight,
728
- xHeight: font.xHeight,
729
- boundingBox: font.bbox
730
- };
731
- let variableFont = false;
732
- if (variableAxes && variableAxes != null && Object.keys(variableAxes).length > 0 && variableInstances && variableInstances != null && Object.keys(variableInstances).length > 0) {
733
- variableFont = true;
734
- }
735
- let patch = {
736
- metrics,
737
- metaData,
738
- variableFont,
739
- variableAxes: JSON.stringify(variableAxes),
740
- variableInstances: JSON.stringify(variableInstances),
741
- glyphCount,
742
- opentypeFeatures: { chars: opentypeFeatures },
743
- characterSet: { chars: characterSet }
744
- };
745
- console.log("data : ", patch);
746
- if (commit) patch = await client.patch(fontId).set(patch).commit({ autoGenerateArrayKeys: true });
747
- return patch;
748
- }
749
-
750
- // src/utils/parseVariableFontInstances.js
751
- import { nanoid as nanoid2 } from "nanoid";
752
- var parseVariableFontInstances = async (font, client) => {
753
- if (!font.variableFont || !font.variableInstances) return [];
754
- let variableInstances;
755
- try {
756
- variableInstances = JSON.parse(font.variableInstances);
757
- } catch (err) {
758
- console.error("Error parsing variable instances:", err);
759
- variableInstances = {};
760
- }
761
- if (Object.keys(variableInstances).length === 0) return [];
762
- let staticFonts;
763
- const typeface = await client.fetch(
764
- `*[_type == 'typeface' && title == $typefaceName][0]{
765
- 'fonts': styles.fonts[]-> {
766
- _id,
767
- title,
768
- subfamily,
769
- style,
770
- weight,
771
- weightName,
772
- metaData,
773
- variableFont
774
- }
775
- }`,
776
- { typefaceName: font.typefaceName }
777
- );
778
- if ((typeface == null ? void 0 : typeface.fonts) && typeface.fonts.length > 0) {
779
- staticFonts = typeface.fonts.filter((f) => !f.variableFont);
780
- console.log("Using curated typeface fonts list:", staticFonts.length, "fonts");
781
- } else {
782
- console.warn("Typeface not found or no fonts in curated list, falling back to all fonts query");
783
- staticFonts = await client.fetch(
784
- `*[_type == 'font' && typefaceName == $typefaceName && variableFont != true]{
785
- _id,
786
- title,
787
- subfamily,
788
- style,
789
- weight,
790
- weightName,
791
- metaData
792
- }`,
793
- { typefaceName: font.typefaceName }
794
- );
795
- }
796
- console.log("Variable font instances:", Object.keys(variableInstances));
797
- console.log("Available static fonts:", staticFonts.map((sf) => sf.title));
798
- const instanceMappings = [];
799
- Object.keys(variableInstances).forEach((instanceName) => {
800
- let matchingFont = null;
801
- matchingFont = staticFonts.find((sf) => sf.title === instanceName);
802
- if (!matchingFont && staticFonts.some((sf) => {
803
- var _a;
804
- return (_a = sf.metaData) == null ? void 0 : _a.fullName;
805
- })) {
806
- matchingFont = staticFonts.find((sf) => {
807
- var _a, _b, _c, _d;
808
- if (!((_a = sf.metaData) == null ? void 0 : _a.fullName)) return false;
809
- let fullName = sf.metaData.fullName;
810
- const WORDS_TO_REMOVE = ["VF", "var", "variable", "VAR", "vf"];
811
- const variableName = (_c = (_b = font.metaData) == null ? void 0 : _b.familyName) == null ? void 0 : _c.replace(new RegExp(`\\b(${WORDS_TO_REMOVE.join("|")})\\b`, "gi"), "").replace(/\s{2,}/g, " ").trim();
812
- if (variableName && fullName.startsWith(variableName)) {
813
- fullName = fullName.substring(variableName.length).trim();
814
- }
815
- if (variableName) {
816
- const words = variableName.split(/\s+/).map((w) => w.trim()).filter(Boolean);
817
- if (words.length > 0) {
818
- const regex = new RegExp(`\\b(${words.join("|")})\\b`, "gi");
819
- const stripped = fullName.replace(regex, "").replace(/\s{2,}/g, " ").trim();
820
- if (stripped !== "") fullName = stripped;
821
- }
822
- }
823
- if (fullName.startsWith(font.typefaceName)) {
824
- fullName = fullName.substring(font.typefaceName.length).trim();
825
- }
826
- if (((_d = sf.style) == null ? void 0 : _d.toLowerCase()) === "italic" && !fullName.toLowerCase().endsWith("italic") && !fullName.toLowerCase().endsWith("slanted")) {
827
- fullName = fullName + " Italic";
828
- }
829
- if (fullName.trim().toLowerCase().endsWith("regular")) {
830
- if (instanceName.trim().toLowerCase() + " regular" === fullName.trim().toLowerCase()) return true;
831
- }
832
- if (fullName.trim().toLowerCase().startsWith("regular")) {
833
- if ("regular " + instanceName.trim().toLowerCase() === fullName.trim().toLowerCase()) return true;
834
- }
835
- if (fullName.trim().toLowerCase().endsWith("italic")) {
836
- if (instanceName.trim().toLowerCase().endsWith("italic")) {
837
- const k = instanceName.trim().toLowerCase().slice(0, -6).trim() + " regular italic";
838
- if (k === fullName.trim().toLowerCase()) return true;
839
- }
840
- }
841
- return fullName.trim().toLowerCase() === instanceName.trim().toLowerCase();
842
- });
843
- }
844
- if (!matchingFont) {
845
- const expandedName = instanceName.split(" ").map((word) => expandAbbreviations(word)).join(" ");
846
- matchingFont = staticFonts.find((sf) => {
847
- const nameWithoutTypeface = sf.title.replace(font.typefaceName, "").trim();
848
- return nameWithoutTypeface === expandedName;
849
- });
850
- }
851
- if (!matchingFont) {
852
- const isItalic = instanceName.toLowerCase().includes("italic");
853
- const weightTerms = [
854
- { term: "thin", weight: "100" },
855
- { term: "extralight", weight: "200" },
856
- { term: "extra light", weight: "200" },
857
- { term: "light", weight: "300" },
858
- { term: "regular", weight: "400" },
859
- { term: "normal", weight: "400" },
860
- { term: "medium", weight: "500" },
861
- { term: "semibold", weight: "600" },
862
- { term: "semi bold", weight: "600" },
863
- { term: "bold", weight: "700" },
864
- { term: "extrabold", weight: "800" },
865
- { term: "extra bold", weight: "800" },
866
- { term: "black", weight: "900" },
867
- { term: "heavy", weight: "900" }
868
- ];
869
- let instanceWeight = "400";
870
- for (const { term, weight } of weightTerms) {
871
- if (instanceName.toLowerCase().includes(term)) {
872
- instanceWeight = weight;
873
- break;
874
- }
875
- }
876
- matchingFont = staticFonts.find(
877
- (sf) => sf.weight === instanceWeight && (isItalic && sf.style === "Italic" || !isItalic && sf.style === "Regular")
878
- );
879
- }
880
- if (!matchingFont) {
881
- matchingFont = staticFonts.find((sf) => {
882
- if (!sf.weightName) return false;
883
- const cleanInstance = instanceName.toLowerCase().replace(/italic/i, "").trim();
884
- const cleanWeight = sf.weightName.toLowerCase().replace(/italic/i, "").trim();
885
- return cleanInstance === cleanWeight;
886
- });
887
- }
888
- if (!matchingFont && staticFonts.some((sf) => {
889
- var _a;
890
- return (_a = sf.metaData) == null ? void 0 : _a.fullName;
891
- })) {
892
- matchingFont = staticFonts.find((sf) => {
893
- var _a;
894
- if (!((_a = sf.metaData) == null ? void 0 : _a.fullName)) return false;
895
- const typefacePattern = new RegExp(`^${font.typefaceName}\\s+`, "i");
896
- const stylePart = sf.metaData.fullName.replace(typefacePattern, "").trim();
897
- return instanceName.toLowerCase() === stylePart.toLowerCase();
898
- });
899
- }
900
- console.log(`Instance "${instanceName}" matched with:`, matchingFont ? matchingFont.title : "No match found");
901
- instanceMappings.push({
902
- key: instanceName,
903
- value: matchingFont ? { _type: "reference", _ref: matchingFont._id, _weak: true } : null,
904
- _key: nanoid2()
905
- });
906
- });
907
- return instanceMappings;
908
- };
909
- var parseVariableFontInstances_default = parseVariableFontInstances;
910
-
911
- // src/utils/uploadFontFiles.js
912
- var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, stylesObject, setStatus, setError) => {
79
+ import { nanoid } from "nanoid";
80
+ var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, stylesObject, setStatus, setError, preserveFileNames = false) => {
913
81
  let fontRefs = [];
914
82
  let variableRefs = [];
915
83
  let failedFiles = [];
@@ -926,10 +94,18 @@ var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, styl
926
94
  for (let j = 0; j < files.length; j++) {
927
95
  const file = files[j];
928
96
  const fileType = determineFileType(file);
929
- console.log(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Uploading font file: ${fontObject._id}.${fileType}`);
930
- setStatus(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Uploading font file: ${fontObject._id}.${fileType}`);
97
+ const assetFilename = preserveFileNames && fontObject.originalFilename ? `${fontObject.originalFilename}.${fileType}` : `${fontObject._id}.${fileType}`;
98
+ console.log(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Uploading font file: ${assetFilename}`);
99
+ setStatus(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Uploading font file: ${assetFilename}`);
931
100
  try {
932
- const baseAsset = await client.assets.upload("file", file, { filename: fontObject._id + "." + fileType });
101
+ const baseAsset = await client.assets.upload("file", file, { filename: assetFilename });
102
+ if (preserveFileNames && baseAsset.originalFilename !== assetFilename) {
103
+ try {
104
+ await client.patch(baseAsset._id).set({ originalFilename: assetFilename }).commit();
105
+ } catch (renameErr) {
106
+ console.warn("Could not rename asset \u2014 permissions may be restricted:", renameErr.message);
107
+ }
108
+ }
933
109
  newFileInput[fileType] = {
934
110
  _type: "file",
935
111
  asset: { _ref: baseAsset._id, _type: "reference" }
@@ -961,7 +137,7 @@ var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, styl
961
137
  Object.assign(fontObject, metadata);
962
138
  }
963
139
  } catch (err) {
964
- console.error("Error uploading font: ", fontObject.title, err.message);
140
+ console.error("Error uploading font:", fontObject.title, err.message);
965
141
  setStatus("Error uploading font: " + err.message);
966
142
  setError(true);
967
143
  failedFiles.push({ name: file.name, fk: fontKit });
@@ -997,22 +173,68 @@ var determineFileType = (file) => {
997
173
  if (file.name.endsWith(".svg")) return "svg";
998
174
  return "";
999
175
  };
1000
- var createOrUpdateFontDocument = async (font, client, setError) => {
176
+ var resolveExistingFont2 = async (font, client) => {
177
+ const result = { exact: null, candidates: [], recommendation: "create" };
1001
178
  try {
1002
- const existingFont = await client.fetch(
1003
- `*[_type == 'font' && _id == $fontId]{
1004
- fileInput,
1005
- description,
1006
- metaData,
1007
- metrics,
1008
- opentypeFeatures,
1009
- characterSet,
1010
- subfamily,
1011
- scriptFileInput,
1012
- variableInstanceReferences
179
+ const idMatches = await client.fetch(
180
+ `*[_type == 'font' && (_id == $id || _id == $draftId || slug.current == $id)]{
181
+ _id, title, weight, style, weightName, typefaceName, subfamily, variableFont,
182
+ fileInput, description, metaData, metrics, opentypeFeatures, characterSet,
183
+ scriptFileInput, variableInstanceReferences
1013
184
  }`,
1014
- { fontId: font._id }
1015
- ).then((res) => res[0]);
185
+ { id: font._id, draftId: `drafts.${font._id}` }
186
+ );
187
+ if (idMatches.length > 0) {
188
+ result.exact = idMatches[0];
189
+ result.recommendation = "use-exact";
190
+ return result;
191
+ }
192
+ const subfamily = font.subfamily || "";
193
+ const contentMatches = await client.fetch(
194
+ `*[_type == 'font'
195
+ && lower(typefaceName) == lower($typefaceName)
196
+ && lower(weightName) == lower($weightName)
197
+ && lower(style) == lower($style)
198
+ && (variableFont == $variableFont || (!defined(variableFont) && $variableFont == false))
199
+ && (
200
+ lower(coalesce(subfamily, '')) == lower($subfamily)
201
+ || (lower(coalesce(subfamily, '')) in ['', 'regular'] && lower($subfamily) in ['', 'regular'])
202
+ )
203
+ ]{
204
+ _id, title, weight, style, weightName, typefaceName, subfamily, variableFont,
205
+ fileInput, description, metaData, metrics, opentypeFeatures, characterSet,
206
+ scriptFileInput, variableInstanceReferences
207
+ }`,
208
+ {
209
+ typefaceName: font.typefaceName,
210
+ weightName: font.weightName || "",
211
+ style: font.style || "Regular",
212
+ variableFont: font.variableFont || false,
213
+ subfamily: subfamily === "" ? "regular" : subfamily
214
+ }
215
+ );
216
+ if (contentMatches.length === 1) {
217
+ result.candidates = contentMatches;
218
+ result.recommendation = "use-candidate";
219
+ return result;
220
+ }
221
+ if (contentMatches.length > 1) {
222
+ result.candidates = contentMatches;
223
+ result.recommendation = "ambiguous";
224
+ console.warn(
225
+ `Ambiguous font match for "${font.title}" \u2014 ${contentMatches.length} candidates found:`,
226
+ contentMatches.map((c) => c._id)
227
+ );
228
+ return result;
229
+ }
230
+ } catch (err) {
231
+ console.error("Error resolving existing font:", font._id, err.message);
232
+ }
233
+ return result;
234
+ };
235
+ var createOrUpdateFontDocument = async (font, client, setError) => {
236
+ try {
237
+ const { exact, candidates, recommendation } = await resolveExistingFont2(font, client);
1016
238
  const { files, fontKit } = font;
1017
239
  delete font.files;
1018
240
  delete font.fontKit;
@@ -1024,19 +246,23 @@ var createOrUpdateFontDocument = async (font, client, setError) => {
1024
246
  }
1025
247
  }
1026
248
  let fontResponse;
1027
- if (existingFont) {
1028
- fontResponse = await updateExistingFont(font, existingFont, client);
249
+ if (recommendation === "use-exact" && exact) {
250
+ fontResponse = await updateExistingFont(font, exact, client);
251
+ } else if (recommendation === "use-candidate" && candidates.length === 1) {
252
+ console.log(`Content-match: reassigning "${font._id}" \u2192 "${candidates[0]._id}"`);
253
+ font._id = candidates[0]._id;
254
+ fontResponse = await updateExistingFont(font, candidates[0], client);
1029
255
  } else {
1030
256
  fontResponse = await createNewFont(font, client);
1031
257
  }
1032
258
  return {
1033
- _key: nanoid3(),
259
+ _key: nanoid(),
1034
260
  _type: "reference",
1035
261
  _ref: fontResponse._id,
1036
262
  _weak: true
1037
263
  };
1038
264
  } catch (e) {
1039
- console.error("Error creating font: ", font.title, font.subfamily, e);
265
+ console.error("Error creating font:", font.title, font.subfamily, e);
1040
266
  setError(true);
1041
267
  return null;
1042
268
  }
@@ -1058,7 +284,7 @@ var updateExistingFont = async (font, existingFont, client) => {
1058
284
  if (font.variableFont && (existingFont == null ? void 0 : existingFont.variableInstanceReferences) && (!font.variableInstanceReferences || font.variableInstanceReferences.length === 0)) {
1059
285
  font.variableInstanceReferences = existingFont.variableInstanceReferences;
1060
286
  }
1061
- console.log("Updating existing font: ", font._id, font.title);
287
+ console.log("Updating existing font:", font._id, font.title);
1062
288
  const patchObject = {
1063
289
  fileInput: font.fileInput,
1064
290
  subfamily: font.subfamily,
@@ -1070,10 +296,10 @@ var updateExistingFont = async (font, existingFont, client) => {
1070
296
  return await client.patch(font._id).set(patchObject).commit();
1071
297
  };
1072
298
  var createNewFont = async (font, client) => {
1073
- console.log("Creating new font: ", font._id, font.title);
299
+ console.log("Creating new font:", font._id, font.title);
1074
300
  if (font.metaData) cleanMetadataValues(font);
1075
301
  const newDocument = {
1076
- _key: nanoid3(),
302
+ _key: nanoid(),
1077
303
  _id: font._id,
1078
304
  _type: "font",
1079
305
  ...font
@@ -1086,7 +312,7 @@ var cleanMetadataValues = (font) => {
1086
312
  if (font.metaData[key] == null) {
1087
313
  font.metaData[key] = "";
1088
314
  } else {
1089
- font.metaData[key] = font.metaData[key].replace(/[-]/g, "");
315
+ font.metaData[key] = font.metaData[key].replace(/[\x00-\x1f]/g, "");
1090
316
  }
1091
317
  });
1092
318
  };
@@ -1110,98 +336,7 @@ var addToVariableRefs = (fontRef, font, variableRefs, stylesObject) => {
1110
336
  }
1111
337
  };
1112
338
 
1113
- // src/utils/updateTypefaceDocument.js
1114
- import { nanoid as nanoid4 } from "nanoid";
1115
- var updateTypefaceDocument = async (doc_id, fontRefs, variableRefs, subfamilies, uniqueSubfamilies, subfamiliesArray, preferredStyleRef, newPreferredStyle, stylesObject, client, setStatus, setError) => {
1116
- console.log("Updating typeface document with new fonts:", { fontRefs, variableRefs, subfamilies, uniqueSubfamilies });
1117
- setStatus("Updating typeface references...");
1118
- let patch = {
1119
- styles: {
1120
- fonts: stylesObject.fonts ? [...stylesObject.fonts, ...fontRefs] : [...fontRefs],
1121
- subfamilies: uniqueSubfamilies.length > 1 ? uniqueSubfamilies : [],
1122
- variableFont: (stylesObject == null ? void 0 : stylesObject.variableFont) ? [...stylesObject.variableFont, ...variableRefs] : [...variableRefs]
1123
- }
1124
- };
1125
- setStatus("Organising font subfamilies...");
1126
- subfamiliesArray = subfamiliesArray || [];
1127
- uniqueSubfamilies.forEach((subfamilyName) => {
1128
- if (!subfamiliesArray.find((sf) => sf.title === subfamilyName)) {
1129
- subfamiliesArray.push({
1130
- title: subfamilyName,
1131
- _key: nanoid4(),
1132
- _type: "object",
1133
- fonts: []
1134
- });
1135
- }
1136
- });
1137
- if (subfamiliesArray.length > 0) {
1138
- Object.entries(subfamilies).forEach(([id, subfamilyName]) => {
1139
- if (id.toLowerCase().includes("vf")) return;
1140
- const subfamilyIndex = subfamiliesArray.findIndex((sf) => sf.title === subfamilyName);
1141
- if (subfamilyIndex !== -1) {
1142
- subfamiliesArray[subfamilyIndex].fonts.push({
1143
- _ref: id,
1144
- _key: nanoid4(),
1145
- _type: "reference",
1146
- _weak: true
1147
- });
1148
- }
1149
- });
1150
- subfamiliesArray = subfamiliesArray.map((subfamily) => ({
1151
- ...subfamily,
1152
- fonts: subfamily.fonts.filter(
1153
- (font, index, self) => index === self.findIndex((f) => f._ref === font._ref)
1154
- )
1155
- }));
1156
- }
1157
- patch.styles.subfamilies = subfamiliesArray;
1158
- await updatePreferredStyle(doc_id, preferredStyleRef, newPreferredStyle, patch, client);
1159
- console.log("doc_id: ", doc_id);
1160
- console.log("Typeface patch: ", patch);
1161
- console.log("New preferred style: ", newPreferredStyle);
1162
- console.log("SubfamiliesArray:", subfamiliesArray);
1163
- try {
1164
- await client.patch(doc_id).set(patch).commit();
1165
- console.log(`Updated document: ${doc_id}`);
1166
- if (doc_id.startsWith("drafts.")) {
1167
- await updatePublishedDocument(doc_id, patch, client);
1168
- }
1169
- } catch (err) {
1170
- console.error("Error updating document:", err.message);
1171
- setStatus("Error updating typeface");
1172
- setError(true);
1173
- }
1174
- };
1175
- var updatePreferredStyle = async (doc_id, preferredStyleRef, newPreferredStyle, patch, client) => {
1176
- var _a;
1177
- if ((preferredStyleRef == null ? void 0 : preferredStyleRef._ref) && preferredStyleRef._ref !== "" && preferredStyleRef._ref !== null && newPreferredStyle._ref !== preferredStyleRef._ref) {
1178
- const prefStyleResult = await client.fetch(
1179
- `*[_id == $docId]{ preferredStyle->{ weight, style, _id } }`,
1180
- { docId: doc_id }
1181
- );
1182
- const prefStyle = (_a = prefStyleResult[0]) == null ? void 0 : _a.preferredStyle;
1183
- if (!(prefStyle == null ? void 0 : prefStyle.weight) || prefStyle === null || prefStyle.weight < newPreferredStyle.weight) {
1184
- patch.preferredStyle = {
1185
- _type: "reference",
1186
- _ref: newPreferredStyle._ref,
1187
- _weak: true
1188
- };
1189
- }
1190
- }
1191
- };
1192
- var updatePublishedDocument = async (doc_id, patch, client) => {
1193
- const publishedId = doc_id.replace("drafts.", "");
1194
- const publishedDoc = await client.fetch(`*[_id == $publishedId]`, { publishedId }).then((res) => res[0]);
1195
- if (publishedDoc) {
1196
- await client.patch(publishedId).set(patch).commit();
1197
- console.log(`Updated published document: ${publishedId}`);
1198
- } else {
1199
- console.log(`No published document found for ${publishedId}, skipping`);
1200
- }
1201
- };
1202
-
1203
339
  // src/utils/regenerateFontData.js
1204
- import * as fontkit4 from "fontkit";
1205
340
  var renameFontDocuments = async ({
1206
341
  client,
1207
342
  typefaceName,
@@ -1271,7 +406,7 @@ var renameFontDocuments = async ({
1271
406
  file = await res.blob();
1272
407
  }
1273
408
  const fontBuffer = await readFontFile(file);
1274
- const font = fontkit4.create(fontBuffer);
409
+ const font = await parseFont(fontBuffer, `${fontDoc._id}.ttf`);
1275
410
  const { weightName, subfamilyName, fontTitle } = extractFontMetadata(
1276
411
  font,
1277
412
  typefaceName,
@@ -1389,24 +524,10 @@ var StatusDisplay = ({ status, error, action }) => {
1389
524
  };
1390
525
  var StatusDisplay_default = StatusDisplay;
1391
526
 
1392
- // src/components/PriceInput.jsx
1393
- import React2 from "react";
1394
- import { Flex as Flex2, Text as Text2 } from "@sanity/ui";
1395
- var PriceInput = ({ inputPrice, handleInputChange }) => /* @__PURE__ */ React2.createElement(Flex2, { align: "center", gap: 2 }, /* @__PURE__ */ React2.createElement(Text2, { size: 1, muted: true }, "Price:"), /* @__PURE__ */ React2.createElement(Text2, { size: 1, muted: true }, "$"), /* @__PURE__ */ React2.createElement(
1396
- "input",
1397
- {
1398
- value: inputPrice,
1399
- onChange: handleInputChange,
1400
- type: "number",
1401
- style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
1402
- }
1403
- ), /* @__PURE__ */ React2.createElement(Text2, { size: 1, muted: true }, "per style"));
1404
- var PriceInput_default = PriceInput;
1405
-
1406
527
  // src/components/RegenerateSubfamiliesComponent.jsx
1407
- import React3, { useState } from "react";
1408
- import { nanoid as nanoid5 } from "nanoid";
1409
- import { Button, Text as Text3, Stack, Box } from "@sanity/ui";
528
+ import React2, { useState } from "react";
529
+ import { nanoid as nanoid2 } from "nanoid";
530
+ import { Button, Text as Text2, Stack, Box } from "@sanity/ui";
1410
531
  import { useFormValue } from "sanity";
1411
532
  var RegenerateSubfamiliesComponent = () => {
1412
533
  const [status, setStatus] = useState("");
@@ -1420,7 +541,7 @@ var RegenerateSubfamiliesComponent = () => {
1420
541
  const handleClick = () => {
1421
542
  regenerateSubfamilies({ title, stylesObject, slug, doc_id, client, setStatus, setReady, setError });
1422
543
  };
1423
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, status && /* @__PURE__ */ React3.createElement(Box, { padding: 3, style: { borderRadius: "4px", marginBottom: "10px" } }, /* @__PURE__ */ React3.createElement(Text3, { size: 1, style: { color: error ? "red" : "green" } }, status)), /* @__PURE__ */ React3.createElement(Button, { mode: "ghost", tone: "primary", width: "fill", padding: 3, onClick: handleClick, disabled: !ready }, /* @__PURE__ */ React3.createElement(Stack, { space: 2 }, /* @__PURE__ */ React3.createElement(Text3, { align: "center" }, "Regenerate Subfamilies"))));
544
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, status && /* @__PURE__ */ React2.createElement(Box, { padding: 3, style: { borderRadius: "4px", marginBottom: "10px" } }, /* @__PURE__ */ React2.createElement(Text2, { size: 1, style: { color: error ? "red" : "green" } }, status)), /* @__PURE__ */ React2.createElement(Button, { mode: "ghost", tone: "primary", width: "fill", padding: 3, onClick: handleClick, disabled: !ready }, /* @__PURE__ */ React2.createElement(Stack, { space: 2 }, /* @__PURE__ */ React2.createElement(Text2, { align: "center" }, "Regenerate Subfamilies"))));
1424
545
  };
1425
546
  var regenerateSubfamilies = async ({ title, stylesObject, slug, doc_id, client, setStatus, setReady, setError }) => {
1426
547
  try {
@@ -1476,11 +597,11 @@ var groupFontsBySubfamily = (fonts) => {
1476
597
  var createSubfamiliesArray = (subfamilies) => {
1477
598
  return Object.keys(subfamilies).map((subfamilyName) => ({
1478
599
  title: subfamilyName,
1479
- _key: nanoid5(),
600
+ _key: nanoid2(),
1480
601
  _type: "object",
1481
602
  fonts: subfamilies[subfamilyName].map((font) => ({
1482
603
  _ref: font._id,
1483
- _key: nanoid5(),
604
+ _key: nanoid2(),
1484
605
  _type: "reference",
1485
606
  _weak: true
1486
607
  }))
@@ -1514,6 +635,7 @@ var updateTypefaceSubfamilies = async (doc_id, stylesObject, newSubfamiliesArray
1514
635
  };
1515
636
 
1516
637
  // src/components/BatchUploadFonts.jsx
638
+ var UploadModal2 = lazy(() => import("./UploadModal-NME2W53V.mjs"));
1517
639
  var ACCEPTED_EXTENSIONS = ["ttf", "otf", "woff", "woff2", "eot", "svg"];
1518
640
  var formatElapsed = (s) => {
1519
641
  const m = Math.floor(s / 60);
@@ -1531,6 +653,7 @@ var BatchUploadFonts = () => {
1531
653
  const [pendingFiles, setPendingFiles] = useState2([]);
1532
654
  const [isDragging, setIsDragging] = useState2(false);
1533
655
  const [elapsedSeconds, setElapsedSeconds] = useState2(0);
656
+ const [showUploadModal, setShowUploadModal] = useState2(false);
1534
657
  const fileInputRef = useRef(null);
1535
658
  const elapsedTimerRef = useRef(null);
1536
659
  const wakeLockRef = useRef(null);
@@ -1670,7 +793,8 @@ var BatchUploadFonts = () => {
1670
793
  inputPrice,
1671
794
  stylesObject,
1672
795
  setStatus,
1673
- setError
796
+ setError,
797
+ preserveFileNames
1674
798
  );
1675
799
  await updateTypefaceDocument(
1676
800
  doc_id,
@@ -1822,17 +946,17 @@ var BatchUploadFonts = () => {
1822
946
  setError(false);
1823
947
  setStatus("ready");
1824
948
  };
1825
- const renderTooltipLabel = (label, description) => /* @__PURE__ */ React4.createElement(
949
+ const renderTooltipLabel = (label, description) => /* @__PURE__ */ React3.createElement(
1826
950
  Tooltip,
1827
951
  {
1828
- content: /* @__PURE__ */ React4.createElement(Box2, { padding: 2, style: { maxWidth: 260 } }, /* @__PURE__ */ React4.createElement(Text4, { size: 1, style: { lineHeight: 1.6 } }, description)),
952
+ content: /* @__PURE__ */ React3.createElement(Box2, { padding: 2, style: { maxWidth: 260 } }, /* @__PURE__ */ React3.createElement(Text3, { size: 1, style: { lineHeight: 1.6 } }, description)),
1829
953
  placement: "top",
1830
954
  portal: true
1831
955
  },
1832
- /* @__PURE__ */ React4.createElement(Flex3, { align: "center", gap: 1, style: { cursor: "default" } }, /* @__PURE__ */ React4.createElement(Label, null, label), /* @__PURE__ */ React4.createElement(InfoOutlineIcon, { style: { opacity: 0.5, display: "block" } }))
956
+ /* @__PURE__ */ React3.createElement(Flex2, { align: "center", gap: 1, style: { cursor: "default" } }, /* @__PURE__ */ React3.createElement(Label, null, label), /* @__PURE__ */ React3.createElement(InfoOutlineIcon, { style: { opacity: 0.5, display: "block" } }))
1833
957
  );
1834
- const renderProcessing = () => /* @__PURE__ */ React4.createElement(Stack2, { space: 3, paddingY: 2 }, /* @__PURE__ */ React4.createElement(Flex3, { align: "center", gap: 3 }, /* @__PURE__ */ React4.createElement(Spinner, null), /* @__PURE__ */ React4.createElement(Text4, { size: 1, muted: true }, status)), /* @__PURE__ */ React4.createElement(Card, { tone: "caution", border: true, radius: 2, padding: 2 }, /* @__PURE__ */ React4.createElement(Flex3, { align: "center", justify: "space-between", gap: 2 }, /* @__PURE__ */ React4.createElement(Flex3, { align: "center", gap: 2 }, /* @__PURE__ */ React4.createElement(WarningOutlineIcon, { style: { flexShrink: 0 } }), /* @__PURE__ */ React4.createElement(Text4, { size: 1, weight: "semibold" }, "Do not close or reload this tab")), /* @__PURE__ */ React4.createElement(Text4, { size: 1, muted: true, style: { flexShrink: 0 } }, formatElapsed(elapsedSeconds)))));
1835
- const renderDropZone = () => /* @__PURE__ */ React4.createElement(
958
+ const renderProcessing = () => /* @__PURE__ */ React3.createElement(Stack2, { space: 3, paddingY: 2 }, /* @__PURE__ */ React3.createElement(Flex2, { align: "center", gap: 3 }, /* @__PURE__ */ React3.createElement(Spinner, null), /* @__PURE__ */ React3.createElement(Text3, { size: 1, muted: true }, status)), /* @__PURE__ */ React3.createElement(Card, { tone: "caution", border: true, radius: 2, padding: 2 }, /* @__PURE__ */ React3.createElement(Flex2, { align: "center", justify: "space-between", gap: 2 }, /* @__PURE__ */ React3.createElement(Flex2, { align: "center", gap: 2 }, /* @__PURE__ */ React3.createElement(WarningOutlineIcon, { style: { flexShrink: 0 } }), /* @__PURE__ */ React3.createElement(Text3, { size: 1, weight: "semibold" }, "Do not close or reload this tab")), /* @__PURE__ */ React3.createElement(Text3, { size: 1, muted: true, style: { flexShrink: 0 } }, formatElapsed(elapsedSeconds)))));
959
+ const renderDropZone = () => /* @__PURE__ */ React3.createElement(
1836
960
  Box2,
1837
961
  {
1838
962
  onDragEnter: handleDragEnter,
@@ -1849,7 +973,7 @@ var BatchUploadFonts = () => {
1849
973
  cursor: "default"
1850
974
  }
1851
975
  },
1852
- /* @__PURE__ */ React4.createElement(
976
+ /* @__PURE__ */ React3.createElement(
1853
977
  "input",
1854
978
  {
1855
979
  ref: fileInputRef,
@@ -1860,7 +984,7 @@ var BatchUploadFonts = () => {
1860
984
  onChange: handleFileSelect
1861
985
  }
1862
986
  ),
1863
- /* @__PURE__ */ React4.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React4.createElement(Text4, { size: 1, muted: true }, isDragging ? "Release to add files" : "Drop font files here"), /* @__PURE__ */ React4.createElement(Flex3, { justify: "center" }, /* @__PURE__ */ React4.createElement(
987
+ /* @__PURE__ */ React3.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React3.createElement(Text3, { size: 1, muted: true }, isDragging ? "Release to add files" : "Drop font files here"), /* @__PURE__ */ React3.createElement(Flex2, { justify: "center" }, /* @__PURE__ */ React3.createElement(
1864
988
  Button2,
1865
989
  {
1866
990
  mode: "ghost",
@@ -1877,7 +1001,7 @@ var BatchUploadFonts = () => {
1877
1001
  );
1878
1002
  const renderFileList = () => {
1879
1003
  const sorted = sortFilesByType(pendingFiles);
1880
- return /* @__PURE__ */ React4.createElement(Stack2, { space: 2 }, /* @__PURE__ */ React4.createElement(Flex3, { align: "center", justify: "space-between" }, /* @__PURE__ */ React4.createElement(Text4, { size: 1, muted: true }, pendingFiles.length, " file", pendingFiles.length === 1 ? "" : "s", " selected"), /* @__PURE__ */ React4.createElement(
1004
+ return /* @__PURE__ */ React3.createElement(Stack2, { space: 2 }, /* @__PURE__ */ React3.createElement(Flex2, { align: "center", justify: "space-between" }, /* @__PURE__ */ React3.createElement(Text3, { size: 1, muted: true }, pendingFiles.length, " file", pendingFiles.length === 1 ? "" : "s", " selected"), /* @__PURE__ */ React3.createElement(
1881
1005
  Button2,
1882
1006
  {
1883
1007
  mode: "bleed",
@@ -1887,16 +1011,16 @@ var BatchUploadFonts = () => {
1887
1011
  text: "Clear all",
1888
1012
  onClick: () => setPendingFiles([])
1889
1013
  }
1890
- )), /* @__PURE__ */ React4.createElement(Box2, { style: { maxHeight: "260px", overflowY: "auto", display: "flex", flexDirection: "column", gap: "4px" } }, sorted.map((file, i) => {
1014
+ )), /* @__PURE__ */ React3.createElement(Box2, { style: { maxHeight: "260px", overflowY: "auto", display: "flex", flexDirection: "column", gap: "4px" } }, sorted.map((file, i) => {
1891
1015
  const ext = file.name.split(".").pop().toUpperCase();
1892
- return /* @__PURE__ */ React4.createElement(Card, { key: `${file.name}-${file.size}-${i}`, border: true, radius: 1, paddingX: 2, paddingY: 2 }, /* @__PURE__ */ React4.createElement(Flex3, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React4.createElement(Flex3, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React4.createElement(
1893
- Text4,
1016
+ return /* @__PURE__ */ React3.createElement(Card, { key: `${file.name}-${file.size}-${i}`, border: true, radius: 1, paddingX: 2, paddingY: 2 }, /* @__PURE__ */ React3.createElement(Flex2, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React3.createElement(Flex2, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React3.createElement(
1017
+ Text3,
1894
1018
  {
1895
1019
  size: 0,
1896
1020
  style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0 }
1897
1021
  },
1898
1022
  ext
1899
- ), /* @__PURE__ */ React4.createElement(Box2, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ React4.createElement(Text4, { size: 1 }, file.name))), /* @__PURE__ */ React4.createElement(
1023
+ ), /* @__PURE__ */ React3.createElement(Box2, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ React3.createElement(Text3, { size: 1 }, file.name))), /* @__PURE__ */ React3.createElement(
1900
1024
  Button2,
1901
1025
  {
1902
1026
  mode: "bleed",
@@ -1906,7 +1030,7 @@ var BatchUploadFonts = () => {
1906
1030
  onClick: () => handleRemoveFile(file)
1907
1031
  }
1908
1032
  )));
1909
- })), /* @__PURE__ */ React4.createElement(
1033
+ })), /* @__PURE__ */ React3.createElement(
1910
1034
  Box2,
1911
1035
  {
1912
1036
  onDragEnter: handleDragEnter,
@@ -1922,7 +1046,7 @@ var BatchUploadFonts = () => {
1922
1046
  transition: "border-color 0.12s, background 0.12s"
1923
1047
  }
1924
1048
  },
1925
- /* @__PURE__ */ React4.createElement(
1049
+ /* @__PURE__ */ React3.createElement(
1926
1050
  "input",
1927
1051
  {
1928
1052
  ref: fileInputRef,
@@ -1933,7 +1057,7 @@ var BatchUploadFonts = () => {
1933
1057
  onChange: handleFileSelect
1934
1058
  }
1935
1059
  ),
1936
- /* @__PURE__ */ React4.createElement(Flex3, { align: "center", justify: "center", gap: 2 }, /* @__PURE__ */ React4.createElement(Text4, { size: 1, muted: true }, isDragging ? "Release to add" : "Drop more files or"), /* @__PURE__ */ React4.createElement(
1060
+ /* @__PURE__ */ React3.createElement(Flex2, { align: "center", justify: "center", gap: 2 }, /* @__PURE__ */ React3.createElement(Text3, { size: 1, muted: true }, isDragging ? "Release to add" : "Drop more files or"), /* @__PURE__ */ React3.createElement(
1937
1061
  Button2,
1938
1062
  {
1939
1063
  mode: "bleed",
@@ -1947,7 +1071,7 @@ var BatchUploadFonts = () => {
1947
1071
  }
1948
1072
  }
1949
1073
  ))
1950
- ), /* @__PURE__ */ React4.createElement(
1074
+ ), /* @__PURE__ */ React3.createElement(
1951
1075
  Button2,
1952
1076
  {
1953
1077
  mode: "ghost",
@@ -1959,12 +1083,13 @@ var BatchUploadFonts = () => {
1959
1083
  }
1960
1084
  ));
1961
1085
  };
1962
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, title && title !== "" && slug && slug !== "" && /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(
1086
+ const hasRequiredFields = title && title !== "" && slug && slug !== "";
1087
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, !hasRequiredFields && /* @__PURE__ */ React3.createElement(Card, { border: true, padding: 4, radius: 2, tone: "caution" }, /* @__PURE__ */ React3.createElement(Flex2, { align: "center", gap: 3 }, /* @__PURE__ */ React3.createElement(Text3, { size: 2 }, /* @__PURE__ */ React3.createElement(WarningOutlineIcon, null)), /* @__PURE__ */ React3.createElement(Stack2, { space: 2 }, /* @__PURE__ */ React3.createElement(Text3, { size: 1, weight: "semibold" }, !title || title === "" ? "Title required to use font uploader" : "Slug required to use font uploader"), /* @__PURE__ */ React3.createElement(Text3, { size: 1, muted: true }, "Add a ", !title || title === "" ? "title" : "slug", " to this typeface document, then return to the Styles tab to upload fonts.")))), hasRequiredFields && /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
1963
1088
  StatusDisplay_default,
1964
1089
  {
1965
1090
  status,
1966
1091
  error,
1967
- action: /* @__PURE__ */ React4.createElement(
1092
+ action: /* @__PURE__ */ React3.createElement(
1968
1093
  Button2,
1969
1094
  {
1970
1095
  mode: showUtilities ? "default" : "ghost",
@@ -1977,16 +1102,31 @@ var BatchUploadFonts = () => {
1977
1102
  }
1978
1103
  )
1979
1104
  }
1980
- ), /* @__PURE__ */ React4.createElement(Card, { border: true, padding: 2, shadow: 1, radius: 2 }, showUtilities ? /* @__PURE__ */ React4.createElement(Stack2, { space: 4, marginTop: 2 }, /* @__PURE__ */ React4.createElement(Stack2, { space: 2 }, /* @__PURE__ */ React4.createElement(Text4, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Regenerate Subfamilies"), /* @__PURE__ */ React4.createElement(RegenerateSubfamiliesComponent, null)), /* @__PURE__ */ React4.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React4.createElement(Text4, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Rename Fonts (name table, Full Name)"), /* @__PURE__ */ React4.createElement(Flex3, { align: "center", gap: 2 }, /* @__PURE__ */ React4.createElement(
1981
- Switch,
1105
+ ), /* @__PURE__ */ React3.createElement(
1106
+ Button2,
1982
1107
  {
1983
- checked: preserveShortenedNames,
1984
- onChange: (e) => setPreserveShortenedNames(e.target.checked)
1108
+ mode: "default",
1109
+ tone: "primary",
1110
+ icon: UploadIcon,
1111
+ text: "Upload Fonts",
1112
+ fontSize: 2,
1113
+ padding: 4,
1114
+ onClick: () => setShowUploadModal(true),
1115
+ style: { width: "100%" }
1985
1116
  }
1986
- ), renderTooltipLabel(
1987
- "Preserve shortened names",
1988
- 'Abbreviations in font names are kept as-is (e.g. "XNarrow" stays "XNarrow", "Bd" stays "Bd").'
1989
- )), ready === "rename" ? renderProcessing() : /* @__PURE__ */ React4.createElement(Button2, { mode: "ghost", tone: "primary", text: "Rename Existing Fonts", style: { width: "100%" }, onClick: handleRenameExistingFonts, disabled: ready !== true })), /* @__PURE__ */ React4.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React4.createElement(Text4, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Update Font Prices"), ready === "price" ? renderProcessing() : /* @__PURE__ */ React4.createElement(Stack2, { space: 2 }, /* @__PURE__ */ React4.createElement(PriceInput_default, { inputPrice, handleInputChange }), /* @__PURE__ */ React4.createElement(Button2, { mode: "ghost", tone: "primary", text: "Update All Font Prices", style: { width: "100%" }, onClick: handleChangeFontPrice, disabled: ready !== true }))), /* @__PURE__ */ React4.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React4.createElement(Text4, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Regenerate CSS"), /* @__PURE__ */ React4.createElement(Text4, { size: 1, muted: true, style: { lineHeight: 1.6 } }, "Rebuilds the CSS @font-face files for all fonts in the typeface fonts list."), ready === "css" ? renderProcessing() : /* @__PURE__ */ React4.createElement(Button2, { mode: "ghost", tone: "primary", text: "Regenerate CSS Files", style: { width: "100%" }, onClick: handleRegenerateCssFiles, disabled: ready !== true }))) : ready ? /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(Grid, { columns: [2], gap: 4, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React4.createElement(Box2, null, /* @__PURE__ */ React4.createElement(PriceInput_default, { inputPrice, handleInputChange })), /* @__PURE__ */ React4.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React4.createElement(Flex3, { align: "center", gap: 2 }, /* @__PURE__ */ React4.createElement(
1117
+ ), showUploadModal && /* @__PURE__ */ React3.createElement(Suspense, { fallback: /* @__PURE__ */ React3.createElement(Spinner, null) }, /* @__PURE__ */ React3.createElement(
1118
+ UploadModal2,
1119
+ {
1120
+ open: showUploadModal,
1121
+ onClose: () => setShowUploadModal(false),
1122
+ client,
1123
+ docId: doc_id,
1124
+ typefaceTitle: title,
1125
+ stylesObject,
1126
+ preferredStyleRef,
1127
+ slug
1128
+ }
1129
+ )), showUtilities && /* @__PURE__ */ React3.createElement(Card, { border: true, padding: 3, shadow: 1, radius: 2, marginTop: 3 }, /* @__PURE__ */ React3.createElement(Stack2, { space: 4 }, /* @__PURE__ */ React3.createElement(Stack2, { space: 2 }, /* @__PURE__ */ React3.createElement(Text3, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Regenerate Subfamilies"), /* @__PURE__ */ React3.createElement(RegenerateSubfamiliesComponent, null)), /* @__PURE__ */ React3.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React3.createElement(Text3, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Rename Fonts (name table, Full Name)"), /* @__PURE__ */ React3.createElement(Flex2, { align: "center", gap: 2 }, /* @__PURE__ */ React3.createElement(
1990
1130
  Switch,
1991
1131
  {
1992
1132
  checked: preserveShortenedNames,
@@ -1995,24 +1135,15 @@ var BatchUploadFonts = () => {
1995
1135
  ), renderTooltipLabel(
1996
1136
  "Preserve shortened names",
1997
1137
  'Abbreviations in font names are kept as-is (e.g. "XNarrow" stays "XNarrow", "Bd" stays "Bd").'
1998
- )), /* @__PURE__ */ React4.createElement(Flex3, { align: "center", gap: 2 }, /* @__PURE__ */ React4.createElement(
1999
- Switch,
2000
- {
2001
- checked: preserveFileNames,
2002
- onChange: (e) => setPreserveFileNames(e.target.checked)
2003
- }
2004
- ), renderTooltipLabel(
2005
- "Preserve file names",
2006
- "Original filename capitalisation is used for asset naming instead of the normalised font title."
2007
- )))), /* @__PURE__ */ React4.createElement(Box2, { marginTop: 3 }, pendingFiles.length === 0 ? renderDropZone() : renderFileList())) : renderProcessing())));
1138
+ )), ready === "rename" ? renderProcessing() : /* @__PURE__ */ React3.createElement(Button2, { mode: "ghost", tone: "primary", text: "Rename Existing Fonts", style: { width: "100%" }, onClick: handleRenameExistingFonts, disabled: ready !== true })), /* @__PURE__ */ React3.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React3.createElement(Text3, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Update Font Prices"), ready === "price" ? renderProcessing() : /* @__PURE__ */ React3.createElement(Stack2, { space: 2 }, /* @__PURE__ */ React3.createElement(PriceInput_default, { inputPrice, handleInputChange }), /* @__PURE__ */ React3.createElement(Button2, { mode: "ghost", tone: "primary", text: "Update All Font Prices", style: { width: "100%" }, onClick: handleChangeFontPrice, disabled: ready !== true }))), /* @__PURE__ */ React3.createElement(Stack2, { space: 3 }, /* @__PURE__ */ React3.createElement(Text3, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Regenerate CSS"), /* @__PURE__ */ React3.createElement(Text3, { size: 1, muted: true, style: { lineHeight: 1.6 } }, "Rebuilds the CSS @font-face files for all fonts in the typeface fonts list."), ready === "css" ? renderProcessing() : /* @__PURE__ */ React3.createElement(Button2, { mode: "ghost", tone: "primary", text: "Regenerate CSS Files", style: { width: "100%" }, onClick: handleRegenerateCssFiles, disabled: ready !== true }))))));
2008
1139
  };
2009
1140
 
2010
1141
  // src/components/GenerateCollectionsPairsComponent.jsx
2011
- import React5, { useCallback as useCallback2, useState as useState3 } from "react";
2012
- import { Stack as Stack3, Grid as Grid2, Flex as Flex4, Text as Text5, Button as Button3, Card as Card2, Spinner as Spinner2 } from "@sanity/ui";
1142
+ import React4, { useCallback as useCallback2, useState as useState3 } from "react";
1143
+ import { Stack as Stack3, Grid as Grid2, Flex as Flex3, Text as Text4, Button as Button3, Card as Card2, Spinner as Spinner2 } from "@sanity/ui";
2013
1144
  import { useFormValue as useFormValue3 } from "sanity";
2014
- import slugify2 from "slugify";
2015
- import { nanoid as nanoid6 } from "nanoid";
1145
+ import slugify from "slugify";
1146
+ import { nanoid as nanoid3 } from "nanoid";
2016
1147
  var GenerateCollectionsPairsComponent = () => {
2017
1148
  const [status, setStatus] = useState3("ready");
2018
1149
  const [ready, setReady] = useState3(true);
@@ -2030,7 +1161,7 @@ var GenerateCollectionsPairsComponent = () => {
2030
1161
  const createSanityCollection = useCallback2(async (fontsList, collectionSlug, newTitle) => {
2031
1162
  const newSlug = collectionSlug.toLowerCase().trim();
2032
1163
  const fontRefs = fontsList.map((font) => ({
2033
- _key: nanoid6(),
1164
+ _key: nanoid3(),
2034
1165
  _type: "reference",
2035
1166
  _ref: font._id ?? font._ref,
2036
1167
  _weak: true
@@ -2046,7 +1177,7 @@ var GenerateCollectionsPairsComponent = () => {
2046
1177
  });
2047
1178
  const price = (collectionPrice ? Number(collectionPrice) : 0) * fontRefs.length;
2048
1179
  await client.createOrReplace({
2049
- _key: nanoid6(),
1180
+ _key: nanoid3(),
2050
1181
  _id: newSlug,
2051
1182
  _type: "collection",
2052
1183
  state: "active",
@@ -2059,18 +1190,18 @@ var GenerateCollectionsPairsComponent = () => {
2059
1190
  }).catch((err) => {
2060
1191
  console.error("Error creating collection:", err.message);
2061
1192
  });
2062
- return { _ref: newSlug, _type: "reference", _weak: true, _key: nanoid6() };
1193
+ return { _ref: newSlug, _type: "reference", _weak: true, _key: nanoid3() };
2063
1194
  }, [collectionPrice, client]);
2064
1195
  const createSanityPair = useCallback2(async (pair, pairSlug, newTitle) => {
2065
1196
  const newSlug = pairSlug.toLowerCase().trim();
2066
1197
  const fontRefs = pair.map((font) => ({
2067
- _key: nanoid6(),
1198
+ _key: nanoid3(),
2068
1199
  _type: "reference",
2069
1200
  _ref: font._id,
2070
1201
  _weak: true
2071
1202
  }));
2072
1203
  await client.createOrReplace({
2073
- _key: nanoid6(),
1204
+ _key: nanoid3(),
2074
1205
  _id: newSlug,
2075
1206
  _type: "pair",
2076
1207
  preferredStyle: { _type: "reference", _ref: fontRefs[0]._ref, _weak: true },
@@ -2081,7 +1212,7 @@ var GenerateCollectionsPairsComponent = () => {
2081
1212
  }).catch((err) => {
2082
1213
  console.error("Error creating pair:", err.message);
2083
1214
  });
2084
- return { _ref: newSlug, _type: "reference", _weak: true, _key: nanoid6() };
1215
+ return { _ref: newSlug, _type: "reference", _weak: true, _key: nanoid3() };
2085
1216
  }, [pairPrice, client]);
2086
1217
  const handleGenerateCollections = useCallback2(async () => {
2087
1218
  setStatus("Generating collections...");
@@ -2119,7 +1250,7 @@ var GenerateCollectionsPairsComponent = () => {
2119
1250
  setStatus(`[${i + 4}/${totalCollections}] Generating ${subfamilies[i].title} collection`);
2120
1251
  const ref = await createSanityCollection(
2121
1252
  subfamilies[i].fonts,
2122
- `${slug.current}-${slugify2(subfamilies[i].title)}-family`,
1253
+ `${slug.current}-${slugify(subfamilies[i].title)}-family`,
2123
1254
  `${title} ${subfamilies[i].title} Family`
2124
1255
  );
2125
1256
  if (ref) typefacePatch.push(ref);
@@ -2161,14 +1292,14 @@ var GenerateCollectionsPairsComponent = () => {
2161
1292
  let pairSlug, pairTitle;
2162
1293
  if (reg.subfamily && reg.subfamily !== "") {
2163
1294
  if (reg.subfamily === "Regular") {
2164
- pairSlug = `${slug.current}-${slugify2(reg.weightName)}s`;
1295
+ pairSlug = `${slug.current}-${slugify(reg.weightName)}s`;
2165
1296
  pairTitle = `${title} ${reg.weightName}s`;
2166
1297
  } else {
2167
- pairSlug = `${slug.current}-${slugify2(reg.subfamily)}-${slugify2(reg.weightName)}s`;
1298
+ pairSlug = `${slug.current}-${slugify(reg.subfamily)}-${slugify(reg.weightName)}s`;
2168
1299
  pairTitle = `${title} ${reg.subfamily} ${reg.weightName}s`;
2169
1300
  }
2170
1301
  } else {
2171
- pairSlug = `${slug.current}-${slugify2(reg.weightName)}s`;
1302
+ pairSlug = `${slug.current}-${slugify(reg.weightName)}s`;
2172
1303
  pairTitle = `${title} ${reg.weightName}s`;
2173
1304
  }
2174
1305
  setStatus(`[${i + 1}/${pairs.length}] Generating ${pairTitle}`);
@@ -2188,7 +1319,7 @@ var GenerateCollectionsPairsComponent = () => {
2188
1319
  setReady(true);
2189
1320
  }, [doc_id, title, slug, stylesObject, pairPrice, client, createSanityPair]);
2190
1321
  if (!title || !slug) return null;
2191
- return /* @__PURE__ */ React5.createElement(Stack3, { space: 2 }, /* @__PURE__ */ React5.createElement(StatusDisplay_default, { status, error: false }), /* @__PURE__ */ React5.createElement(Card2, { border: true, padding: 2, shadow: 1, radius: 2 }, ready ? /* @__PURE__ */ React5.createElement(Stack3, { space: 3 }, /* @__PURE__ */ React5.createElement(Grid2, { columns: [2], gap: 4, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React5.createElement(Stack3, { space: 2 }, /* @__PURE__ */ React5.createElement(Text5, { size: 1, muted: true }, "Collection price / font"), /* @__PURE__ */ React5.createElement(Flex4, { align: "center", gap: 2 }, /* @__PURE__ */ React5.createElement(Text5, { size: 1, muted: true }, "$"), /* @__PURE__ */ React5.createElement(
1322
+ return /* @__PURE__ */ React4.createElement(Stack3, { space: 2 }, /* @__PURE__ */ React4.createElement(StatusDisplay_default, { status, error: false }), /* @__PURE__ */ React4.createElement(Card2, { border: true, padding: 2, shadow: 1, radius: 2 }, ready ? /* @__PURE__ */ React4.createElement(Stack3, { space: 3 }, /* @__PURE__ */ React4.createElement(Grid2, { columns: [2], gap: 4, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React4.createElement(Stack3, { space: 2 }, /* @__PURE__ */ React4.createElement(Text4, { size: 1, muted: true }, "Collection price / font"), /* @__PURE__ */ React4.createElement(Flex3, { align: "center", gap: 2 }, /* @__PURE__ */ React4.createElement(Text4, { size: 1, muted: true }, "$"), /* @__PURE__ */ React4.createElement(
2192
1323
  "input",
2193
1324
  {
2194
1325
  value: collectionPrice,
@@ -2196,7 +1327,7 @@ var GenerateCollectionsPairsComponent = () => {
2196
1327
  type: "number",
2197
1328
  style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
2198
1329
  }
2199
- ))), /* @__PURE__ */ React5.createElement(Stack3, { space: 2 }, /* @__PURE__ */ React5.createElement(Text5, { size: 1, muted: true }, "Pair price"), /* @__PURE__ */ React5.createElement(Flex4, { align: "center", gap: 2 }, /* @__PURE__ */ React5.createElement(Text5, { size: 1, muted: true }, "$"), /* @__PURE__ */ React5.createElement(
1330
+ ))), /* @__PURE__ */ React4.createElement(Stack3, { space: 2 }, /* @__PURE__ */ React4.createElement(Text4, { size: 1, muted: true }, "Pair price"), /* @__PURE__ */ React4.createElement(Flex3, { align: "center", gap: 2 }, /* @__PURE__ */ React4.createElement(Text4, { size: 1, muted: true }, "$"), /* @__PURE__ */ React4.createElement(
2200
1331
  "input",
2201
1332
  {
2202
1333
  value: pairPrice,
@@ -2204,12 +1335,12 @@ var GenerateCollectionsPairsComponent = () => {
2204
1335
  type: "number",
2205
1336
  style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
2206
1337
  }
2207
- )))), /* @__PURE__ */ React5.createElement(Button3, { mode: "ghost", tone: "primary", text: "Generate Collections", style: { width: "100%" }, onClick: handleGenerateCollections }), /* @__PURE__ */ React5.createElement(Button3, { mode: "ghost", tone: "primary", text: "Generate Pairs", style: { width: "100%" }, onClick: handleGeneratePairs })) : /* @__PURE__ */ React5.createElement(Flex4, { align: "center", justify: "center", gap: 3, padding: 4 }, /* @__PURE__ */ React5.createElement(Spinner2, null), /* @__PURE__ */ React5.createElement(Text5, { muted: true, size: 1 }, status))));
1338
+ )))), /* @__PURE__ */ React4.createElement(Button3, { mode: "ghost", tone: "primary", text: "Generate Collections", style: { width: "100%" }, onClick: handleGenerateCollections }), /* @__PURE__ */ React4.createElement(Button3, { mode: "ghost", tone: "primary", text: "Generate Pairs", style: { width: "100%" }, onClick: handleGeneratePairs })) : /* @__PURE__ */ React4.createElement(Flex3, { align: "center", justify: "center", gap: 3, padding: 4 }, /* @__PURE__ */ React4.createElement(Spinner2, null), /* @__PURE__ */ React4.createElement(Text4, { muted: true, size: 1 }, status))));
2208
1339
  };
2209
1340
 
2210
1341
  // src/components/UpdateScriptsComponent.jsx
2211
- import React6, { useState as useState4, useCallback as useCallback3, useRef as useRef2, useEffect as useEffect2 } from "react";
2212
- import { Stack as Stack4, Text as Text6, Button as Button4 } from "@sanity/ui";
1342
+ import React5, { useState as useState4, useCallback as useCallback3, useRef as useRef2, useEffect as useEffect2 } from "react";
1343
+ import { Stack as Stack4, Text as Text5, Button as Button4 } from "@sanity/ui";
2213
1344
  import { useFormValue as useFormValue4, set } from "sanity";
2214
1345
  var UpdateScriptsComponent = (props) => {
2215
1346
  const { onChange } = props;
@@ -2251,7 +1382,7 @@ var UpdateScriptsComponent = (props) => {
2251
1382
  if (isReadyRef.current) onChange(set(newScripts));
2252
1383
  setMessage("Scripts updated");
2253
1384
  }, [onChange, fonts, client]);
2254
- return /* @__PURE__ */ React6.createElement(Stack4, { space: 3 }, /* @__PURE__ */ React6.createElement(
1385
+ return /* @__PURE__ */ React5.createElement(Stack4, { space: 3 }, /* @__PURE__ */ React5.createElement(
2255
1386
  Button4,
2256
1387
  {
2257
1388
  mode: "ghost",
@@ -2260,16 +1391,14 @@ var UpdateScriptsComponent = (props) => {
2260
1391
  text: "Update Scripts from Font Files",
2261
1392
  onClick: updateFromFonts
2262
1393
  }
2263
- ), message && /* @__PURE__ */ React6.createElement(Text6, { size: 1, style: { color: "green" } }, message), props.renderDefault(props));
1394
+ ), message && /* @__PURE__ */ React5.createElement(Text5, { size: 1, style: { color: "green" } }, message), props.renderDefault(props));
2264
1395
  };
2265
1396
 
2266
1397
  // src/components/SingleUploaderTool.jsx
2267
- import React7, { useState as useState5, useEffect as useEffect3, useCallback as useCallback4, useMemo as useMemo3 } from "react";
2268
- import { Button as Button5, Grid as Grid3, Stack as Stack5, Flex as Flex5, Box as Box3, Text as Text7, Card as Card3 } from "@sanity/ui";
1398
+ import React6, { useState as useState5, useEffect as useEffect3, useCallback as useCallback4, useMemo as useMemo3 } from "react";
1399
+ import { Button as Button5, Grid as Grid3, Stack as Stack5, Flex as Flex4, Box as Box3, Text as Text6, Card as Card3 } from "@sanity/ui";
2269
1400
  import { TrashIcon as TrashIcon2, ControlsIcon as ControlsIcon2 } from "@sanity/icons";
2270
1401
  import { useFormValue as useFormValue5, set as set2, unset } from "sanity";
2271
- import { Buffer as Buffer3 } from "buffer";
2272
- import * as fontkit5 from "fontkit";
2273
1402
 
2274
1403
  // src/utils/generateFontFile.js
2275
1404
  async function generateFontFile({
@@ -2503,7 +1632,7 @@ var SingleUploaderTool = (props) => {
2503
1632
  );
2504
1633
  if (!(ttfAsset == null ? void 0 : ttfAsset.url)) throw new Error("Could not fetch TTF file URL");
2505
1634
  const arrayBuffer = await (await fetch(ttfAsset.url)).arrayBuffer();
2506
- const font = fontkit5.create(Buffer3.from(arrayBuffer));
1635
+ const font = await parseFont(arrayBuffer, `${doc_id}.ttf`);
2507
1636
  const { weightName, subfamilyName, style, variableFont } = extractFontMetadata(
2508
1637
  font,
2509
1638
  doc_typefaceName,
@@ -2660,7 +1789,7 @@ var SingleUploaderTool = (props) => {
2660
1789
  }
2661
1790
  if (code === "ttf") {
2662
1791
  const fontBuffer = await readFontFile(file);
2663
- const font = fontkit5.create(fontBuffer);
1792
+ const font = await parseFont(fontBuffer, file.name);
2664
1793
  const { weightName, subfamilyName, style, variableFont } = extractFontMetadata(
2665
1794
  font,
2666
1795
  doc_typefaceName,
@@ -2808,26 +1937,26 @@ var SingleUploaderTool = (props) => {
2808
1937
  const formatUpper = format.toUpperCase();
2809
1938
  const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput[format]) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
2810
1939
  const fileUrl = hasFile ? `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${fileInput[format].asset._ref.replace("file-", "").replace("-", ".")}` : null;
2811
- return /* @__PURE__ */ React7.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React7.createElement(Flex5, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React7.createElement(Flex5, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React7.createElement(Text7, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, formatUpper), hasFile ? /* @__PURE__ */ React7.createElement(Box3, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ React7.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames[format]) || "File")) : /* @__PURE__ */ React7.createElement(Text7, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ React7.createElement(Flex5, { gap: 1, align: "center", style: { flexShrink: 0 } }, buildSource && (fileInput == null ? void 0 : fileInput[buildSource]) && /* @__PURE__ */ React7.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontFile(format, fileInput[buildSource]), text: "Build" }), /* @__PURE__ */ React7.createElement(Button5, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ React7.createElement(Text7, { size: 1 }, "Upload"), /* @__PURE__ */ React7.createElement("input", { ref, type: "file", hidden: true, onChange: (e) => handleUpload(e, format) })), hasFile && /* @__PURE__ */ React7.createElement(Button5, { mode: "bleed", tone: "critical", icon: TrashIcon2, padding: 2, onClick: () => handleDelete(format) }))));
1940
+ return /* @__PURE__ */ React6.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React6.createElement(Flex4, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React6.createElement(Flex4, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement(Text6, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, formatUpper), hasFile ? /* @__PURE__ */ React6.createElement(Box3, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ React6.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames[format]) || "File")) : /* @__PURE__ */ React6.createElement(Text6, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ React6.createElement(Flex4, { gap: 1, align: "center", style: { flexShrink: 0 } }, buildSource && (fileInput == null ? void 0 : fileInput[buildSource]) && /* @__PURE__ */ React6.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontFile(format, fileInput[buildSource]), text: "Build" }), /* @__PURE__ */ React6.createElement(Button5, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ React6.createElement(Text6, { size: 1 }, "Upload"), /* @__PURE__ */ React6.createElement("input", { ref, type: "file", hidden: true, onChange: (e) => handleUpload(e, format) })), hasFile && /* @__PURE__ */ React6.createElement(Button5, { mode: "bleed", tone: "critical", icon: TrashIcon2, padding: 2, onClick: () => handleDelete(format) }))));
2812
1941
  };
2813
1942
  const renderTopLevelAssetSection = (label, fieldName, assetRef, filename, onBuild) => {
2814
1943
  const hasFile = !!assetRef;
2815
1944
  const fileUrl = hasFile ? `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${assetRef.replace("file-", "").replace("-", ".")}` : null;
2816
- return /* @__PURE__ */ React7.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React7.createElement(Flex5, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React7.createElement(Flex5, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React7.createElement(Text7, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, label), hasFile ? /* @__PURE__ */ React7.createElement(Box3, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ React7.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, filename || "File")) : /* @__PURE__ */ React7.createElement(Text7, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ React7.createElement(Flex5, { gap: 1, align: "center", style: { flexShrink: 0 } }, onBuild && (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ React7.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: onBuild, text: "Build" }), /* @__PURE__ */ React7.createElement(Button5, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ React7.createElement(Text7, { size: 1 }, "Upload"), /* @__PURE__ */ React7.createElement("input", { type: "file", hidden: true, onChange: (e) => handleUploadTopLevelFile(e, fieldName) })), hasFile && /* @__PURE__ */ React7.createElement(Button5, { mode: "bleed", tone: "critical", icon: TrashIcon2, padding: 2, onClick: () => handleDeleteTopLevel(fieldName) }))));
1945
+ return /* @__PURE__ */ React6.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React6.createElement(Flex4, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React6.createElement(Flex4, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement(Text6, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, label), hasFile ? /* @__PURE__ */ React6.createElement(Box3, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ React6.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, filename || "File")) : /* @__PURE__ */ React6.createElement(Text6, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ React6.createElement(Flex4, { gap: 1, align: "center", style: { flexShrink: 0 } }, onBuild && (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ React6.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: onBuild, text: "Build" }), /* @__PURE__ */ React6.createElement(Button5, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ React6.createElement(Text6, { size: 1 }, "Upload"), /* @__PURE__ */ React6.createElement("input", { type: "file", hidden: true, onChange: (e) => handleUploadTopLevelFile(e, fieldName) })), hasFile && /* @__PURE__ */ React6.createElement(Button5, { mode: "bleed", tone: "critical", icon: TrashIcon2, padding: 2, onClick: () => handleDeleteTopLevel(fieldName) }))));
2817
1946
  };
2818
1947
  const renderCssSection = () => {
2819
1948
  var _a2, _b2;
2820
1949
  const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput.css) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
2821
1950
  const fileUrl = hasFile ? `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${fileInput.css.asset._ref.replace("file-", "").replace("-", ".")}` : null;
2822
- return /* @__PURE__ */ React7.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React7.createElement(Flex5, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React7.createElement(Flex5, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React7.createElement(Text7, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, "CSS"), hasFile ? /* @__PURE__ */ React7.createElement(Box3, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ React7.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames.css) || "File")) : /* @__PURE__ */ React7.createElement(Text7, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ React7.createElement(Flex5, { gap: 1, align: "center", style: { flexShrink: 0 } }, (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ React7.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateCssFile(), text: "Build" }), hasFile && /* @__PURE__ */ React7.createElement(Button5, { mode: "bleed", tone: "critical", icon: TrashIcon2, padding: 2, onClick: () => handleDelete("css") }))));
1951
+ return /* @__PURE__ */ React6.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React6.createElement(Flex4, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React6.createElement(Flex4, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement(Text6, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, "CSS"), hasFile ? /* @__PURE__ */ React6.createElement(Box3, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ React6.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames.css) || "File")) : /* @__PURE__ */ React6.createElement(Text6, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ React6.createElement(Flex4, { gap: 1, align: "center", style: { flexShrink: 0 } }, (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ React6.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateCssFile(), text: "Build" }), hasFile && /* @__PURE__ */ React6.createElement(Button5, { mode: "bleed", tone: "critical", icon: TrashIcon2, padding: 2, onClick: () => handleDelete("css") }))));
2823
1952
  };
2824
- const renderDataSection = () => /* @__PURE__ */ React7.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React7.createElement(Flex5, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React7.createElement(Flex5, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React7.createElement(Text7, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: (doc_metaData == null ? void 0 : doc_metaData.version) ? 1 : 0.5 } }, "DATA"), (doc_metaData == null ? void 0 : doc_metaData.version) ? /* @__PURE__ */ React7.createElement(Text7, { size: 1 }, "v", doc_metaData.version, " ", /* @__PURE__ */ React7.createElement(Text7, { as: "span", size: 1, muted: true }, "(", doc_metaData.genDate, ")")) : /* @__PURE__ */ React7.createElement(Text7, { size: 1, muted: true }, "\u2014")), status === "ready" && (fileInput == null ? void 0 : fileInput.ttf) && /* @__PURE__ */ React7.createElement(Flex5, { gap: 1, align: "center", style: { flexShrink: 0 } }, /* @__PURE__ */ React7.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontData(), text: "Build" }))));
2825
- return /* @__PURE__ */ React7.createElement(Stack5, { space: 2 }, /* @__PURE__ */ React7.createElement(
1953
+ const renderDataSection = () => /* @__PURE__ */ React6.createElement(Card3, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ React6.createElement(Flex4, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ React6.createElement(Flex4, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React6.createElement(Text6, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: (doc_metaData == null ? void 0 : doc_metaData.version) ? 1 : 0.5 } }, "DATA"), (doc_metaData == null ? void 0 : doc_metaData.version) ? /* @__PURE__ */ React6.createElement(Text6, { size: 1 }, "v", doc_metaData.version, " ", /* @__PURE__ */ React6.createElement(Text6, { as: "span", size: 1, muted: true }, "(", doc_metaData.genDate, ")")) : /* @__PURE__ */ React6.createElement(Text6, { size: 1, muted: true }, "\u2014")), status === "ready" && (fileInput == null ? void 0 : fileInput.ttf) && /* @__PURE__ */ React6.createElement(Flex4, { gap: 1, align: "center", style: { flexShrink: 0 } }, /* @__PURE__ */ React6.createElement(Button5, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontData(), text: "Build" }))));
1954
+ return /* @__PURE__ */ React6.createElement(Stack5, { space: 2 }, /* @__PURE__ */ React6.createElement(
2826
1955
  StatusDisplay_default,
2827
1956
  {
2828
1957
  status,
2829
1958
  error,
2830
- action: /* @__PURE__ */ React7.createElement(
1959
+ action: /* @__PURE__ */ React6.createElement(
2831
1960
  Button5,
2832
1961
  {
2833
1962
  mode: "bleed",
@@ -2839,7 +1968,7 @@ var SingleUploaderTool = (props) => {
2839
1968
  }
2840
1969
  )
2841
1970
  }
2842
- ), renderFontSection("ttf"), status === "ready" && (fileInput == null ? void 0 : fileInput.ttf) && /* @__PURE__ */ React7.createElement(Grid3, { columns: [1, 2], gap: 2 }, /* @__PURE__ */ React7.createElement(
1971
+ ), renderFontSection("ttf"), status === "ready" && (fileInput == null ? void 0 : fileInput.ttf) && /* @__PURE__ */ React6.createElement(Grid3, { columns: [1, 2], gap: 2 }, /* @__PURE__ */ React6.createElement(
2843
1972
  Button5,
2844
1973
  {
2845
1974
  mode: "ghost",
@@ -2848,7 +1977,7 @@ var SingleUploaderTool = (props) => {
2848
1977
  text: "Rebuild All from TTF",
2849
1978
  style: { width: "100%" }
2850
1979
  }
2851
- ), /* @__PURE__ */ React7.createElement(
1980
+ ), /* @__PURE__ */ React6.createElement(
2852
1981
  Button5,
2853
1982
  {
2854
1983
  mode: "ghost",
@@ -2868,19 +1997,18 @@ var SingleUploaderTool = (props) => {
2868
1997
  text: "Build Missing",
2869
1998
  style: { width: "100%" }
2870
1999
  }
2871
- )), renderFontSection("otf", "woff"), renderFontSection("woff", "ttf"), renderFontSection("woff2", "ttf"), showAdvanced && renderTopLevelAssetSection("WEB", "woff2_web", (_b = (_a = fileInput == null ? void 0 : fileInput.woff2_web) == null ? void 0 : _a.asset) == null ? void 0 : _b._ref, filenames == null ? void 0 : filenames.woff2_web, handleGenerateSubsetAndWeb), showAdvanced && renderTopLevelAssetSection("SUBSET", "woff2_subset", (_d = (_c = fileInput == null ? void 0 : fileInput.woff2_subset) == null ? void 0 : _c.asset) == null ? void 0 : _d._ref, filenames == null ? void 0 : filenames.woff2_subset, handleGenerateSubsetAndWeb), showAdvanced && renderFontSection("eot", "ttf"), showAdvanced && renderFontSection("svg", "ttf"), renderCssSection(), showAdvanced && renderDataSection(), status === "ready" && ((fileInput == null ? void 0 : fileInput.ttf) || (fileInput == null ? void 0 : fileInput.otf) || (fileInput == null ? void 0 : fileInput.woff) || (fileInput == null ? void 0 : fileInput.woff2)) && /* @__PURE__ */ React7.createElement(Button5, { mode: "ghost", tone: "critical", onClick: () => handleDeleteAll(), text: "Delete All", style: { width: "100%" } }));
2000
+ )), renderFontSection("otf", "woff"), renderFontSection("woff", "ttf"), renderFontSection("woff2", "ttf"), showAdvanced && renderTopLevelAssetSection("WEB", "woff2_web", (_b = (_a = fileInput == null ? void 0 : fileInput.woff2_web) == null ? void 0 : _a.asset) == null ? void 0 : _b._ref, filenames == null ? void 0 : filenames.woff2_web, handleGenerateSubsetAndWeb), showAdvanced && renderTopLevelAssetSection("SUBSET", "woff2_subset", (_d = (_c = fileInput == null ? void 0 : fileInput.woff2_subset) == null ? void 0 : _c.asset) == null ? void 0 : _d._ref, filenames == null ? void 0 : filenames.woff2_subset, handleGenerateSubsetAndWeb), showAdvanced && renderFontSection("eot", "ttf"), showAdvanced && renderFontSection("svg", "ttf"), renderCssSection(), showAdvanced && renderDataSection(), status === "ready" && ((fileInput == null ? void 0 : fileInput.ttf) || (fileInput == null ? void 0 : fileInput.otf) || (fileInput == null ? void 0 : fileInput.woff) || (fileInput == null ? void 0 : fileInput.woff2)) && /* @__PURE__ */ React6.createElement(Button5, { mode: "ghost", tone: "critical", onClick: () => handleDeleteAll(), text: "Delete All", style: { width: "100%" } }));
2872
2001
  };
2873
2002
 
2874
2003
  // src/components/UploadScriptsComponent.jsx
2875
- import React9, { useCallback as useCallback5, useEffect as useEffect4, useMemo as useMemo4, useState as useState6 } from "react";
2876
- import { Button as Button6, Flex as Flex6, Grid as Grid4, Stack as Stack6, Text as Text8, TextInput, MenuButton, Menu, MenuItem, Select } from "@sanity/ui";
2877
- import * as fontkit6 from "fontkit";
2878
- import slugify3 from "slugify";
2004
+ import React8, { useCallback as useCallback5, useEffect as useEffect4, useMemo as useMemo4, useState as useState6 } from "react";
2005
+ import { Button as Button6, Flex as Flex5, Grid as Grid4, Stack as Stack6, Text as Text7, TextInput, MenuButton, Menu, MenuItem, Select } from "@sanity/ui";
2006
+ import slugify2 from "slugify";
2879
2007
  import { useFormValue as useFormValue6 } from "sanity";
2880
- import { nanoid as nanoid7 } from "nanoid";
2008
+ import { nanoid as nanoid4 } from "nanoid";
2881
2009
 
2882
2010
  // src/utils/utils.js
2883
- import React8 from "react";
2011
+ import React7 from "react";
2884
2012
  var HtmlDescription = ({ children }) => {
2885
2013
  return children || "";
2886
2014
  };
@@ -2898,8 +2026,8 @@ var UploadScriptsComponent = (props) => {
2898
2026
  const { elementProps: { ref } } = props;
2899
2027
  const client = useSanityClient();
2900
2028
  const [selectedScript, setSelectedScript] = useState6("");
2901
- const [status, setStatus] = React9.useState("");
2902
- const [ready, setReady] = React9.useState(true);
2029
+ const [status, setStatus] = React8.useState("");
2030
+ const [ready, setReady] = React8.useState(true);
2903
2031
  let doc_id = useFormValue6(["_id"]);
2904
2032
  const title = useFormValue6(["title"]);
2905
2033
  const slug = useFormValue6(["slug"]);
@@ -2923,7 +2051,6 @@ var UploadScriptsComponent = (props) => {
2923
2051
  });
2924
2052
  };
2925
2053
  const handleUpload = useCallback5(async (event, script) => {
2926
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2927
2054
  setReady(false);
2928
2055
  try {
2929
2056
  let failedFiles = [];
@@ -2940,21 +2067,22 @@ var UploadScriptsComponent = (props) => {
2940
2067
  for (var i = 0; i < event.target.files.length; i++) {
2941
2068
  const file = event.target.files[i];
2942
2069
  const fontBuffer = await readFontFile3(file);
2943
- const font = fontkit6.create(fontBuffer);
2944
- console.log("reading font : ", font.fullName + " " + file.name, font.name.records);
2945
- let weightName = ((_b = (_a = font == null ? void 0 : font.name) == null ? void 0 : _a.records) == null ? void 0 : _b.preferredSubfamily) ? (_d = (_c = font == null ? void 0 : font.name) == null ? void 0 : _c.records) == null ? void 0 : _d.preferredSubfamily : (_f = (_e = font == null ? void 0 : font.name) == null ? void 0 : _e.records) == null ? void 0 : _f.fontSubfamily;
2946
- weightName = (weightName == null ? void 0 : weightName.en) ? weightName.en : weightName.constructor == Object ? weightName[Object.keys(weightName)[0]] : weightName;
2947
- weightName = weightName == null ? void 0 : weightName.replace("Italic", "").replace("It", "").trim();
2948
- if ((weightName == "" || weightName.toLowerCase() == "roman") && ((_h = (_g = font == null ? void 0 : font.name) == null ? void 0 : _g.records) == null ? void 0 : _h.fullName)) {
2949
- weightName = (_j = (_i = font == null ? void 0 : font.name) == null ? void 0 : _i.records) == null ? void 0 : _j.fullName;
2950
- weightName = (weightName == null ? void 0 : weightName.en) ? weightName.en : weightName.constructor == Object ? weightName[Object.keys(weightName)[0]] : weightName;
2951
- weightName = weightName == null ? void 0 : weightName.replace(title + " ", "").replace(title, "").trim();
2952
- weightName = weightName == null ? void 0 : weightName.replace("Italic", "").replace("It", "").trim();
2070
+ const font = await parseFont(fontBuffer, file.name);
2071
+ const fullName = getNameString(font, 4);
2072
+ const familyName = getNameString(font, 1);
2073
+ console.log("Reading font:", fullName, file.name);
2074
+ let weightName = getNameString(font, 17) || getNameString(font, 2) || "";
2075
+ weightName = weightName.replace("Italic", "").replace("It", "").trim();
2076
+ if ((weightName == "" || weightName.toLowerCase() == "roman") && fullName) {
2077
+ weightName = fullName.replace(title + " ", "").replace(title, "").trim();
2078
+ weightName = weightName.replace("Italic", "").replace("It", "").trim();
2953
2079
  }
2954
- let variableFont = (font == null ? void 0 : font.variationAxes) && Object.keys(font.variationAxes).length > 0 ? true : false;
2955
- let subfamilyName = font.familyName.toLowerCase().trim().replace(title.toLowerCase().trim(), "").trim();
2956
- let fontTitle = font == null ? void 0 : font.fullName;
2957
- let style = (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular";
2080
+ const axes = getVariationAxes(font);
2081
+ let variableFont = axes !== null;
2082
+ let subfamilyName = familyName.toLowerCase().trim().replace(title.toLowerCase().trim(), "").trim();
2083
+ let fontTitle = fullName;
2084
+ const italicAngle = getItalicAngle(font);
2085
+ let style = italicAngle !== 0 || fullName.toLowerCase().includes("italic") ? "Italic" : "Regular";
2958
2086
  if (fontTitle.toLowerCase().trim().includes(script)) {
2959
2087
  fontTitle = fontTitle.toLowerCase().trim().replace(script, "").trim();
2960
2088
  fontTitle = fontTitle.split(" ").map((word) => {
@@ -2993,13 +2121,13 @@ var UploadScriptsComponent = (props) => {
2993
2121
  fontTitle = fontTitle + italicKW.join(" ");
2994
2122
  style = "Italic";
2995
2123
  }
2996
- let id = slugify3(fontTitle.toLowerCase().trim());
2124
+ let id = slugify2(fontTitle.toLowerCase().trim());
2997
2125
  console.log("=== Font Info ====");
2998
2126
  console.log(" ");
2999
2127
  console.log("font id : ", id);
3000
2128
  console.log("font title : ", fontTitle);
3001
- console.log("fontkit fullName : ", font.fullName);
3002
- console.log("fontkit family name: ", font.familyName);
2129
+ console.log("Full name:", fullName);
2130
+ console.log("Family name:", familyName);
3003
2131
  console.log("file name : ", file.name);
3004
2132
  console.log("subfamily : ", subfamilyName);
3005
2133
  console.log("style : ", style);
@@ -3013,18 +2141,17 @@ var UploadScriptsComponent = (props) => {
3013
2141
  fontsObjects[id].files = [...fontsObjects[id].files, file];
3014
2142
  } else {
3015
2143
  let fontObject = {
3016
- _key: nanoid7(),
2144
+ _key: nanoid4(),
3017
2145
  _id: id,
3018
2146
  title: fontTitle,
3019
2147
  slug: { _type: "slug", current: id },
3020
2148
  typefaceName: title,
3021
2149
  // Change to match Typeface Document
3022
- style: (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular",
2150
+ style,
3023
2151
  variableFont,
3024
2152
  weightName,
3025
2153
  normalWeight: true,
3026
- // TODO : check if weight is normal ??
3027
- weight: ((_k = font["OS/2"]) == null ? void 0 : _k.usWeightClass) ? Number((_l = font["OS/2"]) == null ? void 0 : _l.usWeightClass) : /hairline|extra thin|extrathin/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 100 : /thin|extra light|extralight/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 200 : /light|book/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 300 : /regular|normal/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 400 : /medium/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 500 : /semi bold|semibold/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 600 : /bold/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 700 : /extra bold|extrabold/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 800 : /black|ultra/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 900 : 400,
2154
+ weight: getWeightClass(font) || (/hairline|extra thin|extrathin/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 100 : /thin|extra light|extralight/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 200 : /light|book/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 300 : /regular|normal/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 400 : /medium/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 500 : /semi bold|semibold/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 600 : /bold/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 700 : /extra bold|extrabold/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 800 : /black|ultra/.test(weightName == null ? void 0 : weightName.toLowerCase()) ? 900 : 400),
3028
2155
  files: [file],
3029
2156
  fontKit: font,
3030
2157
  scriptFileInput: { [script]: {} }
@@ -3126,7 +2253,7 @@ var UploadScriptsComponent = (props) => {
3126
2253
  fontResponse = await client.patch(font._id).set({ scriptFileInput: font.scriptFileInput }).commit();
3127
2254
  } else {
3128
2255
  fontResponse = await client.createOrReplace({
3129
- _key: nanoid7(),
2256
+ _key: nanoid4(),
3130
2257
  _id: font._id,
3131
2258
  _type: "font",
3132
2259
  ...font
@@ -3139,7 +2266,7 @@ var UploadScriptsComponent = (props) => {
3139
2266
  })];
3140
2267
  continue;
3141
2268
  }
3142
- const fontRef = { _key: nanoid7(), _type: "reference", _ref: fontResponse._id, _weak: true };
2269
+ const fontRef = { _key: nanoid4(), _type: "reference", _ref: fontResponse._id, _weak: true };
3143
2270
  console.log("font response : ", fontResponse);
3144
2271
  console.log("existing styles object : ", stylesObject);
3145
2272
  if (!font.variableFont) {
@@ -3207,8 +2334,8 @@ var UploadScriptsComponent = (props) => {
3207
2334
  console.log("failed files : ", failedFiles);
3208
2335
  const names = failedFiles.map((file) => file.name);
3209
2336
  console.log("names : ", failedFiles.map((file) => {
3210
- var _a2, _b2;
3211
- return (_b2 = (_a2 = file == null ? void 0 : file.fk) == null ? void 0 : _a2.name) == null ? void 0 : _b2.records;
2337
+ var _a, _b;
2338
+ return (_b = (_a = file == null ? void 0 : file.fk) == null ? void 0 : _a.name) == null ? void 0 : _b.records;
3212
2339
  }));
3213
2340
  setStatus("fonts uploaded with errors. Failed files : " + names.join(", "));
3214
2341
  } else {
@@ -3221,26 +2348,26 @@ var UploadScriptsComponent = (props) => {
3221
2348
  }
3222
2349
  setReady(true);
3223
2350
  }, [title, slug, doc_id]);
3224
- return /* @__PURE__ */ React9.createElement(Stack6, null, !ready && /* @__PURE__ */ React9.createElement(Text8, null, /* @__PURE__ */ React9.createElement("br", null), status, /* @__PURE__ */ React9.createElement("br", null), /* @__PURE__ */ React9.createElement("br", null)), ready && /* @__PURE__ */ React9.createElement(Stack6, null, /* @__PURE__ */ React9.createElement(Grid4, { columns: !!(selectedScript && selectedScript !== "") ? 2 : 1, gap: 2 }, /* @__PURE__ */ React9.createElement(
2351
+ return /* @__PURE__ */ React8.createElement(Stack6, null, !ready && /* @__PURE__ */ React8.createElement(Text7, null, /* @__PURE__ */ React8.createElement("br", null), status, /* @__PURE__ */ React8.createElement("br", null), /* @__PURE__ */ React8.createElement("br", null)), ready && /* @__PURE__ */ React8.createElement(Stack6, null, /* @__PURE__ */ React8.createElement(Grid4, { columns: !!(selectedScript && selectedScript !== "") ? 2 : 1, gap: 2 }, /* @__PURE__ */ React8.createElement(
3225
2352
  Select,
3226
2353
  {
3227
2354
  id: "menu-button-example",
3228
2355
  onChange: (e) => setSelectedScript(e.target.value)
3229
2356
  },
3230
- /* @__PURE__ */ React9.createElement("option", { key: "script-none", value: "" }, " "),
2357
+ /* @__PURE__ */ React8.createElement("option", { key: "script-none", value: "" }, " "),
3231
2358
  SCRIPTS.map(
3232
2359
  (script, i) => {
3233
2360
  var _a;
3234
- return /* @__PURE__ */ React9.createElement("option", { key: "script-" + i, value: script }, ((_a = script[0]) == null ? void 0 : _a.toUpperCase()) + script.slice(1));
2361
+ return /* @__PURE__ */ React8.createElement("option", { key: "script-" + i, value: script }, ((_a = script[0]) == null ? void 0 : _a.toUpperCase()) + script.slice(1));
3235
2362
  }
3236
2363
  )
3237
- ), !!(selectedScript && selectedScript !== "") && /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement("label", { htmlFor: "upload-scripts-file" }, /* @__PURE__ */ React9.createElement(
2364
+ ), !!(selectedScript && selectedScript !== "") && /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("label", { htmlFor: "upload-scripts-file" }, /* @__PURE__ */ React8.createElement(
3238
2365
  Button6,
3239
2366
  {
3240
2367
  style: { pointerEvents: "none" },
3241
2368
  text: "Upload (ttf/otf/woff/woff2/etc..)"
3242
2369
  }
3243
- )), /* @__PURE__ */ React9.createElement(
2370
+ )), /* @__PURE__ */ React8.createElement(
3244
2371
  "input",
3245
2372
  {
3246
2373
  ref,
@@ -3255,8 +2382,8 @@ var UploadScriptsComponent = (props) => {
3255
2382
  };
3256
2383
 
3257
2384
  // src/components/FontScriptUploaderComponent.jsx
3258
- import React10, { useState as useState7, useEffect as useEffect5, useCallback as useCallback6 } from "react";
3259
- import { Stack as Stack7, Flex as Flex7, Text as Text9, Button as Button7 } from "@sanity/ui";
2385
+ import React9, { useState as useState7, useEffect as useEffect5, useCallback as useCallback6 } from "react";
2386
+ import { Stack as Stack7, Flex as Flex6, Text as Text8, Button as Button7 } from "@sanity/ui";
3260
2387
  import { useFormValue as useFormValue7, set as set3, unset as unset2 } from "sanity";
3261
2388
  var FontScriptUploaderComponent = (props) => {
3262
2389
  const client = useSanityClient();
@@ -3464,17 +2591,17 @@ var FontScriptUploaderComponent = (props) => {
3464
2591
  }
3465
2592
  }
3466
2593
  }, [scriptFileInput]);
3467
- return /* @__PURE__ */ React10.createElement(Stack7, { space: 4 }, SCRIPTS && scriptFileInput && SCRIPTS.map((language, i) => {
2594
+ return /* @__PURE__ */ React9.createElement(Stack7, { space: 4 }, SCRIPTS && scriptFileInput && SCRIPTS.map((language, i) => {
3468
2595
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga;
3469
- return /* @__PURE__ */ React10.createElement(Stack7, { space: 2, key: "language-" + i, style: { borderBottom: "1px solid var(--card-border-color)", paddingBottom: 8 } }, /* @__PURE__ */ React10.createElement(Flex7, { gap: 2 }, /* @__PURE__ */ React10.createElement(Text9, { weight: "semibold" }, ((_a = language[0]) == null ? void 0 : _a.toUpperCase()) + language.slice(1)), message && message[language] && message[language] !== "" && /* @__PURE__ */ React10.createElement(Text9, { style: { color: "green" } }, message[language])), expanded[language] && /* @__PURE__ */ React10.createElement(Stack7, { space: 2 }, /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "TTF:\xA0", !((_d = (_c = (_b = scriptFileInput[language]) == null ? void 0 : _b.ttf) == null ? void 0 : _c.asset) == null ? void 0 : _d._ref) ? ((_e = filenames[language]) == null ? void 0 : _e.ttf) ? /* @__PURE__ */ React10.createElement("b", null, filenames[language].ttf) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_h = (_g = (_f = scriptFileInput[language]) == null ? void 0 : _f.ttf) == null ? void 0 : _g.asset) == null ? void 0 : _h._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_i = filenames[language]) == null ? void 0 : _i.ttf) ? /* @__PURE__ */ React10.createElement("b", null, filenames[language].ttf) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, /* @__PURE__ */ React10.createElement("label", null, /* @__PURE__ */ React10.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React10.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: (event) => handleUpload(event, language, "ttf") })), ((_j = value[language]) == null ? void 0 : _j.ttf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("ttf", language) }, "\xD7"))), status === "ready" && ((_k = value[language]) == null ? void 0 : _k.ttf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("all", value[language].ttf, language) }, "Regenerate Files from TTF"), /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "OTF:\xA0", !((_n = (_m = (_l = scriptFileInput[language]) == null ? void 0 : _l.otf) == null ? void 0 : _m.asset) == null ? void 0 : _n._ref) ? ((_o = filenames[language]) == null ? void 0 : _o.otf) ? /* @__PURE__ */ React10.createElement("b", null, (_p = filenames[language]) == null ? void 0 : _p.otf) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_s = (_r = (_q = scriptFileInput[language]) == null ? void 0 : _q.otf) == null ? void 0 : _r.asset) == null ? void 0 : _s._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_t = filenames[language]) == null ? void 0 : _t.otf) ? /* @__PURE__ */ React10.createElement("b", null, (_u = filenames[language]) == null ? void 0 : _u.otf) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, ((_v = value[language]) == null ? void 0 : _v.woff) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("otf", value[language].woff, language) }, "Build"), /* @__PURE__ */ React10.createElement("label", null, /* @__PURE__ */ React10.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React10.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "otf") })), ((_w = value[language]) == null ? void 0 : _w.otf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("otf", language) }, "\xD7"))), /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "WOFF:\xA0", !((_z = (_y = (_x = scriptFileInput[language]) == null ? void 0 : _x.woff) == null ? void 0 : _y.asset) == null ? void 0 : _z._ref) ? ((_A = filenames[language]) == null ? void 0 : _A.woff) ? /* @__PURE__ */ React10.createElement("b", null, (_B = filenames[language]) == null ? void 0 : _B.woff) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_E = (_D = (_C = scriptFileInput[language]) == null ? void 0 : _C.woff) == null ? void 0 : _D.asset) == null ? void 0 : _E._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_F = filenames[language]) == null ? void 0 : _F.woff) ? /* @__PURE__ */ React10.createElement("b", null, (_G = filenames[language]) == null ? void 0 : _G.woff) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, ((_H = value[language]) == null ? void 0 : _H.ttf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("woff", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React10.createElement("label", null, /* @__PURE__ */ React10.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React10.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "woff") })), ((_I = value[language]) == null ? void 0 : _I.woff) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("woff", language) }, "\xD7"))), /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "WOFF2:\xA0", !((_L = (_K = (_J = scriptFileInput[language]) == null ? void 0 : _J.woff2) == null ? void 0 : _K.asset) == null ? void 0 : _L._ref) ? ((_M = filenames[language]) == null ? void 0 : _M.woff2) ? /* @__PURE__ */ React10.createElement("b", null, (_N = filenames[language]) == null ? void 0 : _N.woff2) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_Q = (_P = (_O = scriptFileInput[language]) == null ? void 0 : _O.woff2) == null ? void 0 : _P.asset) == null ? void 0 : _Q._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_R = filenames[language]) == null ? void 0 : _R.woff2) ? /* @__PURE__ */ React10.createElement("b", null, (_S = filenames[language]) == null ? void 0 : _S.woff2) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, ((_T = value[language]) == null ? void 0 : _T.ttf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("woff2", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React10.createElement("label", null, /* @__PURE__ */ React10.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React10.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "woff2") })), ((_U = value[language]) == null ? void 0 : _U.woff2) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("woff2", language) }, "\xD7"))), /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "EOT:\xA0", !((_X = (_W = (_V = scriptFileInput[language]) == null ? void 0 : _V.eot) == null ? void 0 : _W.asset) == null ? void 0 : _X._ref) ? ((_Y = filenames[language]) == null ? void 0 : _Y.eot) ? /* @__PURE__ */ React10.createElement("b", null, (_Z = filenames[language]) == null ? void 0 : _Z.eot) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_aa = (_$ = (__ = scriptFileInput[language]) == null ? void 0 : __.eot) == null ? void 0 : _$.asset) == null ? void 0 : _aa._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_ba = filenames[language]) == null ? void 0 : _ba.eot) ? /* @__PURE__ */ React10.createElement("b", null, (_ca = filenames[language]) == null ? void 0 : _ca.eot) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, ((_da = value[language]) == null ? void 0 : _da.ttf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("eot", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React10.createElement("label", null, /* @__PURE__ */ React10.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React10.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "eot") })), ((_ea = value[language]) == null ? void 0 : _ea.eot) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("eot", language) }, "\xD7"))), /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "SVG:\xA0", !((_ha = (_ga = (_fa = scriptFileInput[language]) == null ? void 0 : _fa.svg) == null ? void 0 : _ga.asset) == null ? void 0 : _ha._ref) ? ((_ia = filenames[language]) == null ? void 0 : _ia.svg) ? /* @__PURE__ */ React10.createElement("b", null, (_ja = filenames[language]) == null ? void 0 : _ja.svg) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_ma = (_la = (_ka = scriptFileInput[language]) == null ? void 0 : _ka.svg) == null ? void 0 : _la.asset) == null ? void 0 : _ma._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_na = filenames[language]) == null ? void 0 : _na.svg) ? /* @__PURE__ */ React10.createElement("b", null, (_oa = filenames[language]) == null ? void 0 : _oa.svg) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, ((_pa = value[language]) == null ? void 0 : _pa.ttf) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("svg", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React10.createElement("label", null, /* @__PURE__ */ React10.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React10.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "svg") })), ((_qa = value[language]) == null ? void 0 : _qa.svg) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("svg", language) }, "\xD7"))), /* @__PURE__ */ React10.createElement(Flex7, { justify: "space-between", align: "center" }, /* @__PURE__ */ React10.createElement(Text9, null, "CSS:\xA0", !((_ta = (_sa = (_ra = scriptFileInput[language]) == null ? void 0 : _ra.css) == null ? void 0 : _sa.asset) == null ? void 0 : _ta._ref) ? ((_ua = filenames[language]) == null ? void 0 : _ua.css) ? /* @__PURE__ */ React10.createElement("b", null, (_va = filenames[language]) == null ? void 0 : _va.css) : /* @__PURE__ */ React10.createElement("b", null, "Empty") : /* @__PURE__ */ React10.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_ya = (_xa = (_wa = scriptFileInput[language]) == null ? void 0 : _wa.css) == null ? void 0 : _xa.asset) == null ? void 0 : _ya._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_za = filenames[language]) == null ? void 0 : _za.css) ? /* @__PURE__ */ React10.createElement("b", null, (_Aa = filenames[language]) == null ? void 0 : _Aa.css) : /* @__PURE__ */ React10.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React10.createElement(Flex7, { gap: 1 }, ((_Ba = value[language]) == null ? void 0 : _Ba.woff2) && /* @__PURE__ */ React10.createElement(Button7, { mode: "default", onClick: () => handleGenerateCssFile(language) }, "Build"), ((_Ca = value[language]) == null ? void 0 : _Ca.css) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("css", language) }, "\xD7"))), status === "ready" && (((_Da = value[language]) == null ? void 0 : _Da.ttf) || ((_Ea = value[language]) == null ? void 0 : _Ea.otf) || ((_Fa = value[language]) == null ? void 0 : _Fa.woff) || ((_Ga = value[language]) == null ? void 0 : _Ga.woff2)) && /* @__PURE__ */ React10.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDeleteAll(language), style: { width: "100%" } }, "Delete All")));
2596
+ return /* @__PURE__ */ React9.createElement(Stack7, { space: 2, key: "language-" + i, style: { borderBottom: "1px solid var(--card-border-color)", paddingBottom: 8 } }, /* @__PURE__ */ React9.createElement(Flex6, { gap: 2 }, /* @__PURE__ */ React9.createElement(Text8, { weight: "semibold" }, ((_a = language[0]) == null ? void 0 : _a.toUpperCase()) + language.slice(1)), message && message[language] && message[language] !== "" && /* @__PURE__ */ React9.createElement(Text8, { style: { color: "green" } }, message[language])), expanded[language] && /* @__PURE__ */ React9.createElement(Stack7, { space: 2 }, /* @__PURE__ */ React9.createElement(Flex6, { justify: "space-between", align: "center" }, /* @__PURE__ */ React9.createElement(Text8, null, "TTF:\xA0", !((_d = (_c = (_b = scriptFileInput[language]) == null ? void 0 : _b.ttf) == null ? void 0 : _c.asset) == null ? void 0 : _d._ref) ? ((_e = filenames[language]) == null ? void 0 : _e.ttf) ? /* @__PURE__ */ React9.createElement("b", null, filenames[language].ttf) : /* @__PURE__ */ React9.createElement("b", null, "Empty") : /* @__PURE__ */ React9.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_h = (_g = (_f = scriptFileInput[language]) == null ? void 0 : _f.ttf) == null ? void 0 : _g.asset) == null ? void 0 : _h._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_i = filenames[language]) == null ? void 0 : _i.ttf) ? /* @__PURE__ */ React9.createElement("b", null, filenames[language].ttf) : /* @__PURE__ */ React9.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React9.createElement(Flex6, { gap: 1 }, /* @__PURE__ */ React9.createElement("label", null, /* @__PURE__ */ React9.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React9.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: (event) => handleUpload(event, language, "ttf") })), ((_j = value[language]) == null ? void 0 : _j.ttf) && /* @__PURE__ */ React9.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("ttf", language) }, "\xD7"))), status === "ready" && ((_k = value[language]) == null ? void 0 : _k.ttf) && /* @__PURE__ */ React9.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("all", value[language].ttf, language) }, "Regenerate Files from TTF"), /* @__PURE__ */ React9.createElement(Flex6, { justify: "space-between", align: "center" }, /* @__PURE__ */ React9.createElement(Text8, null, "OTF:\xA0", !((_n = (_m = (_l = scriptFileInput[language]) == null ? void 0 : _l.otf) == null ? void 0 : _m.asset) == null ? void 0 : _n._ref) ? ((_o = filenames[language]) == null ? void 0 : _o.otf) ? /* @__PURE__ */ React9.createElement("b", null, (_p = filenames[language]) == null ? void 0 : _p.otf) : /* @__PURE__ */ React9.createElement("b", null, "Empty") : /* @__PURE__ */ React9.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_s = (_r = (_q = scriptFileInput[language]) == null ? void 0 : _q.otf) == null ? void 0 : _r.asset) == null ? void 0 : _s._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_t = filenames[language]) == null ? void 0 : _t.otf) ? /* @__PURE__ */ React9.createElement("b", null, (_u = filenames[language]) == null ? void 0 : _u.otf) : /* @__PURE__ */ React9.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React9.createElement(Flex6, { gap: 1 }, ((_v = value[language]) == null ? void 0 : _v.woff) && /* @__PURE__ */ React9.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("otf", value[language].woff, language) }, "Build"), /* @__PURE__ */ React9.createElement("label", null, /* @__PURE__ */ React9.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React9.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "otf") })), ((_w = value[language]) == null ? void 0 : _w.otf) && /* @__PURE__ */ React9.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("otf", language) }, "\xD7"))), /* @__PURE__ */ React9.createElement(Flex6, { justify: "space-between", align: "center" }, /* @__PURE__ */ React9.createElement(Text8, null, "WOFF:\xA0", !((_z = (_y = (_x = scriptFileInput[language]) == null ? void 0 : _x.woff) == null ? void 0 : _y.asset) == null ? void 0 : _z._ref) ? ((_A = filenames[language]) == null ? void 0 : _A.woff) ? /* @__PURE__ */ React9.createElement("b", null, (_B = filenames[language]) == null ? void 0 : _B.woff) : /* @__PURE__ */ React9.createElement("b", null, "Empty") : /* @__PURE__ */ React9.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_E = (_D = (_C = scriptFileInput[language]) == null ? void 0 : _C.woff) == null ? void 0 : _D.asset) == null ? void 0 : _E._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_F = filenames[language]) == null ? void 0 : _F.woff) ? /* @__PURE__ */ React9.createElement("b", null, (_G = filenames[language]) == null ? void 0 : _G.woff) : /* @__PURE__ */ React9.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React9.createElement(Flex6, { gap: 1 }, ((_H = value[language]) == null ? void 0 : _H.ttf) && /* @__PURE__ */ React9.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("woff", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React9.createElement("label", null, /* @__PURE__ */ React9.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React9.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "woff") })), ((_I = value[language]) == null ? void 0 : _I.woff) && /* @__PURE__ */ React9.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("woff", language) }, "\xD7"))), /* @__PURE__ */ React9.createElement(Flex6, { justify: "space-between", align: "center" }, /* @__PURE__ */ React9.createElement(Text8, null, "WOFF2:\xA0", !((_L = (_K = (_J = scriptFileInput[language]) == null ? void 0 : _J.woff2) == null ? void 0 : _K.asset) == null ? void 0 : _L._ref) ? ((_M = filenames[language]) == null ? void 0 : _M.woff2) ? /* @__PURE__ */ React9.createElement("b", null, (_N = filenames[language]) == null ? void 0 : _N.woff2) : /* @__PURE__ */ React9.createElement("b", null, "Empty") : /* @__PURE__ */ React9.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_Q = (_P = (_O = scriptFileInput[language]) == null ? void 0 : _O.woff2) == null ? void 0 : _P.asset) == null ? void 0 : _Q._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_R = filenames[language]) == null ? void 0 : _R.woff2) ? /* @__PURE__ */ React9.createElement("b", null, (_S = filenames[language]) == null ? void 0 : _S.woff2) : /* @__PURE__ */ React9.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React9.createElement(Flex6, { gap: 1 }, ((_T = value[language]) == null ? void 0 : _T.ttf) && /* @__PURE__ */ React9.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("woff2", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React9.createElement("label", null, /* @__PURE__ */ React9.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React9.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "woff2") })), ((_U = value[language]) == null ? void 0 : _U.woff2) && /* @__PURE__ */ React9.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("woff2", language) }, "\xD7"))), /* @__PURE__ */ React9.createElement(Flex6, { justify: "space-between", align: "center" }, /* @__PURE__ */ React9.createElement(Text8, null, "EOT:\xA0", !((_X = (_W = (_V = scriptFileInput[language]) == null ? void 0 : _V.eot) == null ? void 0 : _W.asset) == null ? void 0 : _X._ref) ? ((_Y = filenames[language]) == null ? void 0 : _Y.eot) ? /* @__PURE__ */ React9.createElement("b", null, (_Z = filenames[language]) == null ? void 0 : _Z.eot) : /* @__PURE__ */ React9.createElement("b", null, "Empty") : /* @__PURE__ */ React9.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_aa = (_$ = (__ = scriptFileInput[language]) == null ? void 0 : __.eot) == null ? void 0 : _$.asset) == null ? void 0 : _aa._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_ba = filenames[language]) == null ? void 0 : _ba.eot) ? /* @__PURE__ */ React9.createElement("b", null, (_ca = filenames[language]) == null ? void 0 : _ca.eot) : /* @__PURE__ */ React9.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React9.createElement(Flex6, { gap: 1 }, ((_da = value[language]) == null ? void 0 : _da.ttf) && /* @__PURE__ */ React9.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("eot", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React9.createElement("label", null, /* @__PURE__ */ React9.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React9.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "eot") })), ((_ea = value[language]) == null ? void 0 : _ea.eot) && /* @__PURE__ */ React9.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("eot", language) }, "\xD7"))), /* @__PURE__ */ React9.createElement(Flex6, { justify: "space-between", align: "center" }, /* @__PURE__ */ React9.createElement(Text8, null, "SVG:\xA0", !((_ha = (_ga = (_fa = scriptFileInput[language]) == null ? void 0 : _fa.svg) == null ? void 0 : _ga.asset) == null ? void 0 : _ha._ref) ? ((_ia = filenames[language]) == null ? void 0 : _ia.svg) ? /* @__PURE__ */ React9.createElement("b", null, (_ja = filenames[language]) == null ? void 0 : _ja.svg) : /* @__PURE__ */ React9.createElement("b", null, "Empty") : /* @__PURE__ */ React9.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_ma = (_la = (_ka = scriptFileInput[language]) == null ? void 0 : _ka.svg) == null ? void 0 : _la.asset) == null ? void 0 : _ma._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_na = filenames[language]) == null ? void 0 : _na.svg) ? /* @__PURE__ */ React9.createElement("b", null, (_oa = filenames[language]) == null ? void 0 : _oa.svg) : /* @__PURE__ */ React9.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React9.createElement(Flex6, { gap: 1 }, ((_pa = value[language]) == null ? void 0 : _pa.ttf) && /* @__PURE__ */ React9.createElement(Button7, { mode: "default", onClick: () => handleGenerateFontFile("svg", value[language].ttf, language) }, "Build"), /* @__PURE__ */ React9.createElement("label", null, /* @__PURE__ */ React9.createElement(Button7, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ React9.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "svg") })), ((_qa = value[language]) == null ? void 0 : _qa.svg) && /* @__PURE__ */ React9.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("svg", language) }, "\xD7"))), /* @__PURE__ */ React9.createElement(Flex6, { justify: "space-between", align: "center" }, /* @__PURE__ */ React9.createElement(Text8, null, "CSS:\xA0", !((_ta = (_sa = (_ra = scriptFileInput[language]) == null ? void 0 : _ra.css) == null ? void 0 : _sa.asset) == null ? void 0 : _ta._ref) ? ((_ua = filenames[language]) == null ? void 0 : _ua.css) ? /* @__PURE__ */ React9.createElement("b", null, (_va = filenames[language]) == null ? void 0 : _va.css) : /* @__PURE__ */ React9.createElement("b", null, "Empty") : /* @__PURE__ */ React9.createElement("a", { href: `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_ya = (_xa = (_wa = scriptFileInput[language]) == null ? void 0 : _wa.css) == null ? void 0 : _xa.asset) == null ? void 0 : _ya._ref.replace("file-", "").replace("-", ".")}`, target: "_blank" }, ((_za = filenames[language]) == null ? void 0 : _za.css) ? /* @__PURE__ */ React9.createElement("b", null, (_Aa = filenames[language]) == null ? void 0 : _Aa.css) : /* @__PURE__ */ React9.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ React9.createElement(Flex6, { gap: 1 }, ((_Ba = value[language]) == null ? void 0 : _Ba.woff2) && /* @__PURE__ */ React9.createElement(Button7, { mode: "default", onClick: () => handleGenerateCssFile(language) }, "Build"), ((_Ca = value[language]) == null ? void 0 : _Ca.css) && /* @__PURE__ */ React9.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDelete("css", language) }, "\xD7"))), status === "ready" && (((_Da = value[language]) == null ? void 0 : _Da.ttf) || ((_Ea = value[language]) == null ? void 0 : _Ea.otf) || ((_Fa = value[language]) == null ? void 0 : _Fa.woff) || ((_Ga = value[language]) == null ? void 0 : _Ga.woff2)) && /* @__PURE__ */ React9.createElement(Button7, { mode: "ghost", tone: "critical", onClick: () => handleDeleteAll(language), style: { width: "100%" } }, "Delete All")));
3470
2597
  }));
3471
2598
  };
3472
2599
 
3473
2600
  // src/components/UploadButton.jsx
3474
- import React11, { forwardRef } from "react";
3475
- import { Button as Button8, Text as Text10 } from "@sanity/ui";
2601
+ import React10, { forwardRef } from "react";
2602
+ import { Button as Button8, Text as Text9 } from "@sanity/ui";
3476
2603
  var UploadButton = forwardRef(({ handleUpload }, ref) => {
3477
- return /* @__PURE__ */ React11.createElement(
2604
+ return /* @__PURE__ */ React10.createElement(
3478
2605
  Button8,
3479
2606
  {
3480
2607
  mode: "ghost",
@@ -3483,8 +2610,8 @@ var UploadButton = forwardRef(({ handleUpload }, ref) => {
3483
2610
  padding: 3,
3484
2611
  style: { position: "relative" }
3485
2612
  },
3486
- /* @__PURE__ */ React11.createElement(Text10, { align: "center" }, "Upload (ttf/otf/woff/woff2/etc...)"),
3487
- /* @__PURE__ */ React11.createElement(
2613
+ /* @__PURE__ */ React10.createElement(Text9, { align: "center" }, "Upload (ttf/otf/woff/woff2/etc...)"),
2614
+ /* @__PURE__ */ React10.createElement(
3488
2615
  "input",
3489
2616
  {
3490
2617
  ref,
@@ -3508,7 +2635,7 @@ UploadButton.displayName = "UploadButton";
3508
2635
  var UploadButton_default = UploadButton;
3509
2636
 
3510
2637
  // src/components/KeyValueInput.jsx
3511
- import React12, { useState as useState8, useCallback as useCallback7 } from "react";
2638
+ import React11, { useState as useState8, useCallback as useCallback7 } from "react";
3512
2639
  import { Button as Button9, Grid as Grid5, Stack as Stack8, TextInput as TextInput2 } from "@sanity/ui";
3513
2640
  import { AddIcon, ArrowDownIcon, ArrowUpIcon, TrashIcon as TrashIcon3 } from "@sanity/icons";
3514
2641
  import { set as set4 } from "sanity";
@@ -3544,37 +2671,37 @@ function KeyValueInput({ value = [], onChange }) {
3544
2671
  setPairs(updatedPairs);
3545
2672
  onChange(set4(updatedPairs));
3546
2673
  }, [pairs, onChange]);
3547
- return /* @__PURE__ */ React12.createElement(Stack8, { space: 3 }, pairs.map((pair, index) => /* @__PURE__ */ React12.createElement(Grid5, { className: "manualButtonWrap", columns: [2], key: index, gap: 0, style: { position: "relative" } }, /* @__PURE__ */ React12.createElement("div", { style: { position: "absolute", height: "100%", top: "0", left: "-10px", width: "min-content", transform: "translate(-100%, 0%)" } }, /* @__PURE__ */ React12.createElement("button", { className: "manualButton manualButtonUp", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveUp(index) }, /* @__PURE__ */ React12.createElement(ArrowUpIcon, null)), /* @__PURE__ */ React12.createElement("button", { className: "manualButton manualButtonDown", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveDown(index) }, /* @__PURE__ */ React12.createElement(ArrowDownIcon, null))), /* @__PURE__ */ React12.createElement(
2674
+ return /* @__PURE__ */ React11.createElement(Stack8, { space: 3 }, pairs.map((pair, index) => /* @__PURE__ */ React11.createElement(Grid5, { className: "manualButtonWrap", columns: [2], key: index, gap: 0, style: { position: "relative" } }, /* @__PURE__ */ React11.createElement("div", { style: { position: "absolute", height: "100%", top: "0", left: "-10px", width: "min-content", transform: "translate(-100%, 0%)" } }, /* @__PURE__ */ React11.createElement("button", { className: "manualButton manualButtonUp", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveUp(index) }, /* @__PURE__ */ React11.createElement(ArrowUpIcon, null)), /* @__PURE__ */ React11.createElement("button", { className: "manualButton manualButtonDown", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveDown(index) }, /* @__PURE__ */ React11.createElement(ArrowDownIcon, null))), /* @__PURE__ */ React11.createElement(
3548
2675
  TextInput2,
3549
2676
  {
3550
2677
  value: pair.key,
3551
2678
  onChange: (e) => handlePairChange(index, "key", e.target.value),
3552
2679
  placeholder: "Key"
3553
2680
  }
3554
- ), /* @__PURE__ */ React12.createElement("div", { style: { marginLeft: "-1px" } }, /* @__PURE__ */ React12.createElement(
2681
+ ), /* @__PURE__ */ React11.createElement("div", { style: { marginLeft: "-1px" } }, /* @__PURE__ */ React11.createElement(
3555
2682
  TextInput2,
3556
2683
  {
3557
2684
  value: pair.value,
3558
2685
  onChange: (e) => handlePairChange(index, "value", e.target.value),
3559
2686
  placeholder: "Value"
3560
2687
  }
3561
- )), /* @__PURE__ */ React12.createElement(
2688
+ )), /* @__PURE__ */ React11.createElement(
3562
2689
  "button",
3563
2690
  {
3564
2691
  className: "manualButton",
3565
2692
  onClick: () => handleRemovePair(index),
3566
2693
  style: { position: "absolute", top: "0", right: "-10px", transform: "translate(100%, 0%)" }
3567
2694
  },
3568
- /* @__PURE__ */ React12.createElement(TrashIcon3, null)
3569
- ))), /* @__PURE__ */ React12.createElement(Button9, { tone: "primary", onClick: handleAddPair, icon: AddIcon, text: "Add Row" }));
2695
+ /* @__PURE__ */ React11.createElement(TrashIcon3, null)
2696
+ ))), /* @__PURE__ */ React11.createElement(Button9, { tone: "primary", onClick: handleAddPair, icon: AddIcon, text: "Add Row" }));
3570
2697
  }
3571
2698
 
3572
2699
  // src/components/KeyValueReferenceInput.jsx
3573
- import React13, { useState as useState9, useCallback as useCallback8, useEffect as useEffect6 } from "react";
3574
- import { Button as Button10, Stack as Stack9, TextInput as TextInput3, Box as Box4, Card as Card4, Flex as Flex8, Text as Text11, Dialog, Menu as Menu2, MenuButton as MenuButton2, MenuItem as MenuItem2, Autocomplete } from "@sanity/ui";
2700
+ import React12, { useState as useState9, useCallback as useCallback8, useEffect as useEffect6 } from "react";
2701
+ import { Button as Button10, Stack as Stack9, TextInput as TextInput3, Box as Box4, Card as Card4, Flex as Flex7, Text as Text10, Dialog, Menu as Menu2, MenuButton as MenuButton2, MenuItem as MenuItem2, Autocomplete } from "@sanity/ui";
3575
2702
  import { AddIcon as AddIcon2, ArrowDownIcon as ArrowDownIcon2, ArrowUpIcon as ArrowUpIcon2, TrashIcon as TrashIcon4, SyncIcon, EllipsisHorizontalIcon } from "@sanity/icons";
3576
2703
  import { set as set5, useFormValue as useFormValue8 } from "sanity";
3577
- import { nanoid as nanoid8 } from "nanoid";
2704
+ import { nanoid as nanoid5 } from "nanoid";
3578
2705
  function KeyValueReferenceInput(props) {
3579
2706
  var _a, _b, _c, _d, _e, _f, _g, _h;
3580
2707
  const { value = [], onChange, schemaType, referenceType, fetchReferences, topActions } = props;
@@ -3620,7 +2747,7 @@ function KeyValueReferenceInput(props) {
3620
2747
  onChange(set5(updatedPairs));
3621
2748
  }, [pairs, onChange]);
3622
2749
  const handleAddPair = useCallback8(() => {
3623
- const updatedPairs = [...pairs, { key: "", value: null, _key: nanoid8() }];
2750
+ const updatedPairs = [...pairs, { key: "", value: null, _key: nanoid5() }];
3624
2751
  setPairs(updatedPairs);
3625
2752
  onChange(set5(updatedPairs));
3626
2753
  }, [pairs, onChange]);
@@ -3681,48 +2808,48 @@ function KeyValueReferenceInput(props) {
3681
2808
  const valueTitle = (valueField == null ? void 0 : valueField.title) || "Value";
3682
2809
  const keyPlaceholder = (keyField == null ? void 0 : keyField.placeholder) || "Enter key";
3683
2810
  const pickerLabel = referenceType || valueTitle.toLowerCase();
3684
- return /* @__PURE__ */ React13.createElement(Stack9, { space: 3 }, topActions && /* @__PURE__ */ React13.createElement(Box4, { paddingBottom: 2 }, topActions), /* @__PURE__ */ React13.createElement(Box4, null, /* @__PURE__ */ React13.createElement(Stack9, { space: 2 }, pairs.map((pair, index) => {
2811
+ return /* @__PURE__ */ React12.createElement(Stack9, { space: 3 }, topActions && /* @__PURE__ */ React12.createElement(Box4, { paddingBottom: 2 }, topActions), /* @__PURE__ */ React12.createElement(Box4, null, /* @__PURE__ */ React12.createElement(Stack9, { space: 2 }, pairs.map((pair, index) => {
3685
2812
  var _a2;
3686
- return /* @__PURE__ */ React13.createElement(Box4, { key: index, style: { position: "relative" } }, /* @__PURE__ */ React13.createElement("div", { style: { position: "absolute", height: "100%", top: "0", left: "-5px", width: "min-content", transform: "translate(-100%, 0%)" } }, /* @__PURE__ */ React13.createElement("button", { className: "manualButton manualButtonUp", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveUp(index) }, /* @__PURE__ */ React13.createElement(ArrowUpIcon2, null)), /* @__PURE__ */ React13.createElement("button", { className: "manualButton manualButtonDown", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveDown(index) }, /* @__PURE__ */ React13.createElement(ArrowDownIcon2, null))), /* @__PURE__ */ React13.createElement(Flex8, { gap: 2, align: "flex-start" }, /* @__PURE__ */ React13.createElement(Box4, { flex: 1 }, /* @__PURE__ */ React13.createElement(
2813
+ return /* @__PURE__ */ React12.createElement(Box4, { key: index, style: { position: "relative" } }, /* @__PURE__ */ React12.createElement("div", { style: { position: "absolute", height: "100%", top: "0", left: "-5px", width: "min-content", transform: "translate(-100%, 0%)" } }, /* @__PURE__ */ React12.createElement("button", { className: "manualButton manualButtonUp", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveUp(index) }, /* @__PURE__ */ React12.createElement(ArrowUpIcon2, null)), /* @__PURE__ */ React12.createElement("button", { className: "manualButton manualButtonDown", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveDown(index) }, /* @__PURE__ */ React12.createElement(ArrowDownIcon2, null))), /* @__PURE__ */ React12.createElement(Flex7, { gap: 2, align: "flex-start" }, /* @__PURE__ */ React12.createElement(Box4, { flex: 1 }, /* @__PURE__ */ React12.createElement(
3687
2814
  TextInput3,
3688
2815
  {
3689
2816
  value: pair.key,
3690
2817
  onChange: (e) => handlePairChange(index, "key", e.target.value),
3691
2818
  placeholder: keyPlaceholder
3692
2819
  }
3693
- )), /* @__PURE__ */ React13.createElement(Box4, { flex: 1, style: { minHeight: "100%" } }, ((_a2 = pair.value) == null ? void 0 : _a2._ref) ? /* @__PURE__ */ React13.createElement(Card4, { className: "referenceCard", radius: 2, tone: "primary", style: { paddingLeft: "1rem", height: "fit-content" } }, /* @__PURE__ */ React13.createElement(Flex8, { align: "center", justify: "space-between" }, /* @__PURE__ */ React13.createElement(
3694
- Text11,
2820
+ )), /* @__PURE__ */ React12.createElement(Box4, { flex: 1, style: { minHeight: "100%" } }, ((_a2 = pair.value) == null ? void 0 : _a2._ref) ? /* @__PURE__ */ React12.createElement(Card4, { className: "referenceCard", radius: 2, tone: "primary", style: { paddingLeft: "1rem", height: "fit-content" } }, /* @__PURE__ */ React12.createElement(Flex7, { align: "center", justify: "space-between" }, /* @__PURE__ */ React12.createElement(
2821
+ Text10,
3695
2822
  {
3696
2823
  size: 2,
3697
2824
  style: { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", maxWidth: "90%" }
3698
2825
  },
3699
2826
  referenceData[pair.value._ref] || "Loading..."
3700
- ), /* @__PURE__ */ React13.createElement(
2827
+ ), /* @__PURE__ */ React12.createElement(
3701
2828
  MenuButton2,
3702
2829
  {
3703
- button: /* @__PURE__ */ React13.createElement(Button10, { icon: EllipsisHorizontalIcon, mode: "bleed", title: "Options" }),
2830
+ button: /* @__PURE__ */ React12.createElement(Button10, { icon: EllipsisHorizontalIcon, mode: "bleed", title: "Options" }),
3704
2831
  id: `ref-options-${index}`,
3705
- menu: /* @__PURE__ */ React13.createElement(Menu2, null, /* @__PURE__ */ React13.createElement(MenuItem2, { tone: "critical", icon: TrashIcon4, text: "Remove", onClick: () => handlePairChange(index, "value", null) }), /* @__PURE__ */ React13.createElement(MenuItem2, { icon: SyncIcon, text: "Replace", onClick: () => openReferenceSelector(index) })),
2832
+ menu: /* @__PURE__ */ React12.createElement(Menu2, null, /* @__PURE__ */ React12.createElement(MenuItem2, { tone: "critical", icon: TrashIcon4, text: "Remove", onClick: () => handlePairChange(index, "value", null) }), /* @__PURE__ */ React12.createElement(MenuItem2, { icon: SyncIcon, text: "Replace", onClick: () => openReferenceSelector(index) })),
3706
2833
  popover: { portal: true, tone: "default", placement: "left" }
3707
2834
  }
3708
- ))) : /* @__PURE__ */ React13.createElement(
2835
+ ))) : /* @__PURE__ */ React12.createElement(
3709
2836
  Box4,
3710
2837
  {
3711
2838
  padding: 2,
3712
2839
  style: { minHeight: "100%", border: "1px dashed #ccc", borderRadius: "4px", display: "flex", alignItems: "center", justifyContent: "center", cursor: "pointer" },
3713
2840
  onClick: () => openReferenceSelector(index)
3714
2841
  },
3715
- /* @__PURE__ */ React13.createElement(Text11, { muted: true, size: 2 }, "Click to select a ", pickerLabel)
3716
- ))), /* @__PURE__ */ React13.createElement(
2842
+ /* @__PURE__ */ React12.createElement(Text10, { muted: true, size: 2 }, "Click to select a ", pickerLabel)
2843
+ ))), /* @__PURE__ */ React12.createElement(
3717
2844
  "button",
3718
2845
  {
3719
2846
  className: "manualButton",
3720
2847
  onClick: () => handleRemovePair(index),
3721
2848
  style: { position: "absolute", top: "0", right: "-7px", transform: "translate(100%, 0%)" }
3722
2849
  },
3723
- /* @__PURE__ */ React13.createElement(TrashIcon4, null)
2850
+ /* @__PURE__ */ React12.createElement(TrashIcon4, null)
3724
2851
  ));
3725
- }))), /* @__PURE__ */ React13.createElement(Button10, { tone: "primary", mode: "ghost", onClick: handleAddPair, icon: AddIcon2, text: `Add ${keyTitle}` }), isDialogOpen && /* @__PURE__ */ React13.createElement(
2852
+ }))), /* @__PURE__ */ React12.createElement(Button10, { tone: "primary", mode: "ghost", onClick: handleAddPair, icon: AddIcon2, text: `Add ${keyTitle}` }), isDialogOpen && /* @__PURE__ */ React12.createElement(
3726
2853
  Dialog,
3727
2854
  {
3728
2855
  header: `Select a ${pickerLabel}`,
@@ -3730,13 +2857,13 @@ function KeyValueReferenceInput(props) {
3730
2857
  onClose: closeDialog,
3731
2858
  width: 1
3732
2859
  },
3733
- /* @__PURE__ */ React13.createElement(Box4, { padding: 4 }, /* @__PURE__ */ React13.createElement(
2860
+ /* @__PURE__ */ React12.createElement(Box4, { padding: 4 }, /* @__PURE__ */ React12.createElement(
3734
2861
  Autocomplete,
3735
2862
  {
3736
2863
  id: "reference-autocomplete",
3737
2864
  options: referenceOptions,
3738
2865
  placeholder: `Search ${pickerLabel}s...`,
3739
- renderOption: (option) => /* @__PURE__ */ React13.createElement(Card4, { key: option.value, padding: 3, radius: 2, tone: "default", style: { cursor: "pointer" } }, /* @__PURE__ */ React13.createElement(Text11, { size: 2 }, option.title)),
2866
+ renderOption: (option) => /* @__PURE__ */ React12.createElement(Card4, { key: option.value, padding: 3, radius: 2, tone: "default", style: { cursor: "pointer" } }, /* @__PURE__ */ React12.createElement(Text10, { size: 2 }, option.title)),
3740
2867
  renderValue: (val) => {
3741
2868
  var _a2;
3742
2869
  return ((_a2 = referenceOptions.find((o) => o.value === val)) == null ? void 0 : _a2.title) || "";
@@ -3753,11 +2880,11 @@ function KeyValueReferenceInput(props) {
3753
2880
  }
3754
2881
 
3755
2882
  // src/components/VariableInstanceReferencesInput.jsx
3756
- import React14, { useState as useState10, useCallback as useCallback9 } from "react";
3757
- import { Button as Button11, Flex as Flex9, Dialog as Dialog2, Box as Box5, Stack as Stack10, Text as Text12 } from "@sanity/ui";
2883
+ import React13, { useState as useState10, useCallback as useCallback9 } from "react";
2884
+ import { Button as Button11, Flex as Flex8, Dialog as Dialog2, Box as Box5, Stack as Stack10, Text as Text11 } from "@sanity/ui";
3758
2885
  import { SyncIcon as SyncIcon2, DocumentTextIcon } from "@sanity/icons";
3759
2886
  import { set as set6, useFormValue as useFormValue9 } from "sanity";
3760
- import { nanoid as nanoid9 } from "nanoid";
2887
+ import { nanoid as nanoid6 } from "nanoid";
3761
2888
  function VariableInstanceReferencesInput(props) {
3762
2889
  const { value = [], onChange } = props;
3763
2890
  const [isAutofilling, setIsAutofilling] = useState10(false);
@@ -3814,7 +2941,7 @@ function VariableInstanceReferencesInput(props) {
3814
2941
  console.warn("No variable instances found in JSON");
3815
2942
  return;
3816
2943
  }
3817
- const keyOnlyPairs = keys.map((key) => ({ key, value: null, _key: nanoid9() }));
2944
+ const keyOnlyPairs = keys.map((key) => ({ key, value: null, _key: nanoid6() }));
3818
2945
  const updatedPairs = mode === "replace" ? keyOnlyPairs : [...value, ...keyOnlyPairs.filter((p) => !value.some((existing) => existing.key === p.key))];
3819
2946
  onChange(set6(updatedPairs));
3820
2947
  } catch (err) {
@@ -3850,7 +2977,7 @@ function VariableInstanceReferencesInput(props) {
3850
2977
  setPendingAction(null);
3851
2978
  }, []);
3852
2979
  const showAutofill = !!((formDocument == null ? void 0 : formDocument.variableFont) && (formDocument == null ? void 0 : formDocument.variableInstances));
3853
- const topActions = showAutofill ? /* @__PURE__ */ React14.createElement(Flex9, { gap: 2 }, /* @__PURE__ */ React14.createElement(
2980
+ const topActions = showAutofill ? /* @__PURE__ */ React13.createElement(Flex8, { gap: 2 }, /* @__PURE__ */ React13.createElement(
3854
2981
  Button11,
3855
2982
  {
3856
2983
  tone: "primary",
@@ -3861,7 +2988,7 @@ function VariableInstanceReferencesInput(props) {
3861
2988
  disabled: isAutofilling,
3862
2989
  loading: isAutofilling
3863
2990
  }
3864
- ), /* @__PURE__ */ React14.createElement(
2991
+ ), /* @__PURE__ */ React13.createElement(
3865
2992
  Button11,
3866
2993
  {
3867
2994
  tone: "default",
@@ -3873,7 +3000,7 @@ function VariableInstanceReferencesInput(props) {
3873
3000
  loading: isAutofilling
3874
3001
  }
3875
3002
  )) : null;
3876
- return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(
3003
+ return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
3877
3004
  KeyValueReferenceInput,
3878
3005
  {
3879
3006
  ...props,
@@ -3881,7 +3008,7 @@ function VariableInstanceReferencesInput(props) {
3881
3008
  fetchReferences,
3882
3009
  topActions
3883
3010
  }
3884
- ), showConfirmDialog && /* @__PURE__ */ React14.createElement(
3011
+ ), showConfirmDialog && /* @__PURE__ */ React13.createElement(
3885
3012
  Dialog2,
3886
3013
  {
3887
3014
  header: "Existing entries found",
@@ -3889,15 +3016,15 @@ function VariableInstanceReferencesInput(props) {
3889
3016
  onClose: handleConfirmCancel,
3890
3017
  width: 1
3891
3018
  },
3892
- /* @__PURE__ */ React14.createElement(Box5, { padding: 4 }, /* @__PURE__ */ React14.createElement(Stack10, { space: 4 }, /* @__PURE__ */ React14.createElement(Text12, null, "You already have ", value.length, " ", value.length === 1 ? "entry" : "entries", ". How would you like to proceed?"), /* @__PURE__ */ React14.createElement(Flex9, { gap: 2, justify: "flex-end" }, /* @__PURE__ */ React14.createElement(Button11, { text: "Cancel", mode: "ghost", onClick: handleConfirmCancel }), /* @__PURE__ */ React14.createElement(Button11, { text: "Merge (Add New)", tone: "primary", mode: "ghost", onClick: () => handleConfirmChoice("merge") }), /* @__PURE__ */ React14.createElement(Button11, { text: "Replace All", tone: "critical", onClick: () => handleConfirmChoice("replace") }))))
3019
+ /* @__PURE__ */ React13.createElement(Box5, { padding: 4 }, /* @__PURE__ */ React13.createElement(Stack10, { space: 4 }, /* @__PURE__ */ React13.createElement(Text11, null, "You already have ", value.length, " ", value.length === 1 ? "entry" : "entries", ". How would you like to proceed?"), /* @__PURE__ */ React13.createElement(Flex8, { gap: 2, justify: "flex-end" }, /* @__PURE__ */ React13.createElement(Button11, { text: "Cancel", mode: "ghost", onClick: handleConfirmCancel }), /* @__PURE__ */ React13.createElement(Button11, { text: "Merge (Add New)", tone: "primary", mode: "ghost", onClick: () => handleConfirmChoice("merge") }), /* @__PURE__ */ React13.createElement(Button11, { text: "Replace All", tone: "critical", onClick: () => handleConfirmChoice("replace") }))))
3893
3020
  ));
3894
3021
  }
3895
3022
 
3896
3023
  // src/components/PrimaryCollectionGeneratorTypeface.jsx
3897
- import React15, { useCallback as useCallback10, useState as useState11 } from "react";
3898
- import { Stack as Stack11, Flex as Flex10, Text as Text13, Button as Button12, Card as Card5, Spinner as Spinner3 } from "@sanity/ui";
3024
+ import React14, { useCallback as useCallback10, useState as useState11 } from "react";
3025
+ import { Stack as Stack11, Flex as Flex9, Text as Text12, Button as Button12, Card as Card5, Spinner as Spinner3 } from "@sanity/ui";
3899
3026
  import { useFormValue as useFormValue10 } from "sanity";
3900
- import { nanoid as nanoid10 } from "nanoid";
3027
+ import { nanoid as nanoid7 } from "nanoid";
3901
3028
  var PrimaryCollectionGeneratorTypeface = () => {
3902
3029
  const client = useSanityClient();
3903
3030
  const [status, setStatus] = useState11("ready");
@@ -3917,7 +3044,7 @@ var PrimaryCollectionGeneratorTypeface = () => {
3917
3044
  if (!id.includes("collection")) id += "-collection";
3918
3045
  const colTitle = id.replace(/-/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
3919
3046
  const collectionDoc = {
3920
- _key: nanoid10(),
3047
+ _key: nanoid7(),
3921
3048
  _id: id,
3922
3049
  title: colTitle,
3923
3050
  slug: { _type: "slug", current: id },
@@ -3935,7 +3062,7 @@ var PrimaryCollectionGeneratorTypeface = () => {
3935
3062
  ...styles,
3936
3063
  collections: [{
3937
3064
  _type: "reference",
3938
- _key: nanoid10(),
3065
+ _key: nanoid7(),
3939
3066
  _ref: sanityCollection._id,
3940
3067
  _weak: true
3941
3068
  }, ...collections]
@@ -3949,7 +3076,7 @@ var PrimaryCollectionGeneratorTypeface = () => {
3949
3076
  setReady(true);
3950
3077
  }, [docId, fonts, price, preferredStyle, styles, title, client]);
3951
3078
  if (!title || !fonts) return null;
3952
- return /* @__PURE__ */ React15.createElement(Stack11, { space: 2 }, /* @__PURE__ */ React15.createElement(StatusDisplay_default, { status, error: false }), /* @__PURE__ */ React15.createElement(Card5, { border: true, padding: 2, shadow: 1, radius: 2 }, ready ? /* @__PURE__ */ React15.createElement(Stack11, { space: 3 }, /* @__PURE__ */ React15.createElement(Flex10, { align: "center", gap: 2, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React15.createElement(Text13, { size: 1, muted: true }, "Price"), /* @__PURE__ */ React15.createElement(Text13, { size: 1, muted: true }, "$"), /* @__PURE__ */ React15.createElement(
3079
+ return /* @__PURE__ */ React14.createElement(Stack11, { space: 2 }, /* @__PURE__ */ React14.createElement(StatusDisplay_default, { status, error: false }), /* @__PURE__ */ React14.createElement(Card5, { border: true, padding: 2, shadow: 1, radius: 2 }, ready ? /* @__PURE__ */ React14.createElement(Stack11, { space: 3 }, /* @__PURE__ */ React14.createElement(Flex9, { align: "center", gap: 2, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ React14.createElement(Text12, { size: 1, muted: true }, "Price"), /* @__PURE__ */ React14.createElement(Text12, { size: 1, muted: true }, "$"), /* @__PURE__ */ React14.createElement(
3953
3080
  "input",
3954
3081
  {
3955
3082
  value: price,
@@ -3957,7 +3084,7 @@ var PrimaryCollectionGeneratorTypeface = () => {
3957
3084
  type: "number",
3958
3085
  style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
3959
3086
  }
3960
- ), /* @__PURE__ */ React15.createElement(Text13, { size: 1, muted: true }, "per full family")), /* @__PURE__ */ React15.createElement(
3087
+ ), /* @__PURE__ */ React14.createElement(Text12, { size: 1, muted: true }, "per full family")), /* @__PURE__ */ React14.createElement(
3961
3088
  Button12,
3962
3089
  {
3963
3090
  mode: "ghost",
@@ -3966,13 +3093,13 @@ var PrimaryCollectionGeneratorTypeface = () => {
3966
3093
  onClick: generateCollection,
3967
3094
  text: "Generate Full Family Collection"
3968
3095
  }
3969
- )) : /* @__PURE__ */ React15.createElement(Flex10, { align: "center", justify: "center", gap: 3, padding: 4 }, /* @__PURE__ */ React15.createElement(Spinner3, null), /* @__PURE__ */ React15.createElement(Text13, { muted: true, size: 1 }, status))));
3096
+ )) : /* @__PURE__ */ React14.createElement(Flex9, { align: "center", justify: "center", gap: 3, padding: 4 }, /* @__PURE__ */ React14.createElement(Spinner3, null), /* @__PURE__ */ React14.createElement(Text12, { muted: true, size: 1 }, status))));
3970
3097
  };
3971
3098
 
3972
3099
  // src/components/SetOTF.jsx
3973
- import React16, { useState as useState12 } from "react";
3100
+ import React15, { useState as useState12 } from "react";
3974
3101
  import { set as set7, useFormValue as useFormValue11 } from "sanity";
3975
- import { Stack as Stack12, Button as Button13, Text as Text14 } from "@sanity/ui";
3102
+ import { Stack as Stack12, Button as Button13, Text as Text13 } from "@sanity/ui";
3976
3103
  var SetOTF = (props) => {
3977
3104
  var _a, _b;
3978
3105
  const { onChange, value = {} } = props;
@@ -4021,7 +3148,7 @@ var SetOTF = (props) => {
4021
3148
  console.error("SetOTF detect error:", err);
4022
3149
  }
4023
3150
  };
4024
- return /* @__PURE__ */ React16.createElement(Stack12, { className: "openType" }, ((_a = value == null ? void 0 : value.features) == null ? void 0 : _a.length) > 0 && /* @__PURE__ */ React16.createElement(Text14, { muted: true, size: 1, style: { marginBottom: "0.5rem" } }, "Number of features: ", value.features.length), !!((_b = stylesObject == null ? void 0 : stylesObject.fonts) == null ? void 0 : _b.length) && /* @__PURE__ */ React16.createElement(
3151
+ return /* @__PURE__ */ React15.createElement(Stack12, { className: "openType" }, ((_a = value == null ? void 0 : value.features) == null ? void 0 : _a.length) > 0 && /* @__PURE__ */ React15.createElement(Text13, { muted: true, size: 1, style: { marginBottom: "0.5rem" } }, "Number of features: ", value.features.length), !!((_b = stylesObject == null ? void 0 : stylesObject.fonts) == null ? void 0 : _b.length) && /* @__PURE__ */ React15.createElement(
4025
3152
  Button13,
4026
3153
  {
4027
3154
  text: "Detect OTF",
@@ -4029,23 +3156,23 @@ var SetOTF = (props) => {
4029
3156
  onClick: detect,
4030
3157
  style: { borderRadius: "0 3px 0 0", marginBottom: "1rem" }
4031
3158
  }
4032
- ), !!message && /* @__PURE__ */ React16.createElement(Text14, { muted: true, size: 1 }, /* @__PURE__ */ React16.createElement("br", null), message, /* @__PURE__ */ React16.createElement("br", null), /* @__PURE__ */ React16.createElement("br", null)), props.renderDefault(props));
3159
+ ), !!message && /* @__PURE__ */ React15.createElement(Text13, { muted: true, size: 1 }, /* @__PURE__ */ React15.createElement("br", null), message, /* @__PURE__ */ React15.createElement("br", null), /* @__PURE__ */ React15.createElement("br", null)), props.renderDefault(props));
4033
3160
  };
4034
3161
 
4035
3162
  // src/components/StyleCountInput.jsx
4036
- import React17 from "react";
4037
- import { Text as Text15 } from "@sanity/ui";
3163
+ import React16 from "react";
3164
+ import { Text as Text14 } from "@sanity/ui";
4038
3165
  import { useFormValue as useFormValue12 } from "sanity";
4039
3166
  var StyleCountInput = (props) => {
4040
3167
  const styles = useFormValue12(["styles", "fonts"]) || [];
4041
3168
  const vfStyles = useFormValue12(["styles", "variableFont"]) || [];
4042
3169
  const count = styles.length + vfStyles.length;
4043
- return /* @__PURE__ */ React17.createElement(Text15, { size: 1 }, count);
3170
+ return /* @__PURE__ */ React16.createElement(Text14, { size: 1 }, count);
4044
3171
  };
4045
3172
 
4046
3173
  // src/components/NestedObjectArraySelector.jsx
4047
- import React18, { useMemo as useMemo5, useState as useState14 } from "react";
4048
- import { Stack as Stack13, Card as Card6, Text as Text16, Checkbox, Box as Box6, Spinner as Spinner4, Flex as Flex11 } from "@sanity/ui";
3174
+ import React17, { useMemo as useMemo5, useState as useState14 } from "react";
3175
+ import { Stack as Stack13, Card as Card6, Text as Text15, Checkbox, Box as Box6, Spinner as Spinner4, Flex as Flex10 } from "@sanity/ui";
4049
3176
 
4050
3177
  // src/hooks/useNestedObjects.js
4051
3178
  import { useState as useState13, useEffect as useEffect7 } from "react";
@@ -4117,7 +3244,7 @@ function useNestedObjects({
4117
3244
 
4118
3245
  // src/components/NestedObjectArraySelector.jsx
4119
3246
  import { set as set8, unset as unset3 } from "sanity";
4120
- var NestedObjectArraySelector = React18.forwardRef((props, ref) => {
3247
+ var NestedObjectArraySelector = React17.forwardRef((props, ref) => {
4121
3248
  const { value = [], onChange, schemaType } = props;
4122
3249
  const options = (schemaType == null ? void 0 : schemaType.options) || {};
4123
3250
  const {
@@ -4151,18 +3278,18 @@ var NestedObjectArraySelector = React18.forwardRef((props, ref) => {
4151
3278
  }
4152
3279
  };
4153
3280
  if (!sourceType || !nestedField || !titleField || !valueField) {
4154
- return /* @__PURE__ */ React18.createElement(Card6, { padding: 3, tone: "critical", border: true }, /* @__PURE__ */ React18.createElement(Text16, { size: 1 }, "Configuration error: Missing required options (sourceType, nestedField, titleField, or valueField)"));
3281
+ return /* @__PURE__ */ React17.createElement(Card6, { padding: 3, tone: "critical", border: true }, /* @__PURE__ */ React17.createElement(Text15, { size: 1 }, "Configuration error: Missing required options (sourceType, nestedField, titleField, or valueField)"));
4155
3282
  }
4156
3283
  if (loading) {
4157
- return /* @__PURE__ */ React18.createElement(Card6, { padding: 3, border: true }, /* @__PURE__ */ React18.createElement(Flex11, { align: "center", justify: "center", padding: 4 }, /* @__PURE__ */ React18.createElement(Spinner4, null), /* @__PURE__ */ React18.createElement(Box6, { marginLeft: 3 }, /* @__PURE__ */ React18.createElement(Text16, { size: 1 }, "Loading options..."))));
3284
+ return /* @__PURE__ */ React17.createElement(Card6, { padding: 3, border: true }, /* @__PURE__ */ React17.createElement(Flex10, { align: "center", justify: "center", padding: 4 }, /* @__PURE__ */ React17.createElement(Spinner4, null), /* @__PURE__ */ React17.createElement(Box6, { marginLeft: 3 }, /* @__PURE__ */ React17.createElement(Text15, { size: 1 }, "Loading options..."))));
4158
3285
  }
4159
3286
  if (error) {
4160
- return /* @__PURE__ */ React18.createElement(Card6, { padding: 3, tone: "critical", border: true }, /* @__PURE__ */ React18.createElement(Text16, { size: 1 }, "Error loading options: ", error.message));
3287
+ return /* @__PURE__ */ React17.createElement(Card6, { padding: 3, tone: "critical", border: true }, /* @__PURE__ */ React17.createElement(Text15, { size: 1 }, "Error loading options: ", error.message));
4161
3288
  }
4162
3289
  if (objects.length === 0) {
4163
- return /* @__PURE__ */ React18.createElement(Card6, { padding: 3, tone: "transparent", border: true }, /* @__PURE__ */ React18.createElement(Text16, { size: 1, muted: true }, emptyMessage));
3290
+ return /* @__PURE__ */ React17.createElement(Card6, { padding: 3, tone: "transparent", border: true }, /* @__PURE__ */ React17.createElement(Text15, { size: 1, muted: true }, emptyMessage));
4164
3291
  }
4165
- return /* @__PURE__ */ React18.createElement(Card6, { padding: 0, border: true, ref }, objects.length > 5 && /* @__PURE__ */ React18.createElement(Box6, { padding: 3, style: { borderBottom: "1px solid var(--card-border-color)" } }, /* @__PURE__ */ React18.createElement(
3292
+ return /* @__PURE__ */ React17.createElement(Card6, { padding: 0, border: true, ref }, objects.length > 5 && /* @__PURE__ */ React17.createElement(Box6, { padding: 3, style: { borderBottom: "1px solid var(--card-border-color)" } }, /* @__PURE__ */ React17.createElement(
4166
3293
  "input",
4167
3294
  {
4168
3295
  type: "text",
@@ -4171,10 +3298,10 @@ var NestedObjectArraySelector = React18.forwardRef((props, ref) => {
4171
3298
  onChange: (e) => setSearchTerm(e.target.value),
4172
3299
  style: { width: "100%", padding: "8px 12px", border: "1px solid var(--card-border-color)", borderRadius: "4px", fontSize: "13px", fontFamily: "inherit" }
4173
3300
  }
4174
- )), /* @__PURE__ */ React18.createElement(Stack13, { space: 0 }, filteredObjects.length === 0 ? /* @__PURE__ */ React18.createElement(Box6, { padding: 3 }, /* @__PURE__ */ React18.createElement(Text16, { size: 1, muted: true }, 'No results found for "', searchTerm, '"')) : filteredObjects.map((obj, index) => {
3301
+ )), /* @__PURE__ */ React17.createElement(Stack13, { space: 0 }, filteredObjects.length === 0 ? /* @__PURE__ */ React17.createElement(Box6, { padding: 3 }, /* @__PURE__ */ React17.createElement(Text15, { size: 1, muted: true }, 'No results found for "', searchTerm, '"')) : filteredObjects.map((obj, index) => {
4175
3302
  const isSelected = value == null ? void 0 : value.includes(obj.value);
4176
3303
  const isLast = index === filteredObjects.length - 1;
4177
- return /* @__PURE__ */ React18.createElement(
3304
+ return /* @__PURE__ */ React17.createElement(
4178
3305
  Box6,
4179
3306
  {
4180
3307
  key: obj.value,
@@ -4182,28 +3309,28 @@ var NestedObjectArraySelector = React18.forwardRef((props, ref) => {
4182
3309
  style: { borderBottom: isLast ? "none" : "1px solid var(--card-border-color)", cursor: "pointer", backgroundColor: isSelected ? "var(--card-muted-fg-color)" : "transparent", transition: "background-color 0.2s" },
4183
3310
  onClick: () => handleToggle(obj.value)
4184
3311
  },
4185
- /* @__PURE__ */ React18.createElement(Flex11, { align: "center", gap: 3 }, /* @__PURE__ */ React18.createElement(Checkbox, { checked: isSelected, readOnly: true, style: { pointerEvents: "none" } }), /* @__PURE__ */ React18.createElement(Text16, { size: 1, weight: isSelected ? "semibold" : "regular" }, obj.title))
3312
+ /* @__PURE__ */ React17.createElement(Flex10, { align: "center", gap: 3 }, /* @__PURE__ */ React17.createElement(Checkbox, { checked: isSelected, readOnly: true, style: { pointerEvents: "none" } }), /* @__PURE__ */ React17.createElement(Text15, { size: 1, weight: isSelected ? "semibold" : "regular" }, obj.title))
4186
3313
  );
4187
- })), (value == null ? void 0 : value.length) > 0 && /* @__PURE__ */ React18.createElement(Box6, { padding: 2, paddingX: 3, style: { borderTop: "1px solid var(--card-border-color)", backgroundColor: "var(--card-muted-fg-color)" } }, /* @__PURE__ */ React18.createElement(Text16, { size: 1, muted: true }, value.length, " selected")));
3314
+ })), (value == null ? void 0 : value.length) > 0 && /* @__PURE__ */ React17.createElement(Box6, { padding: 2, paddingX: 3, style: { borderTop: "1px solid var(--card-border-color)", backgroundColor: "var(--card-muted-fg-color)" } }, /* @__PURE__ */ React17.createElement(Text15, { size: 1, muted: true }, value.length, " selected")));
4188
3315
  });
4189
3316
  NestedObjectArraySelector.displayName = "NestedObjectArraySelector";
4190
3317
 
4191
3318
  // src/utils/getEmptyFontKit.js
4192
- import * as fontkit7 from "fontkit";
4193
- import slugify4 from "slugify";
3319
+ import slugify3 from "slugify";
4194
3320
  async function getEmptyFontKit({ title, files, weightKeywordList, italicKeywordList }) {
4195
- var _a, _b, _c, _d, _e, _f;
4196
3321
  let fontNames = {};
4197
3322
  let subfamilies = {};
4198
3323
  for (var i = 0; i < files.length; i++) {
4199
3324
  const file = files[i];
4200
3325
  const fontBuffer = await readFontFile2(file);
4201
- const font = fontkit7.create(fontBuffer);
4202
- let weightName = ((_b = (_a = font == null ? void 0 : font.name) == null ? void 0 : _a.records) == null ? void 0 : _b.preferredSubfamily) ? (_d = (_c = font == null ? void 0 : font.name) == null ? void 0 : _c.records) == null ? void 0 : _d.preferredSubfamily : (_f = (_e = font == null ? void 0 : font.name) == null ? void 0 : _e.records) == null ? void 0 : _f.fontSubfamily;
4203
- weightName = (weightName == null ? void 0 : weightName.en) ? weightName.en : weightName.constructor == Object ? weightName[Object.keys(weightName)[0]] : weightName;
4204
- let variableFont = (font == null ? void 0 : font.variationAxes) && Object.keys(font.variationAxes).length > 0 ? true : false;
4205
- let subfamilyName = font.familyName.toLowerCase().trim().replace(title.toLowerCase().trim(), "").trim();
4206
- let fontTitle = font == null ? void 0 : font.fullName.toLowerCase().trim();
3326
+ const font = await parseFont(fontBuffer, file.name);
3327
+ let weightName = getNameString(font, 17) || getNameString(font, 2) || "";
3328
+ const axes = getVariationAxes(font);
3329
+ let variableFont = axes !== null;
3330
+ const familyName = getNameString(font, 1);
3331
+ const fullName = getNameString(font, 4);
3332
+ let subfamilyName = familyName.toLowerCase().trim().replace(title.toLowerCase().trim(), "").trim();
3333
+ let fontTitle = fullName.toLowerCase().trim();
4207
3334
  weightKeywordList.forEach((keyword) => {
4208
3335
  const kw = keyword.toLowerCase().trim();
4209
3336
  if (fontTitle.includes(kw)) {
@@ -4225,7 +3352,7 @@ async function getEmptyFontKit({ title, files, weightKeywordList, italicKeywordL
4225
3352
  fontTitle = fontTitle.trim().split(" ").map((word) => word[0].toUpperCase() + word.slice(1)).join(" ");
4226
3353
  subfamilyName = subfamilyName.trim();
4227
3354
  subfamilyName = subfamilyName == "" ? "Regular" : subfamilyName.split(" ").map((word) => word[0].toUpperCase() + word.slice(1)).join(" ");
4228
- let id = slugify4(fontTitle.toLowerCase().trim());
3355
+ let id = slugify3(fontTitle.toLowerCase().trim());
4229
3356
  if (variableFont && !id.endsWith("-vf")) {
4230
3357
  id = id + "-vf";
4231
3358
  fontTitle = fontTitle + " VF";
@@ -4238,26 +3365,26 @@ async function getEmptyFontKit({ title, files, weightKeywordList, italicKeywordL
4238
3365
  if (!fontNames[id]) {
4239
3366
  fontNames[id] = [{
4240
3367
  file: file.name,
4241
- fullName: font.fullName,
4242
- familyName: font.familyName,
3368
+ fullName,
3369
+ familyName,
4243
3370
  subFamily: subfamilyName
4244
3371
  }];
4245
3372
  } else if (fontNames[id].indexOf(file.name) == -1) {
4246
3373
  fontNames[id].push({
4247
3374
  file: file.name,
4248
- fullName: font.fullName,
4249
- familyName: font.familyName,
3375
+ fullName,
3376
+ familyName,
4250
3377
  subFamily: subfamilyName
4251
3378
  });
4252
3379
  }
4253
3380
  }
4254
- console.log("font names : ", fontNames);
3381
+ console.log("Font names:", fontNames);
4255
3382
  }
4256
3383
  var readFontFile2 = (file) => {
4257
3384
  return new Promise((resolve, reject) => {
4258
3385
  const reader = new FileReader();
4259
3386
  reader.onload = (event) => {
4260
- resolve(new Uint8Array(event.target.result));
3387
+ resolve(event.target.result);
4261
3388
  };
4262
3389
  reader.onerror = (error) => {
4263
3390
  reject(error);
@@ -6720,15 +5847,15 @@ var stylisticSetField = {
6720
5847
  };
6721
5848
 
6722
5849
  // src/schema/stylesField.js
6723
- import React19 from "react";
5850
+ import React18 from "react";
6724
5851
  import { AdvancedRefArray } from "@liiift-studio/sanity-advanced-reference-array";
6725
5852
  var typefaceParams = (doc) => ({ typefaceName: (doc == null ? void 0 : doc.title) || "" });
6726
- var FontsRefArray = (props) => React19.createElement(AdvancedRefArray, {
5853
+ var FontsRefArray = (props) => React18.createElement(AdvancedRefArray, {
6727
5854
  ...props,
6728
5855
  filterGroq: "lower(typefaceName) == lower($typefaceName)",
6729
5856
  filterParams: typefaceParams
6730
5857
  });
6731
- var VariableFontsRefArray = (props) => React19.createElement(AdvancedRefArray, {
5858
+ var VariableFontsRefArray = (props) => React18.createElement(AdvancedRefArray, {
6732
5859
  ...props,
6733
5860
  filterGroq: "lower(typefaceName) == lower($typefaceName) && variableFont == true",
6734
5861
  filterParams: typefaceParams
@@ -6955,16 +6082,24 @@ function createStylesField({
6955
6082
  }
6956
6083
  export {
6957
6084
  BatchUploadFonts,
6085
+ BulkActions,
6958
6086
  DISCOUNT_REQUIREMENT_TYPES,
6959
6087
  DISCOUNT_REQUIREMENT_TYPES_OBJECT,
6088
+ EXECUTION_STATUS,
6089
+ ExistingDocumentResolver,
6090
+ FONT_STATUS,
6091
+ FontReviewCard_default as FontReviewCard,
6960
6092
  FontScriptUploaderComponent,
6961
6093
  GenerateCollectionsPairsComponent,
6962
6094
  HtmlDescription,
6963
6095
  KeyValueInput,
6964
6096
  KeyValueReferenceInput,
6965
6097
  NestedObjectArraySelector,
6098
+ PLAN_PHASE,
6099
+ PLAN_VERSION,
6966
6100
  PriceInput_default as PriceInput,
6967
6101
  PrimaryCollectionGeneratorTypeface,
6102
+ RECOMMENDATION,
6968
6103
  RegenerateSubfamiliesComponent,
6969
6104
  SCRIPTS,
6970
6105
  SCRIPTS_OBJECT,
@@ -6974,12 +6109,24 @@ export {
6974
6109
  StyleCountInput,
6975
6110
  UpdateScriptsComponent,
6976
6111
  UploadButton_default as UploadButton,
6112
+ UploadModal,
6977
6113
  UploadScriptsComponent,
6114
+ UploadStep1Settings,
6115
+ UploadStep2Review,
6116
+ UploadStep3Execute,
6117
+ UploadSummary,
6978
6118
  VariableInstanceReferencesInput,
6979
6119
  addItalicToFontTitle,
6120
+ buildUploadPlan,
6121
+ createEmptyPlan,
6122
+ createFontDecisions,
6980
6123
  createFontObject,
6124
+ createInitialExecutionState,
6981
6125
  createStylesField,
6982
6126
  determineWeight,
6127
+ escapeCssFontName,
6128
+ executeUploadPlan,
6129
+ executionReducer,
6983
6130
  expandAbbreviations,
6984
6131
  extractFontMetadata,
6985
6132
  extractWeightFromFullName,
@@ -6990,16 +6137,32 @@ export {
6990
6137
  generateFontFile,
6991
6138
  generateStyleKeywords,
6992
6139
  generateSubset,
6140
+ getAllFeatureTags,
6141
+ getCharacterSet,
6993
6142
  getEmptyFontKit,
6143
+ getFamilyClass,
6144
+ getFontMetadata,
6145
+ getFontMetrics,
6146
+ getFsSelection,
6147
+ getGlyphCount,
6148
+ getItalicAngle,
6149
+ getMacStyle,
6150
+ getNameString,
6151
+ getNamedInstances,
6152
+ getVariationAxes,
6153
+ getWeightClass,
6994
6154
  logFontInfo,
6995
6155
  openTypeField,
6156
+ parseFont,
6996
6157
  parseVariableFontInstances_default as parseVariableFontInstances,
6158
+ planReducer,
6997
6159
  processFontFiles,
6998
6160
  processItalicKeywords,
6999
6161
  processSubfamilyName,
7000
6162
  readFontFile,
7001
6163
  removeWeightNames,
7002
6164
  renameFontDocuments,
6165
+ resolveExistingFont,
7003
6166
  reverseSpellingLookup,
7004
6167
  sanitizeForSanityId,
7005
6168
  sortFontObjects,