@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.js CHANGED
@@ -1,1005 +1,83 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/index.js
30
- var index_exports = {};
31
- __export(index_exports, {
32
- BatchUploadFonts: () => BatchUploadFonts,
33
- DISCOUNT_REQUIREMENT_TYPES: () => DISCOUNT_REQUIREMENT_TYPES,
34
- DISCOUNT_REQUIREMENT_TYPES_OBJECT: () => DISCOUNT_REQUIREMENT_TYPES_OBJECT,
35
- FontScriptUploaderComponent: () => FontScriptUploaderComponent,
36
- GenerateCollectionsPairsComponent: () => GenerateCollectionsPairsComponent,
37
- HtmlDescription: () => HtmlDescription,
38
- KeyValueInput: () => KeyValueInput,
39
- KeyValueReferenceInput: () => KeyValueReferenceInput,
40
- NestedObjectArraySelector: () => NestedObjectArraySelector,
41
- PriceInput: () => PriceInput_default,
42
- PrimaryCollectionGeneratorTypeface: () => PrimaryCollectionGeneratorTypeface,
43
- RegenerateSubfamiliesComponent: () => RegenerateSubfamiliesComponent,
44
- SCRIPTS: () => SCRIPTS,
45
- SCRIPTS_OBJECT: () => SCRIPTS_OBJECT,
46
- SetOTF: () => SetOTF,
47
- SingleUploaderTool: () => SingleUploaderTool,
48
- StatusDisplay: () => StatusDisplay_default,
49
- StyleCountInput: () => StyleCountInput,
50
- UpdateScriptsComponent: () => UpdateScriptsComponent,
51
- UploadButton: () => UploadButton_default,
52
- UploadScriptsComponent: () => UploadScriptsComponent,
53
- VariableInstanceReferencesInput: () => VariableInstanceReferencesInput,
54
- addItalicToFontTitle: () => addItalicToFontTitle,
55
- createFontObject: () => createFontObject,
56
- createStylesField: () => createStylesField,
57
- determineWeight: () => determineWeight,
58
- expandAbbreviations: () => expandAbbreviations,
59
- extractFontMetadata: () => extractFontMetadata,
60
- extractWeightFromFullName: () => extractWeightFromFullName,
61
- extractWeightName: () => extractWeightName,
62
- formatFontTitle: () => formatFontTitle,
63
- generateCssFile: () => generateCssFile,
64
- generateFontData: () => generateFontData,
65
- generateFontFile: () => generateFontFile,
66
- generateStyleKeywords: () => generateStyleKeywords,
67
- generateSubset: () => generateSubset,
68
- getEmptyFontKit: () => getEmptyFontKit,
69
- logFontInfo: () => logFontInfo,
70
- openTypeField: () => openTypeField,
71
- parseVariableFontInstances: () => parseVariableFontInstances_default,
72
- processFontFiles: () => processFontFiles,
73
- processItalicKeywords: () => processItalicKeywords,
74
- processSubfamilyName: () => processSubfamilyName,
75
- readFontFile: () => readFontFile,
76
- removeWeightNames: () => removeWeightNames,
77
- renameFontDocuments: () => renameFontDocuments,
78
- reverseSpellingLookup: () => reverseSpellingLookup,
79
- sanitizeForSanityId: () => sanitizeForSanityId,
80
- sortFontObjects: () => sortFontObjects,
81
- styleCountField: () => styleCountField,
82
- stylisticSetField: () => stylisticSetField,
83
- updateFontPrices: () => updateFontPrices,
84
- updateTypefaceDocument: () => updateTypefaceDocument,
85
- uploadFontFiles: () => uploadFontFiles,
86
- useNestedObjects: () => useNestedObjects,
87
- useSanityClient: () => useSanityClient
88
- });
89
- module.exports = __toCommonJS(index_exports);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
90
34
 
91
- // src/components/BatchUploadFonts.jsx
92
- var import_react5 = __toESM(require("react"));
93
- var import_ui4 = require("@sanity/ui");
94
- var import_icons = require("@sanity/icons");
95
- var import_sanity3 = require("sanity");
96
35
 
97
- // src/hooks/useSanityClient.js
98
- var import_react = require("react");
99
- var import_sanity = require("sanity");
100
- function useSanityClient() {
101
- const client = (0, import_sanity.useClient)({ apiVersion: "2021-10-23" });
102
- return (0, import_react.useMemo)(() => client, [client]);
103
- }
104
36
 
105
- // src/utils/processFontFiles.js
106
- var fontkit = __toESM(require("fontkit"));
107
- var import_nanoid = require("nanoid");
108
-
109
- // src/utils/generateKeywords.js
110
- 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"];
111
- var modifiers = ["Demi", "Semi", "Extra", "Ultra", "Super", "Plus"];
112
- var coreItalics = ["Italic", "Slant", "Oblique", "Cursive", "Rotalic", "Reverse", "Crab Claw", "Crabclaw", "South Paw", "Southpaw", "Backwards", "Backslant", "Backslanted", "Back Slant"];
113
- var alternativeSpelling = {
114
- Backslant: ["Bsl"],
115
- Backwards: ["Bck"],
116
- Black: ["Blak", "Blk"],
117
- Bold: ["Bd", "Bld"],
118
- // B omitted — too ambiguous
119
- Condensed: ["Cond", "Cnd"],
120
- Crabclaw: ["Crab", "Claw"],
121
- Cursive: ["Cur"],
122
- Dark: ["Drk"],
123
- Expanded: ["Exp"],
124
- Extra: ["Xt", "Xtra", "Xtr", "X"],
125
- // X omitted as standalone — too ambiguous
126
- ExtraBlack: ["Xblk", "XBlk", "Xblck", "XBlck"],
127
- ExtraBold: ["Xbd", "XBd", "Xbld", "XBld", "Xbold", "XBold", "ExBold", "Exbold", "Exbd", "ExBd", "Exbld", "ExBld"],
128
- ExtraCondensed: ["XCond", "Xcnd"],
129
- ExtraExpanded: ["XExp"],
130
- ExtraLight: ["Xlight", "XLight", "Xlt", "XLt", "Xlgt", "XLgt", "Xl", "XL", "Xlght", "XLght"],
131
- ExtraThin: ["Xthin", "Xthn", "Xth", "XThin", "XThn", "XTh", "XT"],
132
- Extended: ["Ext"],
133
- Hairline: ["Hl", "Hln", "Hlnn", "Hlnne", "Hlnnne"],
134
- Italic: ["Ital", "It"],
135
- Light: ["Lt", "Lght"],
136
- Medium: ["Med", "Md", "md", "med"],
137
- Oblique: ["Obl"],
138
- Plus: ["Pls"],
139
- Regular: ["Reg", "Rg"],
140
- Reverse: ["Rev"],
141
- Rotalic: ["Rot"],
142
- SemiBold: ["SmBd", "Sb", "Sbd", "Sbld", "Sbold", "Semibd", "SemiBd", "Semibld", "SemiBld", "semiBd", "semiBld"],
143
- Slant: ["Sl"],
144
- Southpaw: ["South", "Paw"],
145
- Super: ["Supr"],
146
- Thin: ["Thn"],
147
- Ultra: ["Ult", "Ultre", "Ul", "Ulta"],
148
- XX: ["XXt", "XXtra", "XXtr", "XX"],
149
- XXBlack: ["XXblk", "XXBlk", "XXblck", "XXBlck"],
150
- XXLight: ["XXlight", "XXLight", "XXlt", "XXLt", "XXlgt", "XXLgt", "XXl", "XXL", "XXlght", "XXLght"],
151
- XXX: ["XXXt", "XXXtra", "XXXtr", "XXX"],
152
- XXXLight: ["XXXlight", "XXXLight", "XXXlt", "XXXLt", "XXXlgt", "XXXLgt", "XXXl", "XXXL", "XXXlght", "XXXLght"]
153
- };
154
- function reverseSpellingLookup(str) {
155
- let exactMatch = "";
156
- Object.keys(alternativeSpelling).forEach(function(key) {
157
- alternativeSpelling[key].forEach(function(alternative) {
158
- if (str === alternative) {
159
- exactMatch = key;
160
- }
161
- });
162
- });
163
- if (exactMatch) return exactMatch;
164
- let result = "";
165
- let longestMatch = 0;
166
- Object.keys(alternativeSpelling).forEach(function(key) {
167
- alternativeSpelling[key].forEach(function(alternative) {
168
- const regex = new RegExp(`\\b${alternative}\\b`);
169
- if (regex.test(str) && alternative.length > longestMatch) {
170
- result = key;
171
- longestMatch = alternative.length;
172
- }
173
- });
174
- });
175
- return result;
176
- }
177
- function expandAbbreviations(str) {
178
- if (!str) return str;
179
- return str.split(" ").map((word) => {
180
- const expanded = reverseSpellingLookup(word);
181
- return expanded || word;
182
- }).join(" ");
183
- }
184
- function removeWeightNames(str) {
185
- if (!str) return str;
186
- return str.split(" ").map((word) => {
187
- coreWeights.forEach((weight) => {
188
- if (word === weight) word = "";
189
- modifiers.forEach((modifier) => {
190
- if (word === modifier || modifier + weight === word) word = "";
191
- });
192
- });
193
- const expanded = reverseSpellingLookup(word);
194
- if (expanded) return "";
195
- return word;
196
- }).join(" ").trim();
197
- }
198
- function generateStyleKeywords() {
199
- let weightKeywordList = [];
200
- let italicKeywordList = [];
201
- weightKeywordList = [...coreWeights];
202
- modifiers.forEach((modifier) => {
203
- coreWeights.forEach((weight) => {
204
- weightKeywordList.push(modifier + weight);
205
- });
206
- });
207
- weightKeywordList = [...weightKeywordList, ...modifiers];
208
- italicKeywordList = [...coreItalics];
209
- weightKeywordList = weightKeywordList.map(function(el) {
210
- var newEls = [];
211
- Object.keys(alternativeSpelling).forEach(function(key) {
212
- if (el.indexOf(key) !== -1) {
213
- alternativeSpelling[key].forEach(function(alternative) {
214
- let newSpelling = el.replace(key, alternative);
215
- newEls.push(newSpelling);
216
- Object.keys(alternativeSpelling).forEach(function(key2) {
217
- if (newSpelling.indexOf(key2) !== -1) {
218
- alternativeSpelling[key2].forEach(function(alternative2) {
219
- let newSpelling2 = newSpelling.replace(key2, alternative2);
220
- newEls.push(newSpelling2);
221
- Object.keys(alternativeSpelling).forEach(function(key3) {
222
- if (newSpelling2.indexOf(key3) !== -1) {
223
- alternativeSpelling[key3].forEach(function(alternative3) {
224
- newEls.push(newSpelling2.replace(key3, alternative3));
225
- });
226
- }
227
- });
228
- });
229
- }
230
- });
231
- });
232
- }
233
- });
234
- newEls.push(el);
235
- return newEls;
236
- }).reduce(function(a, b) {
237
- return a.concat(b);
238
- });
239
- italicKeywordList = italicKeywordList.map(function(el) {
240
- var newEls = [];
241
- Object.keys(alternativeSpelling).forEach(function(key) {
242
- if (el.indexOf(key) !== -1) {
243
- alternativeSpelling[key].forEach(function(alternative) {
244
- newEls.push(el.replace(key, alternative));
245
- });
246
- }
247
- });
248
- newEls.push(el);
249
- return newEls;
250
- }).reduce(function(a, b) {
251
- return a.concat(b);
252
- });
253
- weightKeywordList = weightKeywordList.sort((a, b) => b.length - a.length);
254
- italicKeywordList = italicKeywordList.sort((a, b) => b.length - a.length);
255
- weightKeywordList = weightKeywordList.filter((item, pos) => weightKeywordList.indexOf(item) === pos);
256
- italicKeywordList = italicKeywordList.filter((item, pos) => italicKeywordList.indexOf(item) === pos);
257
- return { weightKeywordList, italicKeywordList };
258
- }
259
37
 
260
- // src/utils/sanitizeForSanityId.js
261
- var import_slugify = __toESM(require("slugify"));
262
- function sanitizeForSanityId(str) {
263
- if (!str || typeof str !== "string") {
264
- return "font-" + Date.now();
265
- }
266
- let sanitized = str.toLowerCase().trim();
267
- sanitized = sanitized.replace(/\+/g, "plus");
268
- sanitized = sanitized.replace(/&/g, "and");
269
- sanitized = sanitized.replace(/@/g, "at");
270
- sanitized = (0, import_slugify.default)(sanitized, {
271
- replacement: "-",
272
- remove: /[^\w\s-]/g,
273
- lower: true,
274
- strict: true,
275
- locale: "en",
276
- trim: true
277
- });
278
- sanitized = sanitized.replace(/[^a-z0-9\-_]/g, "-");
279
- sanitized = sanitized.replace(/-+/g, "-");
280
- sanitized = sanitized.replace(/^[-_]+|[-_]+$/g, "");
281
- if (sanitized && !/^[a-z_]/.test(sanitized)) {
282
- sanitized = "font_" + sanitized;
283
- }
284
- if (!sanitized) {
285
- sanitized = "font_" + Date.now();
286
- }
287
- if (sanitized.length > 128) {
288
- const hash = Math.random().toString(36).substring(2, 8);
289
- sanitized = sanitized.substring(0, 120) + "_" + hash;
290
- }
291
- if (!/^[a-z_][a-z0-9\-_]*$/.test(sanitized)) {
292
- console.warn(`ID sanitization produced invalid result: "${sanitized}", using fallback`);
293
- sanitized = "font_" + Date.now();
294
- }
295
- return sanitized;
296
- }
297
38
 
298
- // src/utils/processFontFiles.js
299
- var readFontFile = (file) => {
300
- return new Promise((resolve, reject) => {
301
- const reader = new FileReader();
302
- reader.onload = (event) => {
303
- resolve(new Uint8Array(event.target.result));
304
- };
305
- reader.onerror = (error) => {
306
- reject(error);
307
- };
308
- reader.readAsArrayBuffer(file);
309
- });
310
- };
311
- var processFontFiles = async (files, title, weightKeywordList, italicKeywordList, setStatus, preserveShortenedNames = false, preserveFileNames = false) => {
312
- let failedFiles = [];
313
- let subfamilies = {};
314
- let fontsObjects = {};
315
- let newPreferredStyle = { weight: -100, style: "Italic", _ref: "" };
316
- for (let i = 0; i < files.length; i++) {
317
- const file = files[i];
318
- const fontBuffer = await readFontFile(file);
319
- const font = fontkit.create(fontBuffer);
320
- console.log("File name: ", file.name);
321
- if (file.name.endsWith(".woff2") || file.name.endsWith(".woff")) {
322
- await handleWebfontMetadata(file, font, files);
323
- }
324
- const { weightName, subfamilyName, fontTitle, style, italicKW, variableFont } = extractFontMetadata(
325
- font,
326
- title,
327
- weightKeywordList,
328
- italicKeywordList,
329
- preserveShortenedNames
330
- );
331
- const id = sanitizeForSanityId(fontTitle);
332
- let originalFilename = null;
333
- if (preserveFileNames) {
334
- originalFilename = file.name.replace(/\.(ttf|otf|woff2?|eot|svg)$/i, "");
335
- }
336
- logFontInfo(id, fontTitle, font, file.name, subfamilyName, style, weightName, variableFont, italicKW);
337
- subfamilies[id] = subfamilyName;
338
- if (fontsObjects[id]) {
339
- fontsObjects[id].files = [...fontsObjects[id].files, file];
340
- if (preserveFileNames && originalFilename) {
341
- fontsObjects[id].originalFilename = originalFilename;
342
- }
343
- } else {
344
- fontsObjects[id] = createFontObject(
345
- id,
346
- fontTitle,
347
- title,
348
- font,
349
- variableFont,
350
- weightName,
351
- subfamilyName,
352
- file,
353
- preserveFileNames ? originalFilename : null
354
- );
355
- }
356
- }
357
- fontsObjects = sortFontObjects(fontsObjects);
358
- const uniqueSubfamilies = [...new Set(Object.values(subfamilies))];
359
- console.log("Subfamilies:", subfamilies);
360
- console.log("Unique subfamilies:", uniqueSubfamilies, uniqueSubfamilies.length);
361
- console.log("Font objects:", fontsObjects);
362
- return { fontsObjects, subfamilies, uniqueSubfamilies, newPreferredStyle, failedFiles };
363
- };
364
- var handleWebfontMetadata = async (file, font, files) => {
365
- var _a, _b, _c, _d, _e, _f, _g;
366
- 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)) {
367
- const ttfFile = files.find((f) => f.name === file.name.replace(".woff2", ".ttf").replace(".woff", ".ttf"));
368
- if (ttfFile) {
369
- const ttfFileBuffer = await readFontFile(ttfFile);
370
- const ttfFileData = fontkit.create(ttfFileBuffer);
371
- if (ttfFileData) font.name.records = (_g = ttfFileData == null ? void 0 : ttfFileData.name) == null ? void 0 : _g.records;
372
- }
373
- }
374
- };
375
- var extractFontMetadata = (font, title, weightKeywordList, italicKeywordList, preserveShortenedNames = false) => {
376
- var _a, _b, _c, _d, _e, _f;
377
- let weightName = extractWeightName(font, italicKeywordList);
378
- if (!preserveShortenedNames) {
379
- weightName = expandAbbreviations(weightName);
380
- }
381
- if ((weightName === "" || weightName.toLowerCase() === "roman") && ((_b = (_a = font == null ? void 0 : font.name) == null ? void 0 : _a.records) == null ? void 0 : _b.fullName)) {
382
- weightName = extractWeightFromFullName(font, title);
383
- if (!preserveShortenedNames) {
384
- weightName = expandAbbreviations(weightName);
385
- }
386
- }
387
- const variableFont = (font == null ? void 0 : font.variationAxes) && Object.keys(font.variationAxes).length > 0;
388
- 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();
389
- if (!preserveShortenedNames) {
390
- subfamilyName = expandAbbreviations(subfamilyName);
391
- }
392
- let fontTitle = font == null ? void 0 : font.fullName.trim();
393
- let style = (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular";
394
- const italicKW = processItalicKeywords(font, fontTitle, italicKeywordList);
395
- subfamilyName = processSubfamilyName(subfamilyName, weightKeywordList, italicKW, preserveShortenedNames);
396
- fontTitle = formatFontTitle(fontTitle, preserveShortenedNames);
397
- subfamilyName = subfamilyName === "" ? "Regular" : subfamilyName.replace(/\s+/g, " ").trim();
398
- if (subfamilyName !== "") {
399
- weightName = weightName.replace(`${subfamilyName} `, "").replace(` ${subfamilyName}`, "").trim();
400
- }
401
- if (variableFont) {
402
- if (!fontTitle.toLowerCase().includes("vf")) {
403
- fontTitle = fontTitle + " VF";
404
- }
405
- subfamilyName = "";
406
- }
407
- if (!(variableFont && fontTitle.toLowerCase().includes("italic"))) {
408
- fontTitle = addItalicToFontTitle(font, fontTitle, italicKW, style, preserveShortenedNames);
409
- }
410
- return { weightName, subfamilyName, fontTitle, style, italicKW, variableFont };
411
- };
412
- var extractWeightName = (font, italicKW) => {
413
- var _a, _b, _c, _d;
414
- 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);
415
- if (typeof weightName === "object") {
416
- weightName = (weightName == null ? void 0 : weightName.en) || (weightName.constructor === Object ? weightName[Object.keys(weightName)[0]] : null);
417
- }
418
- if ((font == null ? void 0 : font.variationAxes) && Object.keys(font.variationAxes).length > 0) {
419
- return "Variable";
420
- }
421
- if (italicKW) {
422
- italicKW.forEach((keyword) => {
423
- const kwRegex = new RegExp(`\\b${keyword.trim()}\\b`, "i");
424
- if (kwRegex.test(weightName)) {
425
- weightName = weightName.replace(kwRegex, "").trim();
426
- }
427
- });
428
- }
429
- return weightName == null ? void 0 : weightName.toString().replace("Italic", "").replace("It", "").replace("Slanted", "").replace("Slant", "").replace("Backslant", "").trim();
430
- };
431
- var extractWeightFromFullName = (font, title) => {
432
- var _a, _b;
433
- let weightName = (_b = (_a = font == null ? void 0 : font.name) == null ? void 0 : _a.records) == null ? void 0 : _b.fullName;
434
- weightName = (weightName == null ? void 0 : weightName.en) ? weightName.en : (weightName == null ? void 0 : weightName.constructor) === Object ? weightName[Object.keys(weightName)[0]] : weightName;
435
- weightName = weightName == null ? void 0 : weightName.replace(title + " ", "").replace(title, "").trim();
436
- weightName = weightName == null ? void 0 : weightName.replace("Italic", "").replace("It", "").replace("Slanted", "").replace("Slant", "").trim();
437
- return weightName;
438
- };
439
- var processSubfamilyName = (subfamilyName, weightKeywordList, italicKeywordList, preserveShortenedNames = false) => {
440
- weightKeywordList.forEach((keyword) => {
441
- const kwRegex = new RegExp(`\\b${keyword.trim()}\\b`, "i");
442
- if (kwRegex.test(subfamilyName)) {
443
- subfamilyName = subfamilyName.replace(kwRegex, "").trim();
444
- }
445
- subfamilyName = removeWeightNames(subfamilyName) || subfamilyName;
446
- if (!preserveShortenedNames) {
447
- subfamilyName = expandAbbreviations(subfamilyName);
448
- }
449
- });
450
- italicKeywordList.forEach((keyword) => {
451
- const kwRegex = new RegExp(`\\b${keyword.trim()}\\b`, "i");
452
- if (kwRegex.test(subfamilyName)) {
453
- subfamilyName = subfamilyName.replace(kwRegex, "").trim();
454
- }
455
- });
456
- return subfamilyName;
457
- };
458
- var processItalicKeywords = (font, fontTitle, italicKeywordList) => {
459
- let italicKW = [];
460
- italicKeywordList.forEach((keyword) => {
461
- const kw = keyword.trim();
462
- const kwRegex = new RegExp(`\\b${kw}\\b`, "i");
463
- if (kwRegex.test(fontTitle)) {
464
- fontTitle = fontTitle.replace(kwRegex, "").trim();
465
- italicKW.push(kw);
466
- }
467
- if ((font == null ? void 0 : font.fullName) && typeof font.fullName === "string" && font.fullName.toLowerCase().includes(kw.toLowerCase())) {
468
- if (!italicKW.includes(kw)) italicKW.push(kw);
469
- }
470
- });
471
- return italicKW;
472
- };
473
- var formatFontTitle = (fontTitle, preserveShortenedNames = false) => {
474
- const hasItalic = fontTitle.toLowerCase().includes("italic");
475
- fontTitle = fontTitle.replace(/-/g, " ");
476
- return fontTitle.replace(/\s+/g, " ").trim().split(" ").map((word) => {
477
- if (hasItalic && word.toLowerCase() === "italic") return "Italic";
478
- let fullWord = word;
479
- if (!preserveShortenedNames) {
480
- fullWord = reverseSpellingLookup(word) || word;
481
- }
482
- return fullWord[0].toUpperCase() + fullWord.slice(1);
483
- }).join(" ");
484
- };
485
- var addItalicToFontTitle = (font, fontTitle, italicKW, style, preserveShortenedNames = false) => {
486
- const hasItalicAngle = (font == null ? void 0 : font.italicAngle) !== 0;
487
- const hasItalicInName = font == null ? void 0 : font.fullName.toLowerCase().includes("italic");
488
- if (italicKW.length > 0 || hasItalicAngle || hasItalicInName) {
489
- italicKW = [...new Set(italicKW)];
490
- if (italicKW.length === 0 && (hasItalicAngle || hasItalicInName)) {
491
- italicKW = ["Italic"];
492
- }
493
- if (!preserveShortenedNames) {
494
- italicKW = italicKW.map((item) => reverseSpellingLookup(item) || item);
495
- }
496
- italicKW = [...new Set(italicKW)];
497
- if (italicKW.length > 1 && italicKW.includes("Italic")) {
498
- italicKW = ["Italic"];
499
- }
500
- const fontTitleLower = fontTitle.toLowerCase();
501
- italicKW = italicKW.filter((keyword) => {
502
- const keywordLower = keyword.toLowerCase();
503
- const kwRegex = new RegExp(`\\b${keywordLower}\\b`);
504
- const isSubstring = fontTitleLower.split(" ").some(
505
- (word) => word.includes(keywordLower) || keywordLower.includes(word)
506
- );
507
- return !kwRegex.test(fontTitleLower) && !isSubstring;
508
- });
509
- if (italicKW.length > 0) {
510
- fontTitle = fontTitle.trim() + " " + italicKW.join(" ");
511
- }
512
- }
513
- return fontTitle;
514
- };
515
- var createFontObject = (id, fontTitle, title, font, variableFont, weightName, subfamilyName, file, originalFilename = null) => {
516
- const fontObject = {
517
- _key: (0, import_nanoid.nanoid)(),
518
- _id: id,
519
- title: fontTitle,
520
- slug: { _type: "slug", current: id },
521
- typefaceName: title,
522
- style: (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular",
523
- variableFont,
524
- weightName,
525
- subfamily: subfamilyName,
526
- normalWeight: true,
527
- weight: Number(determineWeight(font, weightName)),
528
- fileInput: {},
529
- files: [file],
530
- fontKit: font
531
- };
532
- if (originalFilename) {
533
- fontObject.originalFilename = originalFilename;
534
- }
535
- return fontObject;
536
- };
537
- var determineWeight = (font, weightName) => {
538
- var _a;
539
- if ((_a = font["OS/2"]) == null ? void 0 : _a.usWeightClass) {
540
- return Number(font["OS/2"].usWeightClass);
541
- }
542
- const wn = (weightName == null ? void 0 : weightName.toLowerCase()) || "";
543
- if (/hairline|extra thin|extrathin/.test(wn)) return 100;
544
- if (/thin|extra light|extralight/.test(wn)) return 200;
545
- if (/light|book/.test(wn)) return 300;
546
- if (/regular|normal/.test(wn)) return 400;
547
- if (/medium/.test(wn)) return 500;
548
- if (/semi bold|semibold/.test(wn)) return 600;
549
- if (/extra bold|extrabold/.test(wn)) return 800;
550
- if (/bold/.test(wn)) return 700;
551
- if (/black|ultra/.test(wn)) return 900;
552
- return 400;
553
- };
554
- var sortFontObjects = (fontsObjects) => {
555
- return Object.fromEntries(
556
- Object.entries(fontsObjects).sort((a, b) => {
557
- const weightA = Number(a[1].weight);
558
- const weightB = Number(b[1].weight);
559
- if (weightA === weightB) {
560
- if (a[1].style === "Regular" && b[1].style === "Italic") return -1;
561
- if (a[1].style === "Italic" && b[1].style === "Regular") return 1;
562
- return 0;
563
- }
564
- return weightA - weightB;
565
- })
566
- );
567
- };
568
- var logFontInfo = (id, fontTitle, font, fileName, subfamilyName, style, weightName, variableFont, italicKW) => {
569
- console.log("=== Font Info ====");
570
- console.log("Font id: ", id);
571
- console.log("Font title: ", fontTitle);
572
- console.log("Fontkit fullName: ", font.fullName);
573
- console.log("Fontkit family name: ", font.familyName);
574
- console.log("File name: ", fileName);
575
- console.log("Subfamily: ", subfamilyName);
576
- console.log("Style: ", style);
577
- console.log("Weight: ", weightName);
578
- console.log("Variable: ", variableFont);
579
- console.log("italicKW: ", italicKW);
580
- console.log("Font italic angle: ", (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular");
581
- console.log("=======");
582
- };
583
39
 
584
- // src/utils/uploadFontFiles.js
585
- var import_nanoid3 = require("nanoid");
586
-
587
- // src/utils/generateCssFile.js
588
- var import_base_64 = __toESM(require("base-64"));
589
- var import_buffer = require("buffer");
590
- var fontkit2 = __toESM(require("fontkit"));
591
- function _arrayBufferToBase64(buffer) {
592
- var binary = "";
593
- var bytes = new Uint8Array(buffer);
594
- var len = bytes.byteLength;
595
- for (var i = 0; i < len; i++) {
596
- binary += String.fromCharCode(bytes[i]);
597
- }
598
- return import_base_64.default.encode(binary);
599
- }
600
- function buildVFDescriptors(font) {
601
- const cssAxes = {};
602
- const skipped = [];
603
- try {
604
- const va = font.variationAxes;
605
- if (!va) return { descriptors: "", skipped: [] };
606
- for (const [tag, axis] of Object.entries(va)) {
607
- const lo = Math.min(axis.min, axis.max);
608
- const hi = Math.max(axis.min, axis.max);
609
- if (lo === hi) {
610
- skipped.push(tag);
611
- continue;
612
- }
613
- if (tag === "wght") {
614
- cssAxes["font-weight"] = `${lo} ${hi}`;
615
- } else if (tag === "wdth") {
616
- cssAxes["font-stretch"] = `${lo}% ${hi}%`;
617
- } else if (tag === "slnt") {
618
- cssAxes["font-style"] = `oblique ${lo}deg ${hi}deg`;
619
- } else if (tag === "ital" && !cssAxes["font-style"]) {
620
- if (hi > 0) cssAxes["font-style"] = "italic";
621
- else skipped.push(tag);
622
- } else {
623
- skipped.push(tag);
624
- }
625
- }
626
- } catch (_) {
627
- }
628
- const descriptors = Object.entries(cssAxes).map(([k, v]) => `${k}:${v}`).join(";") + (Object.keys(cssAxes).length ? ";" : "");
629
- return { descriptors, skipped };
630
- }
631
- var FALLBACK_STACKS = {
632
- "sans-serif": "local('Arial'), local('Helvetica Neue'), local('Roboto'), local('Liberation Sans')",
633
- "serif": "local('Georgia'), local('Times New Roman'), local('Times')",
634
- "monospace": "local('Courier New'), local('Courier'), local('Menlo'), local('Monaco')",
635
- // Display and script fonts have no universally suitable system fallback; default to sans-serif
636
- "default": "local('Arial'), local('Helvetica Neue'), local('Roboto'), local('Liberation Sans')"
637
- };
638
- var FAMILY_CLASS_MAP = {
639
- 1: "serif",
640
- 2: "serif",
641
- 3: "serif",
642
- 4: "serif",
643
- 5: "serif",
644
- 7: "serif",
645
- 8: "sans-serif"
646
- };
647
- var SERIF_NAMES = /jubilat|corundum|dapifer|birra|daith/i;
648
- var SANS_NAMES = /halyard|gamay|omnes|kit/i;
649
- function detectFontCategory(font, fontName) {
650
- var _a;
651
- if (fontName && SERIF_NAMES.test(fontName)) return "serif";
652
- if (fontName && SANS_NAMES.test(fontName)) return "sans-serif";
653
- try {
654
- const familyClass = ((_a = font["OS/2"]) == null ? void 0 : _a.sFamilyClass) ?? 0;
655
- const highByte = familyClass >> 8 & 255;
656
- return FAMILY_CLASS_MAP[highByte] ?? "default";
657
- } catch {
658
- return "default";
659
- }
660
- }
661
- function calcFallbackData(arrayBuffer, fontName) {
662
- try {
663
- let font = fontkit2.create(import_buffer.Buffer.from(arrayBuffer));
664
- let upm = font.unitsPerEm;
665
- let category = detectFontCategory(font, fontName);
666
- return {
667
- fallbackSrc: FALLBACK_STACKS[category],
668
- ascentOverride: `${(font.ascent / upm * 100).toFixed(2)}%`,
669
- descentOverride: `${(Math.abs(font.descent) / upm * 100).toFixed(2)}%`,
670
- lineGapOverride: `${(font.lineGap / upm * 100).toFixed(2)}%`
671
- };
672
- } catch (err) {
673
- console.error("Failed to extract fallback font data:", err);
674
- return {
675
- fallbackSrc: FALLBACK_STACKS["default"],
676
- ascentOverride: "100%",
677
- descentOverride: "0%",
678
- lineGapOverride: "0%"
679
- };
680
- }
681
- }
682
- async function generateCssFile({
683
- woff2File,
684
- fileInput,
685
- language = null,
686
- fileName,
687
- fontName,
688
- variableFont,
689
- weight,
690
- style = "Normal",
691
- client
692
- }) {
693
- try {
694
- let arrayBuffer = await woff2File.arrayBuffer();
695
- let b64 = _arrayBufferToBase64(arrayBuffer);
696
- let fontkitFont = fontkit2.create(import_buffer.Buffer.from(arrayBuffer));
697
- let { fallbackSrc, ascentOverride, descentOverride, lineGapOverride } = calcFallbackData(arrayBuffer, fontName);
698
- let cssString;
699
- if (variableFont) {
700
- let { descriptors, skipped } = buildVFDescriptors(fontkitFont);
701
- 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" : "") + " */" : "";
702
- 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;}`;
703
- } else {
704
- let fontStyle = style === "Italic" ? "italic" : "normal";
705
- 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;}`;
706
- }
707
- let fallbackCssString = `@font-face{font-family:'${fontName} Fallback';src:${fallbackSrc};ascent-override:${ascentOverride};descent-override:${descentOverride};line-gap-override:${lineGapOverride};}`;
708
- let uploadBuffer = import_buffer.Buffer.from(cssString + fallbackCssString, "utf-8");
709
- let doc = await client.assets.upload("file", uploadBuffer, { filename: fileName + ".css" });
710
- let newFileInput = language == null ? {
711
- ...fileInput,
712
- css: {
713
- _type: "file",
714
- asset: {
715
- _type: "reference",
716
- _ref: doc._id
717
- }
718
- }
719
- } : {
720
- ...fileInput,
721
- [language]: {
722
- ...fileInput[language],
723
- css: {
724
- _type: "file",
725
- asset: {
726
- _type: "reference",
727
- _ref: doc._id
728
- }
729
- }
730
- }
731
- };
732
- return newFileInput;
733
- } catch (err) {
734
- console.error(err);
735
- throw err;
736
- }
737
- }
738
40
 
739
- // src/utils/generateFontData.js
740
- var import_buffer2 = require("buffer");
741
- var fontkit3 = __toESM(require("fontkit"));
742
- async function generateFontData({ fileInput, url, fontKit, fontId, client, commit = true }) {
743
- var _a;
744
- if (fontId.startsWith("drafts.")) {
745
- fontId = fontId.replace("drafts.", "");
746
- }
747
- console.log("generate-font-data ", fontId, commit);
748
- let srcUrl;
749
- if (!url || url == null) {
750
- srcUrl = await client.fetch(`*[_id == $id]{url}`, { id: fileInput.ttf.asset._ref });
751
- console.log("src url ", srcUrl);
752
- srcUrl = srcUrl[0].url;
753
- } else {
754
- srcUrl = url;
755
- }
756
- let font = fontKit;
757
- if (!fontKit || fontKit == null) {
758
- let buffer = await fetch(srcUrl);
759
- buffer = await buffer.arrayBuffer();
760
- buffer = import_buffer2.Buffer.from(buffer);
761
- font = fontkit3.create(buffer);
762
- }
763
- let variableAxes;
764
- try {
765
- variableAxes = font.variationAxes;
766
- } catch (err) {
767
- console.error("err: ", err);
768
- }
769
- let variableInstances;
770
- try {
771
- variableInstances = font.namedVariations;
772
- } catch (e) {
773
- console.log("variable instances 2 error : ", e.message);
774
- let fvar = (_a = font == null ? void 0 : font.fvar) == null ? void 0 : _a.instance;
775
- fvar == null ? void 0 : fvar.forEach((fv) => {
776
- var _a2, _b, _c, _d, _e, _f;
777
- 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;
778
- 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;
779
- });
780
- variableInstances = {};
781
- fvar.forEach((v) => {
782
- let key = v.name;
783
- if (typeof key === "object") {
784
- key = Object.values(key)[0];
785
- }
786
- let coordKeys = Object.keys(variableAxes);
787
- let coord = {};
788
- coordKeys.forEach((ck, ckIndex) => {
789
- coord[ck] = v.coord[ckIndex];
790
- });
791
- variableInstances[key] = coord;
792
- });
793
- }
794
- console.log("font : ", font);
795
- console.log("variable instances : ", variableInstances);
796
- console.log("variable axes : ", variableAxes);
797
- let opentypeFeatures = font.availableFeatures;
798
- let glyphCount = font.numGlyphs;
799
- let characterSet = font.characterSet;
800
- let metaData = {
801
- postscriptName: font.postscriptName,
802
- fullName: font.fullName,
803
- familyName: font.familyName,
804
- subfamilyName: font.subfamilyName,
805
- copyright: font.copyright,
806
- version: font.version.replaceAll("Version ", ""),
807
- genDate: (/* @__PURE__ */ new Date()).toISOString()
808
- };
809
- let metrics = {
810
- unitsPerEm: font.unitsPerEm,
811
- ascender: font.ascent,
812
- descender: font.descent,
813
- lineGap: font.lineGap,
814
- underlinePosition: font.underlinePosition,
815
- underlineThickness: font.underlineThickness,
816
- italicAngle: font.italicAngle,
817
- capHeight: font.capHeight,
818
- xHeight: font.xHeight,
819
- boundingBox: font.bbox
820
- };
821
- let variableFont = false;
822
- if (variableAxes && variableAxes != null && Object.keys(variableAxes).length > 0 && variableInstances && variableInstances != null && Object.keys(variableInstances).length > 0) {
823
- variableFont = true;
824
- }
825
- let patch = {
826
- metrics,
827
- metaData,
828
- variableFont,
829
- variableAxes: JSON.stringify(variableAxes),
830
- variableInstances: JSON.stringify(variableInstances),
831
- glyphCount,
832
- opentypeFeatures: { chars: opentypeFeatures },
833
- characterSet: { chars: characterSet }
834
- };
835
- console.log("data : ", patch);
836
- if (commit) patch = await client.patch(fontId).set(patch).commit({ autoGenerateArrayKeys: true });
837
- return patch;
838
- }
839
41
 
840
- // src/utils/parseVariableFontInstances.js
841
- var import_nanoid2 = require("nanoid");
842
- var parseVariableFontInstances = async (font, client) => {
843
- if (!font.variableFont || !font.variableInstances) return [];
844
- let variableInstances;
845
- try {
846
- variableInstances = JSON.parse(font.variableInstances);
847
- } catch (err) {
848
- console.error("Error parsing variable instances:", err);
849
- variableInstances = {};
850
- }
851
- if (Object.keys(variableInstances).length === 0) return [];
852
- let staticFonts;
853
- const typeface = await client.fetch(
854
- `*[_type == 'typeface' && title == $typefaceName][0]{
855
- 'fonts': styles.fonts[]-> {
856
- _id,
857
- title,
858
- subfamily,
859
- style,
860
- weight,
861
- weightName,
862
- metaData,
863
- variableFont
864
- }
865
- }`,
866
- { typefaceName: font.typefaceName }
867
- );
868
- if ((typeface == null ? void 0 : typeface.fonts) && typeface.fonts.length > 0) {
869
- staticFonts = typeface.fonts.filter((f) => !f.variableFont);
870
- console.log("Using curated typeface fonts list:", staticFonts.length, "fonts");
871
- } else {
872
- console.warn("Typeface not found or no fonts in curated list, falling back to all fonts query");
873
- staticFonts = await client.fetch(
874
- `*[_type == 'font' && typefaceName == $typefaceName && variableFont != true]{
875
- _id,
876
- title,
877
- subfamily,
878
- style,
879
- weight,
880
- weightName,
881
- metaData
882
- }`,
883
- { typefaceName: font.typefaceName }
884
- );
885
- }
886
- console.log("Variable font instances:", Object.keys(variableInstances));
887
- console.log("Available static fonts:", staticFonts.map((sf) => sf.title));
888
- const instanceMappings = [];
889
- Object.keys(variableInstances).forEach((instanceName) => {
890
- let matchingFont = null;
891
- matchingFont = staticFonts.find((sf) => sf.title === instanceName);
892
- if (!matchingFont && staticFonts.some((sf) => {
893
- var _a;
894
- return (_a = sf.metaData) == null ? void 0 : _a.fullName;
895
- })) {
896
- matchingFont = staticFonts.find((sf) => {
897
- var _a, _b, _c, _d;
898
- if (!((_a = sf.metaData) == null ? void 0 : _a.fullName)) return false;
899
- let fullName = sf.metaData.fullName;
900
- const WORDS_TO_REMOVE = ["VF", "var", "variable", "VAR", "vf"];
901
- 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();
902
- if (variableName && fullName.startsWith(variableName)) {
903
- fullName = fullName.substring(variableName.length).trim();
904
- }
905
- if (variableName) {
906
- const words = variableName.split(/\s+/).map((w) => w.trim()).filter(Boolean);
907
- if (words.length > 0) {
908
- const regex = new RegExp(`\\b(${words.join("|")})\\b`, "gi");
909
- const stripped = fullName.replace(regex, "").replace(/\s{2,}/g, " ").trim();
910
- if (stripped !== "") fullName = stripped;
911
- }
912
- }
913
- if (fullName.startsWith(font.typefaceName)) {
914
- fullName = fullName.substring(font.typefaceName.length).trim();
915
- }
916
- if (((_d = sf.style) == null ? void 0 : _d.toLowerCase()) === "italic" && !fullName.toLowerCase().endsWith("italic") && !fullName.toLowerCase().endsWith("slanted")) {
917
- fullName = fullName + " Italic";
918
- }
919
- if (fullName.trim().toLowerCase().endsWith("regular")) {
920
- if (instanceName.trim().toLowerCase() + " regular" === fullName.trim().toLowerCase()) return true;
921
- }
922
- if (fullName.trim().toLowerCase().startsWith("regular")) {
923
- if ("regular " + instanceName.trim().toLowerCase() === fullName.trim().toLowerCase()) return true;
924
- }
925
- if (fullName.trim().toLowerCase().endsWith("italic")) {
926
- if (instanceName.trim().toLowerCase().endsWith("italic")) {
927
- const k = instanceName.trim().toLowerCase().slice(0, -6).trim() + " regular italic";
928
- if (k === fullName.trim().toLowerCase()) return true;
929
- }
930
- }
931
- return fullName.trim().toLowerCase() === instanceName.trim().toLowerCase();
932
- });
933
- }
934
- if (!matchingFont) {
935
- const expandedName = instanceName.split(" ").map((word) => expandAbbreviations(word)).join(" ");
936
- matchingFont = staticFonts.find((sf) => {
937
- const nameWithoutTypeface = sf.title.replace(font.typefaceName, "").trim();
938
- return nameWithoutTypeface === expandedName;
939
- });
940
- }
941
- if (!matchingFont) {
942
- const isItalic = instanceName.toLowerCase().includes("italic");
943
- const weightTerms = [
944
- { term: "thin", weight: "100" },
945
- { term: "extralight", weight: "200" },
946
- { term: "extra light", weight: "200" },
947
- { term: "light", weight: "300" },
948
- { term: "regular", weight: "400" },
949
- { term: "normal", weight: "400" },
950
- { term: "medium", weight: "500" },
951
- { term: "semibold", weight: "600" },
952
- { term: "semi bold", weight: "600" },
953
- { term: "bold", weight: "700" },
954
- { term: "extrabold", weight: "800" },
955
- { term: "extra bold", weight: "800" },
956
- { term: "black", weight: "900" },
957
- { term: "heavy", weight: "900" }
958
- ];
959
- let instanceWeight = "400";
960
- for (const { term, weight } of weightTerms) {
961
- if (instanceName.toLowerCase().includes(term)) {
962
- instanceWeight = weight;
963
- break;
964
- }
965
- }
966
- matchingFont = staticFonts.find(
967
- (sf) => sf.weight === instanceWeight && (isItalic && sf.style === "Italic" || !isItalic && sf.style === "Regular")
968
- );
969
- }
970
- if (!matchingFont) {
971
- matchingFont = staticFonts.find((sf) => {
972
- if (!sf.weightName) return false;
973
- const cleanInstance = instanceName.toLowerCase().replace(/italic/i, "").trim();
974
- const cleanWeight = sf.weightName.toLowerCase().replace(/italic/i, "").trim();
975
- return cleanInstance === cleanWeight;
976
- });
977
- }
978
- if (!matchingFont && staticFonts.some((sf) => {
979
- var _a;
980
- return (_a = sf.metaData) == null ? void 0 : _a.fullName;
981
- })) {
982
- matchingFont = staticFonts.find((sf) => {
983
- var _a;
984
- if (!((_a = sf.metaData) == null ? void 0 : _a.fullName)) return false;
985
- const typefacePattern = new RegExp(`^${font.typefaceName}\\s+`, "i");
986
- const stylePart = sf.metaData.fullName.replace(typefacePattern, "").trim();
987
- return instanceName.toLowerCase() === stylePart.toLowerCase();
988
- });
989
- }
990
- console.log(`Instance "${instanceName}" matched with:`, matchingFont ? matchingFont.title : "No match found");
991
- instanceMappings.push({
992
- key: instanceName,
993
- value: matchingFont ? { _type: "reference", _ref: matchingFont._id, _weak: true } : null,
994
- _key: (0, import_nanoid2.nanoid)()
995
- });
996
- });
997
- return instanceMappings;
998
- };
999
- var parseVariableFontInstances_default = parseVariableFontInstances;
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+ var _chunkFH4QKHOHjs = require('./chunk-FH4QKHOH.js');
63
+
64
+ // src/components/BatchUploadFonts.jsx
65
+ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
66
+ var _ui = require('@sanity/ui');
67
+ var _icons = require('@sanity/icons');
68
+ var _sanity = require('sanity');
69
+
70
+ // src/hooks/useSanityClient.js
71
+
72
+
73
+ function useSanityClient() {
74
+ const client = _sanity.useClient.call(void 0, { apiVersion: "2021-10-23" });
75
+ return _react.useMemo.call(void 0, () => client, [client]);
76
+ }
1000
77
 
1001
78
  // src/utils/uploadFontFiles.js
1002
- var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, stylesObject, setStatus, setError) => {
79
+ var _nanoid = require('nanoid');
80
+ var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, stylesObject, setStatus, setError, preserveFileNames = false) => {
1003
81
  let fontRefs = [];
1004
82
  let variableRefs = [];
1005
83
  let failedFiles = [];
@@ -1016,10 +94,18 @@ var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, styl
1016
94
  for (let j = 0; j < files.length; j++) {
1017
95
  const file = files[j];
1018
96
  const fileType = determineFileType(file);
1019
- console.log(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Uploading font file: ${fontObject._id}.${fileType}`);
1020
- 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}`);
1021
100
  try {
1022
- 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
+ }
1023
109
  newFileInput[fileType] = {
1024
110
  _type: "file",
1025
111
  asset: { _ref: baseAsset._id, _type: "reference" }
@@ -1027,7 +113,7 @@ var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, styl
1027
113
  if (fileType === "woff2") {
1028
114
  console.log(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Generating CSS for: ${fontObject.title}`);
1029
115
  setStatus(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Generating CSS for: ${fontObject.title}`);
1030
- newFileInput = await generateCssFile({
116
+ newFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
1031
117
  woff2File: file,
1032
118
  fileInput: newFileInput,
1033
119
  fontName: fontObject.title,
@@ -1041,7 +127,7 @@ var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, styl
1041
127
  if (fileType === "ttf") {
1042
128
  console.log(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Generating font data for: ${fontObject.title}`);
1043
129
  setStatus(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Generating font data for: ${fontObject.title}`);
1044
- const metadata = await generateFontData({
130
+ const metadata = await _chunkFH4QKHOHjs.generateFontData.call(void 0, {
1045
131
  fontId: fontObject._id,
1046
132
  url: baseAsset.url,
1047
133
  fontKit,
@@ -1051,7 +137,7 @@ var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, styl
1051
137
  Object.assign(fontObject, metadata);
1052
138
  }
1053
139
  } catch (err) {
1054
- console.error("Error uploading font: ", fontObject.title, err.message);
140
+ console.error("Error uploading font:", fontObject.title, err.message);
1055
141
  setStatus("Error uploading font: " + err.message);
1056
142
  setError(true);
1057
143
  failedFiles.push({ name: file.name, fk: fontKit });
@@ -1087,46 +173,96 @@ var determineFileType = (file) => {
1087
173
  if (file.name.endsWith(".svg")) return "svg";
1088
174
  return "";
1089
175
  };
1090
- var createOrUpdateFontDocument = async (font, client, setError) => {
176
+ var resolveExistingFont2 = async (font, client) => {
177
+ const result = { exact: null, candidates: [], recommendation: "create" };
1091
178
  try {
1092
- const existingFont = await client.fetch(
1093
- `*[_type == 'font' && _id == $fontId]{
1094
- fileInput,
1095
- description,
1096
- metaData,
1097
- metrics,
1098
- opentypeFeatures,
1099
- characterSet,
1100
- subfamily,
1101
- scriptFileInput,
1102
- 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
1103
184
  }`,
1104
- { fontId: font._id }
1105
- ).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);
1106
238
  const { files, fontKit } = font;
1107
239
  delete font.files;
1108
240
  delete font.fontKit;
1109
241
  delete font.originalFilename;
1110
242
  if (font.variableFont && font.variableInstances) {
1111
- const instanceMappings = await parseVariableFontInstances(font, client);
243
+ const instanceMappings = await _chunkFH4QKHOHjs.parseVariableFontInstances.call(void 0, font, client);
1112
244
  if (instanceMappings.length > 0) {
1113
245
  font.variableInstanceReferences = instanceMappings;
1114
246
  }
1115
247
  }
1116
248
  let fontResponse;
1117
- if (existingFont) {
1118
- 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);
1119
255
  } else {
1120
256
  fontResponse = await createNewFont(font, client);
1121
257
  }
1122
258
  return {
1123
- _key: (0, import_nanoid3.nanoid)(),
259
+ _key: _nanoid.nanoid.call(void 0, ),
1124
260
  _type: "reference",
1125
261
  _ref: fontResponse._id,
1126
262
  _weak: true
1127
263
  };
1128
264
  } catch (e) {
1129
- console.error("Error creating font: ", font.title, font.subfamily, e);
265
+ console.error("Error creating font:", font.title, font.subfamily, e);
1130
266
  setError(true);
1131
267
  return null;
1132
268
  }
@@ -1148,7 +284,7 @@ var updateExistingFont = async (font, existingFont, client) => {
1148
284
  if (font.variableFont && (existingFont == null ? void 0 : existingFont.variableInstanceReferences) && (!font.variableInstanceReferences || font.variableInstanceReferences.length === 0)) {
1149
285
  font.variableInstanceReferences = existingFont.variableInstanceReferences;
1150
286
  }
1151
- console.log("Updating existing font: ", font._id, font.title);
287
+ console.log("Updating existing font:", font._id, font.title);
1152
288
  const patchObject = {
1153
289
  fileInput: font.fileInput,
1154
290
  subfamily: font.subfamily,
@@ -1160,10 +296,10 @@ var updateExistingFont = async (font, existingFont, client) => {
1160
296
  return await client.patch(font._id).set(patchObject).commit();
1161
297
  };
1162
298
  var createNewFont = async (font, client) => {
1163
- console.log("Creating new font: ", font._id, font.title);
299
+ console.log("Creating new font:", font._id, font.title);
1164
300
  if (font.metaData) cleanMetadataValues(font);
1165
301
  const newDocument = {
1166
- _key: (0, import_nanoid3.nanoid)(),
302
+ _key: _nanoid.nanoid.call(void 0, ),
1167
303
  _id: font._id,
1168
304
  _type: "font",
1169
305
  ...font
@@ -1176,7 +312,7 @@ var cleanMetadataValues = (font) => {
1176
312
  if (font.metaData[key] == null) {
1177
313
  font.metaData[key] = "";
1178
314
  } else {
1179
- font.metaData[key] = font.metaData[key].replace(/[-]/g, "");
315
+ font.metaData[key] = font.metaData[key].replace(/[\x00-\x1f]/g, "");
1180
316
  }
1181
317
  });
1182
318
  };
@@ -1200,98 +336,7 @@ var addToVariableRefs = (fontRef, font, variableRefs, stylesObject) => {
1200
336
  }
1201
337
  };
1202
338
 
1203
- // src/utils/updateTypefaceDocument.js
1204
- var import_nanoid4 = require("nanoid");
1205
- var updateTypefaceDocument = async (doc_id, fontRefs, variableRefs, subfamilies, uniqueSubfamilies, subfamiliesArray, preferredStyleRef, newPreferredStyle, stylesObject, client, setStatus, setError) => {
1206
- console.log("Updating typeface document with new fonts:", { fontRefs, variableRefs, subfamilies, uniqueSubfamilies });
1207
- setStatus("Updating typeface references...");
1208
- let patch = {
1209
- styles: {
1210
- fonts: stylesObject.fonts ? [...stylesObject.fonts, ...fontRefs] : [...fontRefs],
1211
- subfamilies: uniqueSubfamilies.length > 1 ? uniqueSubfamilies : [],
1212
- variableFont: (stylesObject == null ? void 0 : stylesObject.variableFont) ? [...stylesObject.variableFont, ...variableRefs] : [...variableRefs]
1213
- }
1214
- };
1215
- setStatus("Organising font subfamilies...");
1216
- subfamiliesArray = subfamiliesArray || [];
1217
- uniqueSubfamilies.forEach((subfamilyName) => {
1218
- if (!subfamiliesArray.find((sf) => sf.title === subfamilyName)) {
1219
- subfamiliesArray.push({
1220
- title: subfamilyName,
1221
- _key: (0, import_nanoid4.nanoid)(),
1222
- _type: "object",
1223
- fonts: []
1224
- });
1225
- }
1226
- });
1227
- if (subfamiliesArray.length > 0) {
1228
- Object.entries(subfamilies).forEach(([id, subfamilyName]) => {
1229
- if (id.toLowerCase().includes("vf")) return;
1230
- const subfamilyIndex = subfamiliesArray.findIndex((sf) => sf.title === subfamilyName);
1231
- if (subfamilyIndex !== -1) {
1232
- subfamiliesArray[subfamilyIndex].fonts.push({
1233
- _ref: id,
1234
- _key: (0, import_nanoid4.nanoid)(),
1235
- _type: "reference",
1236
- _weak: true
1237
- });
1238
- }
1239
- });
1240
- subfamiliesArray = subfamiliesArray.map((subfamily) => ({
1241
- ...subfamily,
1242
- fonts: subfamily.fonts.filter(
1243
- (font, index, self) => index === self.findIndex((f) => f._ref === font._ref)
1244
- )
1245
- }));
1246
- }
1247
- patch.styles.subfamilies = subfamiliesArray;
1248
- await updatePreferredStyle(doc_id, preferredStyleRef, newPreferredStyle, patch, client);
1249
- console.log("doc_id: ", doc_id);
1250
- console.log("Typeface patch: ", patch);
1251
- console.log("New preferred style: ", newPreferredStyle);
1252
- console.log("SubfamiliesArray:", subfamiliesArray);
1253
- try {
1254
- await client.patch(doc_id).set(patch).commit();
1255
- console.log(`Updated document: ${doc_id}`);
1256
- if (doc_id.startsWith("drafts.")) {
1257
- await updatePublishedDocument(doc_id, patch, client);
1258
- }
1259
- } catch (err) {
1260
- console.error("Error updating document:", err.message);
1261
- setStatus("Error updating typeface");
1262
- setError(true);
1263
- }
1264
- };
1265
- var updatePreferredStyle = async (doc_id, preferredStyleRef, newPreferredStyle, patch, client) => {
1266
- var _a;
1267
- if ((preferredStyleRef == null ? void 0 : preferredStyleRef._ref) && preferredStyleRef._ref !== "" && preferredStyleRef._ref !== null && newPreferredStyle._ref !== preferredStyleRef._ref) {
1268
- const prefStyleResult = await client.fetch(
1269
- `*[_id == $docId]{ preferredStyle->{ weight, style, _id } }`,
1270
- { docId: doc_id }
1271
- );
1272
- const prefStyle = (_a = prefStyleResult[0]) == null ? void 0 : _a.preferredStyle;
1273
- if (!(prefStyle == null ? void 0 : prefStyle.weight) || prefStyle === null || prefStyle.weight < newPreferredStyle.weight) {
1274
- patch.preferredStyle = {
1275
- _type: "reference",
1276
- _ref: newPreferredStyle._ref,
1277
- _weak: true
1278
- };
1279
- }
1280
- }
1281
- };
1282
- var updatePublishedDocument = async (doc_id, patch, client) => {
1283
- const publishedId = doc_id.replace("drafts.", "");
1284
- const publishedDoc = await client.fetch(`*[_id == $publishedId]`, { publishedId }).then((res) => res[0]);
1285
- if (publishedDoc) {
1286
- await client.patch(publishedId).set(patch).commit();
1287
- console.log(`Updated published document: ${publishedId}`);
1288
- } else {
1289
- console.log(`No published document found for ${publishedId}, skipping`);
1290
- }
1291
- };
1292
-
1293
339
  // src/utils/regenerateFontData.js
1294
- var fontkit4 = __toESM(require("fontkit"));
1295
340
  var renameFontDocuments = async ({
1296
341
  client,
1297
342
  typefaceName,
@@ -1360,9 +405,9 @@ var renameFontDocuments = async ({
1360
405
  const res = await fetch(ttfAsset.url);
1361
406
  file = await res.blob();
1362
407
  }
1363
- const fontBuffer = await readFontFile(file);
1364
- const font = fontkit4.create(fontBuffer);
1365
- const { weightName, subfamilyName, fontTitle } = extractFontMetadata(
408
+ const fontBuffer = await _chunkFH4QKHOHjs.readFontFile.call(void 0, file);
409
+ const font = await _chunkFH4QKHOHjs.parseFont.call(void 0, fontBuffer, `${fontDoc._id}.ttf`);
410
+ const { weightName, subfamilyName, fontTitle } = _chunkFH4QKHOHjs.extractFontMetadata.call(void 0,
1366
411
  font,
1367
412
  typefaceName,
1368
413
  weightKeywordList,
@@ -1472,45 +517,31 @@ var updateFontPrices = async ({
1472
517
  };
1473
518
 
1474
519
  // src/components/StatusDisplay.jsx
1475
- var import_react2 = __toESM(require("react"));
1476
- var import_ui = require("@sanity/ui");
520
+
521
+
1477
522
  var StatusDisplay = ({ status, error, action }) => {
1478
- return /* @__PURE__ */ import_react2.default.createElement(import_ui.Flex, { paddingTop: 1, paddingBottom: 3, align: "center", justify: "space-between" }, /* @__PURE__ */ import_react2.default.createElement(import_ui.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ import_react2.default.createElement(import_ui.Text, { size: 1 }, "Status:"), /* @__PURE__ */ import_react2.default.createElement(import_ui.Text, { size: 1, style: { color: error ? "red" : "green" } }, status)), action && action);
523
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { paddingTop: 1, paddingBottom: 3, align: "center", justify: "space-between" }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1 }, "Status:"), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, style: { color: error ? "red" : "green" } }, status)), action && action);
1479
524
  };
1480
525
  var StatusDisplay_default = StatusDisplay;
1481
526
 
1482
- // src/components/PriceInput.jsx
1483
- var import_react3 = __toESM(require("react"));
1484
- var import_ui2 = require("@sanity/ui");
1485
- var PriceInput = ({ inputPrice, handleInputChange }) => /* @__PURE__ */ import_react3.default.createElement(import_ui2.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ import_react3.default.createElement(import_ui2.Text, { size: 1, muted: true }, "Price:"), /* @__PURE__ */ import_react3.default.createElement(import_ui2.Text, { size: 1, muted: true }, "$"), /* @__PURE__ */ import_react3.default.createElement(
1486
- "input",
1487
- {
1488
- value: inputPrice,
1489
- onChange: handleInputChange,
1490
- type: "number",
1491
- style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
1492
- }
1493
- ), /* @__PURE__ */ import_react3.default.createElement(import_ui2.Text, { size: 1, muted: true }, "per style"));
1494
- var PriceInput_default = PriceInput;
1495
-
1496
527
  // src/components/RegenerateSubfamiliesComponent.jsx
1497
- var import_react4 = __toESM(require("react"));
1498
- var import_nanoid5 = require("nanoid");
1499
- var import_ui3 = require("@sanity/ui");
1500
- var import_sanity2 = require("sanity");
528
+
529
+
530
+
531
+
1501
532
  var RegenerateSubfamiliesComponent = () => {
1502
- const [status, setStatus] = (0, import_react4.useState)("");
1503
- const [ready, setReady] = (0, import_react4.useState)(true);
1504
- const [error, setError] = (0, import_react4.useState)(false);
533
+ const [status, setStatus] = _react.useState.call(void 0, "");
534
+ const [ready, setReady] = _react.useState.call(void 0, true);
535
+ const [error, setError] = _react.useState.call(void 0, false);
1505
536
  const client = useSanityClient();
1506
- const doc_id = (0, import_sanity2.useFormValue)(["_id"]);
1507
- const title = (0, import_sanity2.useFormValue)(["title"]);
1508
- const slug = (0, import_sanity2.useFormValue)(["slug"]);
1509
- const stylesObject = (0, import_sanity2.useFormValue)(["styles"]) || { fonts: [], variableFont: [] };
537
+ const doc_id = _sanity.useFormValue.call(void 0, ["_id"]);
538
+ const title = _sanity.useFormValue.call(void 0, ["title"]);
539
+ const slug = _sanity.useFormValue.call(void 0, ["slug"]);
540
+ const stylesObject = _sanity.useFormValue.call(void 0, ["styles"]) || { fonts: [], variableFont: [] };
1510
541
  const handleClick = () => {
1511
542
  regenerateSubfamilies({ title, stylesObject, slug, doc_id, client, setStatus, setReady, setError });
1512
543
  };
1513
- return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, status && /* @__PURE__ */ import_react4.default.createElement(import_ui3.Box, { padding: 3, style: { borderRadius: "4px", marginBottom: "10px" } }, /* @__PURE__ */ import_react4.default.createElement(import_ui3.Text, { size: 1, style: { color: error ? "red" : "green" } }, status)), /* @__PURE__ */ import_react4.default.createElement(import_ui3.Button, { mode: "ghost", tone: "primary", width: "fill", padding: 3, onClick: handleClick, disabled: !ready }, /* @__PURE__ */ import_react4.default.createElement(import_ui3.Stack, { space: 2 }, /* @__PURE__ */ import_react4.default.createElement(import_ui3.Text, { align: "center" }, "Regenerate Subfamilies"))));
544
+ return /* @__PURE__ */ _react2.default.createElement(_react2.default.Fragment, null, status && /* @__PURE__ */ _react2.default.createElement(_ui.Box, { padding: 3, style: { borderRadius: "4px", marginBottom: "10px" } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, style: { color: error ? "red" : "green" } }, status)), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", width: "fill", padding: 3, onClick: handleClick, disabled: !ready }, /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { align: "center" }, "Regenerate Subfamilies"))));
1514
545
  };
1515
546
  var regenerateSubfamilies = async ({ title, stylesObject, slug, doc_id, client, setStatus, setReady, setError }) => {
1516
547
  try {
@@ -1556,7 +587,7 @@ var groupFontsBySubfamily = (fonts) => {
1556
587
  if ((_a = font.title) == null ? void 0 : _a.includes("VF")) {
1557
588
  subfamilies[`VF_${font.title}`] = [font];
1558
589
  } else {
1559
- const subfamilyName = font.subfamily ? expandAbbreviations(font.subfamily) : "Regular";
590
+ const subfamilyName = font.subfamily ? _chunkFH4QKHOHjs.expandAbbreviations.call(void 0, font.subfamily) : "Regular";
1560
591
  if (!subfamilies[subfamilyName]) subfamilies[subfamilyName] = [];
1561
592
  subfamilies[subfamilyName].push(font);
1562
593
  }
@@ -1566,11 +597,11 @@ var groupFontsBySubfamily = (fonts) => {
1566
597
  var createSubfamiliesArray = (subfamilies) => {
1567
598
  return Object.keys(subfamilies).map((subfamilyName) => ({
1568
599
  title: subfamilyName,
1569
- _key: (0, import_nanoid5.nanoid)(),
600
+ _key: _nanoid.nanoid.call(void 0, ),
1570
601
  _type: "object",
1571
602
  fonts: subfamilies[subfamilyName].map((font) => ({
1572
603
  _ref: font._id,
1573
- _key: (0, import_nanoid5.nanoid)(),
604
+ _key: _nanoid.nanoid.call(void 0, ),
1574
605
  _type: "reference",
1575
606
  _weak: true
1576
607
  }))
@@ -1604,6 +635,7 @@ var updateTypefaceSubfamilies = async (doc_id, stylesObject, newSubfamiliesArray
1604
635
  };
1605
636
 
1606
637
  // src/components/BatchUploadFonts.jsx
638
+ var UploadModal2 = _react.lazy.call(void 0, () => Promise.resolve().then(() => _interopRequireWildcard(require("./UploadModal-6LIX7XOK.js"))));
1607
639
  var ACCEPTED_EXTENSIONS = ["ttf", "otf", "woff", "woff2", "eot", "svg"];
1608
640
  var formatElapsed = (s) => {
1609
641
  const m = Math.floor(s / 60);
@@ -1611,28 +643,29 @@ var formatElapsed = (s) => {
1611
643
  return m > 0 ? `${m}m ${sec}s` : `${sec}s`;
1612
644
  };
1613
645
  var BatchUploadFonts = () => {
1614
- const [status, setStatus] = (0, import_react5.useState)("ready");
1615
- const [ready, setReady] = (0, import_react5.useState)(true);
1616
- const [inputPrice, setInputPrice] = (0, import_react5.useState)("0");
1617
- const [error, setError] = (0, import_react5.useState)(false);
1618
- const [preserveShortenedNames, setPreserveShortenedNames] = (0, import_react5.useState)(true);
1619
- const [preserveFileNames, setPreserveFileNames] = (0, import_react5.useState)(false);
1620
- const [showUtilities, setShowUtilities] = (0, import_react5.useState)(false);
1621
- const [pendingFiles, setPendingFiles] = (0, import_react5.useState)([]);
1622
- const [isDragging, setIsDragging] = (0, import_react5.useState)(false);
1623
- const [elapsedSeconds, setElapsedSeconds] = (0, import_react5.useState)(0);
1624
- const fileInputRef = (0, import_react5.useRef)(null);
1625
- const elapsedTimerRef = (0, import_react5.useRef)(null);
1626
- const wakeLockRef = (0, import_react5.useRef)(null);
646
+ const [status, setStatus] = _react.useState.call(void 0, "ready");
647
+ const [ready, setReady] = _react.useState.call(void 0, true);
648
+ const [inputPrice, setInputPrice] = _react.useState.call(void 0, "0");
649
+ const [error, setError] = _react.useState.call(void 0, false);
650
+ const [preserveShortenedNames, setPreserveShortenedNames] = _react.useState.call(void 0, true);
651
+ const [preserveFileNames, setPreserveFileNames] = _react.useState.call(void 0, false);
652
+ const [showUtilities, setShowUtilities] = _react.useState.call(void 0, false);
653
+ const [pendingFiles, setPendingFiles] = _react.useState.call(void 0, []);
654
+ const [isDragging, setIsDragging] = _react.useState.call(void 0, false);
655
+ const [elapsedSeconds, setElapsedSeconds] = _react.useState.call(void 0, 0);
656
+ const [showUploadModal, setShowUploadModal] = _react.useState.call(void 0, false);
657
+ const fileInputRef = _react.useRef.call(void 0, null);
658
+ const elapsedTimerRef = _react.useRef.call(void 0, null);
659
+ const wakeLockRef = _react.useRef.call(void 0, null);
1627
660
  const client = useSanityClient();
1628
- const doc_id = (0, import_sanity3.useFormValue)(["_id"]);
1629
- const title = (0, import_sanity3.useFormValue)(["title"]);
1630
- const preferredStyleRef = (0, import_sanity3.useFormValue)(["preferredStyle"]);
1631
- const slug = (0, import_sanity3.useFormValue)(["slug"]);
1632
- const stylesObject = (0, import_sanity3.useFormValue)(["styles"]) || { fonts: [], variableFont: [] };
661
+ const doc_id = _sanity.useFormValue.call(void 0, ["_id"]);
662
+ const title = _sanity.useFormValue.call(void 0, ["title"]);
663
+ const preferredStyleRef = _sanity.useFormValue.call(void 0, ["preferredStyle"]);
664
+ const slug = _sanity.useFormValue.call(void 0, ["slug"]);
665
+ const stylesObject = _sanity.useFormValue.call(void 0, ["styles"]) || { fonts: [], variableFont: [] };
1633
666
  const subfamiliesArray = (stylesObject == null ? void 0 : stylesObject.subfamilies) || [];
1634
- const { weightKeywordList, italicKeywordList } = (0, import_react5.useMemo)(() => generateStyleKeywords(), []);
1635
- (0, import_react5.useEffect)(() => {
667
+ const { weightKeywordList, italicKeywordList } = _react.useMemo.call(void 0, () => _chunkFH4QKHOHjs.generateStyleKeywords.call(void 0, ), []);
668
+ _react.useEffect.call(void 0, () => {
1636
669
  if (ready !== true) {
1637
670
  setElapsedSeconds(0);
1638
671
  elapsedTimerRef.current = setInterval(() => {
@@ -1643,7 +676,7 @@ var BatchUploadFonts = () => {
1643
676
  }
1644
677
  return () => clearInterval(elapsedTimerRef.current);
1645
678
  }, [ready]);
1646
- (0, import_react5.useEffect)(() => {
679
+ _react.useEffect.call(void 0, () => {
1647
680
  if (ready !== true) {
1648
681
  const handler = (e) => {
1649
682
  e.preventDefault();
@@ -1653,7 +686,7 @@ var BatchUploadFonts = () => {
1653
686
  return () => window.removeEventListener("beforeunload", handler);
1654
687
  }
1655
688
  }, [ready]);
1656
- (0, import_react5.useEffect)(() => {
689
+ _react.useEffect.call(void 0, () => {
1657
690
  var _a;
1658
691
  if (ready !== true) {
1659
692
  (_a = navigator.wakeLock) == null ? void 0 : _a.request("screen").then((lock) => {
@@ -1708,32 +741,32 @@ var BatchUploadFonts = () => {
1708
741
  setStatus2("Upload completed successfully");
1709
742
  }
1710
743
  };
1711
- const handleFileSelect = (0, import_react5.useCallback)((e) => {
744
+ const handleFileSelect = _react.useCallback.call(void 0, (e) => {
1712
745
  const files = filterFontFiles(e.target.files);
1713
746
  if (files.length > 0) setPendingFiles((prev) => [...prev, ...files]);
1714
747
  e.target.value = "";
1715
748
  }, []);
1716
- const handleRemoveFile = (0, import_react5.useCallback)((file) => {
749
+ const handleRemoveFile = _react.useCallback.call(void 0, (file) => {
1717
750
  setPendingFiles((prev) => prev.filter((f) => f !== file));
1718
751
  }, []);
1719
- const handleDragEnter = (0, import_react5.useCallback)((e) => {
752
+ const handleDragEnter = _react.useCallback.call(void 0, (e) => {
1720
753
  e.preventDefault();
1721
754
  setIsDragging(true);
1722
755
  }, []);
1723
- const handleDragOver = (0, import_react5.useCallback)((e) => {
756
+ const handleDragOver = _react.useCallback.call(void 0, (e) => {
1724
757
  e.preventDefault();
1725
758
  }, []);
1726
- const handleDragLeave = (0, import_react5.useCallback)((e) => {
759
+ const handleDragLeave = _react.useCallback.call(void 0, (e) => {
1727
760
  e.preventDefault();
1728
761
  setIsDragging(false);
1729
762
  }, []);
1730
- const handleDrop = (0, import_react5.useCallback)((e) => {
763
+ const handleDrop = _react.useCallback.call(void 0, (e) => {
1731
764
  e.preventDefault();
1732
765
  setIsDragging(false);
1733
766
  const files = filterFontFiles(e.dataTransfer.files);
1734
767
  if (files.length > 0) setPendingFiles((prev) => [...prev, ...files]);
1735
768
  }, []);
1736
- const handleConfirmUpload = (0, import_react5.useCallback)(async () => {
769
+ const handleConfirmUpload = _react.useCallback.call(void 0, async () => {
1737
770
  try {
1738
771
  setStatus("Uploading font files...");
1739
772
  setReady("upload");
@@ -1744,7 +777,7 @@ var BatchUploadFonts = () => {
1744
777
  }
1745
778
  const sortedFiles = sortFilesByType(pendingFiles);
1746
779
  setPendingFiles([]);
1747
- const { fontsObjects, subfamilies, uniqueSubfamilies, newPreferredStyle, failedFiles } = await processFontFiles(
780
+ const { fontsObjects, subfamilies, uniqueSubfamilies, newPreferredStyle, failedFiles } = await _chunkFH4QKHOHjs.processFontFiles.call(void 0,
1748
781
  sortedFiles,
1749
782
  title,
1750
783
  weightKeywordList,
@@ -1760,9 +793,10 @@ var BatchUploadFonts = () => {
1760
793
  inputPrice,
1761
794
  stylesObject,
1762
795
  setStatus,
1763
- setError
796
+ setError,
797
+ preserveFileNames
1764
798
  );
1765
- await updateTypefaceDocument(
799
+ await _chunkFH4QKHOHjs.updateTypefaceDocument.call(void 0,
1766
800
  doc_id,
1767
801
  fontRefs,
1768
802
  variableRefs,
@@ -1785,7 +819,7 @@ var BatchUploadFonts = () => {
1785
819
  setReady(true);
1786
820
  setError(false);
1787
821
  }, [pendingFiles, stylesObject, title, slug, doc_id, inputPrice, weightKeywordList, italicKeywordList, client, preferredStyleRef, subfamiliesArray, preserveShortenedNames, preserveFileNames]);
1788
- const handleRenameExistingFonts = (0, import_react5.useCallback)(async () => {
822
+ const handleRenameExistingFonts = _react.useCallback.call(void 0, async () => {
1789
823
  try {
1790
824
  setStatus("Processing font documents...");
1791
825
  setReady("rename");
@@ -1814,14 +848,14 @@ var BatchUploadFonts = () => {
1814
848
  }
1815
849
  setReady(true);
1816
850
  }, [title, client, slug, weightKeywordList, italicKeywordList, preserveShortenedNames]);
1817
- const handleChangeFontPrice = (0, import_react5.useCallback)(async () => {
851
+ const handleChangeFontPrice = _react.useCallback.call(void 0, async () => {
1818
852
  setStatus("Updating font prices...");
1819
853
  setReady("price");
1820
854
  setError(false);
1821
855
  await updateFontPrices({ client, title, slug, inputPrice, doc_id, setStatus, setError });
1822
856
  setReady(true);
1823
857
  }, [title, slug, client, doc_id, inputPrice]);
1824
- const handleRegenerateCssFiles = (0, import_react5.useCallback)(async () => {
858
+ const handleRegenerateCssFiles = _react.useCallback.call(void 0, async () => {
1825
859
  var _a, _b, _c, _d;
1826
860
  try {
1827
861
  setStatus("Regenerating CSS files...");
@@ -1879,7 +913,7 @@ var BatchUploadFonts = () => {
1879
913
  const woff2Blob = await woff2Response.blob();
1880
914
  const woff2File = new File([woff2Blob], `${fontDoc._id}.woff2`, { type: "font/woff2" });
1881
915
  setStatus(`Regenerating CSS for font ${i + 1}/${fontRefs.length}: ${fontDoc.title}`);
1882
- const updatedFileInput = await generateCssFile({
916
+ const updatedFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
1883
917
  woff2File,
1884
918
  fileInput: fontDoc.fileInput,
1885
919
  fileName: fontDoc._id,
@@ -1912,18 +946,18 @@ var BatchUploadFonts = () => {
1912
946
  setError(false);
1913
947
  setStatus("ready");
1914
948
  };
1915
- const renderTooltipLabel = (label, description) => /* @__PURE__ */ import_react5.default.createElement(
1916
- import_ui4.Tooltip,
949
+ const renderTooltipLabel = (label, description) => /* @__PURE__ */ _react2.default.createElement(
950
+ _ui.Tooltip,
1917
951
  {
1918
- content: /* @__PURE__ */ import_react5.default.createElement(import_ui4.Box, { padding: 2, style: { maxWidth: 260 } }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Text, { size: 1, style: { lineHeight: 1.6 } }, description)),
952
+ content: /* @__PURE__ */ _react2.default.createElement(_ui.Box, { padding: 2, style: { maxWidth: 260 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, style: { lineHeight: 1.6 } }, description)),
1919
953
  placement: "top",
1920
954
  portal: true
1921
955
  },
1922
- /* @__PURE__ */ import_react5.default.createElement(import_ui4.Flex, { align: "center", gap: 1, style: { cursor: "default" } }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Label, null, label), /* @__PURE__ */ import_react5.default.createElement(import_icons.InfoOutlineIcon, { style: { opacity: 0.5, display: "block" } }))
956
+ /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", gap: 1, style: { cursor: "default" } }, /* @__PURE__ */ _react2.default.createElement(_ui.Label, null, label), /* @__PURE__ */ _react2.default.createElement(_icons.InfoOutlineIcon, { style: { opacity: 0.5, display: "block" } }))
1923
957
  );
1924
- const renderProcessing = () => /* @__PURE__ */ import_react5.default.createElement(import_ui4.Stack, { space: 3, paddingY: 2 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Flex, { align: "center", gap: 3 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Spinner, null), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Text, { size: 1, muted: true }, status)), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Card, { tone: "caution", border: true, radius: 2, padding: 2 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Flex, { align: "center", justify: "space-between", gap: 2 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ import_react5.default.createElement(import_icons.WarningOutlineIcon, { style: { flexShrink: 0 } }), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Text, { size: 1, weight: "semibold" }, "Do not close or reload this tab")), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Text, { size: 1, muted: true, style: { flexShrink: 0 } }, formatElapsed(elapsedSeconds)))));
1925
- const renderDropZone = () => /* @__PURE__ */ import_react5.default.createElement(
1926
- import_ui4.Box,
958
+ const renderProcessing = () => /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3, paddingY: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", gap: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Spinner, null), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, status)), /* @__PURE__ */ _react2.default.createElement(_ui.Card, { tone: "caution", border: true, radius: 2, padding: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", justify: "space-between", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_icons.WarningOutlineIcon, { style: { flexShrink: 0 } }), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, weight: "semibold" }, "Do not close or reload this tab")), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true, style: { flexShrink: 0 } }, formatElapsed(elapsedSeconds)))));
959
+ const renderDropZone = () => /* @__PURE__ */ _react2.default.createElement(
960
+ _ui.Box,
1927
961
  {
1928
962
  onDragEnter: handleDragEnter,
1929
963
  onDragOver: handleDragOver,
@@ -1939,7 +973,7 @@ var BatchUploadFonts = () => {
1939
973
  cursor: "default"
1940
974
  }
1941
975
  },
1942
- /* @__PURE__ */ import_react5.default.createElement(
976
+ /* @__PURE__ */ _react2.default.createElement(
1943
977
  "input",
1944
978
  {
1945
979
  ref: fileInputRef,
@@ -1950,8 +984,8 @@ var BatchUploadFonts = () => {
1950
984
  onChange: handleFileSelect
1951
985
  }
1952
986
  ),
1953
- /* @__PURE__ */ import_react5.default.createElement(import_ui4.Stack, { space: 3 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Text, { size: 1, muted: true }, isDragging ? "Release to add files" : "Drop font files here"), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Flex, { justify: "center" }, /* @__PURE__ */ import_react5.default.createElement(
1954
- import_ui4.Button,
987
+ /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, isDragging ? "Release to add files" : "Drop font files here"), /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "center" }, /* @__PURE__ */ _react2.default.createElement(
988
+ _ui.Button,
1955
989
  {
1956
990
  mode: "ghost",
1957
991
  tone: "primary",
@@ -1967,8 +1001,8 @@ var BatchUploadFonts = () => {
1967
1001
  );
1968
1002
  const renderFileList = () => {
1969
1003
  const sorted = sortFilesByType(pendingFiles);
1970
- return /* @__PURE__ */ import_react5.default.createElement(import_ui4.Stack, { space: 2 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Flex, { align: "center", justify: "space-between" }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Text, { size: 1, muted: true }, pendingFiles.length, " file", pendingFiles.length === 1 ? "" : "s", " selected"), /* @__PURE__ */ import_react5.default.createElement(
1971
- import_ui4.Button,
1004
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", justify: "space-between" }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, pendingFiles.length, " file", pendingFiles.length === 1 ? "" : "s", " selected"), /* @__PURE__ */ _react2.default.createElement(
1005
+ _ui.Button,
1972
1006
  {
1973
1007
  mode: "bleed",
1974
1008
  tone: "default",
@@ -1977,27 +1011,27 @@ var BatchUploadFonts = () => {
1977
1011
  text: "Clear all",
1978
1012
  onClick: () => setPendingFiles([])
1979
1013
  }
1980
- )), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Box, { style: { maxHeight: "260px", overflowY: "auto", display: "flex", flexDirection: "column", gap: "4px" } }, sorted.map((file, i) => {
1014
+ )), /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { maxHeight: "260px", overflowY: "auto", display: "flex", flexDirection: "column", gap: "4px" } }, sorted.map((file, i) => {
1981
1015
  const ext = file.name.split(".").pop().toUpperCase();
1982
- return /* @__PURE__ */ import_react5.default.createElement(import_ui4.Card, { key: `${file.name}-${file.size}-${i}`, border: true, radius: 1, paddingX: 2, paddingY: 2 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ import_react5.default.createElement(
1983
- import_ui4.Text,
1016
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { key: `${file.name}-${file.size}-${i}`, border: true, radius: 1, paddingX: 2, paddingY: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement(
1017
+ _ui.Text,
1984
1018
  {
1985
1019
  size: 0,
1986
1020
  style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0 }
1987
1021
  },
1988
1022
  ext
1989
- ), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Box, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Text, { size: 1 }, file.name))), /* @__PURE__ */ import_react5.default.createElement(
1990
- import_ui4.Button,
1023
+ ), /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1 }, file.name))), /* @__PURE__ */ _react2.default.createElement(
1024
+ _ui.Button,
1991
1025
  {
1992
1026
  mode: "bleed",
1993
1027
  tone: "critical",
1994
- icon: import_icons.TrashIcon,
1028
+ icon: _icons.TrashIcon,
1995
1029
  padding: 2,
1996
1030
  onClick: () => handleRemoveFile(file)
1997
1031
  }
1998
1032
  )));
1999
- })), /* @__PURE__ */ import_react5.default.createElement(
2000
- import_ui4.Box,
1033
+ })), /* @__PURE__ */ _react2.default.createElement(
1034
+ _ui.Box,
2001
1035
  {
2002
1036
  onDragEnter: handleDragEnter,
2003
1037
  onDragOver: handleDragOver,
@@ -2012,7 +1046,7 @@ var BatchUploadFonts = () => {
2012
1046
  transition: "border-color 0.12s, background 0.12s"
2013
1047
  }
2014
1048
  },
2015
- /* @__PURE__ */ import_react5.default.createElement(
1049
+ /* @__PURE__ */ _react2.default.createElement(
2016
1050
  "input",
2017
1051
  {
2018
1052
  ref: fileInputRef,
@@ -2023,8 +1057,8 @@ var BatchUploadFonts = () => {
2023
1057
  onChange: handleFileSelect
2024
1058
  }
2025
1059
  ),
2026
- /* @__PURE__ */ import_react5.default.createElement(import_ui4.Flex, { align: "center", justify: "center", gap: 2 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Text, { size: 1, muted: true }, isDragging ? "Release to add" : "Drop more files or"), /* @__PURE__ */ import_react5.default.createElement(
2027
- import_ui4.Button,
1060
+ /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", justify: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, isDragging ? "Release to add" : "Drop more files or"), /* @__PURE__ */ _react2.default.createElement(
1061
+ _ui.Button,
2028
1062
  {
2029
1063
  mode: "bleed",
2030
1064
  tone: "primary",
@@ -2037,29 +1071,30 @@ var BatchUploadFonts = () => {
2037
1071
  }
2038
1072
  }
2039
1073
  ))
2040
- ), /* @__PURE__ */ import_react5.default.createElement(
2041
- import_ui4.Button,
1074
+ ), /* @__PURE__ */ _react2.default.createElement(
1075
+ _ui.Button,
2042
1076
  {
2043
1077
  mode: "ghost",
2044
1078
  tone: "primary",
2045
- icon: import_icons.UploadIcon,
1079
+ icon: _icons.UploadIcon,
2046
1080
  text: `Upload ${pendingFiles.length} Font${pendingFiles.length === 1 ? "" : "s"}`,
2047
1081
  style: { width: "100%" },
2048
1082
  onClick: handleConfirmUpload
2049
1083
  }
2050
1084
  ));
2051
1085
  };
2052
- return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, title && title !== "" && slug && slug !== "" && /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement(
1086
+ const hasRequiredFields = title && title !== "" && slug && slug !== "";
1087
+ return /* @__PURE__ */ _react2.default.createElement(_react2.default.Fragment, null, !hasRequiredFields && /* @__PURE__ */ _react2.default.createElement(_ui.Card, { border: true, padding: 4, radius: 2, tone: "caution" }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", gap: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 2 }, /* @__PURE__ */ _react2.default.createElement(_icons.WarningOutlineIcon, null)), /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, weight: "semibold" }, !title || title === "" ? "Title required to use font uploader" : "Slug required to use font uploader"), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { 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__ */ _react2.default.createElement(_react2.default.Fragment, null, /* @__PURE__ */ _react2.default.createElement(
2053
1088
  StatusDisplay_default,
2054
1089
  {
2055
1090
  status,
2056
1091
  error,
2057
- action: /* @__PURE__ */ import_react5.default.createElement(
2058
- import_ui4.Button,
1092
+ action: /* @__PURE__ */ _react2.default.createElement(
1093
+ _ui.Button,
2059
1094
  {
2060
1095
  mode: showUtilities ? "default" : "ghost",
2061
1096
  tone: "primary",
2062
- icon: import_icons.ControlsIcon,
1097
+ icon: _icons.ControlsIcon,
2063
1098
  text: "Utilities",
2064
1099
  fontSize: 1,
2065
1100
  padding: 2,
@@ -2067,17 +1102,32 @@ var BatchUploadFonts = () => {
2067
1102
  }
2068
1103
  )
2069
1104
  }
2070
- ), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Card, { border: true, padding: 2, shadow: 1, radius: 2 }, showUtilities ? /* @__PURE__ */ import_react5.default.createElement(import_ui4.Stack, { space: 4, marginTop: 2 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Stack, { space: 2 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Text, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Regenerate Subfamilies"), /* @__PURE__ */ import_react5.default.createElement(RegenerateSubfamiliesComponent, null)), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Stack, { space: 3 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Text, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Rename Fonts (name table, Full Name)"), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ import_react5.default.createElement(
2071
- import_ui4.Switch,
1105
+ ), /* @__PURE__ */ _react2.default.createElement(
1106
+ _ui.Button,
2072
1107
  {
2073
- checked: preserveShortenedNames,
2074
- onChange: (e) => setPreserveShortenedNames(e.target.checked)
1108
+ mode: "default",
1109
+ tone: "primary",
1110
+ icon: _icons.UploadIcon,
1111
+ text: "Upload Fonts",
1112
+ fontSize: 2,
1113
+ padding: 4,
1114
+ onClick: () => setShowUploadModal(true),
1115
+ style: { width: "100%" }
2075
1116
  }
2076
- ), renderTooltipLabel(
2077
- "Preserve shortened names",
2078
- 'Abbreviations in font names are kept as-is (e.g. "XNarrow" stays "XNarrow", "Bd" stays "Bd").'
2079
- )), ready === "rename" ? renderProcessing() : /* @__PURE__ */ import_react5.default.createElement(import_ui4.Button, { mode: "ghost", tone: "primary", text: "Rename Existing Fonts", style: { width: "100%" }, onClick: handleRenameExistingFonts, disabled: ready !== true })), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Stack, { space: 3 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Text, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Update Font Prices"), ready === "price" ? renderProcessing() : /* @__PURE__ */ import_react5.default.createElement(import_ui4.Stack, { space: 2 }, /* @__PURE__ */ import_react5.default.createElement(PriceInput_default, { inputPrice, handleInputChange }), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Button, { mode: "ghost", tone: "primary", text: "Update All Font Prices", style: { width: "100%" }, onClick: handleChangeFontPrice, disabled: ready !== true }))), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Stack, { space: 3 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Text, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Regenerate CSS"), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Text, { 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__ */ import_react5.default.createElement(import_ui4.Button, { mode: "ghost", tone: "primary", text: "Regenerate CSS Files", style: { width: "100%" }, onClick: handleRegenerateCssFiles, disabled: ready !== true }))) : ready ? /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Grid, { columns: [2], gap: 4, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Box, null, /* @__PURE__ */ import_react5.default.createElement(PriceInput_default, { inputPrice, handleInputChange })), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Stack, { space: 3 }, /* @__PURE__ */ import_react5.default.createElement(import_ui4.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ import_react5.default.createElement(
2080
- import_ui4.Switch,
1117
+ ), showUploadModal && /* @__PURE__ */ _react2.default.createElement(_react.Suspense, { fallback: /* @__PURE__ */ _react2.default.createElement(_ui.Spinner, null) }, /* @__PURE__ */ _react2.default.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__ */ _react2.default.createElement(_ui.Card, { border: true, padding: 3, shadow: 1, radius: 2, marginTop: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 4 }, /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Regenerate Subfamilies"), /* @__PURE__ */ _react2.default.createElement(RegenerateSubfamiliesComponent, null)), /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Rename Fonts (name table, Full Name)"), /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(
1130
+ _ui.Switch,
2081
1131
  {
2082
1132
  checked: preserveShortenedNames,
2083
1133
  onChange: (e) => setPreserveShortenedNames(e.target.checked)
@@ -2085,44 +1135,35 @@ var BatchUploadFonts = () => {
2085
1135
  ), renderTooltipLabel(
2086
1136
  "Preserve shortened names",
2087
1137
  'Abbreviations in font names are kept as-is (e.g. "XNarrow" stays "XNarrow", "Bd" stays "Bd").'
2088
- )), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ import_react5.default.createElement(
2089
- import_ui4.Switch,
2090
- {
2091
- checked: preserveFileNames,
2092
- onChange: (e) => setPreserveFileNames(e.target.checked)
2093
- }
2094
- ), renderTooltipLabel(
2095
- "Preserve file names",
2096
- "Original filename capitalisation is used for asset naming instead of the normalised font title."
2097
- )))), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Box, { marginTop: 3 }, pendingFiles.length === 0 ? renderDropZone() : renderFileList())) : renderProcessing())));
1138
+ )), ready === "rename" ? renderProcessing() : /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", text: "Rename Existing Fonts", style: { width: "100%" }, onClick: handleRenameExistingFonts, disabled: ready !== true })), /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Update Font Prices"), ready === "price" ? renderProcessing() : /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(_chunkFH4QKHOHjs.PriceInput_default, { inputPrice, handleInputChange }), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", text: "Update All Font Prices", style: { width: "100%" }, onClick: handleChangeFontPrice, disabled: ready !== true }))), /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, weight: "semibold", style: { lineHeight: 1.6 } }, "Regenerate CSS"), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { 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__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", text: "Regenerate CSS Files", style: { width: "100%" }, onClick: handleRegenerateCssFiles, disabled: ready !== true }))))));
2098
1139
  };
2099
1140
 
2100
1141
  // src/components/GenerateCollectionsPairsComponent.jsx
2101
- var import_react6 = __toESM(require("react"));
2102
- var import_ui5 = require("@sanity/ui");
2103
- var import_sanity4 = require("sanity");
2104
- var import_slugify2 = __toESM(require("slugify"));
2105
- var import_nanoid6 = require("nanoid");
1142
+
1143
+
1144
+
1145
+ var _slugify = require('slugify'); var _slugify2 = _interopRequireDefault(_slugify);
1146
+
2106
1147
  var GenerateCollectionsPairsComponent = () => {
2107
- const [status, setStatus] = (0, import_react6.useState)("ready");
2108
- const [ready, setReady] = (0, import_react6.useState)(true);
2109
- const [collectionPrice, setCollectionPrice] = (0, import_react6.useState)(
1148
+ const [status, setStatus] = _react.useState.call(void 0, "ready");
1149
+ const [ready, setReady] = _react.useState.call(void 0, true);
1150
+ const [collectionPrice, setCollectionPrice] = _react.useState.call(void 0,
2110
1151
  process.env.SANITY_STUDIO_DEFAULT_COLLECTION_PRICE || 20
2111
1152
  );
2112
- const [pairPrice, setPairPrice] = (0, import_react6.useState)(
1153
+ const [pairPrice, setPairPrice] = _react.useState.call(void 0,
2113
1154
  process.env.SANITY_STUDIO_DEFAULT_PAIR_PRICE || 75
2114
1155
  );
2115
1156
  const client = useSanityClient();
2116
- const doc_id = (0, import_sanity4.useFormValue)(["_id"]);
2117
- const title = (0, import_sanity4.useFormValue)(["title"]);
2118
- const slug = (0, import_sanity4.useFormValue)(["slug"]);
2119
- const stylesObject = (0, import_sanity4.useFormValue)(["styles"]);
2120
- const createSanityCollection = (0, import_react6.useCallback)(async (fontsList, collectionSlug, newTitle) => {
1157
+ const doc_id = _sanity.useFormValue.call(void 0, ["_id"]);
1158
+ const title = _sanity.useFormValue.call(void 0, ["title"]);
1159
+ const slug = _sanity.useFormValue.call(void 0, ["slug"]);
1160
+ const stylesObject = _sanity.useFormValue.call(void 0, ["styles"]);
1161
+ const createSanityCollection = _react.useCallback.call(void 0, async (fontsList, collectionSlug, newTitle) => {
2121
1162
  const newSlug = collectionSlug.toLowerCase().trim();
2122
1163
  const fontRefs = fontsList.map((font) => ({
2123
- _key: (0, import_nanoid6.nanoid)(),
1164
+ _key: _nanoid.nanoid.call(void 0, ),
2124
1165
  _type: "reference",
2125
- _ref: font._id ?? font._ref,
1166
+ _ref: _nullishCoalesce(font._id, () => ( font._ref)),
2126
1167
  _weak: true
2127
1168
  }));
2128
1169
  let preferredStyle = { weight: fontsList[0].weight, style: fontsList[0].style, _ref: fontsList[0]._ref };
@@ -2136,7 +1177,7 @@ var GenerateCollectionsPairsComponent = () => {
2136
1177
  });
2137
1178
  const price = (collectionPrice ? Number(collectionPrice) : 0) * fontRefs.length;
2138
1179
  await client.createOrReplace({
2139
- _key: (0, import_nanoid6.nanoid)(),
1180
+ _key: _nanoid.nanoid.call(void 0, ),
2140
1181
  _id: newSlug,
2141
1182
  _type: "collection",
2142
1183
  state: "active",
@@ -2149,18 +1190,18 @@ var GenerateCollectionsPairsComponent = () => {
2149
1190
  }).catch((err) => {
2150
1191
  console.error("Error creating collection:", err.message);
2151
1192
  });
2152
- return { _ref: newSlug, _type: "reference", _weak: true, _key: (0, import_nanoid6.nanoid)() };
1193
+ return { _ref: newSlug, _type: "reference", _weak: true, _key: _nanoid.nanoid.call(void 0, ) };
2153
1194
  }, [collectionPrice, client]);
2154
- const createSanityPair = (0, import_react6.useCallback)(async (pair, pairSlug, newTitle) => {
1195
+ const createSanityPair = _react.useCallback.call(void 0, async (pair, pairSlug, newTitle) => {
2155
1196
  const newSlug = pairSlug.toLowerCase().trim();
2156
1197
  const fontRefs = pair.map((font) => ({
2157
- _key: (0, import_nanoid6.nanoid)(),
1198
+ _key: _nanoid.nanoid.call(void 0, ),
2158
1199
  _type: "reference",
2159
1200
  _ref: font._id,
2160
1201
  _weak: true
2161
1202
  }));
2162
1203
  await client.createOrReplace({
2163
- _key: (0, import_nanoid6.nanoid)(),
1204
+ _key: _nanoid.nanoid.call(void 0, ),
2164
1205
  _id: newSlug,
2165
1206
  _type: "pair",
2166
1207
  preferredStyle: { _type: "reference", _ref: fontRefs[0]._ref, _weak: true },
@@ -2171,9 +1212,9 @@ var GenerateCollectionsPairsComponent = () => {
2171
1212
  }).catch((err) => {
2172
1213
  console.error("Error creating pair:", err.message);
2173
1214
  });
2174
- return { _ref: newSlug, _type: "reference", _weak: true, _key: (0, import_nanoid6.nanoid)() };
1215
+ return { _ref: newSlug, _type: "reference", _weak: true, _key: _nanoid.nanoid.call(void 0, ) };
2175
1216
  }, [pairPrice, client]);
2176
- const handleGenerateCollections = (0, import_react6.useCallback)(async () => {
1217
+ const handleGenerateCollections = _react.useCallback.call(void 0, async () => {
2177
1218
  setStatus("Generating collections...");
2178
1219
  setReady(false);
2179
1220
  try {
@@ -2181,8 +1222,8 @@ var GenerateCollectionsPairsComponent = () => {
2181
1222
  `*[_type == "typeface" && _id == $id]{ "fonts": styles.fonts[] -> }[0]`,
2182
1223
  { id: doc_id }
2183
1224
  );
2184
- const sanityFonts = (result == null ? void 0 : result.fonts) ?? [];
2185
- const subfamilies = (stylesObject == null ? void 0 : stylesObject.subfamilies) ?? [];
1225
+ const sanityFonts = _nullishCoalesce((result == null ? void 0 : result.fonts), () => ( []));
1226
+ const subfamilies = _nullishCoalesce((stylesObject == null ? void 0 : stylesObject.subfamilies), () => ( []));
2186
1227
  const totalCollections = subfamilies.length + 3;
2187
1228
  const fullFamily = [], uprights = [], italics = [];
2188
1229
  for (const font of sanityFonts) {
@@ -2209,7 +1250,7 @@ var GenerateCollectionsPairsComponent = () => {
2209
1250
  setStatus(`[${i + 4}/${totalCollections}] Generating ${subfamilies[i].title} collection`);
2210
1251
  const ref = await createSanityCollection(
2211
1252
  subfamilies[i].fonts,
2212
- `${slug.current}-${(0, import_slugify2.default)(subfamilies[i].title)}-family`,
1253
+ `${slug.current}-${_slugify2.default.call(void 0, subfamilies[i].title)}-family`,
2213
1254
  `${title} ${subfamilies[i].title} Family`
2214
1255
  );
2215
1256
  if (ref) typefacePatch.push(ref);
@@ -2222,7 +1263,7 @@ var GenerateCollectionsPairsComponent = () => {
2222
1263
  }
2223
1264
  setReady(true);
2224
1265
  }, [doc_id, title, slug, stylesObject, collectionPrice, client, createSanityCollection]);
2225
- const handleGeneratePairs = (0, import_react6.useCallback)(async () => {
1266
+ const handleGeneratePairs = _react.useCallback.call(void 0, async () => {
2226
1267
  var _a;
2227
1268
  setStatus("Generating pairs...");
2228
1269
  setReady(false);
@@ -2231,7 +1272,7 @@ var GenerateCollectionsPairsComponent = () => {
2231
1272
  `*[_type == "typeface" && _id == $id]{ "fonts": styles.fonts[] -> }[0]`,
2232
1273
  { id: doc_id }
2233
1274
  );
2234
- const sanityFonts = (result == null ? void 0 : result.fonts) ?? [];
1275
+ const sanityFonts = _nullishCoalesce((result == null ? void 0 : result.fonts), () => ( []));
2235
1276
  const regular = [], italic = [];
2236
1277
  for (const font of sanityFonts) {
2237
1278
  if (font.style === "Regular") regular.push(font);
@@ -2251,21 +1292,21 @@ var GenerateCollectionsPairsComponent = () => {
2251
1292
  let pairSlug, pairTitle;
2252
1293
  if (reg.subfamily && reg.subfamily !== "") {
2253
1294
  if (reg.subfamily === "Regular") {
2254
- pairSlug = `${slug.current}-${(0, import_slugify2.default)(reg.weightName)}s`;
1295
+ pairSlug = `${slug.current}-${_slugify2.default.call(void 0, reg.weightName)}s`;
2255
1296
  pairTitle = `${title} ${reg.weightName}s`;
2256
1297
  } else {
2257
- pairSlug = `${slug.current}-${(0, import_slugify2.default)(reg.subfamily)}-${(0, import_slugify2.default)(reg.weightName)}s`;
1298
+ pairSlug = `${slug.current}-${_slugify2.default.call(void 0, reg.subfamily)}-${_slugify2.default.call(void 0, reg.weightName)}s`;
2258
1299
  pairTitle = `${title} ${reg.subfamily} ${reg.weightName}s`;
2259
1300
  }
2260
1301
  } else {
2261
- pairSlug = `${slug.current}-${(0, import_slugify2.default)(reg.weightName)}s`;
1302
+ pairSlug = `${slug.current}-${_slugify2.default.call(void 0, reg.weightName)}s`;
2262
1303
  pairTitle = `${title} ${reg.weightName}s`;
2263
1304
  }
2264
1305
  setStatus(`[${i + 1}/${pairs.length}] Generating ${pairTitle}`);
2265
1306
  const ref = await createSanityPair(pairs[i], pairSlug, pairTitle);
2266
1307
  if (ref) typefacePatch.push(ref);
2267
1308
  }
2268
- const preferredStyle = ((_a = regular[0]) == null ? void 0 : _a._id) ?? "";
1309
+ const preferredStyle = _nullishCoalesce(((_a = regular[0]) == null ? void 0 : _a._id), () => ( ""));
2269
1310
  await client.patch(doc_id).set({
2270
1311
  preferredStyle: { _ref: preferredStyle, _type: "reference", _weak: true },
2271
1312
  styles: { ...stylesObject, pairs: typefacePatch }
@@ -2278,7 +1319,7 @@ var GenerateCollectionsPairsComponent = () => {
2278
1319
  setReady(true);
2279
1320
  }, [doc_id, title, slug, stylesObject, pairPrice, client, createSanityPair]);
2280
1321
  if (!title || !slug) return null;
2281
- return /* @__PURE__ */ import_react6.default.createElement(import_ui5.Stack, { space: 2 }, /* @__PURE__ */ import_react6.default.createElement(StatusDisplay_default, { status, error: false }), /* @__PURE__ */ import_react6.default.createElement(import_ui5.Card, { border: true, padding: 2, shadow: 1, radius: 2 }, ready ? /* @__PURE__ */ import_react6.default.createElement(import_ui5.Stack, { space: 3 }, /* @__PURE__ */ import_react6.default.createElement(import_ui5.Grid, { columns: [2], gap: 4, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ import_react6.default.createElement(import_ui5.Stack, { space: 2 }, /* @__PURE__ */ import_react6.default.createElement(import_ui5.Text, { size: 1, muted: true }, "Collection price / font"), /* @__PURE__ */ import_react6.default.createElement(import_ui5.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ import_react6.default.createElement(import_ui5.Text, { size: 1, muted: true }, "$"), /* @__PURE__ */ import_react6.default.createElement(
1322
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(StatusDisplay_default, { status, error: false }), /* @__PURE__ */ _react2.default.createElement(_ui.Card, { border: true, padding: 2, shadow: 1, radius: 2 }, ready ? /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Grid, { columns: [2], gap: 4, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "Collection price / font"), /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "$"), /* @__PURE__ */ _react2.default.createElement(
2282
1323
  "input",
2283
1324
  {
2284
1325
  value: collectionPrice,
@@ -2286,7 +1327,7 @@ var GenerateCollectionsPairsComponent = () => {
2286
1327
  type: "number",
2287
1328
  style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
2288
1329
  }
2289
- ))), /* @__PURE__ */ import_react6.default.createElement(import_ui5.Stack, { space: 2 }, /* @__PURE__ */ import_react6.default.createElement(import_ui5.Text, { size: 1, muted: true }, "Pair price"), /* @__PURE__ */ import_react6.default.createElement(import_ui5.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ import_react6.default.createElement(import_ui5.Text, { size: 1, muted: true }, "$"), /* @__PURE__ */ import_react6.default.createElement(
1330
+ ))), /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "Pair price"), /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "$"), /* @__PURE__ */ _react2.default.createElement(
2290
1331
  "input",
2291
1332
  {
2292
1333
  value: pairPrice,
@@ -2294,27 +1335,27 @@ var GenerateCollectionsPairsComponent = () => {
2294
1335
  type: "number",
2295
1336
  style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
2296
1337
  }
2297
- )))), /* @__PURE__ */ import_react6.default.createElement(import_ui5.Button, { mode: "ghost", tone: "primary", text: "Generate Collections", style: { width: "100%" }, onClick: handleGenerateCollections }), /* @__PURE__ */ import_react6.default.createElement(import_ui5.Button, { mode: "ghost", tone: "primary", text: "Generate Pairs", style: { width: "100%" }, onClick: handleGeneratePairs })) : /* @__PURE__ */ import_react6.default.createElement(import_ui5.Flex, { align: "center", justify: "center", gap: 3, padding: 4 }, /* @__PURE__ */ import_react6.default.createElement(import_ui5.Spinner, null), /* @__PURE__ */ import_react6.default.createElement(import_ui5.Text, { muted: true, size: 1 }, status))));
1338
+ )))), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", text: "Generate Collections", style: { width: "100%" }, onClick: handleGenerateCollections }), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", text: "Generate Pairs", style: { width: "100%" }, onClick: handleGeneratePairs })) : /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", justify: "center", gap: 3, padding: 4 }, /* @__PURE__ */ _react2.default.createElement(_ui.Spinner, null), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { muted: true, size: 1 }, status))));
2298
1339
  };
2299
1340
 
2300
1341
  // src/components/UpdateScriptsComponent.jsx
2301
- var import_react7 = __toESM(require("react"));
2302
- var import_ui6 = require("@sanity/ui");
2303
- var import_sanity5 = require("sanity");
1342
+
1343
+
1344
+
2304
1345
  var UpdateScriptsComponent = (props) => {
2305
1346
  const { onChange } = props;
2306
1347
  const client = useSanityClient();
2307
- const scripts = (0, import_sanity5.useFormValue)(["scripts"]) || [];
2308
- const fonts = (0, import_sanity5.useFormValue)(["styles", "fonts"]);
2309
- const isReadyRef = (0, import_react7.useRef)(false);
2310
- const [message, setMessage] = (0, import_react7.useState)("");
2311
- (0, import_react7.useEffect)(() => {
1348
+ const scripts = _sanity.useFormValue.call(void 0, ["scripts"]) || [];
1349
+ const fonts = _sanity.useFormValue.call(void 0, ["styles", "fonts"]);
1350
+ const isReadyRef = _react.useRef.call(void 0, false);
1351
+ const [message, setMessage] = _react.useState.call(void 0, "");
1352
+ _react.useEffect.call(void 0, () => {
2312
1353
  const timer = setTimeout(() => {
2313
1354
  isReadyRef.current = true;
2314
1355
  }, 100);
2315
1356
  return () => clearTimeout(timer);
2316
1357
  }, []);
2317
- const updateFromFonts = (0, import_react7.useCallback)(async () => {
1358
+ const updateFromFonts = _react.useCallback.call(void 0, async () => {
2318
1359
  if (!fonts || fonts.length === 0) {
2319
1360
  setMessage("No fonts found to extract scripts from");
2320
1361
  return;
@@ -2338,11 +1379,11 @@ var UpdateScriptsComponent = (props) => {
2338
1379
  }
2339
1380
  return acc;
2340
1381
  }, []);
2341
- if (isReadyRef.current) onChange((0, import_sanity5.set)(newScripts));
1382
+ if (isReadyRef.current) onChange(_sanity.set.call(void 0, newScripts));
2342
1383
  setMessage("Scripts updated");
2343
1384
  }, [onChange, fonts, client]);
2344
- return /* @__PURE__ */ import_react7.default.createElement(import_ui6.Stack, { space: 3 }, /* @__PURE__ */ import_react7.default.createElement(
2345
- import_ui6.Button,
1385
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, /* @__PURE__ */ _react2.default.createElement(
1386
+ _ui.Button,
2346
1387
  {
2347
1388
  mode: "ghost",
2348
1389
  tone: "primary",
@@ -2350,16 +1391,14 @@ var UpdateScriptsComponent = (props) => {
2350
1391
  text: "Update Scripts from Font Files",
2351
1392
  onClick: updateFromFonts
2352
1393
  }
2353
- ), message && /* @__PURE__ */ import_react7.default.createElement(import_ui6.Text, { size: 1, style: { color: "green" } }, message), props.renderDefault(props));
1394
+ ), message && /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, style: { color: "green" } }, message), props.renderDefault(props));
2354
1395
  };
2355
1396
 
2356
1397
  // src/components/SingleUploaderTool.jsx
2357
- var import_react8 = __toESM(require("react"));
2358
- var import_ui7 = require("@sanity/ui");
2359
- var import_icons2 = require("@sanity/icons");
2360
- var import_sanity6 = require("sanity");
2361
- var import_buffer3 = require("buffer");
2362
- var fontkit5 = __toESM(require("fontkit"));
1398
+
1399
+
1400
+
1401
+
2363
1402
 
2364
1403
  // src/utils/generateFontFile.js
2365
1404
  async function generateFontFile({
@@ -2434,28 +1473,28 @@ var SingleUploaderTool = (props) => {
2434
1473
  var _a, _b, _c, _d;
2435
1474
  const client = useSanityClient();
2436
1475
  const { elementProps: { ref }, onChange } = props;
2437
- const [message, setMessage] = (0, import_react8.useState)("");
2438
- const [status, setStatus] = (0, import_react8.useState)("ready");
2439
- const [error, setError] = (0, import_react8.useState)(false);
2440
- const [filenames, setFilenames] = (0, import_react8.useState)({});
2441
- const [showAdvanced, setShowAdvanced] = (0, import_react8.useState)(false);
2442
- const fileInput = (0, import_sanity6.useFormValue)(["fileInput"]);
2443
- const doc_id = (0, import_sanity6.useFormValue)(["_id"]);
2444
- const doc_title = (0, import_sanity6.useFormValue)(["title"]);
2445
- const doc_typefaceName = (0, import_sanity6.useFormValue)(["typefaceName"]);
2446
- const doc_variableFont = (0, import_sanity6.useFormValue)(["variableFont"]);
2447
- const doc_weight = (0, import_sanity6.useFormValue)(["weight"]);
2448
- const doc_style = (0, import_sanity6.useFormValue)(["style"]);
2449
- const doc_slug = (0, import_sanity6.useFormValue)(["slug"]);
2450
- const doc_metaData = (0, import_sanity6.useFormValue)(["metaData"]);
2451
- const { weightKeywordList, italicKeywordList } = (0, import_react8.useMemo)(() => generateStyleKeywords(), []);
2452
- (0, import_react8.useEffect)(() => {
1476
+ const [message, setMessage] = _react.useState.call(void 0, "");
1477
+ const [status, setStatus] = _react.useState.call(void 0, "ready");
1478
+ const [error, setError] = _react.useState.call(void 0, false);
1479
+ const [filenames, setFilenames] = _react.useState.call(void 0, {});
1480
+ const [showAdvanced, setShowAdvanced] = _react.useState.call(void 0, false);
1481
+ const fileInput = _sanity.useFormValue.call(void 0, ["fileInput"]);
1482
+ const doc_id = _sanity.useFormValue.call(void 0, ["_id"]);
1483
+ const doc_title = _sanity.useFormValue.call(void 0, ["title"]);
1484
+ const doc_typefaceName = _sanity.useFormValue.call(void 0, ["typefaceName"]);
1485
+ const doc_variableFont = _sanity.useFormValue.call(void 0, ["variableFont"]);
1486
+ const doc_weight = _sanity.useFormValue.call(void 0, ["weight"]);
1487
+ const doc_style = _sanity.useFormValue.call(void 0, ["style"]);
1488
+ const doc_slug = _sanity.useFormValue.call(void 0, ["slug"]);
1489
+ const doc_metaData = _sanity.useFormValue.call(void 0, ["metaData"]);
1490
+ const { weightKeywordList, italicKeywordList } = _react.useMemo.call(void 0, () => _chunkFH4QKHOHjs.generateStyleKeywords.call(void 0, ), []);
1491
+ _react.useEffect.call(void 0, () => {
2453
1492
  handleSetFilenames();
2454
1493
  }, [fileInput]);
2455
- const handleSetFilenames = (0, import_react8.useCallback)(async () => {
1494
+ const handleSetFilenames = _react.useCallback.call(void 0, async () => {
2456
1495
  var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
2457
- const woff2WebRef = ((_b2 = (_a2 = fileInput == null ? void 0 : fileInput.woff2_web) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref) ?? null;
2458
- const woff2SubsetRef = ((_d2 = (_c2 = fileInput == null ? void 0 : fileInput.woff2_subset) == null ? void 0 : _c2.asset) == null ? void 0 : _d2._ref) ?? null;
1496
+ const woff2WebRef = _nullishCoalesce(((_b2 = (_a2 = fileInput == null ? void 0 : fileInput.woff2_web) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref), () => ( null));
1497
+ const woff2SubsetRef = _nullishCoalesce(((_d2 = (_c2 = fileInput == null ? void 0 : fileInput.woff2_subset) == null ? void 0 : _c2.asset) == null ? void 0 : _d2._ref), () => ( null));
2459
1498
  const assetIds = [
2460
1499
  (_f = (_e = fileInput == null ? void 0 : fileInput.ttf) == null ? void 0 : _e.asset) == null ? void 0 : _f._ref,
2461
1500
  (_h = (_g = fileInput == null ? void 0 : fileInput.otf) == null ? void 0 : _g.asset) == null ? void 0 : _h._ref,
@@ -2489,7 +1528,7 @@ var SingleUploaderTool = (props) => {
2489
1528
  }, {});
2490
1529
  setFilenames(fontNames);
2491
1530
  }, [fileInput, client]);
2492
- const handleGenerateCssFile = (0, import_react8.useCallback)(async () => {
1531
+ const handleGenerateCssFile = _react.useCallback.call(void 0, async () => {
2493
1532
  var _a2, _b2;
2494
1533
  setMessage("Building CSS: " + doc_title + ".css");
2495
1534
  setStatus("Building CSS file");
@@ -2502,7 +1541,7 @@ var SingleUploaderTool = (props) => {
2502
1541
  { id: woff2AssetRef }
2503
1542
  );
2504
1543
  const blob = await (await fetch(woff2Asset.url)).blob();
2505
- const newFileInput = await generateCssFile({
1544
+ const newFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
2506
1545
  woff2File: blob,
2507
1546
  fileInput,
2508
1547
  fontName: doc_title,
@@ -2517,7 +1556,7 @@ var SingleUploaderTool = (props) => {
2517
1556
  setMessage("");
2518
1557
  setStatus("ready");
2519
1558
  }, 2e3);
2520
- onChange((0, import_sanity6.set)(newFileInput));
1559
+ onChange(_sanity.set.call(void 0, newFileInput));
2521
1560
  } catch (err) {
2522
1561
  console.error("Error building CSS file:", err);
2523
1562
  setMessage("Error building CSS file: " + err.message);
@@ -2530,7 +1569,7 @@ var SingleUploaderTool = (props) => {
2530
1569
  }, 3e3);
2531
1570
  }
2532
1571
  }, [fileInput, onChange, doc_title, doc_variableFont, doc_weight, client]);
2533
- const handleGenerateFontFile = (0, import_react8.useCallback)(async (code, sourceFile) => {
1572
+ const handleGenerateFontFile = _react.useCallback.call(void 0, async (code, sourceFile) => {
2534
1573
  var _a2;
2535
1574
  const isMissing = Array.isArray(code);
2536
1575
  const label = code === "all" ? "all font files" : isMissing ? "missing files" : code + " file";
@@ -2570,7 +1609,7 @@ var SingleUploaderTool = (props) => {
2570
1609
  }, 3e3);
2571
1610
  }
2572
1611
  }, [doc_id, doc_title, doc_variableFont, doc_style, doc_weight, doc_slug, fileInput, client]);
2573
- const handleGenerateFontData = (0, import_react8.useCallback)(async () => {
1612
+ const handleGenerateFontData = _react.useCallback.call(void 0, async () => {
2574
1613
  var _a2, _b2;
2575
1614
  setMessage("Building font data...");
2576
1615
  setStatus("Building font data");
@@ -2593,16 +1632,16 @@ var SingleUploaderTool = (props) => {
2593
1632
  );
2594
1633
  if (!(ttfAsset == null ? void 0 : ttfAsset.url)) throw new Error("Could not fetch TTF file URL");
2595
1634
  const arrayBuffer = await (await fetch(ttfAsset.url)).arrayBuffer();
2596
- const font = fontkit5.create(import_buffer3.Buffer.from(arrayBuffer));
2597
- const { weightName, subfamilyName, style, variableFont } = extractFontMetadata(
1635
+ const font = await _chunkFH4QKHOHjs.parseFont.call(void 0, arrayBuffer, `${doc_id}.ttf`);
1636
+ const { weightName, subfamilyName, style, variableFont } = _chunkFH4QKHOHjs.extractFontMetadata.call(void 0,
2598
1637
  font,
2599
1638
  doc_typefaceName,
2600
1639
  weightKeywordList,
2601
1640
  italicKeywordList
2602
1641
  );
2603
- const weight = determineWeight(font, weightName);
1642
+ const weight = _chunkFH4QKHOHjs.determineWeight.call(void 0, font, weightName);
2604
1643
  await client.patch(doc_id).set({ weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
2605
- const fontData = await generateFontData({
1644
+ const fontData = await _chunkFH4QKHOHjs.generateFontData.call(void 0, {
2606
1645
  url: ttfAsset.url,
2607
1646
  fontKit: font,
2608
1647
  fontId: doc_id,
@@ -2616,7 +1655,7 @@ var SingleUploaderTool = (props) => {
2616
1655
  variableFont,
2617
1656
  variableInstances: fontData.variableInstances
2618
1657
  };
2619
- const instanceMappings = await parseVariableFontInstances(fontObj, client);
1658
+ const instanceMappings = await _chunkFH4QKHOHjs.parseVariableFontInstances.call(void 0, fontObj, client);
2620
1659
  if (instanceMappings.length > 0) {
2621
1660
  await client.patch(doc_id).set({ variableInstanceReferences: instanceMappings }).commit();
2622
1661
  }
@@ -2639,7 +1678,7 @@ var SingleUploaderTool = (props) => {
2639
1678
  }, 3e3);
2640
1679
  }
2641
1680
  }, [fileInput, doc_id, doc_typefaceName, client, weightKeywordList, italicKeywordList]);
2642
- const handleGenerateSubsetAndWeb = (0, import_react8.useCallback)(async () => {
1681
+ const handleGenerateSubsetAndWeb = _react.useCallback.call(void 0, async () => {
2643
1682
  var _a2, _b2;
2644
1683
  try {
2645
1684
  const woff2AssetRef = (_b2 = (_a2 = fileInput == null ? void 0 : fileInput.woff2) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref;
@@ -2678,7 +1717,7 @@ var SingleUploaderTool = (props) => {
2678
1717
  }, 3e3);
2679
1718
  }
2680
1719
  }, [fileInput, doc_id, doc_title, doc_variableFont, doc_style, doc_weight, doc_slug, client]);
2681
- const handleUploadTopLevelFile = (0, import_react8.useCallback)(async (event, fieldName) => {
1720
+ const handleUploadTopLevelFile = _react.useCallback.call(void 0, async (event, fieldName) => {
2682
1721
  try {
2683
1722
  const file = event.target.files[0];
2684
1723
  if (!file) return;
@@ -2692,7 +1731,7 @@ var SingleUploaderTool = (props) => {
2692
1731
  ...fileInput,
2693
1732
  [fieldName]: { _type: "file", asset: { _ref: asset._id, _type: "reference" } }
2694
1733
  };
2695
- onChange((0, import_sanity6.set)(newFileInput));
1734
+ onChange(_sanity.set.call(void 0, newFileInput));
2696
1735
  setMessage(`${fieldName} uploaded`);
2697
1736
  setStatus(`${fieldName} uploaded successfully`);
2698
1737
  setTimeout(() => {
@@ -2711,7 +1750,7 @@ var SingleUploaderTool = (props) => {
2711
1750
  }, 3e3);
2712
1751
  }
2713
1752
  }, [fileInput, onChange, doc_slug, client]);
2714
- const handleUpload = (0, import_react8.useCallback)(async (event, code) => {
1753
+ const handleUpload = _react.useCallback.call(void 0, async (event, code) => {
2715
1754
  try {
2716
1755
  const file = event.target.files[0];
2717
1756
  if (!file) {
@@ -2735,7 +1774,7 @@ var SingleUploaderTool = (props) => {
2735
1774
  if (code === "woff2") {
2736
1775
  setMessage("Building CSS: " + doc_title + ".css");
2737
1776
  setStatus("Building CSS file");
2738
- newFileInput = await generateCssFile({
1777
+ newFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
2739
1778
  woff2File: file,
2740
1779
  fileInput: newFileInput,
2741
1780
  fontName: doc_title,
@@ -2749,19 +1788,19 @@ var SingleUploaderTool = (props) => {
2749
1788
  setStatus("CSS file built successfully");
2750
1789
  }
2751
1790
  if (code === "ttf") {
2752
- const fontBuffer = await readFontFile(file);
2753
- const font = fontkit5.create(fontBuffer);
2754
- const { weightName, subfamilyName, style, variableFont } = extractFontMetadata(
1791
+ const fontBuffer = await _chunkFH4QKHOHjs.readFontFile.call(void 0, file);
1792
+ const font = await _chunkFH4QKHOHjs.parseFont.call(void 0, fontBuffer, file.name);
1793
+ const { weightName, subfamilyName, style, variableFont } = _chunkFH4QKHOHjs.extractFontMetadata.call(void 0,
2755
1794
  font,
2756
1795
  doc_typefaceName,
2757
1796
  weightKeywordList,
2758
1797
  italicKeywordList
2759
1798
  );
2760
- const weight = determineWeight(font, weightName);
1799
+ const weight = _chunkFH4QKHOHjs.determineWeight.call(void 0, font, weightName);
2761
1800
  const normalizedId = doc_id.startsWith("drafts.") ? doc_id.replace("drafts.", "") : doc_id;
2762
1801
  await client.patch(normalizedId).set({ weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
2763
1802
  }
2764
- onChange((0, import_sanity6.set)(newFileInput));
1803
+ onChange(_sanity.set.call(void 0, newFileInput));
2765
1804
  setTimeout(() => {
2766
1805
  setMessage("");
2767
1806
  setStatus("ready");
@@ -2778,7 +1817,7 @@ var SingleUploaderTool = (props) => {
2778
1817
  }, 3e3);
2779
1818
  }
2780
1819
  }, [fileInput, onChange, doc_title, doc_typefaceName, doc_variableFont, doc_weight, doc_slug, doc_id, client, weightKeywordList, italicKeywordList]);
2781
- const handleDelete = (0, import_react8.useCallback)(async (code) => {
1820
+ const handleDelete = _react.useCallback.call(void 0, async (code) => {
2782
1821
  var _a2, _b2;
2783
1822
  try {
2784
1823
  setMessage(`Deleting ${code} file...`);
@@ -2791,7 +1830,7 @@ var SingleUploaderTool = (props) => {
2791
1830
  setError(true);
2792
1831
  return;
2793
1832
  }
2794
- onChange((0, import_sanity6.unset)([code]));
1833
+ onChange(_sanity.unset.call(void 0, [code]));
2795
1834
  await client.delete(asset);
2796
1835
  setMessage(`${code} file deleted`);
2797
1836
  setStatus(`${code} file deleted successfully`);
@@ -2811,7 +1850,7 @@ var SingleUploaderTool = (props) => {
2811
1850
  }, 3e3);
2812
1851
  }
2813
1852
  }, [fileInput, onChange, client]);
2814
- const handleDeleteTopLevel = (0, import_react8.useCallback)(async (fieldName) => {
1853
+ const handleDeleteTopLevel = _react.useCallback.call(void 0, async (fieldName) => {
2815
1854
  var _a2, _b2;
2816
1855
  try {
2817
1856
  setMessage(`Deleting ${fieldName}...`);
@@ -2824,7 +1863,7 @@ var SingleUploaderTool = (props) => {
2824
1863
  setError(true);
2825
1864
  return;
2826
1865
  }
2827
- onChange((0, import_sanity6.unset)([fieldName]));
1866
+ onChange(_sanity.unset.call(void 0, [fieldName]));
2828
1867
  await client.delete(asset);
2829
1868
  setMessage(`${fieldName} deleted`);
2830
1869
  setStatus(`${fieldName} deleted successfully`);
@@ -2844,12 +1883,12 @@ var SingleUploaderTool = (props) => {
2844
1883
  }, 3e3);
2845
1884
  }
2846
1885
  }, [fileInput, onChange, client]);
2847
- const handleDeleteAll = (0, import_react8.useCallback)(async () => {
1886
+ const handleDeleteAll = _react.useCallback.call(void 0, async () => {
2848
1887
  try {
2849
1888
  setMessage("Deleting all files and metadata...");
2850
1889
  setStatus("Deleting all files and metadata");
2851
1890
  setError(false);
2852
- onChange((0, import_sanity6.unset)([]));
1891
+ onChange(_sanity.unset.call(void 0, []));
2853
1892
  await client.patch(doc_id).set({
2854
1893
  characterSet: { chars: [] },
2855
1894
  glyphCount: 0,
@@ -2898,30 +1937,30 @@ var SingleUploaderTool = (props) => {
2898
1937
  const formatUpper = format.toUpperCase();
2899
1938
  const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput[format]) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
2900
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;
2901
- return /* @__PURE__ */ import_react8.default.createElement(import_ui7.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Text, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, formatUpper), hasFile ? /* @__PURE__ */ import_react8.default.createElement(import_ui7.Box, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ import_react8.default.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames[format]) || "File")) : /* @__PURE__ */ import_react8.default.createElement(import_ui7.Text, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ import_react8.default.createElement(import_ui7.Flex, { gap: 1, align: "center", style: { flexShrink: 0 } }, buildSource && (fileInput == null ? void 0 : fileInput[buildSource]) && /* @__PURE__ */ import_react8.default.createElement(import_ui7.Button, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontFile(format, fileInput[buildSource]), text: "Build" }), /* @__PURE__ */ import_react8.default.createElement(import_ui7.Button, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Text, { size: 1 }, "Upload"), /* @__PURE__ */ import_react8.default.createElement("input", { ref, type: "file", hidden: true, onChange: (e) => handleUpload(e, format) })), hasFile && /* @__PURE__ */ import_react8.default.createElement(import_ui7.Button, { mode: "bleed", tone: "critical", icon: import_icons2.TrashIcon, padding: 2, onClick: () => handleDelete(format) }))));
1940
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, formatUpper), hasFile ? /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ _react2.default.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames[format]) || "File")) : /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1, align: "center", style: { flexShrink: 0 } }, buildSource && (fileInput == null ? void 0 : fileInput[buildSource]) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontFile(format, fileInput[buildSource]), text: "Build" }), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1 }, "Upload"), /* @__PURE__ */ _react2.default.createElement("input", { ref, type: "file", hidden: true, onChange: (e) => handleUpload(e, format) })), hasFile && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "bleed", tone: "critical", icon: _icons.TrashIcon, padding: 2, onClick: () => handleDelete(format) }))));
2902
1941
  };
2903
1942
  const renderTopLevelAssetSection = (label, fieldName, assetRef, filename, onBuild) => {
2904
1943
  const hasFile = !!assetRef;
2905
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;
2906
- return /* @__PURE__ */ import_react8.default.createElement(import_ui7.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Text, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, label), hasFile ? /* @__PURE__ */ import_react8.default.createElement(import_ui7.Box, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ import_react8.default.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, filename || "File")) : /* @__PURE__ */ import_react8.default.createElement(import_ui7.Text, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ import_react8.default.createElement(import_ui7.Flex, { gap: 1, align: "center", style: { flexShrink: 0 } }, onBuild && (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ import_react8.default.createElement(import_ui7.Button, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: onBuild, text: "Build" }), /* @__PURE__ */ import_react8.default.createElement(import_ui7.Button, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Text, { size: 1 }, "Upload"), /* @__PURE__ */ import_react8.default.createElement("input", { type: "file", hidden: true, onChange: (e) => handleUploadTopLevelFile(e, fieldName) })), hasFile && /* @__PURE__ */ import_react8.default.createElement(import_ui7.Button, { mode: "bleed", tone: "critical", icon: import_icons2.TrashIcon, padding: 2, onClick: () => handleDeleteTopLevel(fieldName) }))));
1945
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, label), hasFile ? /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ _react2.default.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, filename || "File")) : /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1, align: "center", style: { flexShrink: 0 } }, onBuild && (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: onBuild, text: "Build" }), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { as: "label", mode: "ghost", tone: "primary", fontSize: 1, padding: 2, style: { cursor: "pointer" } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1 }, "Upload"), /* @__PURE__ */ _react2.default.createElement("input", { type: "file", hidden: true, onChange: (e) => handleUploadTopLevelFile(e, fieldName) })), hasFile && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "bleed", tone: "critical", icon: _icons.TrashIcon, padding: 2, onClick: () => handleDeleteTopLevel(fieldName) }))));
2907
1946
  };
2908
1947
  const renderCssSection = () => {
2909
1948
  var _a2, _b2;
2910
1949
  const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput.css) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
2911
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;
2912
- return /* @__PURE__ */ import_react8.default.createElement(import_ui7.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Text, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, "CSS"), hasFile ? /* @__PURE__ */ import_react8.default.createElement(import_ui7.Box, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ import_react8.default.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames.css) || "File")) : /* @__PURE__ */ import_react8.default.createElement(import_ui7.Text, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ import_react8.default.createElement(import_ui7.Flex, { gap: 1, align: "center", style: { flexShrink: 0 } }, (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ import_react8.default.createElement(import_ui7.Button, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateCssFile(), text: "Build" }), hasFile && /* @__PURE__ */ import_react8.default.createElement(import_ui7.Button, { mode: "bleed", tone: "critical", icon: import_icons2.TrashIcon, padding: 2, onClick: () => handleDelete("css") }))));
1951
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 0, style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0, opacity: hasFile ? 1 : 0.5 } }, "CSS"), hasFile ? /* @__PURE__ */ _react2.default.createElement(_ui.Box, { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, /* @__PURE__ */ _react2.default.createElement("a", { href: fileUrl, target: "_blank", rel: "noreferrer" }, (filenames == null ? void 0 : filenames.css) || "File")) : /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "\u2014")), status === "ready" && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1, align: "center", style: { flexShrink: 0 } }, (fileInput == null ? void 0 : fileInput.woff2) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateCssFile(), text: "Build" }), hasFile && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "bleed", tone: "critical", icon: _icons.TrashIcon, padding: 2, onClick: () => handleDelete("css") }))));
2913
1952
  };
2914
- const renderDataSection = () => /* @__PURE__ */ import_react8.default.createElement(import_ui7.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Text, { 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__ */ import_react8.default.createElement(import_ui7.Text, { size: 1 }, "v", doc_metaData.version, " ", /* @__PURE__ */ import_react8.default.createElement(import_ui7.Text, { as: "span", size: 1, muted: true }, "(", doc_metaData.genDate, ")")) : /* @__PURE__ */ import_react8.default.createElement(import_ui7.Text, { size: 1, muted: true }, "\u2014")), status === "ready" && (fileInput == null ? void 0 : fileInput.ttf) && /* @__PURE__ */ import_react8.default.createElement(import_ui7.Flex, { gap: 1, align: "center", style: { flexShrink: 0 } }, /* @__PURE__ */ import_react8.default.createElement(import_ui7.Button, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontData(), text: "Build" }))));
2915
- return /* @__PURE__ */ import_react8.default.createElement(import_ui7.Stack, { space: 2 }, /* @__PURE__ */ import_react8.default.createElement(
1953
+ const renderDataSection = () => /* @__PURE__ */ _react2.default.createElement(_ui.Card, { border: true, radius: 1, paddingX: 2, paddingY: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center", gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 3, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { 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__ */ _react2.default.createElement(_ui.Text, { size: 1 }, "v", doc_metaData.version, " ", /* @__PURE__ */ _react2.default.createElement(_ui.Text, { as: "span", size: 1, muted: true }, "(", doc_metaData.genDate, ")")) : /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "\u2014")), status === "ready" && (fileInput == null ? void 0 : fileInput.ttf) && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1, align: "center", style: { flexShrink: 0 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "primary", fontSize: 1, padding: 2, onClick: () => handleGenerateFontData(), text: "Build" }))));
1954
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(
2916
1955
  StatusDisplay_default,
2917
1956
  {
2918
1957
  status,
2919
1958
  error,
2920
- action: /* @__PURE__ */ import_react8.default.createElement(
2921
- import_ui7.Button,
1959
+ action: /* @__PURE__ */ _react2.default.createElement(
1960
+ _ui.Button,
2922
1961
  {
2923
1962
  mode: "bleed",
2924
- icon: import_icons2.ControlsIcon,
1963
+ icon: _icons.ControlsIcon,
2925
1964
  padding: 2,
2926
1965
  tone: showAdvanced ? "primary" : "default",
2927
1966
  title: "Show advanced file formats",
@@ -2929,8 +1968,8 @@ var SingleUploaderTool = (props) => {
2929
1968
  }
2930
1969
  )
2931
1970
  }
2932
- ), renderFontSection("ttf"), status === "ready" && (fileInput == null ? void 0 : fileInput.ttf) && /* @__PURE__ */ import_react8.default.createElement(import_ui7.Grid, { columns: [1, 2], gap: 2 }, /* @__PURE__ */ import_react8.default.createElement(
2933
- import_ui7.Button,
1971
+ ), renderFontSection("ttf"), status === "ready" && (fileInput == null ? void 0 : fileInput.ttf) && /* @__PURE__ */ _react2.default.createElement(_ui.Grid, { columns: [1, 2], gap: 2 }, /* @__PURE__ */ _react2.default.createElement(
1972
+ _ui.Button,
2934
1973
  {
2935
1974
  mode: "ghost",
2936
1975
  tone: "primary",
@@ -2938,8 +1977,8 @@ var SingleUploaderTool = (props) => {
2938
1977
  text: "Rebuild All from TTF",
2939
1978
  style: { width: "100%" }
2940
1979
  }
2941
- ), /* @__PURE__ */ import_react8.default.createElement(
2942
- import_ui7.Button,
1980
+ ), /* @__PURE__ */ _react2.default.createElement(
1981
+ _ui.Button,
2943
1982
  {
2944
1983
  mode: "ghost",
2945
1984
  tone: "primary",
@@ -2958,19 +1997,18 @@ var SingleUploaderTool = (props) => {
2958
1997
  text: "Build Missing",
2959
1998
  style: { width: "100%" }
2960
1999
  }
2961
- )), 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__ */ import_react8.default.createElement(import_ui7.Button, { 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__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "critical", onClick: () => handleDeleteAll(), text: "Delete All", style: { width: "100%" } }));
2962
2001
  };
2963
2002
 
2964
2003
  // src/components/UploadScriptsComponent.jsx
2965
- var import_react10 = __toESM(require("react"));
2966
- var import_ui8 = require("@sanity/ui");
2967
- var fontkit6 = __toESM(require("fontkit"));
2968
- var import_slugify3 = __toESM(require("slugify"));
2969
- var import_sanity7 = require("sanity");
2970
- var import_nanoid7 = require("nanoid");
2004
+
2005
+
2006
+
2007
+
2008
+
2971
2009
 
2972
2010
  // src/utils/utils.js
2973
- var import_react9 = __toESM(require("react"));
2011
+
2974
2012
  var HtmlDescription = ({ children }) => {
2975
2013
  return children || "";
2976
2014
  };
@@ -2987,17 +2025,17 @@ var DISCOUNT_REQUIREMENT_TYPES_OBJECT = DISCOUNT_REQUIREMENT_TYPES.map((type) =>
2987
2025
  var UploadScriptsComponent = (props) => {
2988
2026
  const { elementProps: { ref } } = props;
2989
2027
  const client = useSanityClient();
2990
- const [selectedScript, setSelectedScript] = (0, import_react10.useState)("");
2991
- const [status, setStatus] = import_react10.default.useState("");
2992
- const [ready, setReady] = import_react10.default.useState(true);
2993
- let doc_id = (0, import_sanity7.useFormValue)(["_id"]);
2994
- const title = (0, import_sanity7.useFormValue)(["title"]);
2995
- const slug = (0, import_sanity7.useFormValue)(["slug"]);
2996
- const scripts = (0, import_sanity7.useFormValue)(["scripts"]) || [];
2997
- const stylesObject = (0, import_sanity7.useFormValue)(["styles"]);
2028
+ const [selectedScript, setSelectedScript] = _react.useState.call(void 0, "");
2029
+ const [status, setStatus] = _react2.default.useState("");
2030
+ const [ready, setReady] = _react2.default.useState(true);
2031
+ let doc_id = _sanity.useFormValue.call(void 0, ["_id"]);
2032
+ const title = _sanity.useFormValue.call(void 0, ["title"]);
2033
+ const slug = _sanity.useFormValue.call(void 0, ["slug"]);
2034
+ const scripts = _sanity.useFormValue.call(void 0, ["scripts"]) || [];
2035
+ const stylesObject = _sanity.useFormValue.call(void 0, ["styles"]);
2998
2036
  let subfamiliesArray = (stylesObject == null ? void 0 : stylesObject.subfamilies) || [];
2999
- const { weightKeywordList, italicKeywordList } = (0, import_react10.useMemo)(
3000
- () => generateStyleKeywords(),
2037
+ const { weightKeywordList, italicKeywordList } = _react.useMemo.call(void 0,
2038
+ () => _chunkFH4QKHOHjs.generateStyleKeywords.call(void 0, ),
3001
2039
  []
3002
2040
  );
3003
2041
  const readFontFile3 = (file) => {
@@ -3012,8 +2050,7 @@ var UploadScriptsComponent = (props) => {
3012
2050
  reader.readAsArrayBuffer(file);
3013
2051
  });
3014
2052
  };
3015
- const handleUpload = (0, import_react10.useCallback)(async (event, script) => {
3016
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2053
+ const handleUpload = _react.useCallback.call(void 0, async (event, script) => {
3017
2054
  setReady(false);
3018
2055
  try {
3019
2056
  let failedFiles = [];
@@ -3030,21 +2067,22 @@ var UploadScriptsComponent = (props) => {
3030
2067
  for (var i = 0; i < event.target.files.length; i++) {
3031
2068
  const file = event.target.files[i];
3032
2069
  const fontBuffer = await readFontFile3(file);
3033
- const font = fontkit6.create(fontBuffer);
3034
- console.log("reading font : ", font.fullName + " " + file.name, font.name.records);
3035
- 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;
3036
- weightName = (weightName == null ? void 0 : weightName.en) ? weightName.en : weightName.constructor == Object ? weightName[Object.keys(weightName)[0]] : weightName;
3037
- weightName = weightName == null ? void 0 : weightName.replace("Italic", "").replace("It", "").trim();
3038
- if ((weightName == "" || weightName.toLowerCase() == "roman") && ((_h = (_g = font == null ? void 0 : font.name) == null ? void 0 : _g.records) == null ? void 0 : _h.fullName)) {
3039
- weightName = (_j = (_i = font == null ? void 0 : font.name) == null ? void 0 : _i.records) == null ? void 0 : _j.fullName;
3040
- weightName = (weightName == null ? void 0 : weightName.en) ? weightName.en : weightName.constructor == Object ? weightName[Object.keys(weightName)[0]] : weightName;
3041
- weightName = weightName == null ? void 0 : weightName.replace(title + " ", "").replace(title, "").trim();
3042
- weightName = weightName == null ? void 0 : weightName.replace("Italic", "").replace("It", "").trim();
2070
+ const font = await _chunkFH4QKHOHjs.parseFont.call(void 0, fontBuffer, file.name);
2071
+ const fullName = _chunkFH4QKHOHjs.getNameString.call(void 0, font, 4);
2072
+ const familyName = _chunkFH4QKHOHjs.getNameString.call(void 0, font, 1);
2073
+ console.log("Reading font:", fullName, file.name);
2074
+ let weightName = _chunkFH4QKHOHjs.getNameString.call(void 0, font, 17) || _chunkFH4QKHOHjs.getNameString.call(void 0, 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();
3043
2079
  }
3044
- let variableFont = (font == null ? void 0 : font.variationAxes) && Object.keys(font.variationAxes).length > 0 ? true : false;
3045
- let subfamilyName = font.familyName.toLowerCase().trim().replace(title.toLowerCase().trim(), "").trim();
3046
- let fontTitle = font == null ? void 0 : font.fullName;
3047
- let style = (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular";
2080
+ const axes = _chunkFH4QKHOHjs.getVariationAxes.call(void 0, font);
2081
+ let variableFont = axes !== null;
2082
+ let subfamilyName = familyName.toLowerCase().trim().replace(title.toLowerCase().trim(), "").trim();
2083
+ let fontTitle = fullName;
2084
+ const italicAngle = _chunkFH4QKHOHjs.getItalicAngle.call(void 0, font);
2085
+ let style = italicAngle !== 0 || fullName.toLowerCase().includes("italic") ? "Italic" : "Regular";
3048
2086
  if (fontTitle.toLowerCase().trim().includes(script)) {
3049
2087
  fontTitle = fontTitle.toLowerCase().trim().replace(script, "").trim();
3050
2088
  fontTitle = fontTitle.split(" ").map((word) => {
@@ -3079,17 +2117,17 @@ var UploadScriptsComponent = (props) => {
3079
2117
  }
3080
2118
  if (variableFont && !fontTitle.toLowerCase().trim().endsWith(" vf")) fontTitle = fontTitle + " VF";
3081
2119
  if (italicKW.length > 0) {
3082
- italicKW = italicKW.map((item) => reverseSpellingLookup(item));
2120
+ italicKW = italicKW.map((item) => _chunkFH4QKHOHjs.reverseSpellingLookup.call(void 0, item));
3083
2121
  fontTitle = fontTitle + italicKW.join(" ");
3084
2122
  style = "Italic";
3085
2123
  }
3086
- let id = (0, import_slugify3.default)(fontTitle.toLowerCase().trim());
2124
+ let id = _slugify2.default.call(void 0, fontTitle.toLowerCase().trim());
3087
2125
  console.log("=== Font Info ====");
3088
2126
  console.log(" ");
3089
2127
  console.log("font id : ", id);
3090
2128
  console.log("font title : ", fontTitle);
3091
- console.log("fontkit fullName : ", font.fullName);
3092
- console.log("fontkit family name: ", font.familyName);
2129
+ console.log("Full name:", fullName);
2130
+ console.log("Family name:", familyName);
3093
2131
  console.log("file name : ", file.name);
3094
2132
  console.log("subfamily : ", subfamilyName);
3095
2133
  console.log("style : ", style);
@@ -3103,18 +2141,17 @@ var UploadScriptsComponent = (props) => {
3103
2141
  fontsObjects[id].files = [...fontsObjects[id].files, file];
3104
2142
  } else {
3105
2143
  let fontObject = {
3106
- _key: (0, import_nanoid7.nanoid)(),
2144
+ _key: _nanoid.nanoid.call(void 0, ),
3107
2145
  _id: id,
3108
2146
  title: fontTitle,
3109
2147
  slug: { _type: "slug", current: id },
3110
2148
  typefaceName: title,
3111
2149
  // Change to match Typeface Document
3112
- style: (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular",
2150
+ style,
3113
2151
  variableFont,
3114
2152
  weightName,
3115
2153
  normalWeight: true,
3116
- // TODO : check if weight is normal ??
3117
- 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: _chunkFH4QKHOHjs.getWeightClass.call(void 0, 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),
3118
2155
  files: [file],
3119
2156
  fontKit: font,
3120
2157
  scriptFileInput: { [script]: {} }
@@ -3163,7 +2200,7 @@ var UploadScriptsComponent = (props) => {
3163
2200
  if (file.name.endsWith(".woff2")) {
3164
2201
  console.log("generating css file for: ", fontObject.title);
3165
2202
  setStatus("generating css file for: " + fontObject.title);
3166
- newFileInput = await generateCssFile({
2203
+ newFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
3167
2204
  woff2File: file,
3168
2205
  fileInput: newFileInput,
3169
2206
  // script: script,
@@ -3216,7 +2253,7 @@ var UploadScriptsComponent = (props) => {
3216
2253
  fontResponse = await client.patch(font._id).set({ scriptFileInput: font.scriptFileInput }).commit();
3217
2254
  } else {
3218
2255
  fontResponse = await client.createOrReplace({
3219
- _key: (0, import_nanoid7.nanoid)(),
2256
+ _key: _nanoid.nanoid.call(void 0, ),
3220
2257
  _id: font._id,
3221
2258
  _type: "font",
3222
2259
  ...font
@@ -3229,7 +2266,7 @@ var UploadScriptsComponent = (props) => {
3229
2266
  })];
3230
2267
  continue;
3231
2268
  }
3232
- const fontRef = { _key: (0, import_nanoid7.nanoid)(), _type: "reference", _ref: fontResponse._id, _weak: true };
2269
+ const fontRef = { _key: _nanoid.nanoid.call(void 0, ), _type: "reference", _ref: fontResponse._id, _weak: true };
3233
2270
  console.log("font response : ", fontResponse);
3234
2271
  console.log("existing styles object : ", stylesObject);
3235
2272
  if (!font.variableFont) {
@@ -3297,8 +2334,8 @@ var UploadScriptsComponent = (props) => {
3297
2334
  console.log("failed files : ", failedFiles);
3298
2335
  const names = failedFiles.map((file) => file.name);
3299
2336
  console.log("names : ", failedFiles.map((file) => {
3300
- var _a2, _b2;
3301
- 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;
3302
2339
  }));
3303
2340
  setStatus("fonts uploaded with errors. Failed files : " + names.join(", "));
3304
2341
  } else {
@@ -3311,26 +2348,26 @@ var UploadScriptsComponent = (props) => {
3311
2348
  }
3312
2349
  setReady(true);
3313
2350
  }, [title, slug, doc_id]);
3314
- return /* @__PURE__ */ import_react10.default.createElement(import_ui8.Stack, null, !ready && /* @__PURE__ */ import_react10.default.createElement(import_ui8.Text, null, /* @__PURE__ */ import_react10.default.createElement("br", null), status, /* @__PURE__ */ import_react10.default.createElement("br", null), /* @__PURE__ */ import_react10.default.createElement("br", null)), ready && /* @__PURE__ */ import_react10.default.createElement(import_ui8.Stack, null, /* @__PURE__ */ import_react10.default.createElement(import_ui8.Grid, { columns: !!(selectedScript && selectedScript !== "") ? 2 : 1, gap: 2 }, /* @__PURE__ */ import_react10.default.createElement(
3315
- import_ui8.Select,
2351
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, null, !ready && /* @__PURE__ */ _react2.default.createElement(_ui.Text, null, /* @__PURE__ */ _react2.default.createElement("br", null), status, /* @__PURE__ */ _react2.default.createElement("br", null), /* @__PURE__ */ _react2.default.createElement("br", null)), ready && /* @__PURE__ */ _react2.default.createElement(_ui.Stack, null, /* @__PURE__ */ _react2.default.createElement(_ui.Grid, { columns: !!(selectedScript && selectedScript !== "") ? 2 : 1, gap: 2 }, /* @__PURE__ */ _react2.default.createElement(
2352
+ _ui.Select,
3316
2353
  {
3317
2354
  id: "menu-button-example",
3318
2355
  onChange: (e) => setSelectedScript(e.target.value)
3319
2356
  },
3320
- /* @__PURE__ */ import_react10.default.createElement("option", { key: "script-none", value: "" }, " "),
2357
+ /* @__PURE__ */ _react2.default.createElement("option", { key: "script-none", value: "" }, " "),
3321
2358
  SCRIPTS.map(
3322
2359
  (script, i) => {
3323
2360
  var _a;
3324
- return /* @__PURE__ */ import_react10.default.createElement("option", { key: "script-" + i, value: script }, ((_a = script[0]) == null ? void 0 : _a.toUpperCase()) + script.slice(1));
2361
+ return /* @__PURE__ */ _react2.default.createElement("option", { key: "script-" + i, value: script }, ((_a = script[0]) == null ? void 0 : _a.toUpperCase()) + script.slice(1));
3325
2362
  }
3326
2363
  )
3327
- ), !!(selectedScript && selectedScript !== "") && /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, /* @__PURE__ */ import_react10.default.createElement("label", { htmlFor: "upload-scripts-file" }, /* @__PURE__ */ import_react10.default.createElement(
3328
- import_ui8.Button,
2364
+ ), !!(selectedScript && selectedScript !== "") && /* @__PURE__ */ _react2.default.createElement(_react2.default.Fragment, null, /* @__PURE__ */ _react2.default.createElement("label", { htmlFor: "upload-scripts-file" }, /* @__PURE__ */ _react2.default.createElement(
2365
+ _ui.Button,
3329
2366
  {
3330
2367
  style: { pointerEvents: "none" },
3331
2368
  text: "Upload (ttf/otf/woff/woff2/etc..)"
3332
2369
  }
3333
- )), /* @__PURE__ */ import_react10.default.createElement(
2370
+ )), /* @__PURE__ */ _react2.default.createElement(
3334
2371
  "input",
3335
2372
  {
3336
2373
  ref,
@@ -3345,9 +2382,9 @@ var UploadScriptsComponent = (props) => {
3345
2382
  };
3346
2383
 
3347
2384
  // src/components/FontScriptUploaderComponent.jsx
3348
- var import_react11 = __toESM(require("react"));
3349
- var import_ui9 = require("@sanity/ui");
3350
- var import_sanity8 = require("sanity");
2385
+
2386
+
2387
+
3351
2388
  var FontScriptUploaderComponent = (props) => {
3352
2389
  const client = useSanityClient();
3353
2390
  const {
@@ -3355,23 +2392,23 @@ var FontScriptUploaderComponent = (props) => {
3355
2392
  onChange,
3356
2393
  value = ""
3357
2394
  } = props;
3358
- const [expanded, setExpanded] = (0, import_react11.useState)(SCRIPTS.reduce((acc, language) => ({ ...acc, [language]: true }), {}));
3359
- const [message, setMessage] = (0, import_react11.useState)({});
3360
- const [status, setStatus] = (0, import_react11.useState)("ready");
3361
- const [filenames, setFilenames] = (0, import_react11.useState)({});
3362
- let scriptFileInput = (0, import_sanity8.useFormValue)(["scriptFileInput"]) || [];
3363
- let fileInput = (0, import_sanity8.useFormValue)(["fileInput"]);
3364
- let doc_id = (0, import_sanity8.useFormValue)(["_id"]);
3365
- let doc_title = (0, import_sanity8.useFormValue)(["title"]);
3366
- let doc_variableFont = (0, import_sanity8.useFormValue)(["variableFont"]);
3367
- let doc_weight = (0, import_sanity8.useFormValue)(["weight"]);
3368
- let doc_style = (0, import_sanity8.useFormValue)(["style"]);
3369
- let doc_slug = (0, import_sanity8.useFormValue)(["slug"]);
3370
- (0, import_react11.useEffect)(() => {
2395
+ const [expanded, setExpanded] = _react.useState.call(void 0, SCRIPTS.reduce((acc, language) => ({ ...acc, [language]: true }), {}));
2396
+ const [message, setMessage] = _react.useState.call(void 0, {});
2397
+ const [status, setStatus] = _react.useState.call(void 0, "ready");
2398
+ const [filenames, setFilenames] = _react.useState.call(void 0, {});
2399
+ let scriptFileInput = _sanity.useFormValue.call(void 0, ["scriptFileInput"]) || [];
2400
+ let fileInput = _sanity.useFormValue.call(void 0, ["fileInput"]);
2401
+ let doc_id = _sanity.useFormValue.call(void 0, ["_id"]);
2402
+ let doc_title = _sanity.useFormValue.call(void 0, ["title"]);
2403
+ let doc_variableFont = _sanity.useFormValue.call(void 0, ["variableFont"]);
2404
+ let doc_weight = _sanity.useFormValue.call(void 0, ["weight"]);
2405
+ let doc_style = _sanity.useFormValue.call(void 0, ["style"]);
2406
+ let doc_slug = _sanity.useFormValue.call(void 0, ["slug"]);
2407
+ _react.useEffect.call(void 0, () => {
3371
2408
  if (!scriptFileInput || Object.keys(scriptFileInput).length === 0) return;
3372
2409
  handleSetFilenames();
3373
2410
  }, [scriptFileInput]);
3374
- const handleSetFilenames = (0, import_react11.useCallback)(async () => {
2411
+ const handleSetFilenames = _react.useCallback.call(void 0, async () => {
3375
2412
  console.log("Set font names ", scriptFileInput);
3376
2413
  let allIds = [];
3377
2414
  const assetIds = SCRIPTS.reduce((acc, language) => {
@@ -3405,7 +2442,7 @@ var FontScriptUploaderComponent = (props) => {
3405
2442
  });
3406
2443
  setFilenames(fontNames);
3407
2444
  }, [scriptFileInput]);
3408
- const handleGenerateCssFile = (0, import_react11.useCallback)(async (language) => {
2445
+ const handleGenerateCssFile = _react.useCallback.call(void 0, async (language) => {
3409
2446
  var _a, _b, _c;
3410
2447
  setMessage({ ...message, [language]: "Generating css: " + doc_title + ".css" });
3411
2448
  const woff2AssetRef = (_c = (_b = (_a = scriptFileInput[language]) == null ? void 0 : _a.woff2) == null ? void 0 : _b.asset) == null ? void 0 : _c._ref;
@@ -3415,7 +2452,7 @@ var FontScriptUploaderComponent = (props) => {
3415
2452
  );
3416
2453
  let blob = await fetch(woff2Buffer.url);
3417
2454
  blob = await blob.blob();
3418
- let newFileInput = await generateCssFile({
2455
+ let newFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
3419
2456
  woff2File: blob,
3420
2457
  fileInput: scriptFileInput,
3421
2458
  language,
@@ -3430,9 +2467,9 @@ var FontScriptUploaderComponent = (props) => {
3430
2467
  setTimeout(() => {
3431
2468
  setMessage({});
3432
2469
  }, 2e3);
3433
- onChange((0, import_sanity8.set)(newFileInput));
2470
+ onChange(_sanity.set.call(void 0, newFileInput));
3434
2471
  }, [scriptFileInput, onChange, doc_title, doc_variableFont]);
3435
- const handleGenerateFontFile = (0, import_react11.useCallback)(async (code, sourceFile, language) => {
2472
+ const handleGenerateFontFile = _react.useCallback.call(void 0, async (code, sourceFile, language) => {
3436
2473
  var _a;
3437
2474
  setMessage({ ...message, [language]: "Generating files: ", code });
3438
2475
  let url = `https://cdn.sanity.io/files/${process.env.SANITY_STUDIO_PROJECT_ID}/${process.env.SANITY_STUDIO_DATASET}/${(_a = sourceFile == null ? void 0 : sourceFile.asset) == null ? void 0 : _a._ref.replace("file-", "").replace("-", ".")}`;
@@ -3469,7 +2506,7 @@ var FontScriptUploaderComponent = (props) => {
3469
2506
  setMessage({});
3470
2507
  }, 2e3);
3471
2508
  }, []);
3472
- const handleUpload = (0, import_react11.useCallback)(async (event, language, code) => {
2509
+ const handleUpload = _react.useCallback.call(void 0, async (event, language, code) => {
3473
2510
  console.log("Handle upload ", scriptFileInput, language, code);
3474
2511
  let file = event.target.files[0];
3475
2512
  let filename = doc_slug.current + "-" + language + "." + file.name.split(".").pop();
@@ -3500,7 +2537,7 @@ var FontScriptUploaderComponent = (props) => {
3500
2537
  if (code === "woff2") {
3501
2538
  console.log("woff2");
3502
2539
  setMessage({ ...message, [language]: "Generating Css: " + doc_title + ".css" });
3503
- newFileInput = await generateCssFile({
2540
+ newFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
3504
2541
  woff2File: file,
3505
2542
  fileInput: newFileInput,
3506
2543
  language,
@@ -3513,16 +2550,16 @@ var FontScriptUploaderComponent = (props) => {
3513
2550
  });
3514
2551
  setMessage({ ...message, [language]: "" + doc_title + ".css generated!" });
3515
2552
  }
3516
- onChange((0, import_sanity8.set)(newFileInput));
2553
+ onChange(_sanity.set.call(void 0, newFileInput));
3517
2554
  }, [scriptFileInput, onChange, doc_title, doc_variableFont, doc_slug]);
3518
- const handleDelete = (0, import_react11.useCallback)(async (code, language) => {
2555
+ const handleDelete = _react.useCallback.call(void 0, async (code, language) => {
3519
2556
  var _a, _b;
3520
2557
  console.log("Delete : ", code, language);
3521
2558
  setMessage({ ...message, [language]: `deleting ${language} ${code}` });
3522
2559
  const asset = (_b = (_a = scriptFileInput[language][code]) == null ? void 0 : _a.asset) == null ? void 0 : _b._ref;
3523
2560
  let newFileInput = { ...scriptFileInput };
3524
2561
  delete newFileInput[language][code];
3525
- onChange((0, import_sanity8.unset)([language, code]));
2562
+ onChange(_sanity.unset.call(void 0, [language, code]));
3526
2563
  await client.delete(asset).then((result) => {
3527
2564
  setMessage({ ...message, [language]: "deleted asset: ", result });
3528
2565
  setTimeout(() => {
@@ -3533,10 +2570,10 @@ var FontScriptUploaderComponent = (props) => {
3533
2570
  setMessage({ ...message, [language]: "WARNING: " + e.message });
3534
2571
  });
3535
2572
  }, [doc_id, scriptFileInput, onChange]);
3536
- const handleDeleteAll = (0, import_react11.useCallback)(async (language) => {
2573
+ const handleDeleteAll = _react.useCallback.call(void 0, async (language) => {
3537
2574
  var _a, _b;
3538
2575
  setMessage({ ...message, [language]: "deleting..." });
3539
- onChange((0, import_sanity8.unset)([language]));
2576
+ onChange(_sanity.unset.call(void 0, [language]));
3540
2577
  console.log("Delete all : ", scriptFileInput[language]);
3541
2578
  for (var i = 0; i < Object.keys(scriptFileInput[language]).length; i++) {
3542
2579
  let refKey = Object.keys(scriptFileInput[language])[i];
@@ -3554,18 +2591,18 @@ var FontScriptUploaderComponent = (props) => {
3554
2591
  }
3555
2592
  }
3556
2593
  }, [scriptFileInput]);
3557
- return /* @__PURE__ */ import_react11.default.createElement(import_ui9.Stack, { space: 4 }, SCRIPTS && scriptFileInput && SCRIPTS.map((language, i) => {
2594
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 4 }, SCRIPTS && scriptFileInput && SCRIPTS.map((language, i) => {
3558
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;
3559
- return /* @__PURE__ */ import_react11.default.createElement(import_ui9.Stack, { space: 2, key: "language-" + i, style: { borderBottom: "1px solid var(--card-border-color)", paddingBottom: 8 } }, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { gap: 2 }, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Text, { weight: "semibold" }, ((_a = language[0]) == null ? void 0 : _a.toUpperCase()) + language.slice(1)), message && message[language] && message[language] !== "" && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Text, { style: { color: "green" } }, message[language])), expanded[language] && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Stack, { space: 2 }, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Text, 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__ */ import_react11.default.createElement("b", null, filenames[language].ttf) : /* @__PURE__ */ import_react11.default.createElement("b", null, "Empty") : /* @__PURE__ */ import_react11.default.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__ */ import_react11.default.createElement("b", null, filenames[language].ttf) : /* @__PURE__ */ import_react11.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { gap: 1 }, /* @__PURE__ */ import_react11.default.createElement("label", null, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ import_react11.default.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: (event) => handleUpload(event, language, "ttf") })), ((_j = value[language]) == null ? void 0 : _j.ttf) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { mode: "ghost", tone: "critical", onClick: () => handleDelete("ttf", language) }, "\xD7"))), status === "ready" && ((_k = value[language]) == null ? void 0 : _k.ttf) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { mode: "default", onClick: () => handleGenerateFontFile("all", value[language].ttf, language) }, "Regenerate Files from TTF"), /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Text, 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__ */ import_react11.default.createElement("b", null, (_p = filenames[language]) == null ? void 0 : _p.otf) : /* @__PURE__ */ import_react11.default.createElement("b", null, "Empty") : /* @__PURE__ */ import_react11.default.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__ */ import_react11.default.createElement("b", null, (_u = filenames[language]) == null ? void 0 : _u.otf) : /* @__PURE__ */ import_react11.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { gap: 1 }, ((_v = value[language]) == null ? void 0 : _v.woff) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { mode: "default", onClick: () => handleGenerateFontFile("otf", value[language].woff, language) }, "Build"), /* @__PURE__ */ import_react11.default.createElement("label", null, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ import_react11.default.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "otf") })), ((_w = value[language]) == null ? void 0 : _w.otf) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { mode: "ghost", tone: "critical", onClick: () => handleDelete("otf", language) }, "\xD7"))), /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Text, 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__ */ import_react11.default.createElement("b", null, (_B = filenames[language]) == null ? void 0 : _B.woff) : /* @__PURE__ */ import_react11.default.createElement("b", null, "Empty") : /* @__PURE__ */ import_react11.default.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__ */ import_react11.default.createElement("b", null, (_G = filenames[language]) == null ? void 0 : _G.woff) : /* @__PURE__ */ import_react11.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { gap: 1 }, ((_H = value[language]) == null ? void 0 : _H.ttf) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { mode: "default", onClick: () => handleGenerateFontFile("woff", value[language].ttf, language) }, "Build"), /* @__PURE__ */ import_react11.default.createElement("label", null, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ import_react11.default.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "woff") })), ((_I = value[language]) == null ? void 0 : _I.woff) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { mode: "ghost", tone: "critical", onClick: () => handleDelete("woff", language) }, "\xD7"))), /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Text, 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__ */ import_react11.default.createElement("b", null, (_N = filenames[language]) == null ? void 0 : _N.woff2) : /* @__PURE__ */ import_react11.default.createElement("b", null, "Empty") : /* @__PURE__ */ import_react11.default.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__ */ import_react11.default.createElement("b", null, (_S = filenames[language]) == null ? void 0 : _S.woff2) : /* @__PURE__ */ import_react11.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { gap: 1 }, ((_T = value[language]) == null ? void 0 : _T.ttf) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { mode: "default", onClick: () => handleGenerateFontFile("woff2", value[language].ttf, language) }, "Build"), /* @__PURE__ */ import_react11.default.createElement("label", null, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ import_react11.default.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "woff2") })), ((_U = value[language]) == null ? void 0 : _U.woff2) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { mode: "ghost", tone: "critical", onClick: () => handleDelete("woff2", language) }, "\xD7"))), /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Text, 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__ */ import_react11.default.createElement("b", null, (_Z = filenames[language]) == null ? void 0 : _Z.eot) : /* @__PURE__ */ import_react11.default.createElement("b", null, "Empty") : /* @__PURE__ */ import_react11.default.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__ */ import_react11.default.createElement("b", null, (_ca = filenames[language]) == null ? void 0 : _ca.eot) : /* @__PURE__ */ import_react11.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { gap: 1 }, ((_da = value[language]) == null ? void 0 : _da.ttf) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { mode: "default", onClick: () => handleGenerateFontFile("eot", value[language].ttf, language) }, "Build"), /* @__PURE__ */ import_react11.default.createElement("label", null, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ import_react11.default.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "eot") })), ((_ea = value[language]) == null ? void 0 : _ea.eot) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { mode: "ghost", tone: "critical", onClick: () => handleDelete("eot", language) }, "\xD7"))), /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Text, 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__ */ import_react11.default.createElement("b", null, (_ja = filenames[language]) == null ? void 0 : _ja.svg) : /* @__PURE__ */ import_react11.default.createElement("b", null, "Empty") : /* @__PURE__ */ import_react11.default.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__ */ import_react11.default.createElement("b", null, (_oa = filenames[language]) == null ? void 0 : _oa.svg) : /* @__PURE__ */ import_react11.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { gap: 1 }, ((_pa = value[language]) == null ? void 0 : _pa.ttf) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { mode: "default", onClick: () => handleGenerateFontFile("svg", value[language].ttf, language) }, "Build"), /* @__PURE__ */ import_react11.default.createElement("label", null, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ import_react11.default.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "svg") })), ((_qa = value[language]) == null ? void 0 : _qa.svg) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { mode: "ghost", tone: "critical", onClick: () => handleDelete("svg", language) }, "\xD7"))), /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ import_react11.default.createElement(import_ui9.Text, 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__ */ import_react11.default.createElement("b", null, (_va = filenames[language]) == null ? void 0 : _va.css) : /* @__PURE__ */ import_react11.default.createElement("b", null, "Empty") : /* @__PURE__ */ import_react11.default.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__ */ import_react11.default.createElement("b", null, (_Aa = filenames[language]) == null ? void 0 : _Aa.css) : /* @__PURE__ */ import_react11.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Flex, { gap: 1 }, ((_Ba = value[language]) == null ? void 0 : _Ba.woff2) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { mode: "default", onClick: () => handleGenerateCssFile(language) }, "Build"), ((_Ca = value[language]) == null ? void 0 : _Ca.css) && /* @__PURE__ */ import_react11.default.createElement(import_ui9.Button, { 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__ */ import_react11.default.createElement(import_ui9.Button, { mode: "ghost", tone: "critical", onClick: () => handleDeleteAll(language), style: { width: "100%" } }, "Delete All")));
2596
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2, key: "language-" + i, style: { borderBottom: "1px solid var(--card-border-color)", paddingBottom: 8 } }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { weight: "semibold" }, ((_a = language[0]) == null ? void 0 : _a.toUpperCase()) + language.slice(1)), message && message[language] && message[language] !== "" && /* @__PURE__ */ _react2.default.createElement(_ui.Text, { style: { color: "green" } }, message[language])), expanded[language] && /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, 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__ */ _react2.default.createElement("b", null, filenames[language].ttf) : /* @__PURE__ */ _react2.default.createElement("b", null, "Empty") : /* @__PURE__ */ _react2.default.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__ */ _react2.default.createElement("b", null, filenames[language].ttf) : /* @__PURE__ */ _react2.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1 }, /* @__PURE__ */ _react2.default.createElement("label", null, /* @__PURE__ */ _react2.default.createElement(_ui.Button, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ _react2.default.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: (event) => handleUpload(event, language, "ttf") })), ((_j = value[language]) == null ? void 0 : _j.ttf) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "critical", onClick: () => handleDelete("ttf", language) }, "\xD7"))), status === "ready" && ((_k = value[language]) == null ? void 0 : _k.ttf) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "default", onClick: () => handleGenerateFontFile("all", value[language].ttf, language) }, "Regenerate Files from TTF"), /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, 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__ */ _react2.default.createElement("b", null, (_p = filenames[language]) == null ? void 0 : _p.otf) : /* @__PURE__ */ _react2.default.createElement("b", null, "Empty") : /* @__PURE__ */ _react2.default.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__ */ _react2.default.createElement("b", null, (_u = filenames[language]) == null ? void 0 : _u.otf) : /* @__PURE__ */ _react2.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1 }, ((_v = value[language]) == null ? void 0 : _v.woff) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "default", onClick: () => handleGenerateFontFile("otf", value[language].woff, language) }, "Build"), /* @__PURE__ */ _react2.default.createElement("label", null, /* @__PURE__ */ _react2.default.createElement(_ui.Button, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ _react2.default.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "otf") })), ((_w = value[language]) == null ? void 0 : _w.otf) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "critical", onClick: () => handleDelete("otf", language) }, "\xD7"))), /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, 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__ */ _react2.default.createElement("b", null, (_B = filenames[language]) == null ? void 0 : _B.woff) : /* @__PURE__ */ _react2.default.createElement("b", null, "Empty") : /* @__PURE__ */ _react2.default.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__ */ _react2.default.createElement("b", null, (_G = filenames[language]) == null ? void 0 : _G.woff) : /* @__PURE__ */ _react2.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1 }, ((_H = value[language]) == null ? void 0 : _H.ttf) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "default", onClick: () => handleGenerateFontFile("woff", value[language].ttf, language) }, "Build"), /* @__PURE__ */ _react2.default.createElement("label", null, /* @__PURE__ */ _react2.default.createElement(_ui.Button, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ _react2.default.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "woff") })), ((_I = value[language]) == null ? void 0 : _I.woff) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "critical", onClick: () => handleDelete("woff", language) }, "\xD7"))), /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, 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__ */ _react2.default.createElement("b", null, (_N = filenames[language]) == null ? void 0 : _N.woff2) : /* @__PURE__ */ _react2.default.createElement("b", null, "Empty") : /* @__PURE__ */ _react2.default.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__ */ _react2.default.createElement("b", null, (_S = filenames[language]) == null ? void 0 : _S.woff2) : /* @__PURE__ */ _react2.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1 }, ((_T = value[language]) == null ? void 0 : _T.ttf) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "default", onClick: () => handleGenerateFontFile("woff2", value[language].ttf, language) }, "Build"), /* @__PURE__ */ _react2.default.createElement("label", null, /* @__PURE__ */ _react2.default.createElement(_ui.Button, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ _react2.default.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "woff2") })), ((_U = value[language]) == null ? void 0 : _U.woff2) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "critical", onClick: () => handleDelete("woff2", language) }, "\xD7"))), /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, 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__ */ _react2.default.createElement("b", null, (_Z = filenames[language]) == null ? void 0 : _Z.eot) : /* @__PURE__ */ _react2.default.createElement("b", null, "Empty") : /* @__PURE__ */ _react2.default.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__ */ _react2.default.createElement("b", null, (_ca = filenames[language]) == null ? void 0 : _ca.eot) : /* @__PURE__ */ _react2.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1 }, ((_da = value[language]) == null ? void 0 : _da.ttf) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "default", onClick: () => handleGenerateFontFile("eot", value[language].ttf, language) }, "Build"), /* @__PURE__ */ _react2.default.createElement("label", null, /* @__PURE__ */ _react2.default.createElement(_ui.Button, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ _react2.default.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "eot") })), ((_ea = value[language]) == null ? void 0 : _ea.eot) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "critical", onClick: () => handleDelete("eot", language) }, "\xD7"))), /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, 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__ */ _react2.default.createElement("b", null, (_ja = filenames[language]) == null ? void 0 : _ja.svg) : /* @__PURE__ */ _react2.default.createElement("b", null, "Empty") : /* @__PURE__ */ _react2.default.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__ */ _react2.default.createElement("b", null, (_oa = filenames[language]) == null ? void 0 : _oa.svg) : /* @__PURE__ */ _react2.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1 }, ((_pa = value[language]) == null ? void 0 : _pa.ttf) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "default", onClick: () => handleGenerateFontFile("svg", value[language].ttf, language) }, "Build"), /* @__PURE__ */ _react2.default.createElement("label", null, /* @__PURE__ */ _react2.default.createElement(_ui.Button, { as: "span", mode: "ghost" }, "Upload"), /* @__PURE__ */ _react2.default.createElement("input", { ref, type: "file", style: { display: "none" }, onChange: async (event) => handleUpload(event, language, "svg") })), ((_qa = value[language]) == null ? void 0 : _qa.svg) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "critical", onClick: () => handleDelete("svg", language) }, "\xD7"))), /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { justify: "space-between", align: "center" }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, 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__ */ _react2.default.createElement("b", null, (_va = filenames[language]) == null ? void 0 : _va.css) : /* @__PURE__ */ _react2.default.createElement("b", null, "Empty") : /* @__PURE__ */ _react2.default.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__ */ _react2.default.createElement("b", null, (_Aa = filenames[language]) == null ? void 0 : _Aa.css) : /* @__PURE__ */ _react2.default.createElement("b", null, "File"))), status === "ready" && /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 1 }, ((_Ba = value[language]) == null ? void 0 : _Ba.woff2) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { mode: "default", onClick: () => handleGenerateCssFile(language) }, "Build"), ((_Ca = value[language]) == null ? void 0 : _Ca.css) && /* @__PURE__ */ _react2.default.createElement(_ui.Button, { 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__ */ _react2.default.createElement(_ui.Button, { mode: "ghost", tone: "critical", onClick: () => handleDeleteAll(language), style: { width: "100%" } }, "Delete All")));
3560
2597
  }));
3561
2598
  };
3562
2599
 
3563
2600
  // src/components/UploadButton.jsx
3564
- var import_react12 = __toESM(require("react"));
3565
- var import_ui10 = require("@sanity/ui");
3566
- var UploadButton = (0, import_react12.forwardRef)(({ handleUpload }, ref) => {
3567
- return /* @__PURE__ */ import_react12.default.createElement(
3568
- import_ui10.Button,
2601
+
2602
+
2603
+ var UploadButton = _react.forwardRef.call(void 0, ({ handleUpload }, ref) => {
2604
+ return /* @__PURE__ */ _react2.default.createElement(
2605
+ _ui.Button,
3569
2606
  {
3570
2607
  mode: "ghost",
3571
2608
  tone: "primary",
@@ -3573,8 +2610,8 @@ var UploadButton = (0, import_react12.forwardRef)(({ handleUpload }, ref) => {
3573
2610
  padding: 3,
3574
2611
  style: { position: "relative" }
3575
2612
  },
3576
- /* @__PURE__ */ import_react12.default.createElement(import_ui10.Text, { align: "center" }, "Upload (ttf/otf/woff/woff2/etc...)"),
3577
- /* @__PURE__ */ import_react12.default.createElement(
2613
+ /* @__PURE__ */ _react2.default.createElement(_ui.Text, { align: "center" }, "Upload (ttf/otf/woff/woff2/etc...)"),
2614
+ /* @__PURE__ */ _react2.default.createElement(
3578
2615
  "input",
3579
2616
  {
3580
2617
  ref,
@@ -3598,84 +2635,84 @@ UploadButton.displayName = "UploadButton";
3598
2635
  var UploadButton_default = UploadButton;
3599
2636
 
3600
2637
  // src/components/KeyValueInput.jsx
3601
- var import_react13 = __toESM(require("react"));
3602
- var import_ui11 = require("@sanity/ui");
3603
- var import_icons3 = require("@sanity/icons");
3604
- var import_sanity9 = require("sanity");
2638
+
2639
+
2640
+
2641
+
3605
2642
  function KeyValueInput({ value = [], onChange }) {
3606
- const [pairs, setPairs] = (0, import_react13.useState)(value);
3607
- const handlePairChange = (0, import_react13.useCallback)((index, field2, fieldValue) => {
2643
+ const [pairs, setPairs] = _react.useState.call(void 0, value);
2644
+ const handlePairChange = _react.useCallback.call(void 0, (index, field2, fieldValue) => {
3608
2645
  const updatedPairs = pairs.map((pair, idx) => idx === index ? { ...pair, [field2]: fieldValue } : pair);
3609
2646
  setPairs(updatedPairs);
3610
- onChange((0, import_sanity9.set)(updatedPairs));
2647
+ onChange(_sanity.set.call(void 0, updatedPairs));
3611
2648
  }, [pairs, onChange]);
3612
- const handleAddPair = (0, import_react13.useCallback)(() => {
2649
+ const handleAddPair = _react.useCallback.call(void 0, () => {
3613
2650
  const newPair = { key: "", value: "", _key: Math.random().toString(36).substr(2, 9) };
3614
2651
  const updatedPairs = [...pairs, newPair];
3615
2652
  setPairs(updatedPairs);
3616
- onChange((0, import_sanity9.set)(updatedPairs));
2653
+ onChange(_sanity.set.call(void 0, updatedPairs));
3617
2654
  }, [pairs, onChange]);
3618
- const handleRemovePair = (0, import_react13.useCallback)((index) => {
2655
+ const handleRemovePair = _react.useCallback.call(void 0, (index) => {
3619
2656
  const updatedPairs = pairs.filter((_, idx) => idx !== index);
3620
2657
  setPairs(updatedPairs);
3621
- onChange((0, import_sanity9.set)(updatedPairs));
2658
+ onChange(_sanity.set.call(void 0, updatedPairs));
3622
2659
  }, [pairs, onChange]);
3623
- const handleMoveUp = (0, import_react13.useCallback)((index) => {
2660
+ const handleMoveUp = _react.useCallback.call(void 0, (index) => {
3624
2661
  if (index === 0) return;
3625
2662
  const updatedPairs = [...pairs];
3626
2663
  [updatedPairs[index], updatedPairs[index - 1]] = [updatedPairs[index - 1], updatedPairs[index]];
3627
2664
  setPairs(updatedPairs);
3628
- onChange((0, import_sanity9.set)(updatedPairs));
2665
+ onChange(_sanity.set.call(void 0, updatedPairs));
3629
2666
  }, [pairs, onChange]);
3630
- const handleMoveDown = (0, import_react13.useCallback)((index) => {
2667
+ const handleMoveDown = _react.useCallback.call(void 0, (index) => {
3631
2668
  if (index === pairs.length - 1) return;
3632
2669
  const updatedPairs = [...pairs];
3633
2670
  [updatedPairs[index], updatedPairs[index + 1]] = [updatedPairs[index + 1], updatedPairs[index]];
3634
2671
  setPairs(updatedPairs);
3635
- onChange((0, import_sanity9.set)(updatedPairs));
2672
+ onChange(_sanity.set.call(void 0, updatedPairs));
3636
2673
  }, [pairs, onChange]);
3637
- return /* @__PURE__ */ import_react13.default.createElement(import_ui11.Stack, { space: 3 }, pairs.map((pair, index) => /* @__PURE__ */ import_react13.default.createElement(import_ui11.Grid, { className: "manualButtonWrap", columns: [2], key: index, gap: 0, style: { position: "relative" } }, /* @__PURE__ */ import_react13.default.createElement("div", { style: { position: "absolute", height: "100%", top: "0", left: "-10px", width: "min-content", transform: "translate(-100%, 0%)" } }, /* @__PURE__ */ import_react13.default.createElement("button", { className: "manualButton manualButtonUp", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveUp(index) }, /* @__PURE__ */ import_react13.default.createElement(import_icons3.ArrowUpIcon, null)), /* @__PURE__ */ import_react13.default.createElement("button", { className: "manualButton manualButtonDown", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveDown(index) }, /* @__PURE__ */ import_react13.default.createElement(import_icons3.ArrowDownIcon, null))), /* @__PURE__ */ import_react13.default.createElement(
3638
- import_ui11.TextInput,
2674
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, pairs.map((pair, index) => /* @__PURE__ */ _react2.default.createElement(_ui.Grid, { className: "manualButtonWrap", columns: [2], key: index, gap: 0, style: { position: "relative" } }, /* @__PURE__ */ _react2.default.createElement("div", { style: { position: "absolute", height: "100%", top: "0", left: "-10px", width: "min-content", transform: "translate(-100%, 0%)" } }, /* @__PURE__ */ _react2.default.createElement("button", { className: "manualButton manualButtonUp", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveUp(index) }, /* @__PURE__ */ _react2.default.createElement(_icons.ArrowUpIcon, null)), /* @__PURE__ */ _react2.default.createElement("button", { className: "manualButton manualButtonDown", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveDown(index) }, /* @__PURE__ */ _react2.default.createElement(_icons.ArrowDownIcon, null))), /* @__PURE__ */ _react2.default.createElement(
2675
+ _ui.TextInput,
3639
2676
  {
3640
2677
  value: pair.key,
3641
2678
  onChange: (e) => handlePairChange(index, "key", e.target.value),
3642
2679
  placeholder: "Key"
3643
2680
  }
3644
- ), /* @__PURE__ */ import_react13.default.createElement("div", { style: { marginLeft: "-1px" } }, /* @__PURE__ */ import_react13.default.createElement(
3645
- import_ui11.TextInput,
2681
+ ), /* @__PURE__ */ _react2.default.createElement("div", { style: { marginLeft: "-1px" } }, /* @__PURE__ */ _react2.default.createElement(
2682
+ _ui.TextInput,
3646
2683
  {
3647
2684
  value: pair.value,
3648
2685
  onChange: (e) => handlePairChange(index, "value", e.target.value),
3649
2686
  placeholder: "Value"
3650
2687
  }
3651
- )), /* @__PURE__ */ import_react13.default.createElement(
2688
+ )), /* @__PURE__ */ _react2.default.createElement(
3652
2689
  "button",
3653
2690
  {
3654
2691
  className: "manualButton",
3655
2692
  onClick: () => handleRemovePair(index),
3656
2693
  style: { position: "absolute", top: "0", right: "-10px", transform: "translate(100%, 0%)" }
3657
2694
  },
3658
- /* @__PURE__ */ import_react13.default.createElement(import_icons3.TrashIcon, null)
3659
- ))), /* @__PURE__ */ import_react13.default.createElement(import_ui11.Button, { tone: "primary", onClick: handleAddPair, icon: import_icons3.AddIcon, text: "Add Row" }));
2695
+ /* @__PURE__ */ _react2.default.createElement(_icons.TrashIcon, null)
2696
+ ))), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { tone: "primary", onClick: handleAddPair, icon: _icons.AddIcon, text: "Add Row" }));
3660
2697
  }
3661
2698
 
3662
2699
  // src/components/KeyValueReferenceInput.jsx
3663
- var import_react14 = __toESM(require("react"));
3664
- var import_ui12 = require("@sanity/ui");
3665
- var import_icons4 = require("@sanity/icons");
3666
- var import_sanity10 = require("sanity");
3667
- var import_nanoid8 = require("nanoid");
2700
+
2701
+
2702
+
2703
+
2704
+
3668
2705
  function KeyValueReferenceInput(props) {
3669
2706
  var _a, _b, _c, _d, _e, _f, _g, _h;
3670
2707
  const { value = [], onChange, schemaType, referenceType, fetchReferences, topActions } = props;
3671
- const [pairs, setPairs] = (0, import_react14.useState)(value);
3672
- const [referenceData, setReferenceData] = (0, import_react14.useState)({});
3673
- const [isDialogOpen, setIsDialogOpen] = (0, import_react14.useState)(false);
3674
- const [editingIndex, setEditingIndex] = (0, import_react14.useState)(null);
3675
- const [availableReferences, setAvailableReferences] = (0, import_react14.useState)([]);
2708
+ const [pairs, setPairs] = _react.useState.call(void 0, value);
2709
+ const [referenceData, setReferenceData] = _react.useState.call(void 0, {});
2710
+ const [isDialogOpen, setIsDialogOpen] = _react.useState.call(void 0, false);
2711
+ const [editingIndex, setEditingIndex] = _react.useState.call(void 0, null);
2712
+ const [availableReferences, setAvailableReferences] = _react.useState.call(void 0, []);
3676
2713
  const sanityClient = useSanityClient();
3677
- const formDocument = (0, import_sanity10.useFormValue)([]);
3678
- (0, import_react14.useEffect)(() => {
2714
+ const formDocument = _sanity.useFormValue.call(void 0, []);
2715
+ _react.useEffect.call(void 0, () => {
3679
2716
  const refIds = pairs.filter((p) => {
3680
2717
  var _a2;
3681
2718
  return (_a2 = p.value) == null ? void 0 : _a2._ref;
@@ -3704,36 +2741,36 @@ function KeyValueReferenceInput(props) {
3704
2741
  setReferenceData(fallback);
3705
2742
  });
3706
2743
  }, [pairs, sanityClient]);
3707
- const handlePairChange = (0, import_react14.useCallback)((index, field2, fieldValue) => {
2744
+ const handlePairChange = _react.useCallback.call(void 0, (index, field2, fieldValue) => {
3708
2745
  const updatedPairs = pairs.map((pair, idx) => idx === index ? { ...pair, [field2]: fieldValue } : pair);
3709
2746
  setPairs(updatedPairs);
3710
- onChange((0, import_sanity10.set)(updatedPairs));
2747
+ onChange(_sanity.set.call(void 0, updatedPairs));
3711
2748
  }, [pairs, onChange]);
3712
- const handleAddPair = (0, import_react14.useCallback)(() => {
3713
- const updatedPairs = [...pairs, { key: "", value: null, _key: (0, import_nanoid8.nanoid)() }];
2749
+ const handleAddPair = _react.useCallback.call(void 0, () => {
2750
+ const updatedPairs = [...pairs, { key: "", value: null, _key: _nanoid.nanoid.call(void 0, ) }];
3714
2751
  setPairs(updatedPairs);
3715
- onChange((0, import_sanity10.set)(updatedPairs));
2752
+ onChange(_sanity.set.call(void 0, updatedPairs));
3716
2753
  }, [pairs, onChange]);
3717
- const handleRemovePair = (0, import_react14.useCallback)((index) => {
2754
+ const handleRemovePair = _react.useCallback.call(void 0, (index) => {
3718
2755
  const updatedPairs = pairs.filter((_, idx) => idx !== index);
3719
2756
  setPairs(updatedPairs);
3720
- onChange((0, import_sanity10.set)(updatedPairs));
2757
+ onChange(_sanity.set.call(void 0, updatedPairs));
3721
2758
  }, [pairs, onChange]);
3722
- const handleMoveUp = (0, import_react14.useCallback)((index) => {
2759
+ const handleMoveUp = _react.useCallback.call(void 0, (index) => {
3723
2760
  if (index === 0) return;
3724
2761
  const updatedPairs = [...pairs];
3725
2762
  [updatedPairs[index], updatedPairs[index - 1]] = [updatedPairs[index - 1], updatedPairs[index]];
3726
2763
  setPairs(updatedPairs);
3727
- onChange((0, import_sanity10.set)(updatedPairs));
2764
+ onChange(_sanity.set.call(void 0, updatedPairs));
3728
2765
  }, [pairs, onChange]);
3729
- const handleMoveDown = (0, import_react14.useCallback)((index) => {
2766
+ const handleMoveDown = _react.useCallback.call(void 0, (index) => {
3730
2767
  if (index === pairs.length - 1) return;
3731
2768
  const updatedPairs = [...pairs];
3732
2769
  [updatedPairs[index], updatedPairs[index + 1]] = [updatedPairs[index + 1], updatedPairs[index]];
3733
2770
  setPairs(updatedPairs);
3734
- onChange((0, import_sanity10.set)(updatedPairs));
2771
+ onChange(_sanity.set.call(void 0, updatedPairs));
3735
2772
  }, [pairs, onChange]);
3736
- const openReferenceSelector = (0, import_react14.useCallback)(async (index) => {
2773
+ const openReferenceSelector = _react.useCallback.call(void 0, async (index) => {
3737
2774
  setEditingIndex(index);
3738
2775
  if (!sanityClient) {
3739
2776
  console.error("KeyValueReferenceInput: Sanity client not available");
@@ -3755,11 +2792,11 @@ function KeyValueReferenceInput(props) {
3755
2792
  console.error("Error fetching available references:", err);
3756
2793
  }
3757
2794
  }, [sanityClient, fetchReferences, referenceType, formDocument]);
3758
- const closeDialog = (0, import_react14.useCallback)(() => {
2795
+ const closeDialog = _react.useCallback.call(void 0, () => {
3759
2796
  setIsDialogOpen(false);
3760
2797
  setEditingIndex(null);
3761
2798
  }, []);
3762
- const handleReferenceSelect = (0, import_react14.useCallback)((reference) => {
2799
+ const handleReferenceSelect = _react.useCallback.call(void 0, (reference) => {
3763
2800
  if (editingIndex === null) return;
3764
2801
  handlePairChange(editingIndex, "value", { _type: "reference", _ref: reference._id, _weak: true });
3765
2802
  closeDialog();
@@ -3771,62 +2808,62 @@ function KeyValueReferenceInput(props) {
3771
2808
  const valueTitle = (valueField == null ? void 0 : valueField.title) || "Value";
3772
2809
  const keyPlaceholder = (keyField == null ? void 0 : keyField.placeholder) || "Enter key";
3773
2810
  const pickerLabel = referenceType || valueTitle.toLowerCase();
3774
- return /* @__PURE__ */ import_react14.default.createElement(import_ui12.Stack, { space: 3 }, topActions && /* @__PURE__ */ import_react14.default.createElement(import_ui12.Box, { paddingBottom: 2 }, topActions), /* @__PURE__ */ import_react14.default.createElement(import_ui12.Box, null, /* @__PURE__ */ import_react14.default.createElement(import_ui12.Stack, { space: 2 }, pairs.map((pair, index) => {
2811
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, topActions && /* @__PURE__ */ _react2.default.createElement(_ui.Box, { paddingBottom: 2 }, topActions), /* @__PURE__ */ _react2.default.createElement(_ui.Box, null, /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, pairs.map((pair, index) => {
3775
2812
  var _a2;
3776
- return /* @__PURE__ */ import_react14.default.createElement(import_ui12.Box, { key: index, style: { position: "relative" } }, /* @__PURE__ */ import_react14.default.createElement("div", { style: { position: "absolute", height: "100%", top: "0", left: "-5px", width: "min-content", transform: "translate(-100%, 0%)" } }, /* @__PURE__ */ import_react14.default.createElement("button", { className: "manualButton manualButtonUp", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveUp(index) }, /* @__PURE__ */ import_react14.default.createElement(import_icons4.ArrowUpIcon, null)), /* @__PURE__ */ import_react14.default.createElement("button", { className: "manualButton manualButtonDown", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveDown(index) }, /* @__PURE__ */ import_react14.default.createElement(import_icons4.ArrowDownIcon, null))), /* @__PURE__ */ import_react14.default.createElement(import_ui12.Flex, { gap: 2, align: "flex-start" }, /* @__PURE__ */ import_react14.default.createElement(import_ui12.Box, { flex: 1 }, /* @__PURE__ */ import_react14.default.createElement(
3777
- import_ui12.TextInput,
2813
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Box, { key: index, style: { position: "relative" } }, /* @__PURE__ */ _react2.default.createElement("div", { style: { position: "absolute", height: "100%", top: "0", left: "-5px", width: "min-content", transform: "translate(-100%, 0%)" } }, /* @__PURE__ */ _react2.default.createElement("button", { className: "manualButton manualButtonUp", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveUp(index) }, /* @__PURE__ */ _react2.default.createElement(_icons.ArrowUpIcon, null)), /* @__PURE__ */ _react2.default.createElement("button", { className: "manualButton manualButtonDown", style: { fontSize: "15px", height: "50%" }, onClick: () => handleMoveDown(index) }, /* @__PURE__ */ _react2.default.createElement(_icons.ArrowDownIcon, null))), /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 2, align: "flex-start" }, /* @__PURE__ */ _react2.default.createElement(_ui.Box, { flex: 1 }, /* @__PURE__ */ _react2.default.createElement(
2814
+ _ui.TextInput,
3778
2815
  {
3779
2816
  value: pair.key,
3780
2817
  onChange: (e) => handlePairChange(index, "key", e.target.value),
3781
2818
  placeholder: keyPlaceholder
3782
2819
  }
3783
- )), /* @__PURE__ */ import_react14.default.createElement(import_ui12.Box, { flex: 1, style: { minHeight: "100%" } }, ((_a2 = pair.value) == null ? void 0 : _a2._ref) ? /* @__PURE__ */ import_react14.default.createElement(import_ui12.Card, { className: "referenceCard", radius: 2, tone: "primary", style: { paddingLeft: "1rem", height: "fit-content" } }, /* @__PURE__ */ import_react14.default.createElement(import_ui12.Flex, { align: "center", justify: "space-between" }, /* @__PURE__ */ import_react14.default.createElement(
3784
- import_ui12.Text,
2820
+ )), /* @__PURE__ */ _react2.default.createElement(_ui.Box, { flex: 1, style: { minHeight: "100%" } }, ((_a2 = pair.value) == null ? void 0 : _a2._ref) ? /* @__PURE__ */ _react2.default.createElement(_ui.Card, { className: "referenceCard", radius: 2, tone: "primary", style: { paddingLeft: "1rem", height: "fit-content" } }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", justify: "space-between" }, /* @__PURE__ */ _react2.default.createElement(
2821
+ _ui.Text,
3785
2822
  {
3786
2823
  size: 2,
3787
2824
  style: { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", maxWidth: "90%" }
3788
2825
  },
3789
2826
  referenceData[pair.value._ref] || "Loading..."
3790
- ), /* @__PURE__ */ import_react14.default.createElement(
3791
- import_ui12.MenuButton,
2827
+ ), /* @__PURE__ */ _react2.default.createElement(
2828
+ _ui.MenuButton,
3792
2829
  {
3793
- button: /* @__PURE__ */ import_react14.default.createElement(import_ui12.Button, { icon: import_icons4.EllipsisHorizontalIcon, mode: "bleed", title: "Options" }),
2830
+ button: /* @__PURE__ */ _react2.default.createElement(_ui.Button, { icon: _icons.EllipsisHorizontalIcon, mode: "bleed", title: "Options" }),
3794
2831
  id: `ref-options-${index}`,
3795
- menu: /* @__PURE__ */ import_react14.default.createElement(import_ui12.Menu, null, /* @__PURE__ */ import_react14.default.createElement(import_ui12.MenuItem, { tone: "critical", icon: import_icons4.TrashIcon, text: "Remove", onClick: () => handlePairChange(index, "value", null) }), /* @__PURE__ */ import_react14.default.createElement(import_ui12.MenuItem, { icon: import_icons4.SyncIcon, text: "Replace", onClick: () => openReferenceSelector(index) })),
2832
+ menu: /* @__PURE__ */ _react2.default.createElement(_ui.Menu, null, /* @__PURE__ */ _react2.default.createElement(_ui.MenuItem, { tone: "critical", icon: _icons.TrashIcon, text: "Remove", onClick: () => handlePairChange(index, "value", null) }), /* @__PURE__ */ _react2.default.createElement(_ui.MenuItem, { icon: _icons.SyncIcon, text: "Replace", onClick: () => openReferenceSelector(index) })),
3796
2833
  popover: { portal: true, tone: "default", placement: "left" }
3797
2834
  }
3798
- ))) : /* @__PURE__ */ import_react14.default.createElement(
3799
- import_ui12.Box,
2835
+ ))) : /* @__PURE__ */ _react2.default.createElement(
2836
+ _ui.Box,
3800
2837
  {
3801
2838
  padding: 2,
3802
2839
  style: { minHeight: "100%", border: "1px dashed #ccc", borderRadius: "4px", display: "flex", alignItems: "center", justifyContent: "center", cursor: "pointer" },
3803
2840
  onClick: () => openReferenceSelector(index)
3804
2841
  },
3805
- /* @__PURE__ */ import_react14.default.createElement(import_ui12.Text, { muted: true, size: 2 }, "Click to select a ", pickerLabel)
3806
- ))), /* @__PURE__ */ import_react14.default.createElement(
2842
+ /* @__PURE__ */ _react2.default.createElement(_ui.Text, { muted: true, size: 2 }, "Click to select a ", pickerLabel)
2843
+ ))), /* @__PURE__ */ _react2.default.createElement(
3807
2844
  "button",
3808
2845
  {
3809
2846
  className: "manualButton",
3810
2847
  onClick: () => handleRemovePair(index),
3811
2848
  style: { position: "absolute", top: "0", right: "-7px", transform: "translate(100%, 0%)" }
3812
2849
  },
3813
- /* @__PURE__ */ import_react14.default.createElement(import_icons4.TrashIcon, null)
2850
+ /* @__PURE__ */ _react2.default.createElement(_icons.TrashIcon, null)
3814
2851
  ));
3815
- }))), /* @__PURE__ */ import_react14.default.createElement(import_ui12.Button, { tone: "primary", mode: "ghost", onClick: handleAddPair, icon: import_icons4.AddIcon, text: `Add ${keyTitle}` }), isDialogOpen && /* @__PURE__ */ import_react14.default.createElement(
3816
- import_ui12.Dialog,
2852
+ }))), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { tone: "primary", mode: "ghost", onClick: handleAddPair, icon: _icons.AddIcon, text: `Add ${keyTitle}` }), isDialogOpen && /* @__PURE__ */ _react2.default.createElement(
2853
+ _ui.Dialog,
3817
2854
  {
3818
2855
  header: `Select a ${pickerLabel}`,
3819
2856
  id: "reference-selector-dialog",
3820
2857
  onClose: closeDialog,
3821
2858
  width: 1
3822
2859
  },
3823
- /* @__PURE__ */ import_react14.default.createElement(import_ui12.Box, { padding: 4 }, /* @__PURE__ */ import_react14.default.createElement(
3824
- import_ui12.Autocomplete,
2860
+ /* @__PURE__ */ _react2.default.createElement(_ui.Box, { padding: 4 }, /* @__PURE__ */ _react2.default.createElement(
2861
+ _ui.Autocomplete,
3825
2862
  {
3826
2863
  id: "reference-autocomplete",
3827
2864
  options: referenceOptions,
3828
2865
  placeholder: `Search ${pickerLabel}s...`,
3829
- renderOption: (option) => /* @__PURE__ */ import_react14.default.createElement(import_ui12.Card, { key: option.value, padding: 3, radius: 2, tone: "default", style: { cursor: "pointer" } }, /* @__PURE__ */ import_react14.default.createElement(import_ui12.Text, { size: 2 }, option.title)),
2866
+ renderOption: (option) => /* @__PURE__ */ _react2.default.createElement(_ui.Card, { key: option.value, padding: 3, radius: 2, tone: "default", style: { cursor: "pointer" } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 2 }, option.title)),
3830
2867
  renderValue: (val) => {
3831
2868
  var _a2;
3832
2869
  return ((_a2 = referenceOptions.find((o) => o.value === val)) == null ? void 0 : _a2.title) || "";
@@ -3843,19 +2880,19 @@ function KeyValueReferenceInput(props) {
3843
2880
  }
3844
2881
 
3845
2882
  // src/components/VariableInstanceReferencesInput.jsx
3846
- var import_react15 = __toESM(require("react"));
3847
- var import_ui13 = require("@sanity/ui");
3848
- var import_icons5 = require("@sanity/icons");
3849
- var import_sanity11 = require("sanity");
3850
- var import_nanoid9 = require("nanoid");
2883
+
2884
+
2885
+
2886
+
2887
+
3851
2888
  function VariableInstanceReferencesInput(props) {
3852
2889
  const { value = [], onChange } = props;
3853
- const [isAutofilling, setIsAutofilling] = (0, import_react15.useState)(false);
3854
- const [showConfirmDialog, setShowConfirmDialog] = (0, import_react15.useState)(false);
3855
- const [pendingAction, setPendingAction] = (0, import_react15.useState)(null);
3856
- const formDocument = (0, import_sanity11.useFormValue)([]);
2890
+ const [isAutofilling, setIsAutofilling] = _react.useState.call(void 0, false);
2891
+ const [showConfirmDialog, setShowConfirmDialog] = _react.useState.call(void 0, false);
2892
+ const [pendingAction, setPendingAction] = _react.useState.call(void 0, null);
2893
+ const formDocument = _sanity.useFormValue.call(void 0, []);
3857
2894
  const sanityClient = useSanityClient();
3858
- const fetchReferences = (0, import_react15.useCallback)(async (client, doc) => {
2895
+ const fetchReferences = _react.useCallback.call(void 0, async (client, doc) => {
3859
2896
  const typefaceName = doc == null ? void 0 : doc.typefaceName;
3860
2897
  if (!typefaceName) {
3861
2898
  return client.fetch(`*[_type == 'font' && variableFont != true]{_id, title}`, {});
@@ -3865,27 +2902,27 @@ function VariableInstanceReferencesInput(props) {
3865
2902
  { typefaceName }
3866
2903
  );
3867
2904
  }, []);
3868
- const performAutofillWithMatching = (0, import_react15.useCallback)(async (mode) => {
2905
+ const performAutofillWithMatching = _react.useCallback.call(void 0, async (mode) => {
3869
2906
  setIsAutofilling(true);
3870
2907
  try {
3871
2908
  if (!(formDocument == null ? void 0 : formDocument.variableInstances)) {
3872
2909
  console.warn("Cannot autofill: no variableInstances data on this document");
3873
2910
  return;
3874
2911
  }
3875
- const mappings = await parseVariableFontInstances(formDocument, sanityClient);
2912
+ const mappings = await _chunkFH4QKHOHjs.parseVariableFontInstances.call(void 0, formDocument, sanityClient);
3876
2913
  if (mappings.length === 0) {
3877
2914
  console.warn("No variable instances could be parsed from this font");
3878
2915
  return;
3879
2916
  }
3880
2917
  const updatedPairs = mode === "replace" ? mappings : [...value, ...mappings.filter((m) => !value.some((p) => p.key === m.key))];
3881
- onChange((0, import_sanity11.set)(updatedPairs));
2918
+ onChange(_sanity.set.call(void 0, updatedPairs));
3882
2919
  } catch (err) {
3883
2920
  console.error("Error during autofill with matching:", err);
3884
2921
  } finally {
3885
2922
  setIsAutofilling(false);
3886
2923
  }
3887
2924
  }, [formDocument, sanityClient, value, onChange]);
3888
- const performAutofillKeysOnly = (0, import_react15.useCallback)(async (mode) => {
2925
+ const performAutofillKeysOnly = _react.useCallback.call(void 0, async (mode) => {
3889
2926
  setIsAutofilling(true);
3890
2927
  try {
3891
2928
  if (!(formDocument == null ? void 0 : formDocument.variableInstances)) {
@@ -3895,7 +2932,7 @@ function VariableInstanceReferencesInput(props) {
3895
2932
  let instances;
3896
2933
  try {
3897
2934
  instances = JSON.parse(formDocument.variableInstances);
3898
- } catch {
2935
+ } catch (e2) {
3899
2936
  console.error("Invalid variableInstances JSON on this document");
3900
2937
  return;
3901
2938
  }
@@ -3904,16 +2941,16 @@ function VariableInstanceReferencesInput(props) {
3904
2941
  console.warn("No variable instances found in JSON");
3905
2942
  return;
3906
2943
  }
3907
- const keyOnlyPairs = keys.map((key) => ({ key, value: null, _key: (0, import_nanoid9.nanoid)() }));
2944
+ const keyOnlyPairs = keys.map((key) => ({ key, value: null, _key: _nanoid.nanoid.call(void 0, ) }));
3908
2945
  const updatedPairs = mode === "replace" ? keyOnlyPairs : [...value, ...keyOnlyPairs.filter((p) => !value.some((existing) => existing.key === p.key))];
3909
- onChange((0, import_sanity11.set)(updatedPairs));
2946
+ onChange(_sanity.set.call(void 0, updatedPairs));
3910
2947
  } catch (err) {
3911
2948
  console.error("Error during keys-only autofill:", err);
3912
2949
  } finally {
3913
2950
  setIsAutofilling(false);
3914
2951
  }
3915
2952
  }, [formDocument, value, onChange]);
3916
- const handleAutofillWithMatching = (0, import_react15.useCallback)(() => {
2953
+ const handleAutofillWithMatching = _react.useCallback.call(void 0, () => {
3917
2954
  if (value.length > 0) {
3918
2955
  setPendingAction("matching");
3919
2956
  setShowConfirmDialog(true);
@@ -3921,7 +2958,7 @@ function VariableInstanceReferencesInput(props) {
3921
2958
  }
3922
2959
  performAutofillWithMatching("replace");
3923
2960
  }, [value, performAutofillWithMatching]);
3924
- const handleAutofillKeysOnly = (0, import_react15.useCallback)(() => {
2961
+ const handleAutofillKeysOnly = _react.useCallback.call(void 0, () => {
3925
2962
  if (value.length > 0) {
3926
2963
  setPendingAction("keysOnly");
3927
2964
  setShowConfirmDialog(true);
@@ -3929,41 +2966,41 @@ function VariableInstanceReferencesInput(props) {
3929
2966
  }
3930
2967
  performAutofillKeysOnly("replace");
3931
2968
  }, [value, performAutofillKeysOnly]);
3932
- const handleConfirmChoice = (0, import_react15.useCallback)(async (choice) => {
2969
+ const handleConfirmChoice = _react.useCallback.call(void 0, async (choice) => {
3933
2970
  setShowConfirmDialog(false);
3934
2971
  if (pendingAction === "matching") await performAutofillWithMatching(choice);
3935
2972
  else if (pendingAction === "keysOnly") await performAutofillKeysOnly(choice);
3936
2973
  setPendingAction(null);
3937
2974
  }, [pendingAction, performAutofillWithMatching, performAutofillKeysOnly]);
3938
- const handleConfirmCancel = (0, import_react15.useCallback)(() => {
2975
+ const handleConfirmCancel = _react.useCallback.call(void 0, () => {
3939
2976
  setShowConfirmDialog(false);
3940
2977
  setPendingAction(null);
3941
2978
  }, []);
3942
2979
  const showAutofill = !!((formDocument == null ? void 0 : formDocument.variableFont) && (formDocument == null ? void 0 : formDocument.variableInstances));
3943
- const topActions = showAutofill ? /* @__PURE__ */ import_react15.default.createElement(import_ui13.Flex, { gap: 2 }, /* @__PURE__ */ import_react15.default.createElement(
3944
- import_ui13.Button,
2980
+ const topActions = showAutofill ? /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 2 }, /* @__PURE__ */ _react2.default.createElement(
2981
+ _ui.Button,
3945
2982
  {
3946
2983
  tone: "primary",
3947
2984
  mode: "ghost",
3948
2985
  onClick: handleAutofillWithMatching,
3949
- icon: import_icons5.SyncIcon,
2986
+ icon: _icons.SyncIcon,
3950
2987
  text: "Autofill with Matching",
3951
2988
  disabled: isAutofilling,
3952
2989
  loading: isAutofilling
3953
2990
  }
3954
- ), /* @__PURE__ */ import_react15.default.createElement(
3955
- import_ui13.Button,
2991
+ ), /* @__PURE__ */ _react2.default.createElement(
2992
+ _ui.Button,
3956
2993
  {
3957
2994
  tone: "default",
3958
2995
  mode: "ghost",
3959
2996
  onClick: handleAutofillKeysOnly,
3960
- icon: import_icons5.DocumentTextIcon,
2997
+ icon: _icons.DocumentTextIcon,
3961
2998
  text: "Autofill Keys Only",
3962
2999
  disabled: isAutofilling,
3963
3000
  loading: isAutofilling
3964
3001
  }
3965
3002
  )) : null;
3966
- return /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, /* @__PURE__ */ import_react15.default.createElement(
3003
+ return /* @__PURE__ */ _react2.default.createElement(_react2.default.Fragment, null, /* @__PURE__ */ _react2.default.createElement(
3967
3004
  KeyValueReferenceInput,
3968
3005
  {
3969
3006
  ...props,
@@ -3971,43 +3008,43 @@ function VariableInstanceReferencesInput(props) {
3971
3008
  fetchReferences,
3972
3009
  topActions
3973
3010
  }
3974
- ), showConfirmDialog && /* @__PURE__ */ import_react15.default.createElement(
3975
- import_ui13.Dialog,
3011
+ ), showConfirmDialog && /* @__PURE__ */ _react2.default.createElement(
3012
+ _ui.Dialog,
3976
3013
  {
3977
3014
  header: "Existing entries found",
3978
3015
  id: "autofill-confirm-dialog",
3979
3016
  onClose: handleConfirmCancel,
3980
3017
  width: 1
3981
3018
  },
3982
- /* @__PURE__ */ import_react15.default.createElement(import_ui13.Box, { padding: 4 }, /* @__PURE__ */ import_react15.default.createElement(import_ui13.Stack, { space: 4 }, /* @__PURE__ */ import_react15.default.createElement(import_ui13.Text, null, "You already have ", value.length, " ", value.length === 1 ? "entry" : "entries", ". How would you like to proceed?"), /* @__PURE__ */ import_react15.default.createElement(import_ui13.Flex, { gap: 2, justify: "flex-end" }, /* @__PURE__ */ import_react15.default.createElement(import_ui13.Button, { text: "Cancel", mode: "ghost", onClick: handleConfirmCancel }), /* @__PURE__ */ import_react15.default.createElement(import_ui13.Button, { text: "Merge (Add New)", tone: "primary", mode: "ghost", onClick: () => handleConfirmChoice("merge") }), /* @__PURE__ */ import_react15.default.createElement(import_ui13.Button, { text: "Replace All", tone: "critical", onClick: () => handleConfirmChoice("replace") }))))
3019
+ /* @__PURE__ */ _react2.default.createElement(_ui.Box, { padding: 4 }, /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 4 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, null, "You already have ", value.length, " ", value.length === 1 ? "entry" : "entries", ". How would you like to proceed?"), /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 2, justify: "flex-end" }, /* @__PURE__ */ _react2.default.createElement(_ui.Button, { text: "Cancel", mode: "ghost", onClick: handleConfirmCancel }), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { text: "Merge (Add New)", tone: "primary", mode: "ghost", onClick: () => handleConfirmChoice("merge") }), /* @__PURE__ */ _react2.default.createElement(_ui.Button, { text: "Replace All", tone: "critical", onClick: () => handleConfirmChoice("replace") }))))
3983
3020
  ));
3984
3021
  }
3985
3022
 
3986
3023
  // src/components/PrimaryCollectionGeneratorTypeface.jsx
3987
- var import_react16 = __toESM(require("react"));
3988
- var import_ui14 = require("@sanity/ui");
3989
- var import_sanity12 = require("sanity");
3990
- var import_nanoid10 = require("nanoid");
3024
+
3025
+
3026
+
3027
+
3991
3028
  var PrimaryCollectionGeneratorTypeface = () => {
3992
3029
  const client = useSanityClient();
3993
- const [status, setStatus] = (0, import_react16.useState)("ready");
3994
- const [ready, setReady] = (0, import_react16.useState)(true);
3995
- const [price, setPrice] = (0, import_react16.useState)(
3030
+ const [status, setStatus] = _react.useState.call(void 0, "ready");
3031
+ const [ready, setReady] = _react.useState.call(void 0, true);
3032
+ const [price, setPrice] = _react.useState.call(void 0,
3996
3033
  process.env.SANITY_STUDIO_DEFAULT_COLLECTION_PRICE || 100
3997
3034
  );
3998
- const fonts = (0, import_sanity12.useFormValue)(["styles", "fonts"]);
3999
- const title = (0, import_sanity12.useFormValue)(["title"]);
4000
- const preferredStyle = (0, import_sanity12.useFormValue)(["preferredStyle"]);
4001
- const docId = (0, import_sanity12.useFormValue)(["_id"]);
4002
- const styles = (0, import_sanity12.useFormValue)(["styles"]);
4003
- const generateCollection = (0, import_react16.useCallback)(async () => {
3035
+ const fonts = _sanity.useFormValue.call(void 0, ["styles", "fonts"]);
3036
+ const title = _sanity.useFormValue.call(void 0, ["title"]);
3037
+ const preferredStyle = _sanity.useFormValue.call(void 0, ["preferredStyle"]);
3038
+ const docId = _sanity.useFormValue.call(void 0, ["_id"]);
3039
+ const styles = _sanity.useFormValue.call(void 0, ["styles"]);
3040
+ const generateCollection = _react.useCallback.call(void 0, async () => {
4004
3041
  setStatus("Generating collection...");
4005
3042
  setReady(false);
4006
3043
  let id = title.toLowerCase().replace(/\s+/g, "-").slice(0, 200);
4007
3044
  if (!id.includes("collection")) id += "-collection";
4008
3045
  const colTitle = id.replace(/-/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
4009
3046
  const collectionDoc = {
4010
- _key: (0, import_nanoid10.nanoid)(),
3047
+ _key: _nanoid.nanoid.call(void 0, ),
4011
3048
  _id: id,
4012
3049
  title: colTitle,
4013
3050
  slug: { _type: "slug", current: id },
@@ -4025,7 +3062,7 @@ var PrimaryCollectionGeneratorTypeface = () => {
4025
3062
  ...styles,
4026
3063
  collections: [{
4027
3064
  _type: "reference",
4028
- _key: (0, import_nanoid10.nanoid)(),
3065
+ _key: _nanoid.nanoid.call(void 0, ),
4029
3066
  _ref: sanityCollection._id,
4030
3067
  _weak: true
4031
3068
  }, ...collections]
@@ -4039,7 +3076,7 @@ var PrimaryCollectionGeneratorTypeface = () => {
4039
3076
  setReady(true);
4040
3077
  }, [docId, fonts, price, preferredStyle, styles, title, client]);
4041
3078
  if (!title || !fonts) return null;
4042
- return /* @__PURE__ */ import_react16.default.createElement(import_ui14.Stack, { space: 2 }, /* @__PURE__ */ import_react16.default.createElement(StatusDisplay_default, { status, error: false }), /* @__PURE__ */ import_react16.default.createElement(import_ui14.Card, { border: true, padding: 2, shadow: 1, radius: 2 }, ready ? /* @__PURE__ */ import_react16.default.createElement(import_ui14.Stack, { space: 3 }, /* @__PURE__ */ import_react16.default.createElement(import_ui14.Flex, { align: "center", gap: 2, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ import_react16.default.createElement(import_ui14.Text, { size: 1, muted: true }, "Price"), /* @__PURE__ */ import_react16.default.createElement(import_ui14.Text, { size: 1, muted: true }, "$"), /* @__PURE__ */ import_react16.default.createElement(
3079
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 2 }, /* @__PURE__ */ _react2.default.createElement(StatusDisplay_default, { status, error: false }), /* @__PURE__ */ _react2.default.createElement(_ui.Card, { border: true, padding: 2, shadow: 1, radius: 2 }, ready ? /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", gap: 2, marginTop: 1, marginBottom: 1 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "Price"), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "$"), /* @__PURE__ */ _react2.default.createElement(
4043
3080
  "input",
4044
3081
  {
4045
3082
  value: price,
@@ -4047,8 +3084,8 @@ var PrimaryCollectionGeneratorTypeface = () => {
4047
3084
  type: "number",
4048
3085
  style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
4049
3086
  }
4050
- ), /* @__PURE__ */ import_react16.default.createElement(import_ui14.Text, { size: 1, muted: true }, "per full family")), /* @__PURE__ */ import_react16.default.createElement(
4051
- import_ui14.Button,
3087
+ ), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "per full family")), /* @__PURE__ */ _react2.default.createElement(
3088
+ _ui.Button,
4052
3089
  {
4053
3090
  mode: "ghost",
4054
3091
  tone: "primary",
@@ -4056,19 +3093,19 @@ var PrimaryCollectionGeneratorTypeface = () => {
4056
3093
  onClick: generateCollection,
4057
3094
  text: "Generate Full Family Collection"
4058
3095
  }
4059
- )) : /* @__PURE__ */ import_react16.default.createElement(import_ui14.Flex, { align: "center", justify: "center", gap: 3, padding: 4 }, /* @__PURE__ */ import_react16.default.createElement(import_ui14.Spinner, null), /* @__PURE__ */ import_react16.default.createElement(import_ui14.Text, { muted: true, size: 1 }, status))));
3096
+ )) : /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", justify: "center", gap: 3, padding: 4 }, /* @__PURE__ */ _react2.default.createElement(_ui.Spinner, null), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { muted: true, size: 1 }, status))));
4060
3097
  };
4061
3098
 
4062
3099
  // src/components/SetOTF.jsx
4063
- var import_react17 = __toESM(require("react"));
4064
- var import_sanity13 = require("sanity");
4065
- var import_ui15 = require("@sanity/ui");
3100
+
3101
+
3102
+
4066
3103
  var SetOTF = (props) => {
4067
3104
  var _a, _b;
4068
3105
  const { onChange, value = {} } = props;
4069
3106
  const client = useSanityClient();
4070
- const stylesObject = (0, import_sanity13.useFormValue)(["styles"]);
4071
- const [message, setMessage] = (0, import_react17.useState)("");
3107
+ const stylesObject = _sanity.useFormValue.call(void 0, ["styles"]);
3108
+ const [message, setMessage] = _react.useState.call(void 0, "");
4072
3109
  const detect = async () => {
4073
3110
  var _a2, _b2, _c;
4074
3111
  if (!((_a2 = stylesObject == null ? void 0 : stylesObject.fonts) == null ? void 0 : _a2.length)) {
@@ -4103,7 +3140,7 @@ var SetOTF = (props) => {
4103
3140
  if (approved) features.push(key);
4104
3141
  }
4105
3142
  });
4106
- onChange((0, import_sanity13.set)({ ...value, features }));
3143
+ onChange(_sanity.set.call(void 0, { ...value, features }));
4107
3144
  setMessage(`Features detected: ${features.length ? features.join(", ") : "none"}.`);
4108
3145
  setTimeout(() => setMessage(""), 5e3);
4109
3146
  } catch (err) {
@@ -4111,35 +3148,35 @@ var SetOTF = (props) => {
4111
3148
  console.error("SetOTF detect error:", err);
4112
3149
  }
4113
3150
  };
4114
- return /* @__PURE__ */ import_react17.default.createElement(import_ui15.Stack, { className: "openType" }, ((_a = value == null ? void 0 : value.features) == null ? void 0 : _a.length) > 0 && /* @__PURE__ */ import_react17.default.createElement(import_ui15.Text, { 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__ */ import_react17.default.createElement(
4115
- import_ui15.Button,
3151
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { className: "openType" }, ((_a = value == null ? void 0 : value.features) == null ? void 0 : _a.length) > 0 && /* @__PURE__ */ _react2.default.createElement(_ui.Text, { 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__ */ _react2.default.createElement(
3152
+ _ui.Button,
4116
3153
  {
4117
3154
  text: "Detect OTF",
4118
3155
  mode: "ghost",
4119
3156
  onClick: detect,
4120
3157
  style: { borderRadius: "0 3px 0 0", marginBottom: "1rem" }
4121
3158
  }
4122
- ), !!message && /* @__PURE__ */ import_react17.default.createElement(import_ui15.Text, { muted: true, size: 1 }, /* @__PURE__ */ import_react17.default.createElement("br", null), message, /* @__PURE__ */ import_react17.default.createElement("br", null), /* @__PURE__ */ import_react17.default.createElement("br", null)), props.renderDefault(props));
3159
+ ), !!message && /* @__PURE__ */ _react2.default.createElement(_ui.Text, { muted: true, size: 1 }, /* @__PURE__ */ _react2.default.createElement("br", null), message, /* @__PURE__ */ _react2.default.createElement("br", null), /* @__PURE__ */ _react2.default.createElement("br", null)), props.renderDefault(props));
4123
3160
  };
4124
3161
 
4125
3162
  // src/components/StyleCountInput.jsx
4126
- var import_react18 = __toESM(require("react"));
4127
- var import_ui16 = require("@sanity/ui");
4128
- var import_sanity14 = require("sanity");
3163
+
3164
+
3165
+
4129
3166
  var StyleCountInput = (props) => {
4130
- const styles = (0, import_sanity14.useFormValue)(["styles", "fonts"]) || [];
4131
- const vfStyles = (0, import_sanity14.useFormValue)(["styles", "variableFont"]) || [];
3167
+ const styles = _sanity.useFormValue.call(void 0, ["styles", "fonts"]) || [];
3168
+ const vfStyles = _sanity.useFormValue.call(void 0, ["styles", "variableFont"]) || [];
4132
3169
  const count = styles.length + vfStyles.length;
4133
- return /* @__PURE__ */ import_react18.default.createElement(import_ui16.Text, { size: 1 }, count);
3170
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1 }, count);
4134
3171
  };
4135
3172
 
4136
3173
  // src/components/NestedObjectArraySelector.jsx
4137
- var import_react20 = __toESM(require("react"));
4138
- var import_ui17 = require("@sanity/ui");
3174
+
3175
+
4139
3176
 
4140
3177
  // src/hooks/useNestedObjects.js
4141
- var import_react19 = require("react");
4142
- var import_sanity15 = require("sanity");
3178
+
3179
+
4143
3180
  function useNestedObjects({
4144
3181
  sourceType,
4145
3182
  nestedField,
@@ -4148,11 +3185,11 @@ function useNestedObjects({
4148
3185
  filter = "",
4149
3186
  sortBy = ""
4150
3187
  }) {
4151
- const client = (0, import_sanity15.useClient)({ apiVersion: "2023-01-01" });
4152
- const [objects, setObjects] = (0, import_react19.useState)([]);
4153
- const [loading, setLoading] = (0, import_react19.useState)(true);
4154
- const [error, setError] = (0, import_react19.useState)(null);
4155
- (0, import_react19.useEffect)(() => {
3188
+ const client = _sanity.useClient.call(void 0, { apiVersion: "2023-01-01" });
3189
+ const [objects, setObjects] = _react.useState.call(void 0, []);
3190
+ const [loading, setLoading] = _react.useState.call(void 0, true);
3191
+ const [error, setError] = _react.useState.call(void 0, null);
3192
+ _react.useEffect.call(void 0, () => {
4156
3193
  if (!sourceType || !nestedField || !titleField || !valueField) {
4157
3194
  setError(new Error("Missing required configuration"));
4158
3195
  setLoading(false);
@@ -4206,8 +3243,8 @@ function useNestedObjects({
4206
3243
  }
4207
3244
 
4208
3245
  // src/components/NestedObjectArraySelector.jsx
4209
- var import_sanity16 = require("sanity");
4210
- var NestedObjectArraySelector = import_react20.default.forwardRef((props, ref) => {
3246
+
3247
+ var NestedObjectArraySelector = _react2.default.forwardRef((props, ref) => {
4211
3248
  const { value = [], onChange, schemaType } = props;
4212
3249
  const options = (schemaType == null ? void 0 : schemaType.options) || {};
4213
3250
  const {
@@ -4220,9 +3257,9 @@ var NestedObjectArraySelector = import_react20.default.forwardRef((props, ref) =
4220
3257
  emptyMessage = "No options found",
4221
3258
  searchPlaceholder = "Search..."
4222
3259
  } = options;
4223
- const [searchTerm, setSearchTerm] = (0, import_react20.useState)("");
3260
+ const [searchTerm, setSearchTerm] = _react.useState.call(void 0, "");
4224
3261
  const { objects, loading, error } = useNestedObjects({ sourceType, nestedField, titleField, valueField, filter, sortBy });
4225
- const filteredObjects = (0, import_react20.useMemo)(() => {
3262
+ const filteredObjects = _react.useMemo.call(void 0, () => {
4226
3263
  if (!searchTerm) return objects;
4227
3264
  const lower = searchTerm.toLowerCase();
4228
3265
  return objects.filter((obj) => {
@@ -4235,24 +3272,24 @@ var NestedObjectArraySelector = import_react20.default.forwardRef((props, ref) =
4235
3272
  const isSelected = currentValue.includes(itemValue);
4236
3273
  if (isSelected) {
4237
3274
  const newValue = currentValue.filter((v) => v !== itemValue);
4238
- onChange(newValue.length > 0 ? (0, import_sanity16.set)(newValue) : (0, import_sanity16.unset)());
3275
+ onChange(newValue.length > 0 ? _sanity.set.call(void 0, newValue) : _sanity.unset.call(void 0, ));
4239
3276
  } else {
4240
- onChange((0, import_sanity16.set)([...currentValue, itemValue]));
3277
+ onChange(_sanity.set.call(void 0, [...currentValue, itemValue]));
4241
3278
  }
4242
3279
  };
4243
3280
  if (!sourceType || !nestedField || !titleField || !valueField) {
4244
- return /* @__PURE__ */ import_react20.default.createElement(import_ui17.Card, { padding: 3, tone: "critical", border: true }, /* @__PURE__ */ import_react20.default.createElement(import_ui17.Text, { size: 1 }, "Configuration error: Missing required options (sourceType, nestedField, titleField, or valueField)"));
3281
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { padding: 3, tone: "critical", border: true }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1 }, "Configuration error: Missing required options (sourceType, nestedField, titleField, or valueField)"));
4245
3282
  }
4246
3283
  if (loading) {
4247
- return /* @__PURE__ */ import_react20.default.createElement(import_ui17.Card, { padding: 3, border: true }, /* @__PURE__ */ import_react20.default.createElement(import_ui17.Flex, { align: "center", justify: "center", padding: 4 }, /* @__PURE__ */ import_react20.default.createElement(import_ui17.Spinner, null), /* @__PURE__ */ import_react20.default.createElement(import_ui17.Box, { marginLeft: 3 }, /* @__PURE__ */ import_react20.default.createElement(import_ui17.Text, { size: 1 }, "Loading options..."))));
3284
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { padding: 3, border: true }, /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", justify: "center", padding: 4 }, /* @__PURE__ */ _react2.default.createElement(_ui.Spinner, null), /* @__PURE__ */ _react2.default.createElement(_ui.Box, { marginLeft: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1 }, "Loading options..."))));
4248
3285
  }
4249
3286
  if (error) {
4250
- return /* @__PURE__ */ import_react20.default.createElement(import_ui17.Card, { padding: 3, tone: "critical", border: true }, /* @__PURE__ */ import_react20.default.createElement(import_ui17.Text, { size: 1 }, "Error loading options: ", error.message));
3287
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { padding: 3, tone: "critical", border: true }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1 }, "Error loading options: ", error.message));
4251
3288
  }
4252
3289
  if (objects.length === 0) {
4253
- return /* @__PURE__ */ import_react20.default.createElement(import_ui17.Card, { padding: 3, tone: "transparent", border: true }, /* @__PURE__ */ import_react20.default.createElement(import_ui17.Text, { size: 1, muted: true }, emptyMessage));
3290
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { padding: 3, tone: "transparent", border: true }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, emptyMessage));
4254
3291
  }
4255
- return /* @__PURE__ */ import_react20.default.createElement(import_ui17.Card, { padding: 0, border: true, ref }, objects.length > 5 && /* @__PURE__ */ import_react20.default.createElement(import_ui17.Box, { padding: 3, style: { borderBottom: "1px solid var(--card-border-color)" } }, /* @__PURE__ */ import_react20.default.createElement(
3292
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Card, { padding: 0, border: true, ref }, objects.length > 5 && /* @__PURE__ */ _react2.default.createElement(_ui.Box, { padding: 3, style: { borderBottom: "1px solid var(--card-border-color)" } }, /* @__PURE__ */ _react2.default.createElement(
4256
3293
  "input",
4257
3294
  {
4258
3295
  type: "text",
@@ -4261,39 +3298,39 @@ var NestedObjectArraySelector = import_react20.default.forwardRef((props, ref) =
4261
3298
  onChange: (e) => setSearchTerm(e.target.value),
4262
3299
  style: { width: "100%", padding: "8px 12px", border: "1px solid var(--card-border-color)", borderRadius: "4px", fontSize: "13px", fontFamily: "inherit" }
4263
3300
  }
4264
- )), /* @__PURE__ */ import_react20.default.createElement(import_ui17.Stack, { space: 0 }, filteredObjects.length === 0 ? /* @__PURE__ */ import_react20.default.createElement(import_ui17.Box, { padding: 3 }, /* @__PURE__ */ import_react20.default.createElement(import_ui17.Text, { size: 1, muted: true }, 'No results found for "', searchTerm, '"')) : filteredObjects.map((obj, index) => {
3301
+ )), /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 0 }, filteredObjects.length === 0 ? /* @__PURE__ */ _react2.default.createElement(_ui.Box, { padding: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, 'No results found for "', searchTerm, '"')) : filteredObjects.map((obj, index) => {
4265
3302
  const isSelected = value == null ? void 0 : value.includes(obj.value);
4266
3303
  const isLast = index === filteredObjects.length - 1;
4267
- return /* @__PURE__ */ import_react20.default.createElement(
4268
- import_ui17.Box,
3304
+ return /* @__PURE__ */ _react2.default.createElement(
3305
+ _ui.Box,
4269
3306
  {
4270
3307
  key: obj.value,
4271
3308
  padding: 3,
4272
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" },
4273
3310
  onClick: () => handleToggle(obj.value)
4274
3311
  },
4275
- /* @__PURE__ */ import_react20.default.createElement(import_ui17.Flex, { align: "center", gap: 3 }, /* @__PURE__ */ import_react20.default.createElement(import_ui17.Checkbox, { checked: isSelected, readOnly: true, style: { pointerEvents: "none" } }), /* @__PURE__ */ import_react20.default.createElement(import_ui17.Text, { size: 1, weight: isSelected ? "semibold" : "regular" }, obj.title))
3312
+ /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { align: "center", gap: 3 }, /* @__PURE__ */ _react2.default.createElement(_ui.Checkbox, { checked: isSelected, readOnly: true, style: { pointerEvents: "none" } }), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, weight: isSelected ? "semibold" : "regular" }, obj.title))
4276
3313
  );
4277
- })), (value == null ? void 0 : value.length) > 0 && /* @__PURE__ */ import_react20.default.createElement(import_ui17.Box, { padding: 2, paddingX: 3, style: { borderTop: "1px solid var(--card-border-color)", backgroundColor: "var(--card-muted-fg-color)" } }, /* @__PURE__ */ import_react20.default.createElement(import_ui17.Text, { size: 1, muted: true }, value.length, " selected")));
3314
+ })), (value == null ? void 0 : value.length) > 0 && /* @__PURE__ */ _react2.default.createElement(_ui.Box, { padding: 2, paddingX: 3, style: { borderTop: "1px solid var(--card-border-color)", backgroundColor: "var(--card-muted-fg-color)" } }, /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, value.length, " selected")));
4278
3315
  });
4279
3316
  NestedObjectArraySelector.displayName = "NestedObjectArraySelector";
4280
3317
 
4281
3318
  // src/utils/getEmptyFontKit.js
4282
- var fontkit7 = __toESM(require("fontkit"));
4283
- var import_slugify4 = __toESM(require("slugify"));
3319
+
4284
3320
  async function getEmptyFontKit({ title, files, weightKeywordList, italicKeywordList }) {
4285
- var _a, _b, _c, _d, _e, _f;
4286
3321
  let fontNames = {};
4287
3322
  let subfamilies = {};
4288
3323
  for (var i = 0; i < files.length; i++) {
4289
3324
  const file = files[i];
4290
3325
  const fontBuffer = await readFontFile2(file);
4291
- const font = fontkit7.create(fontBuffer);
4292
- 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;
4293
- weightName = (weightName == null ? void 0 : weightName.en) ? weightName.en : weightName.constructor == Object ? weightName[Object.keys(weightName)[0]] : weightName;
4294
- let variableFont = (font == null ? void 0 : font.variationAxes) && Object.keys(font.variationAxes).length > 0 ? true : false;
4295
- let subfamilyName = font.familyName.toLowerCase().trim().replace(title.toLowerCase().trim(), "").trim();
4296
- let fontTitle = font == null ? void 0 : font.fullName.toLowerCase().trim();
3326
+ const font = await _chunkFH4QKHOHjs.parseFont.call(void 0, fontBuffer, file.name);
3327
+ let weightName = _chunkFH4QKHOHjs.getNameString.call(void 0, font, 17) || _chunkFH4QKHOHjs.getNameString.call(void 0, font, 2) || "";
3328
+ const axes = _chunkFH4QKHOHjs.getVariationAxes.call(void 0, font);
3329
+ let variableFont = axes !== null;
3330
+ const familyName = _chunkFH4QKHOHjs.getNameString.call(void 0, font, 1);
3331
+ const fullName = _chunkFH4QKHOHjs.getNameString.call(void 0, font, 4);
3332
+ let subfamilyName = familyName.toLowerCase().trim().replace(title.toLowerCase().trim(), "").trim();
3333
+ let fontTitle = fullName.toLowerCase().trim();
4297
3334
  weightKeywordList.forEach((keyword) => {
4298
3335
  const kw = keyword.toLowerCase().trim();
4299
3336
  if (fontTitle.includes(kw)) {
@@ -4315,7 +3352,7 @@ async function getEmptyFontKit({ title, files, weightKeywordList, italicKeywordL
4315
3352
  fontTitle = fontTitle.trim().split(" ").map((word) => word[0].toUpperCase() + word.slice(1)).join(" ");
4316
3353
  subfamilyName = subfamilyName.trim();
4317
3354
  subfamilyName = subfamilyName == "" ? "Regular" : subfamilyName.split(" ").map((word) => word[0].toUpperCase() + word.slice(1)).join(" ");
4318
- let id = (0, import_slugify4.default)(fontTitle.toLowerCase().trim());
3355
+ let id = _slugify2.default.call(void 0, fontTitle.toLowerCase().trim());
4319
3356
  if (variableFont && !id.endsWith("-vf")) {
4320
3357
  id = id + "-vf";
4321
3358
  fontTitle = fontTitle + " VF";
@@ -4328,26 +3365,26 @@ async function getEmptyFontKit({ title, files, weightKeywordList, italicKeywordL
4328
3365
  if (!fontNames[id]) {
4329
3366
  fontNames[id] = [{
4330
3367
  file: file.name,
4331
- fullName: font.fullName,
4332
- familyName: font.familyName,
3368
+ fullName,
3369
+ familyName,
4333
3370
  subFamily: subfamilyName
4334
3371
  }];
4335
3372
  } else if (fontNames[id].indexOf(file.name) == -1) {
4336
3373
  fontNames[id].push({
4337
3374
  file: file.name,
4338
- fullName: font.fullName,
4339
- familyName: font.familyName,
3375
+ fullName,
3376
+ familyName,
4340
3377
  subFamily: subfamilyName
4341
3378
  });
4342
3379
  }
4343
3380
  }
4344
- console.log("font names : ", fontNames);
3381
+ console.log("Font names:", fontNames);
4345
3382
  }
4346
3383
  var readFontFile2 = (file) => {
4347
3384
  return new Promise((resolve, reject) => {
4348
3385
  const reader = new FileReader();
4349
3386
  reader.onload = (event) => {
4350
- resolve(new Uint8Array(event.target.result));
3387
+ resolve(event.target.result);
4351
3388
  };
4352
3389
  reader.onerror = (error) => {
4353
3390
  reject(error);
@@ -6510,7 +5547,7 @@ var styleCountField = {
6510
5547
  };
6511
5548
 
6512
5549
  // src/schema/stylisticSetField.js
6513
- var import_icons6 = require("@sanity/icons");
5550
+
6514
5551
  var stylisticSetField = {
6515
5552
  title: "Stylistic Features Section",
6516
5553
  name: "stylisticSet",
@@ -6527,7 +5564,7 @@ var stylisticSetField = {
6527
5564
  name: "featuredWord",
6528
5565
  title: "Words or Phrase",
6529
5566
  type: "object",
6530
- icon: import_icons6.StringIcon,
5567
+ icon: _icons.StringIcon,
6531
5568
  fields: [
6532
5569
  {
6533
5570
  type: "text",
@@ -6678,7 +5715,7 @@ var stylisticSetField = {
6678
5715
  name: "set",
6679
5716
  type: "object",
6680
5717
  title: "Stylistic Feature",
6681
- icon: import_icons6.StringIcon,
5718
+ icon: _icons.StringIcon,
6682
5719
  fields: [
6683
5720
  {
6684
5721
  name: "title",
@@ -6810,15 +5847,15 @@ var stylisticSetField = {
6810
5847
  };
6811
5848
 
6812
5849
  // src/schema/stylesField.js
6813
- var import_react21 = __toESM(require("react"));
6814
- var import_sanity_advanced_reference_array = require("@liiift-studio/sanity-advanced-reference-array");
5850
+
5851
+ var _sanityadvancedreferencearray = require('@liiift-studio/sanity-advanced-reference-array');
6815
5852
  var typefaceParams = (doc) => ({ typefaceName: (doc == null ? void 0 : doc.title) || "" });
6816
- var FontsRefArray = (props) => import_react21.default.createElement(import_sanity_advanced_reference_array.AdvancedRefArray, {
5853
+ var FontsRefArray = (props) => _react2.default.createElement(_sanityadvancedreferencearray.AdvancedRefArray, {
6817
5854
  ...props,
6818
5855
  filterGroq: "lower(typefaceName) == lower($typefaceName)",
6819
5856
  filterParams: typefaceParams
6820
5857
  });
6821
- var VariableFontsRefArray = (props) => import_react21.default.createElement(import_sanity_advanced_reference_array.AdvancedRefArray, {
5858
+ var VariableFontsRefArray = (props) => _react2.default.createElement(_sanityadvancedreferencearray.AdvancedRefArray, {
6822
5859
  ...props,
6823
5860
  filterGroq: "lower(typefaceName) == lower($typefaceName) && variableFont == true",
6824
5861
  filterParams: typefaceParams
@@ -7018,7 +6055,7 @@ function createStylesField({
7018
6055
  title: "Collections",
7019
6056
  name: "collections",
7020
6057
  type: "array",
7021
- components: { input: import_sanity_advanced_reference_array.AdvancedRefArray },
6058
+ components: { input: _sanityadvancedreferencearray.AdvancedRefArray },
7022
6059
  of: [{ type: "reference", weak: true, to: [{ type: "collection" }] }],
7023
6060
  options: { sortable: true },
7024
6061
  validation: (Rule) => Rule.unique()
@@ -7027,7 +6064,7 @@ function createStylesField({
7027
6064
  title: "Pairs",
7028
6065
  name: "pairs",
7029
6066
  type: "array",
7030
- components: { input: import_sanity_advanced_reference_array.AdvancedRefArray },
6067
+ components: { input: _sanityadvancedreferencearray.AdvancedRefArray },
7031
6068
  of: [{ type: "reference", weak: true, to: [{ type: "pair" }] }],
7032
6069
  options: { sortable: true },
7033
6070
  validation: (Rule) => Rule.unique(),
@@ -7043,62 +6080,97 @@ function createStylesField({
7043
6080
  options: { collapsible: true }
7044
6081
  };
7045
6082
  }
7046
- // Annotate the CommonJS export names for ESM import in node:
7047
- 0 && (module.exports = {
7048
- BatchUploadFonts,
7049
- DISCOUNT_REQUIREMENT_TYPES,
7050
- DISCOUNT_REQUIREMENT_TYPES_OBJECT,
7051
- FontScriptUploaderComponent,
7052
- GenerateCollectionsPairsComponent,
7053
- HtmlDescription,
7054
- KeyValueInput,
7055
- KeyValueReferenceInput,
7056
- NestedObjectArraySelector,
7057
- PriceInput,
7058
- PrimaryCollectionGeneratorTypeface,
7059
- RegenerateSubfamiliesComponent,
7060
- SCRIPTS,
7061
- SCRIPTS_OBJECT,
7062
- SetOTF,
7063
- SingleUploaderTool,
7064
- StatusDisplay,
7065
- StyleCountInput,
7066
- UpdateScriptsComponent,
7067
- UploadButton,
7068
- UploadScriptsComponent,
7069
- VariableInstanceReferencesInput,
7070
- addItalicToFontTitle,
7071
- createFontObject,
7072
- createStylesField,
7073
- determineWeight,
7074
- expandAbbreviations,
7075
- extractFontMetadata,
7076
- extractWeightFromFullName,
7077
- extractWeightName,
7078
- formatFontTitle,
7079
- generateCssFile,
7080
- generateFontData,
7081
- generateFontFile,
7082
- generateStyleKeywords,
7083
- generateSubset,
7084
- getEmptyFontKit,
7085
- logFontInfo,
7086
- openTypeField,
7087
- parseVariableFontInstances,
7088
- processFontFiles,
7089
- processItalicKeywords,
7090
- processSubfamilyName,
7091
- readFontFile,
7092
- removeWeightNames,
7093
- renameFontDocuments,
7094
- reverseSpellingLookup,
7095
- sanitizeForSanityId,
7096
- sortFontObjects,
7097
- styleCountField,
7098
- stylisticSetField,
7099
- updateFontPrices,
7100
- updateTypefaceDocument,
7101
- uploadFontFiles,
7102
- useNestedObjects,
7103
- useSanityClient
7104
- });
6083
+
6084
+
6085
+
6086
+
6087
+
6088
+
6089
+
6090
+
6091
+
6092
+
6093
+
6094
+
6095
+
6096
+
6097
+
6098
+
6099
+
6100
+
6101
+
6102
+
6103
+
6104
+
6105
+
6106
+
6107
+
6108
+
6109
+
6110
+
6111
+
6112
+
6113
+
6114
+
6115
+
6116
+
6117
+
6118
+
6119
+
6120
+
6121
+
6122
+
6123
+
6124
+
6125
+
6126
+
6127
+
6128
+
6129
+
6130
+
6131
+
6132
+
6133
+
6134
+
6135
+
6136
+
6137
+
6138
+
6139
+
6140
+
6141
+
6142
+
6143
+
6144
+
6145
+
6146
+
6147
+
6148
+
6149
+
6150
+
6151
+
6152
+
6153
+
6154
+
6155
+
6156
+
6157
+
6158
+
6159
+
6160
+
6161
+
6162
+
6163
+
6164
+
6165
+
6166
+
6167
+
6168
+
6169
+
6170
+
6171
+
6172
+
6173
+
6174
+
6175
+
6176
+ exports.BatchUploadFonts = BatchUploadFonts; exports.BulkActions = _chunkFH4QKHOHjs.BulkActions; exports.DISCOUNT_REQUIREMENT_TYPES = DISCOUNT_REQUIREMENT_TYPES; exports.DISCOUNT_REQUIREMENT_TYPES_OBJECT = DISCOUNT_REQUIREMENT_TYPES_OBJECT; exports.EXECUTION_STATUS = _chunkFH4QKHOHjs.EXECUTION_STATUS; exports.ExistingDocumentResolver = _chunkFH4QKHOHjs.ExistingDocumentResolver; exports.FONT_STATUS = _chunkFH4QKHOHjs.FONT_STATUS; exports.FontReviewCard = _chunkFH4QKHOHjs.FontReviewCard_default; exports.FontScriptUploaderComponent = FontScriptUploaderComponent; exports.GenerateCollectionsPairsComponent = GenerateCollectionsPairsComponent; exports.HtmlDescription = HtmlDescription; exports.KeyValueInput = KeyValueInput; exports.KeyValueReferenceInput = KeyValueReferenceInput; exports.NestedObjectArraySelector = NestedObjectArraySelector; exports.PLAN_PHASE = _chunkFH4QKHOHjs.PLAN_PHASE; exports.PLAN_VERSION = _chunkFH4QKHOHjs.PLAN_VERSION; exports.PriceInput = _chunkFH4QKHOHjs.PriceInput_default; exports.PrimaryCollectionGeneratorTypeface = PrimaryCollectionGeneratorTypeface; exports.RECOMMENDATION = _chunkFH4QKHOHjs.RECOMMENDATION; exports.RegenerateSubfamiliesComponent = RegenerateSubfamiliesComponent; exports.SCRIPTS = SCRIPTS; exports.SCRIPTS_OBJECT = SCRIPTS_OBJECT; exports.SetOTF = SetOTF; exports.SingleUploaderTool = SingleUploaderTool; exports.StatusDisplay = StatusDisplay_default; exports.StyleCountInput = StyleCountInput; exports.UpdateScriptsComponent = UpdateScriptsComponent; exports.UploadButton = UploadButton_default; exports.UploadModal = _chunkFH4QKHOHjs.UploadModal; exports.UploadScriptsComponent = UploadScriptsComponent; exports.UploadStep1Settings = _chunkFH4QKHOHjs.UploadStep1Settings; exports.UploadStep2Review = _chunkFH4QKHOHjs.UploadStep2Review; exports.UploadStep3Execute = _chunkFH4QKHOHjs.UploadStep3Execute; exports.UploadSummary = _chunkFH4QKHOHjs.UploadSummary; exports.VariableInstanceReferencesInput = VariableInstanceReferencesInput; exports.addItalicToFontTitle = _chunkFH4QKHOHjs.addItalicToFontTitle; exports.buildUploadPlan = _chunkFH4QKHOHjs.buildUploadPlan; exports.createEmptyPlan = _chunkFH4QKHOHjs.createEmptyPlan; exports.createFontDecisions = _chunkFH4QKHOHjs.createFontDecisions; exports.createFontObject = _chunkFH4QKHOHjs.createFontObject; exports.createInitialExecutionState = _chunkFH4QKHOHjs.createInitialExecutionState; exports.createStylesField = createStylesField; exports.determineWeight = _chunkFH4QKHOHjs.determineWeight; exports.escapeCssFontName = _chunkFH4QKHOHjs.escapeCssFontName; exports.executeUploadPlan = _chunkFH4QKHOHjs.executeUploadPlan; exports.executionReducer = _chunkFH4QKHOHjs.executionReducer; exports.expandAbbreviations = _chunkFH4QKHOHjs.expandAbbreviations; exports.extractFontMetadata = _chunkFH4QKHOHjs.extractFontMetadata; exports.extractWeightFromFullName = _chunkFH4QKHOHjs.extractWeightFromFullName; exports.extractWeightName = _chunkFH4QKHOHjs.extractWeightName; exports.formatFontTitle = _chunkFH4QKHOHjs.formatFontTitle; exports.generateCssFile = _chunkFH4QKHOHjs.generateCssFile; exports.generateFontData = _chunkFH4QKHOHjs.generateFontData; exports.generateFontFile = generateFontFile; exports.generateStyleKeywords = _chunkFH4QKHOHjs.generateStyleKeywords; exports.generateSubset = generateSubset; exports.getAllFeatureTags = _chunkFH4QKHOHjs.getAllFeatureTags; exports.getCharacterSet = _chunkFH4QKHOHjs.getCharacterSet; exports.getEmptyFontKit = getEmptyFontKit; exports.getFamilyClass = _chunkFH4QKHOHjs.getFamilyClass; exports.getFontMetadata = _chunkFH4QKHOHjs.getFontMetadata; exports.getFontMetrics = _chunkFH4QKHOHjs.getFontMetrics; exports.getFsSelection = _chunkFH4QKHOHjs.getFsSelection; exports.getGlyphCount = _chunkFH4QKHOHjs.getGlyphCount; exports.getItalicAngle = _chunkFH4QKHOHjs.getItalicAngle; exports.getMacStyle = _chunkFH4QKHOHjs.getMacStyle; exports.getNameString = _chunkFH4QKHOHjs.getNameString; exports.getNamedInstances = _chunkFH4QKHOHjs.getNamedInstances; exports.getVariationAxes = _chunkFH4QKHOHjs.getVariationAxes; exports.getWeightClass = _chunkFH4QKHOHjs.getWeightClass; exports.logFontInfo = _chunkFH4QKHOHjs.logFontInfo; exports.openTypeField = openTypeField; exports.parseFont = _chunkFH4QKHOHjs.parseFont; exports.parseVariableFontInstances = _chunkFH4QKHOHjs.parseVariableFontInstances_default; exports.planReducer = _chunkFH4QKHOHjs.planReducer; exports.processFontFiles = _chunkFH4QKHOHjs.processFontFiles; exports.processItalicKeywords = _chunkFH4QKHOHjs.processItalicKeywords; exports.processSubfamilyName = _chunkFH4QKHOHjs.processSubfamilyName; exports.readFontFile = _chunkFH4QKHOHjs.readFontFile; exports.removeWeightNames = _chunkFH4QKHOHjs.removeWeightNames; exports.renameFontDocuments = renameFontDocuments; exports.resolveExistingFont = _chunkFH4QKHOHjs.resolveExistingFont; exports.reverseSpellingLookup = _chunkFH4QKHOHjs.reverseSpellingLookup; exports.sanitizeForSanityId = _chunkFH4QKHOHjs.sanitizeForSanityId; exports.sortFontObjects = _chunkFH4QKHOHjs.sortFontObjects; exports.styleCountField = styleCountField; exports.stylisticSetField = stylisticSetField; exports.updateFontPrices = updateFontPrices; exports.updateTypefaceDocument = _chunkFH4QKHOHjs.updateTypefaceDocument; exports.uploadFontFiles = uploadFontFiles; exports.useNestedObjects = useNestedObjects; exports.useSanityClient = useSanityClient;