@liiift-studio/sanity-font-manager 2.4.0 → 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 (33) hide show
  1. package/dist/UploadModal-6LIX7XOK.js +6 -0
  2. package/dist/UploadModal-NME2W53V.mjs +6 -0
  3. package/dist/chunk-646WCBRR.mjs +7276 -0
  4. package/dist/chunk-FH4QKHOH.js +7276 -0
  5. package/dist/index.js +664 -1647
  6. package/dist/index.mjs +317 -1209
  7. package/package.json +5 -5
  8. package/src/components/BatchUploadFonts.jsx +57 -44
  9. package/src/components/BulkActions.jsx +99 -0
  10. package/src/components/ExistingDocumentResolver.jsx +152 -0
  11. package/src/components/FontReviewCard.jsx +415 -0
  12. package/src/components/SingleUploaderTool.jsx +3 -4
  13. package/src/components/UploadModal.jsx +268 -0
  14. package/src/components/UploadScriptsComponent.jsx +23 -21
  15. package/src/components/UploadStep1Settings.jsx +272 -0
  16. package/src/components/UploadStep2Review.jsx +472 -0
  17. package/src/components/UploadStep3Execute.jsx +234 -0
  18. package/src/components/UploadSummary.jsx +196 -0
  19. package/src/index.js +45 -0
  20. package/src/utils/buildUploadPlan.js +325 -0
  21. package/src/utils/executeUploadPlan.js +437 -0
  22. package/src/utils/executionReducer.js +56 -0
  23. package/src/utils/fontHelpers.js +267 -0
  24. package/src/utils/generateCssFile.js +79 -77
  25. package/src/utils/generateFontData.js +47 -94
  26. package/src/utils/getEmptyFontKit.js +19 -17
  27. package/src/utils/parseFont.js +55 -0
  28. package/src/utils/planReducer.js +517 -0
  29. package/src/utils/planTypes.js +183 -0
  30. package/src/utils/processFontFiles.js +120 -78
  31. package/src/utils/regenerateFontData.js +2 -2
  32. package/src/utils/resolveExistingFont.js +87 -0
  33. package/src/utils/uploadFontFiles.js +405 -405
package/dist/index.js CHANGED
@@ -1,1009 +1,82 @@
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
+
90
22
 
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
23
 
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
24
 
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
25
 
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
26
 
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
- let { weightName, subfamilyName, fontTitle, style, italicKW, variableFont } = extractFontMetadata(
325
- font,
326
- title,
327
- weightKeywordList,
328
- italicKeywordList,
329
- preserveShortenedNames
330
- );
331
- let id;
332
- let originalFilename = null;
333
- if (preserveFileNames) {
334
- originalFilename = file.name.replace(/\.(ttf|otf|woff2?|eot|svg)$/i, "");
335
- const normalizedName = originalFilename.replace(/-/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim();
336
- fontTitle = normalizedName;
337
- id = sanitizeForSanityId(normalizedName);
338
- } else {
339
- id = sanitizeForSanityId(fontTitle);
340
- }
341
- logFontInfo(id, fontTitle, font, file.name, subfamilyName, style, weightName, variableFont, italicKW);
342
- subfamilies[id] = subfamilyName;
343
- if (fontsObjects[id]) {
344
- fontsObjects[id].files = [...fontsObjects[id].files, file];
345
- if (preserveFileNames && originalFilename) {
346
- fontsObjects[id].originalFilename = originalFilename;
347
- }
348
- } else {
349
- fontsObjects[id] = createFontObject(
350
- id,
351
- fontTitle,
352
- title,
353
- font,
354
- variableFont,
355
- weightName,
356
- subfamilyName,
357
- file,
358
- preserveFileNames ? originalFilename : null
359
- );
360
- }
361
- }
362
- fontsObjects = sortFontObjects(fontsObjects);
363
- const uniqueSubfamilies = [...new Set(Object.values(subfamilies))];
364
- console.log("Subfamilies:", subfamilies);
365
- console.log("Unique subfamilies:", uniqueSubfamilies, uniqueSubfamilies.length);
366
- console.log("Font objects:", fontsObjects);
367
- return { fontsObjects, subfamilies, uniqueSubfamilies, newPreferredStyle, failedFiles };
368
- };
369
- var handleWebfontMetadata = async (file, font, files) => {
370
- var _a, _b, _c, _d, _e, _f, _g;
371
- 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)) {
372
- const ttfFile = files.find((f) => f.name === file.name.replace(".woff2", ".ttf").replace(".woff", ".ttf"));
373
- if (ttfFile) {
374
- const ttfFileBuffer = await readFontFile(ttfFile);
375
- const ttfFileData = fontkit.create(ttfFileBuffer);
376
- if (ttfFileData) font.name.records = (_g = ttfFileData == null ? void 0 : ttfFileData.name) == null ? void 0 : _g.records;
377
- }
378
- }
379
- };
380
- var extractFontMetadata = (font, title, weightKeywordList, italicKeywordList, preserveShortenedNames = false) => {
381
- var _a, _b, _c, _d, _e, _f;
382
- let weightName = extractWeightName(font, italicKeywordList);
383
- if (!preserveShortenedNames) {
384
- weightName = expandAbbreviations(weightName);
385
- }
386
- if ((weightName === "" || weightName.toLowerCase() === "roman") && ((_b = (_a = font == null ? void 0 : font.name) == null ? void 0 : _a.records) == null ? void 0 : _b.fullName)) {
387
- weightName = extractWeightFromFullName(font, title);
388
- if (!preserveShortenedNames) {
389
- weightName = expandAbbreviations(weightName);
390
- }
391
- }
392
- const variableFont = (font == null ? void 0 : font.variationAxes) && Object.keys(font.variationAxes).length > 0;
393
- 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();
394
- if (!preserveShortenedNames) {
395
- subfamilyName = expandAbbreviations(subfamilyName);
396
- }
397
- let fontTitle = font == null ? void 0 : font.fullName.trim();
398
- let style = (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular";
399
- const italicKW = processItalicKeywords(font, fontTitle, italicKeywordList);
400
- subfamilyName = processSubfamilyName(subfamilyName, weightKeywordList, italicKW, preserveShortenedNames);
401
- fontTitle = formatFontTitle(fontTitle, preserveShortenedNames);
402
- subfamilyName = subfamilyName === "" ? "Regular" : subfamilyName.replace(/\s+/g, " ").trim();
403
- if (subfamilyName !== "") {
404
- weightName = weightName.replace(`${subfamilyName} `, "").replace(` ${subfamilyName}`, "").trim();
405
- }
406
- if (variableFont) {
407
- if (!fontTitle.toLowerCase().includes("vf")) {
408
- fontTitle = fontTitle + " VF";
409
- }
410
- subfamilyName = "";
411
- }
412
- if (!(variableFont && fontTitle.toLowerCase().includes("italic"))) {
413
- fontTitle = addItalicToFontTitle(font, fontTitle, italicKW, style, preserveShortenedNames);
414
- }
415
- return { weightName, subfamilyName, fontTitle, style, italicKW, variableFont };
416
- };
417
- var extractWeightName = (font, italicKW) => {
418
- var _a, _b, _c, _d;
419
- 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);
420
- if (typeof weightName === "object") {
421
- weightName = (weightName == null ? void 0 : weightName.en) || (weightName.constructor === Object ? weightName[Object.keys(weightName)[0]] : null);
422
- }
423
- if ((font == null ? void 0 : font.variationAxes) && Object.keys(font.variationAxes).length > 0) {
424
- return "Variable";
425
- }
426
- if (italicKW) {
427
- italicKW.forEach((keyword) => {
428
- const kwRegex = new RegExp(`\\b${keyword.trim()}\\b`, "i");
429
- if (kwRegex.test(weightName)) {
430
- weightName = weightName.replace(kwRegex, "").trim();
431
- }
432
- });
433
- }
434
- return weightName == null ? void 0 : weightName.toString().replace("Italic", "").replace("It", "").replace("Slanted", "").replace("Slant", "").replace("Backslant", "").trim();
435
- };
436
- var extractWeightFromFullName = (font, title) => {
437
- var _a, _b;
438
- let weightName = (_b = (_a = font == null ? void 0 : font.name) == null ? void 0 : _a.records) == null ? void 0 : _b.fullName;
439
- weightName = (weightName == null ? void 0 : weightName.en) ? weightName.en : (weightName == null ? void 0 : weightName.constructor) === Object ? weightName[Object.keys(weightName)[0]] : weightName;
440
- weightName = weightName == null ? void 0 : weightName.replace(title + " ", "").replace(title, "").trim();
441
- weightName = weightName == null ? void 0 : weightName.replace("Italic", "").replace("It", "").replace("Slanted", "").replace("Slant", "").trim();
442
- return weightName;
443
- };
444
- var processSubfamilyName = (subfamilyName, weightKeywordList, italicKeywordList, preserveShortenedNames = false) => {
445
- weightKeywordList.forEach((keyword) => {
446
- const kwRegex = new RegExp(`\\b${keyword.trim()}\\b`, "i");
447
- if (kwRegex.test(subfamilyName)) {
448
- subfamilyName = subfamilyName.replace(kwRegex, "").trim();
449
- }
450
- subfamilyName = removeWeightNames(subfamilyName) || subfamilyName;
451
- if (!preserveShortenedNames) {
452
- subfamilyName = expandAbbreviations(subfamilyName);
453
- }
454
- });
455
- italicKeywordList.forEach((keyword) => {
456
- const kwRegex = new RegExp(`\\b${keyword.trim()}\\b`, "i");
457
- if (kwRegex.test(subfamilyName)) {
458
- subfamilyName = subfamilyName.replace(kwRegex, "").trim();
459
- }
460
- });
461
- return subfamilyName;
462
- };
463
- var processItalicKeywords = (font, fontTitle, italicKeywordList) => {
464
- let italicKW = [];
465
- italicKeywordList.forEach((keyword) => {
466
- const kw = keyword.trim();
467
- const kwRegex = new RegExp(`\\b${kw}\\b`, "i");
468
- if (kwRegex.test(fontTitle)) {
469
- fontTitle = fontTitle.replace(kwRegex, "").trim();
470
- italicKW.push(kw);
471
- }
472
- if ((font == null ? void 0 : font.fullName) && typeof font.fullName === "string" && font.fullName.toLowerCase().includes(kw.toLowerCase())) {
473
- if (!italicKW.includes(kw)) italicKW.push(kw);
474
- }
475
- });
476
- return italicKW;
477
- };
478
- var formatFontTitle = (fontTitle, preserveShortenedNames = false) => {
479
- const hasItalic = fontTitle.toLowerCase().includes("italic");
480
- fontTitle = fontTitle.replace(/-/g, " ");
481
- return fontTitle.replace(/\s+/g, " ").trim().split(" ").map((word) => {
482
- if (hasItalic && word.toLowerCase() === "italic") return "Italic";
483
- let fullWord = word;
484
- if (!preserveShortenedNames) {
485
- fullWord = reverseSpellingLookup(word) || word;
486
- }
487
- return fullWord[0].toUpperCase() + fullWord.slice(1);
488
- }).join(" ");
489
- };
490
- var addItalicToFontTitle = (font, fontTitle, italicKW, style, preserveShortenedNames = false) => {
491
- const hasItalicAngle = (font == null ? void 0 : font.italicAngle) !== 0;
492
- const hasItalicInName = font == null ? void 0 : font.fullName.toLowerCase().includes("italic");
493
- if (italicKW.length > 0 || hasItalicAngle || hasItalicInName) {
494
- italicKW = [...new Set(italicKW)];
495
- if (italicKW.length === 0 && (hasItalicAngle || hasItalicInName)) {
496
- italicKW = ["Italic"];
497
- }
498
- if (!preserveShortenedNames) {
499
- italicKW = italicKW.map((item) => reverseSpellingLookup(item) || item);
500
- }
501
- italicKW = [...new Set(italicKW)];
502
- if (italicKW.length > 1 && italicKW.includes("Italic")) {
503
- italicKW = ["Italic"];
504
- }
505
- const fontTitleLower = fontTitle.toLowerCase();
506
- italicKW = italicKW.filter((keyword) => {
507
- const keywordLower = keyword.toLowerCase();
508
- const kwRegex = new RegExp(`\\b${keywordLower}\\b`);
509
- const isSubstring = fontTitleLower.split(" ").some(
510
- (word) => word.includes(keywordLower) || keywordLower.includes(word)
511
- );
512
- return !kwRegex.test(fontTitleLower) && !isSubstring;
513
- });
514
- if (italicKW.length > 0) {
515
- fontTitle = fontTitle.trim() + " " + italicKW.join(" ");
516
- }
517
- }
518
- return fontTitle;
519
- };
520
- var createFontObject = (id, fontTitle, title, font, variableFont, weightName, subfamilyName, file, originalFilename = null) => {
521
- const fontObject = {
522
- _key: (0, import_nanoid.nanoid)(),
523
- _id: id,
524
- title: fontTitle,
525
- slug: { _type: "slug", current: id },
526
- typefaceName: title,
527
- style: (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular",
528
- variableFont,
529
- weightName,
530
- subfamily: subfamilyName,
531
- normalWeight: true,
532
- weight: Number(determineWeight(font, weightName)),
533
- fileInput: {},
534
- files: [file],
535
- fontKit: font
536
- };
537
- if (originalFilename) {
538
- fontObject.originalFilename = originalFilename;
539
- }
540
- return fontObject;
541
- };
542
- var determineWeight = (font, weightName) => {
543
- var _a;
544
- if ((_a = font["OS/2"]) == null ? void 0 : _a.usWeightClass) {
545
- return Number(font["OS/2"].usWeightClass);
546
- }
547
- const wn = (weightName == null ? void 0 : weightName.toLowerCase()) || "";
548
- if (/hairline|extra thin|extrathin/.test(wn)) return 100;
549
- if (/thin|extra light|extralight/.test(wn)) return 200;
550
- if (/light|book/.test(wn)) return 300;
551
- if (/regular|normal/.test(wn)) return 400;
552
- if (/medium/.test(wn)) return 500;
553
- if (/semi bold|semibold/.test(wn)) return 600;
554
- if (/extra bold|extrabold/.test(wn)) return 800;
555
- if (/bold/.test(wn)) return 700;
556
- if (/black|ultra/.test(wn)) return 900;
557
- return 400;
558
- };
559
- var sortFontObjects = (fontsObjects) => {
560
- return Object.fromEntries(
561
- Object.entries(fontsObjects).sort((a, b) => {
562
- const weightA = Number(a[1].weight);
563
- const weightB = Number(b[1].weight);
564
- if (weightA === weightB) {
565
- if (a[1].style === "Regular" && b[1].style === "Italic") return -1;
566
- if (a[1].style === "Italic" && b[1].style === "Regular") return 1;
567
- return 0;
568
- }
569
- return weightA - weightB;
570
- })
571
- );
572
- };
573
- var logFontInfo = (id, fontTitle, font, fileName, subfamilyName, style, weightName, variableFont, italicKW) => {
574
- console.log("=== Font Info ====");
575
- console.log("Font id: ", id);
576
- console.log("Font title: ", fontTitle);
577
- console.log("Fontkit fullName: ", font.fullName);
578
- console.log("Fontkit family name: ", font.familyName);
579
- console.log("File name: ", fileName);
580
- console.log("Subfamily: ", subfamilyName);
581
- console.log("Style: ", style);
582
- console.log("Weight: ", weightName);
583
- console.log("Variable: ", variableFont);
584
- console.log("italicKW: ", italicKW);
585
- console.log("Font italic angle: ", (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular");
586
- console.log("=======");
587
- };
588
27
 
589
- // src/utils/uploadFontFiles.js
590
- var import_nanoid3 = require("nanoid");
591
-
592
- // src/utils/generateCssFile.js
593
- var import_base_64 = __toESM(require("base-64"));
594
- var import_buffer = require("buffer");
595
- var fontkit2 = __toESM(require("fontkit"));
596
- function _arrayBufferToBase64(buffer) {
597
- var binary = "";
598
- var bytes = new Uint8Array(buffer);
599
- var len = bytes.byteLength;
600
- for (var i = 0; i < len; i++) {
601
- binary += String.fromCharCode(bytes[i]);
602
- }
603
- return import_base_64.default.encode(binary);
604
- }
605
- function buildVFDescriptors(font) {
606
- const cssAxes = {};
607
- const skipped = [];
608
- try {
609
- const va = font.variationAxes;
610
- if (!va) return { descriptors: "", skipped: [] };
611
- for (const [tag, axis] of Object.entries(va)) {
612
- const lo = Math.min(axis.min, axis.max);
613
- const hi = Math.max(axis.min, axis.max);
614
- if (lo === hi) {
615
- skipped.push(tag);
616
- continue;
617
- }
618
- if (tag === "wght") {
619
- cssAxes["font-weight"] = `${lo} ${hi}`;
620
- } else if (tag === "wdth") {
621
- cssAxes["font-stretch"] = `${lo}% ${hi}%`;
622
- } else if (tag === "slnt") {
623
- cssAxes["font-style"] = `oblique ${lo}deg ${hi}deg`;
624
- } else if (tag === "ital" && !cssAxes["font-style"]) {
625
- if (hi > 0) cssAxes["font-style"] = "italic";
626
- else skipped.push(tag);
627
- } else {
628
- skipped.push(tag);
629
- }
630
- }
631
- } catch (_) {
632
- }
633
- const descriptors = Object.entries(cssAxes).map(([k, v]) => `${k}:${v}`).join(";") + (Object.keys(cssAxes).length ? ";" : "");
634
- return { descriptors, skipped };
635
- }
636
- var FALLBACK_STACKS = {
637
- "sans-serif": "local('Arial'), local('Helvetica Neue'), local('Roboto'), local('Liberation Sans')",
638
- "serif": "local('Georgia'), local('Times New Roman'), local('Times')",
639
- "monospace": "local('Courier New'), local('Courier'), local('Menlo'), local('Monaco')",
640
- // Display and script fonts have no universally suitable system fallback; default to sans-serif
641
- "default": "local('Arial'), local('Helvetica Neue'), local('Roboto'), local('Liberation Sans')"
642
- };
643
- var FAMILY_CLASS_MAP = {
644
- 1: "serif",
645
- 2: "serif",
646
- 3: "serif",
647
- 4: "serif",
648
- 5: "serif",
649
- 7: "serif",
650
- 8: "sans-serif"
651
- };
652
- var SERIF_NAMES = /jubilat|corundum|dapifer|birra|daith/i;
653
- var SANS_NAMES = /halyard|gamay|omnes|kit/i;
654
- function detectFontCategory(font, fontName) {
655
- var _a;
656
- if (fontName && SERIF_NAMES.test(fontName)) return "serif";
657
- if (fontName && SANS_NAMES.test(fontName)) return "sans-serif";
658
- try {
659
- const familyClass = ((_a = font["OS/2"]) == null ? void 0 : _a.sFamilyClass) ?? 0;
660
- const highByte = familyClass >> 8 & 255;
661
- return FAMILY_CLASS_MAP[highByte] ?? "default";
662
- } catch {
663
- return "default";
664
- }
665
- }
666
- function calcFallbackData(arrayBuffer, fontName) {
667
- try {
668
- let font = fontkit2.create(import_buffer.Buffer.from(arrayBuffer));
669
- let upm = font.unitsPerEm;
670
- let category = detectFontCategory(font, fontName);
671
- return {
672
- fallbackSrc: FALLBACK_STACKS[category],
673
- ascentOverride: `${(font.ascent / upm * 100).toFixed(2)}%`,
674
- descentOverride: `${(Math.abs(font.descent) / upm * 100).toFixed(2)}%`,
675
- lineGapOverride: `${(font.lineGap / upm * 100).toFixed(2)}%`
676
- };
677
- } catch (err) {
678
- console.error("Failed to extract fallback font data:", err);
679
- return {
680
- fallbackSrc: FALLBACK_STACKS["default"],
681
- ascentOverride: "100%",
682
- descentOverride: "0%",
683
- lineGapOverride: "0%"
684
- };
685
- }
686
- }
687
- async function generateCssFile({
688
- woff2File,
689
- fileInput,
690
- language = null,
691
- fileName,
692
- fontName,
693
- variableFont,
694
- weight,
695
- style = "Normal",
696
- client
697
- }) {
698
- try {
699
- let arrayBuffer = await woff2File.arrayBuffer();
700
- let b64 = _arrayBufferToBase64(arrayBuffer);
701
- let fontkitFont = fontkit2.create(import_buffer.Buffer.from(arrayBuffer));
702
- let { fallbackSrc, ascentOverride, descentOverride, lineGapOverride } = calcFallbackData(arrayBuffer, fontName);
703
- let cssString;
704
- if (variableFont) {
705
- let { descriptors, skipped } = buildVFDescriptors(fontkitFont);
706
- 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" : "") + " */" : "";
707
- 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;}`;
708
- } else {
709
- let fontStyle = style === "Italic" ? "italic" : "normal";
710
- 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;}`;
711
- }
712
- let fallbackCssString = `@font-face{font-family:'${fontName} Fallback';src:${fallbackSrc};ascent-override:${ascentOverride};descent-override:${descentOverride};line-gap-override:${lineGapOverride};}`;
713
- let uploadBuffer = import_buffer.Buffer.from(cssString + fallbackCssString, "utf-8");
714
- let doc = await client.assets.upload("file", uploadBuffer, { filename: fileName + ".css" });
715
- let newFileInput = language == null ? {
716
- ...fileInput,
717
- css: {
718
- _type: "file",
719
- asset: {
720
- _type: "reference",
721
- _ref: doc._id
722
- }
723
- }
724
- } : {
725
- ...fileInput,
726
- [language]: {
727
- ...fileInput[language],
728
- css: {
729
- _type: "file",
730
- asset: {
731
- _type: "reference",
732
- _ref: doc._id
733
- }
734
- }
735
- }
736
- };
737
- return newFileInput;
738
- } catch (err) {
739
- console.error(err);
740
- throw err;
741
- }
742
- }
743
28
 
744
- // src/utils/generateFontData.js
745
- var import_buffer2 = require("buffer");
746
- var fontkit3 = __toESM(require("fontkit"));
747
- async function generateFontData({ fileInput, url, fontKit, fontId, client, commit = true }) {
748
- var _a;
749
- if (fontId.startsWith("drafts.")) {
750
- fontId = fontId.replace("drafts.", "");
751
- }
752
- console.log("generate-font-data ", fontId, commit);
753
- let srcUrl;
754
- if (!url || url == null) {
755
- srcUrl = await client.fetch(`*[_id == $id]{url}`, { id: fileInput.ttf.asset._ref });
756
- console.log("src url ", srcUrl);
757
- srcUrl = srcUrl[0].url;
758
- } else {
759
- srcUrl = url;
760
- }
761
- let font = fontKit;
762
- if (!fontKit || fontKit == null) {
763
- let buffer = await fetch(srcUrl);
764
- buffer = await buffer.arrayBuffer();
765
- buffer = import_buffer2.Buffer.from(buffer);
766
- font = fontkit3.create(buffer);
767
- }
768
- let variableAxes;
769
- try {
770
- variableAxes = font.variationAxes;
771
- } catch (err) {
772
- console.error("err: ", err);
773
- }
774
- let variableInstances;
775
- try {
776
- variableInstances = font.namedVariations;
777
- } catch (e) {
778
- console.log("variable instances 2 error : ", e.message);
779
- let fvar = (_a = font == null ? void 0 : font.fvar) == null ? void 0 : _a.instance;
780
- fvar == null ? void 0 : fvar.forEach((fv) => {
781
- var _a2, _b, _c, _d, _e, _f;
782
- 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;
783
- 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;
784
- });
785
- variableInstances = {};
786
- fvar.forEach((v) => {
787
- let key = v.name;
788
- if (typeof key === "object") {
789
- key = Object.values(key)[0];
790
- }
791
- let coordKeys = Object.keys(variableAxes);
792
- let coord = {};
793
- coordKeys.forEach((ck, ckIndex) => {
794
- coord[ck] = v.coord[ckIndex];
795
- });
796
- variableInstances[key] = coord;
797
- });
798
- }
799
- console.log("font : ", font);
800
- console.log("variable instances : ", variableInstances);
801
- console.log("variable axes : ", variableAxes);
802
- let opentypeFeatures = font.availableFeatures;
803
- let glyphCount = font.numGlyphs;
804
- let characterSet = font.characterSet;
805
- let metaData = {
806
- postscriptName: font.postscriptName,
807
- fullName: font.fullName,
808
- familyName: font.familyName,
809
- subfamilyName: font.subfamilyName,
810
- copyright: font.copyright,
811
- version: font.version.replaceAll("Version ", ""),
812
- genDate: (/* @__PURE__ */ new Date()).toISOString()
813
- };
814
- let metrics = {
815
- unitsPerEm: font.unitsPerEm,
816
- ascender: font.ascent,
817
- descender: font.descent,
818
- lineGap: font.lineGap,
819
- underlinePosition: font.underlinePosition,
820
- underlineThickness: font.underlineThickness,
821
- italicAngle: font.italicAngle,
822
- capHeight: font.capHeight,
823
- xHeight: font.xHeight,
824
- boundingBox: font.bbox
825
- };
826
- let variableFont = false;
827
- if (variableAxes && variableAxes != null && Object.keys(variableAxes).length > 0 && variableInstances && variableInstances != null && Object.keys(variableInstances).length > 0) {
828
- variableFont = true;
829
- }
830
- let patch = {
831
- metrics,
832
- metaData,
833
- variableFont,
834
- variableAxes: JSON.stringify(variableAxes),
835
- variableInstances: JSON.stringify(variableInstances),
836
- glyphCount,
837
- opentypeFeatures: { chars: opentypeFeatures },
838
- characterSet: { chars: characterSet }
839
- };
840
- console.log("data : ", patch);
841
- if (commit) patch = await client.patch(fontId).set(patch).commit({ autoGenerateArrayKeys: true });
842
- return patch;
843
- }
844
29
 
845
- // src/utils/parseVariableFontInstances.js
846
- var import_nanoid2 = require("nanoid");
847
- var parseVariableFontInstances = async (font, client) => {
848
- if (!font.variableFont || !font.variableInstances) return [];
849
- let variableInstances;
850
- try {
851
- variableInstances = JSON.parse(font.variableInstances);
852
- } catch (err) {
853
- console.error("Error parsing variable instances:", err);
854
- variableInstances = {};
855
- }
856
- if (Object.keys(variableInstances).length === 0) return [];
857
- let staticFonts;
858
- const typeface = await client.fetch(
859
- `*[_type == 'typeface' && title == $typefaceName][0]{
860
- 'fonts': styles.fonts[]-> {
861
- _id,
862
- title,
863
- subfamily,
864
- style,
865
- weight,
866
- weightName,
867
- metaData,
868
- variableFont
869
- }
870
- }`,
871
- { typefaceName: font.typefaceName }
872
- );
873
- if ((typeface == null ? void 0 : typeface.fonts) && typeface.fonts.length > 0) {
874
- staticFonts = typeface.fonts.filter((f) => !f.variableFont);
875
- console.log("Using curated typeface fonts list:", staticFonts.length, "fonts");
876
- } else {
877
- console.warn("Typeface not found or no fonts in curated list, falling back to all fonts query");
878
- staticFonts = await client.fetch(
879
- `*[_type == 'font' && typefaceName == $typefaceName && variableFont != true]{
880
- _id,
881
- title,
882
- subfamily,
883
- style,
884
- weight,
885
- weightName,
886
- metaData
887
- }`,
888
- { typefaceName: font.typefaceName }
889
- );
890
- }
891
- console.log("Variable font instances:", Object.keys(variableInstances));
892
- console.log("Available static fonts:", staticFonts.map((sf) => sf.title));
893
- const instanceMappings = [];
894
- Object.keys(variableInstances).forEach((instanceName) => {
895
- let matchingFont = null;
896
- matchingFont = staticFonts.find((sf) => sf.title === instanceName);
897
- if (!matchingFont && staticFonts.some((sf) => {
898
- var _a;
899
- return (_a = sf.metaData) == null ? void 0 : _a.fullName;
900
- })) {
901
- matchingFont = staticFonts.find((sf) => {
902
- var _a, _b, _c, _d;
903
- if (!((_a = sf.metaData) == null ? void 0 : _a.fullName)) return false;
904
- let fullName = sf.metaData.fullName;
905
- const WORDS_TO_REMOVE = ["VF", "var", "variable", "VAR", "vf"];
906
- 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();
907
- if (variableName && fullName.startsWith(variableName)) {
908
- fullName = fullName.substring(variableName.length).trim();
909
- }
910
- if (variableName) {
911
- const words = variableName.split(/\s+/).map((w) => w.trim()).filter(Boolean);
912
- if (words.length > 0) {
913
- const regex = new RegExp(`\\b(${words.join("|")})\\b`, "gi");
914
- const stripped = fullName.replace(regex, "").replace(/\s{2,}/g, " ").trim();
915
- if (stripped !== "") fullName = stripped;
916
- }
917
- }
918
- if (fullName.startsWith(font.typefaceName)) {
919
- fullName = fullName.substring(font.typefaceName.length).trim();
920
- }
921
- if (((_d = sf.style) == null ? void 0 : _d.toLowerCase()) === "italic" && !fullName.toLowerCase().endsWith("italic") && !fullName.toLowerCase().endsWith("slanted")) {
922
- fullName = fullName + " Italic";
923
- }
924
- if (fullName.trim().toLowerCase().endsWith("regular")) {
925
- if (instanceName.trim().toLowerCase() + " regular" === fullName.trim().toLowerCase()) return true;
926
- }
927
- if (fullName.trim().toLowerCase().startsWith("regular")) {
928
- if ("regular " + instanceName.trim().toLowerCase() === fullName.trim().toLowerCase()) return true;
929
- }
930
- if (fullName.trim().toLowerCase().endsWith("italic")) {
931
- if (instanceName.trim().toLowerCase().endsWith("italic")) {
932
- const k = instanceName.trim().toLowerCase().slice(0, -6).trim() + " regular italic";
933
- if (k === fullName.trim().toLowerCase()) return true;
934
- }
935
- }
936
- return fullName.trim().toLowerCase() === instanceName.trim().toLowerCase();
937
- });
938
- }
939
- if (!matchingFont) {
940
- const expandedName = instanceName.split(" ").map((word) => expandAbbreviations(word)).join(" ");
941
- matchingFont = staticFonts.find((sf) => {
942
- const nameWithoutTypeface = sf.title.replace(font.typefaceName, "").trim();
943
- return nameWithoutTypeface === expandedName;
944
- });
945
- }
946
- if (!matchingFont) {
947
- const isItalic = instanceName.toLowerCase().includes("italic");
948
- const weightTerms = [
949
- { term: "thin", weight: "100" },
950
- { term: "extralight", weight: "200" },
951
- { term: "extra light", weight: "200" },
952
- { term: "light", weight: "300" },
953
- { term: "regular", weight: "400" },
954
- { term: "normal", weight: "400" },
955
- { term: "medium", weight: "500" },
956
- { term: "semibold", weight: "600" },
957
- { term: "semi bold", weight: "600" },
958
- { term: "bold", weight: "700" },
959
- { term: "extrabold", weight: "800" },
960
- { term: "extra bold", weight: "800" },
961
- { term: "black", weight: "900" },
962
- { term: "heavy", weight: "900" }
963
- ];
964
- let instanceWeight = "400";
965
- for (const { term, weight } of weightTerms) {
966
- if (instanceName.toLowerCase().includes(term)) {
967
- instanceWeight = weight;
968
- break;
969
- }
970
- }
971
- matchingFont = staticFonts.find(
972
- (sf) => sf.weight === instanceWeight && (isItalic && sf.style === "Italic" || !isItalic && sf.style === "Regular")
973
- );
974
- }
975
- if (!matchingFont) {
976
- matchingFont = staticFonts.find((sf) => {
977
- if (!sf.weightName) return false;
978
- const cleanInstance = instanceName.toLowerCase().replace(/italic/i, "").trim();
979
- const cleanWeight = sf.weightName.toLowerCase().replace(/italic/i, "").trim();
980
- return cleanInstance === cleanWeight;
981
- });
982
- }
983
- if (!matchingFont && staticFonts.some((sf) => {
984
- var _a;
985
- return (_a = sf.metaData) == null ? void 0 : _a.fullName;
986
- })) {
987
- matchingFont = staticFonts.find((sf) => {
988
- var _a;
989
- if (!((_a = sf.metaData) == null ? void 0 : _a.fullName)) return false;
990
- const typefacePattern = new RegExp(`^${font.typefaceName}\\s+`, "i");
991
- const stylePart = sf.metaData.fullName.replace(typefacePattern, "").trim();
992
- return instanceName.toLowerCase() === stylePart.toLowerCase();
993
- });
994
- }
995
- console.log(`Instance "${instanceName}" matched with:`, matchingFont ? matchingFont.title : "No match found");
996
- instanceMappings.push({
997
- key: instanceName,
998
- value: matchingFont ? { _type: "reference", _ref: matchingFont._id, _weak: true } : null,
999
- _key: (0, import_nanoid2.nanoid)()
1000
- });
1001
- });
1002
- return instanceMappings;
1003
- };
1004
- var parseVariableFontInstances_default = parseVariableFontInstances;
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
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
+ }
1005
77
 
1006
78
  // src/utils/uploadFontFiles.js
79
+ var _nanoid = require('nanoid');
1007
80
  var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, stylesObject, setStatus, setError, preserveFileNames = false) => {
1008
81
  let fontRefs = [];
1009
82
  let variableRefs = [];
@@ -1040,7 +113,7 @@ var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, styl
1040
113
  if (fileType === "woff2") {
1041
114
  console.log(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Generating CSS for: ${fontObject.title}`);
1042
115
  setStatus(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Generating CSS for: ${fontObject.title}`);
1043
- newFileInput = await generateCssFile({
116
+ newFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
1044
117
  woff2File: file,
1045
118
  fileInput: newFileInput,
1046
119
  fontName: fontObject.title,
@@ -1054,7 +127,7 @@ var uploadFontFiles = async (fontsObjects, subfamilies, client, inputPrice, styl
1054
127
  if (fileType === "ttf") {
1055
128
  console.log(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Generating font data for: ${fontObject.title}`);
1056
129
  setStatus(`[${i + 1}/${fontObjectKeys.length}][${j + 1}/${files.length}] Generating font data for: ${fontObject.title}`);
1057
- const metadata = await generateFontData({
130
+ const metadata = await _chunkFH4QKHOHjs.generateFontData.call(void 0, {
1058
131
  fontId: fontObject._id,
1059
132
  url: baseAsset.url,
1060
133
  fontKit,
@@ -1100,7 +173,7 @@ var determineFileType = (file) => {
1100
173
  if (file.name.endsWith(".svg")) return "svg";
1101
174
  return "";
1102
175
  };
1103
- var resolveExistingFont = async (font, client) => {
176
+ var resolveExistingFont2 = async (font, client) => {
1104
177
  const result = { exact: null, candidates: [], recommendation: "create" };
1105
178
  try {
1106
179
  const idMatches = await client.fetch(
@@ -1161,13 +234,13 @@ var resolveExistingFont = async (font, client) => {
1161
234
  };
1162
235
  var createOrUpdateFontDocument = async (font, client, setError) => {
1163
236
  try {
1164
- const { exact, candidates, recommendation } = await resolveExistingFont(font, client);
237
+ const { exact, candidates, recommendation } = await resolveExistingFont2(font, client);
1165
238
  const { files, fontKit } = font;
1166
239
  delete font.files;
1167
240
  delete font.fontKit;
1168
241
  delete font.originalFilename;
1169
242
  if (font.variableFont && font.variableInstances) {
1170
- const instanceMappings = await parseVariableFontInstances(font, client);
243
+ const instanceMappings = await _chunkFH4QKHOHjs.parseVariableFontInstances.call(void 0, font, client);
1171
244
  if (instanceMappings.length > 0) {
1172
245
  font.variableInstanceReferences = instanceMappings;
1173
246
  }
@@ -1183,7 +256,7 @@ var createOrUpdateFontDocument = async (font, client, setError) => {
1183
256
  fontResponse = await createNewFont(font, client);
1184
257
  }
1185
258
  return {
1186
- _key: (0, import_nanoid3.nanoid)(),
259
+ _key: _nanoid.nanoid.call(void 0, ),
1187
260
  _type: "reference",
1188
261
  _ref: fontResponse._id,
1189
262
  _weak: true
@@ -1226,7 +299,7 @@ var createNewFont = async (font, client) => {
1226
299
  console.log("Creating new font:", font._id, font.title);
1227
300
  if (font.metaData) cleanMetadataValues(font);
1228
301
  const newDocument = {
1229
- _key: (0, import_nanoid3.nanoid)(),
302
+ _key: _nanoid.nanoid.call(void 0, ),
1230
303
  _id: font._id,
1231
304
  _type: "font",
1232
305
  ...font
@@ -1263,89 +336,7 @@ var addToVariableRefs = (fontRef, font, variableRefs, stylesObject) => {
1263
336
  }
1264
337
  };
1265
338
 
1266
- // src/utils/updateTypefaceDocument.js
1267
- var import_nanoid4 = require("nanoid");
1268
- var updateTypefaceDocument = async (doc_id, fontRefs, variableRefs, subfamilies, uniqueSubfamilies, subfamiliesArray, preferredStyleRef, newPreferredStyle, stylesObject, client, setStatus, setError) => {
1269
- console.log("Updating typeface document with new fonts:", { fontRefs, variableRefs, subfamilies, uniqueSubfamilies });
1270
- setStatus("Updating typeface references...");
1271
- let patch = {
1272
- "styles.fonts": stylesObject.fonts ? [...stylesObject.fonts, ...fontRefs] : [...fontRefs],
1273
- "styles.variableFont": (stylesObject == null ? void 0 : stylesObject.variableFont) ? [...stylesObject.variableFont, ...variableRefs] : [...variableRefs]
1274
- };
1275
- setStatus("Organising font subfamilies...");
1276
- subfamiliesArray = subfamiliesArray || [];
1277
- uniqueSubfamilies.forEach((subfamilyName) => {
1278
- if (!subfamiliesArray.find((sf) => sf.title === subfamilyName)) {
1279
- subfamiliesArray.push({
1280
- title: subfamilyName,
1281
- _key: (0, import_nanoid4.nanoid)(),
1282
- _type: "object",
1283
- fonts: []
1284
- });
1285
- }
1286
- });
1287
- if (subfamiliesArray.length > 0) {
1288
- Object.entries(subfamilies).forEach(([id, subfamilyName]) => {
1289
- if (id.toLowerCase().includes("vf")) return;
1290
- const subfamilyIndex = subfamiliesArray.findIndex((sf) => sf.title === subfamilyName);
1291
- if (subfamilyIndex !== -1) {
1292
- subfamiliesArray[subfamilyIndex].fonts.push({
1293
- _ref: id,
1294
- _key: (0, import_nanoid4.nanoid)(),
1295
- _type: "reference",
1296
- _weak: true
1297
- });
1298
- }
1299
- });
1300
- subfamiliesArray = subfamiliesArray.map((subfamily) => ({
1301
- ...subfamily,
1302
- fonts: subfamily.fonts.filter(
1303
- (font, index, self) => index === self.findIndex((f) => f._ref === font._ref)
1304
- )
1305
- }));
1306
- }
1307
- patch["styles.subfamilies"] = subfamiliesArray;
1308
- await updatePreferredStyle(doc_id, preferredStyleRef, newPreferredStyle, patch, client);
1309
- console.log("doc_id: ", doc_id);
1310
- console.log("Typeface patch: ", patch);
1311
- console.log("New preferred style: ", newPreferredStyle);
1312
- console.log("SubfamiliesArray:", subfamiliesArray);
1313
- try {
1314
- await client.patch(doc_id).set(patch).commit();
1315
- console.log(`Updated document: ${doc_id}`);
1316
- if (doc_id.startsWith("drafts.")) {
1317
- await updatePublishedDocument(doc_id, patch, client);
1318
- }
1319
- } catch (err) {
1320
- console.error("Error updating document:", err.message);
1321
- setStatus("Error updating typeface");
1322
- setError(true);
1323
- }
1324
- };
1325
- var updatePreferredStyle = async (doc_id, preferredStyleRef, newPreferredStyle, patch, client) => {
1326
- const isCurrentlyEmpty = !(preferredStyleRef == null ? void 0 : preferredStyleRef._ref) || preferredStyleRef._ref === "" || preferredStyleRef._ref === null;
1327
- const hasCandidate = (newPreferredStyle == null ? void 0 : newPreferredStyle._ref) && newPreferredStyle._ref !== "";
1328
- if (isCurrentlyEmpty && hasCandidate) {
1329
- patch.preferredStyle = {
1330
- _type: "reference",
1331
- _ref: newPreferredStyle._ref,
1332
- _weak: true
1333
- };
1334
- }
1335
- };
1336
- var updatePublishedDocument = async (doc_id, patch, client) => {
1337
- const publishedId = doc_id.replace("drafts.", "");
1338
- const publishedDoc = await client.fetch(`*[_id == $publishedId]`, { publishedId }).then((res) => res[0]);
1339
- if (publishedDoc) {
1340
- await client.patch(publishedId).set(patch).commit();
1341
- console.log(`Updated published document: ${publishedId}`);
1342
- } else {
1343
- console.log(`No published document found for ${publishedId}, skipping`);
1344
- }
1345
- };
1346
-
1347
339
  // src/utils/regenerateFontData.js
1348
- var fontkit4 = __toESM(require("fontkit"));
1349
340
  var renameFontDocuments = async ({
1350
341
  client,
1351
342
  typefaceName,
@@ -1414,9 +405,9 @@ var renameFontDocuments = async ({
1414
405
  const res = await fetch(ttfAsset.url);
1415
406
  file = await res.blob();
1416
407
  }
1417
- const fontBuffer = await readFontFile(file);
1418
- const font = fontkit4.create(fontBuffer);
1419
- 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,
1420
411
  font,
1421
412
  typefaceName,
1422
413
  weightKeywordList,
@@ -1526,45 +517,31 @@ var updateFontPrices = async ({
1526
517
  };
1527
518
 
1528
519
  // src/components/StatusDisplay.jsx
1529
- var import_react2 = __toESM(require("react"));
1530
- var import_ui = require("@sanity/ui");
520
+
521
+
1531
522
  var StatusDisplay = ({ status, error, action }) => {
1532
- 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);
1533
524
  };
1534
525
  var StatusDisplay_default = StatusDisplay;
1535
526
 
1536
- // src/components/PriceInput.jsx
1537
- var import_react3 = __toESM(require("react"));
1538
- var import_ui2 = require("@sanity/ui");
1539
- 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(
1540
- "input",
1541
- {
1542
- value: inputPrice,
1543
- onChange: handleInputChange,
1544
- type: "number",
1545
- style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
1546
- }
1547
- ), /* @__PURE__ */ import_react3.default.createElement(import_ui2.Text, { size: 1, muted: true }, "per style"));
1548
- var PriceInput_default = PriceInput;
1549
-
1550
527
  // src/components/RegenerateSubfamiliesComponent.jsx
1551
- var import_react4 = __toESM(require("react"));
1552
- var import_nanoid5 = require("nanoid");
1553
- var import_ui3 = require("@sanity/ui");
1554
- var import_sanity2 = require("sanity");
528
+
529
+
530
+
531
+
1555
532
  var RegenerateSubfamiliesComponent = () => {
1556
- const [status, setStatus] = (0, import_react4.useState)("");
1557
- const [ready, setReady] = (0, import_react4.useState)(true);
1558
- 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);
1559
536
  const client = useSanityClient();
1560
- const doc_id = (0, import_sanity2.useFormValue)(["_id"]);
1561
- const title = (0, import_sanity2.useFormValue)(["title"]);
1562
- const slug = (0, import_sanity2.useFormValue)(["slug"]);
1563
- 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: [] };
1564
541
  const handleClick = () => {
1565
542
  regenerateSubfamilies({ title, stylesObject, slug, doc_id, client, setStatus, setReady, setError });
1566
543
  };
1567
- 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"))));
1568
545
  };
1569
546
  var regenerateSubfamilies = async ({ title, stylesObject, slug, doc_id, client, setStatus, setReady, setError }) => {
1570
547
  try {
@@ -1610,7 +587,7 @@ var groupFontsBySubfamily = (fonts) => {
1610
587
  if ((_a = font.title) == null ? void 0 : _a.includes("VF")) {
1611
588
  subfamilies[`VF_${font.title}`] = [font];
1612
589
  } else {
1613
- const subfamilyName = font.subfamily ? expandAbbreviations(font.subfamily) : "Regular";
590
+ const subfamilyName = font.subfamily ? _chunkFH4QKHOHjs.expandAbbreviations.call(void 0, font.subfamily) : "Regular";
1614
591
  if (!subfamilies[subfamilyName]) subfamilies[subfamilyName] = [];
1615
592
  subfamilies[subfamilyName].push(font);
1616
593
  }
@@ -1620,11 +597,11 @@ var groupFontsBySubfamily = (fonts) => {
1620
597
  var createSubfamiliesArray = (subfamilies) => {
1621
598
  return Object.keys(subfamilies).map((subfamilyName) => ({
1622
599
  title: subfamilyName,
1623
- _key: (0, import_nanoid5.nanoid)(),
600
+ _key: _nanoid.nanoid.call(void 0, ),
1624
601
  _type: "object",
1625
602
  fonts: subfamilies[subfamilyName].map((font) => ({
1626
603
  _ref: font._id,
1627
- _key: (0, import_nanoid5.nanoid)(),
604
+ _key: _nanoid.nanoid.call(void 0, ),
1628
605
  _type: "reference",
1629
606
  _weak: true
1630
607
  }))
@@ -1658,6 +635,7 @@ var updateTypefaceSubfamilies = async (doc_id, stylesObject, newSubfamiliesArray
1658
635
  };
1659
636
 
1660
637
  // src/components/BatchUploadFonts.jsx
638
+ var UploadModal2 = _react.lazy.call(void 0, () => Promise.resolve().then(() => _interopRequireWildcard(require("./UploadModal-6LIX7XOK.js"))));
1661
639
  var ACCEPTED_EXTENSIONS = ["ttf", "otf", "woff", "woff2", "eot", "svg"];
1662
640
  var formatElapsed = (s) => {
1663
641
  const m = Math.floor(s / 60);
@@ -1665,28 +643,29 @@ var formatElapsed = (s) => {
1665
643
  return m > 0 ? `${m}m ${sec}s` : `${sec}s`;
1666
644
  };
1667
645
  var BatchUploadFonts = () => {
1668
- const [status, setStatus] = (0, import_react5.useState)("ready");
1669
- const [ready, setReady] = (0, import_react5.useState)(true);
1670
- const [inputPrice, setInputPrice] = (0, import_react5.useState)("0");
1671
- const [error, setError] = (0, import_react5.useState)(false);
1672
- const [preserveShortenedNames, setPreserveShortenedNames] = (0, import_react5.useState)(true);
1673
- const [preserveFileNames, setPreserveFileNames] = (0, import_react5.useState)(false);
1674
- const [showUtilities, setShowUtilities] = (0, import_react5.useState)(false);
1675
- const [pendingFiles, setPendingFiles] = (0, import_react5.useState)([]);
1676
- const [isDragging, setIsDragging] = (0, import_react5.useState)(false);
1677
- const [elapsedSeconds, setElapsedSeconds] = (0, import_react5.useState)(0);
1678
- const fileInputRef = (0, import_react5.useRef)(null);
1679
- const elapsedTimerRef = (0, import_react5.useRef)(null);
1680
- 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);
1681
660
  const client = useSanityClient();
1682
- const doc_id = (0, import_sanity3.useFormValue)(["_id"]);
1683
- const title = (0, import_sanity3.useFormValue)(["title"]);
1684
- const preferredStyleRef = (0, import_sanity3.useFormValue)(["preferredStyle"]);
1685
- const slug = (0, import_sanity3.useFormValue)(["slug"]);
1686
- 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: [] };
1687
666
  const subfamiliesArray = (stylesObject == null ? void 0 : stylesObject.subfamilies) || [];
1688
- const { weightKeywordList, italicKeywordList } = (0, import_react5.useMemo)(() => generateStyleKeywords(), []);
1689
- (0, import_react5.useEffect)(() => {
667
+ const { weightKeywordList, italicKeywordList } = _react.useMemo.call(void 0, () => _chunkFH4QKHOHjs.generateStyleKeywords.call(void 0, ), []);
668
+ _react.useEffect.call(void 0, () => {
1690
669
  if (ready !== true) {
1691
670
  setElapsedSeconds(0);
1692
671
  elapsedTimerRef.current = setInterval(() => {
@@ -1697,7 +676,7 @@ var BatchUploadFonts = () => {
1697
676
  }
1698
677
  return () => clearInterval(elapsedTimerRef.current);
1699
678
  }, [ready]);
1700
- (0, import_react5.useEffect)(() => {
679
+ _react.useEffect.call(void 0, () => {
1701
680
  if (ready !== true) {
1702
681
  const handler = (e) => {
1703
682
  e.preventDefault();
@@ -1707,7 +686,7 @@ var BatchUploadFonts = () => {
1707
686
  return () => window.removeEventListener("beforeunload", handler);
1708
687
  }
1709
688
  }, [ready]);
1710
- (0, import_react5.useEffect)(() => {
689
+ _react.useEffect.call(void 0, () => {
1711
690
  var _a;
1712
691
  if (ready !== true) {
1713
692
  (_a = navigator.wakeLock) == null ? void 0 : _a.request("screen").then((lock) => {
@@ -1762,32 +741,32 @@ var BatchUploadFonts = () => {
1762
741
  setStatus2("Upload completed successfully");
1763
742
  }
1764
743
  };
1765
- const handleFileSelect = (0, import_react5.useCallback)((e) => {
744
+ const handleFileSelect = _react.useCallback.call(void 0, (e) => {
1766
745
  const files = filterFontFiles(e.target.files);
1767
746
  if (files.length > 0) setPendingFiles((prev) => [...prev, ...files]);
1768
747
  e.target.value = "";
1769
748
  }, []);
1770
- const handleRemoveFile = (0, import_react5.useCallback)((file) => {
749
+ const handleRemoveFile = _react.useCallback.call(void 0, (file) => {
1771
750
  setPendingFiles((prev) => prev.filter((f) => f !== file));
1772
751
  }, []);
1773
- const handleDragEnter = (0, import_react5.useCallback)((e) => {
752
+ const handleDragEnter = _react.useCallback.call(void 0, (e) => {
1774
753
  e.preventDefault();
1775
754
  setIsDragging(true);
1776
755
  }, []);
1777
- const handleDragOver = (0, import_react5.useCallback)((e) => {
756
+ const handleDragOver = _react.useCallback.call(void 0, (e) => {
1778
757
  e.preventDefault();
1779
758
  }, []);
1780
- const handleDragLeave = (0, import_react5.useCallback)((e) => {
759
+ const handleDragLeave = _react.useCallback.call(void 0, (e) => {
1781
760
  e.preventDefault();
1782
761
  setIsDragging(false);
1783
762
  }, []);
1784
- const handleDrop = (0, import_react5.useCallback)((e) => {
763
+ const handleDrop = _react.useCallback.call(void 0, (e) => {
1785
764
  e.preventDefault();
1786
765
  setIsDragging(false);
1787
766
  const files = filterFontFiles(e.dataTransfer.files);
1788
767
  if (files.length > 0) setPendingFiles((prev) => [...prev, ...files]);
1789
768
  }, []);
1790
- const handleConfirmUpload = (0, import_react5.useCallback)(async () => {
769
+ const handleConfirmUpload = _react.useCallback.call(void 0, async () => {
1791
770
  try {
1792
771
  setStatus("Uploading font files...");
1793
772
  setReady("upload");
@@ -1798,7 +777,7 @@ var BatchUploadFonts = () => {
1798
777
  }
1799
778
  const sortedFiles = sortFilesByType(pendingFiles);
1800
779
  setPendingFiles([]);
1801
- const { fontsObjects, subfamilies, uniqueSubfamilies, newPreferredStyle, failedFiles } = await processFontFiles(
780
+ const { fontsObjects, subfamilies, uniqueSubfamilies, newPreferredStyle, failedFiles } = await _chunkFH4QKHOHjs.processFontFiles.call(void 0,
1802
781
  sortedFiles,
1803
782
  title,
1804
783
  weightKeywordList,
@@ -1817,7 +796,7 @@ var BatchUploadFonts = () => {
1817
796
  setError,
1818
797
  preserveFileNames
1819
798
  );
1820
- await updateTypefaceDocument(
799
+ await _chunkFH4QKHOHjs.updateTypefaceDocument.call(void 0,
1821
800
  doc_id,
1822
801
  fontRefs,
1823
802
  variableRefs,
@@ -1840,7 +819,7 @@ var BatchUploadFonts = () => {
1840
819
  setReady(true);
1841
820
  setError(false);
1842
821
  }, [pendingFiles, stylesObject, title, slug, doc_id, inputPrice, weightKeywordList, italicKeywordList, client, preferredStyleRef, subfamiliesArray, preserveShortenedNames, preserveFileNames]);
1843
- const handleRenameExistingFonts = (0, import_react5.useCallback)(async () => {
822
+ const handleRenameExistingFonts = _react.useCallback.call(void 0, async () => {
1844
823
  try {
1845
824
  setStatus("Processing font documents...");
1846
825
  setReady("rename");
@@ -1869,14 +848,14 @@ var BatchUploadFonts = () => {
1869
848
  }
1870
849
  setReady(true);
1871
850
  }, [title, client, slug, weightKeywordList, italicKeywordList, preserveShortenedNames]);
1872
- const handleChangeFontPrice = (0, import_react5.useCallback)(async () => {
851
+ const handleChangeFontPrice = _react.useCallback.call(void 0, async () => {
1873
852
  setStatus("Updating font prices...");
1874
853
  setReady("price");
1875
854
  setError(false);
1876
855
  await updateFontPrices({ client, title, slug, inputPrice, doc_id, setStatus, setError });
1877
856
  setReady(true);
1878
857
  }, [title, slug, client, doc_id, inputPrice]);
1879
- const handleRegenerateCssFiles = (0, import_react5.useCallback)(async () => {
858
+ const handleRegenerateCssFiles = _react.useCallback.call(void 0, async () => {
1880
859
  var _a, _b, _c, _d;
1881
860
  try {
1882
861
  setStatus("Regenerating CSS files...");
@@ -1934,7 +913,7 @@ var BatchUploadFonts = () => {
1934
913
  const woff2Blob = await woff2Response.blob();
1935
914
  const woff2File = new File([woff2Blob], `${fontDoc._id}.woff2`, { type: "font/woff2" });
1936
915
  setStatus(`Regenerating CSS for font ${i + 1}/${fontRefs.length}: ${fontDoc.title}`);
1937
- const updatedFileInput = await generateCssFile({
916
+ const updatedFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
1938
917
  woff2File,
1939
918
  fileInput: fontDoc.fileInput,
1940
919
  fileName: fontDoc._id,
@@ -1967,18 +946,18 @@ var BatchUploadFonts = () => {
1967
946
  setError(false);
1968
947
  setStatus("ready");
1969
948
  };
1970
- const renderTooltipLabel = (label, description) => /* @__PURE__ */ import_react5.default.createElement(
1971
- import_ui4.Tooltip,
949
+ const renderTooltipLabel = (label, description) => /* @__PURE__ */ _react2.default.createElement(
950
+ _ui.Tooltip,
1972
951
  {
1973
- 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)),
1974
953
  placement: "top",
1975
954
  portal: true
1976
955
  },
1977
- /* @__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" } }))
1978
957
  );
1979
- 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)))));
1980
- const renderDropZone = () => /* @__PURE__ */ import_react5.default.createElement(
1981
- 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,
1982
961
  {
1983
962
  onDragEnter: handleDragEnter,
1984
963
  onDragOver: handleDragOver,
@@ -1994,7 +973,7 @@ var BatchUploadFonts = () => {
1994
973
  cursor: "default"
1995
974
  }
1996
975
  },
1997
- /* @__PURE__ */ import_react5.default.createElement(
976
+ /* @__PURE__ */ _react2.default.createElement(
1998
977
  "input",
1999
978
  {
2000
979
  ref: fileInputRef,
@@ -2005,8 +984,8 @@ var BatchUploadFonts = () => {
2005
984
  onChange: handleFileSelect
2006
985
  }
2007
986
  ),
2008
- /* @__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(
2009
- 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,
2010
989
  {
2011
990
  mode: "ghost",
2012
991
  tone: "primary",
@@ -2022,8 +1001,8 @@ var BatchUploadFonts = () => {
2022
1001
  );
2023
1002
  const renderFileList = () => {
2024
1003
  const sorted = sortFilesByType(pendingFiles);
2025
- 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(
2026
- 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,
2027
1006
  {
2028
1007
  mode: "bleed",
2029
1008
  tone: "default",
@@ -2032,27 +1011,27 @@ var BatchUploadFonts = () => {
2032
1011
  text: "Clear all",
2033
1012
  onClick: () => setPendingFiles([])
2034
1013
  }
2035
- )), /* @__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) => {
2036
1015
  const ext = file.name.split(".").pop().toUpperCase();
2037
- 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(
2038
- 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,
2039
1018
  {
2040
1019
  size: 0,
2041
1020
  style: { fontFamily: "monospace", minWidth: "2.5rem", flexShrink: 0 }
2042
1021
  },
2043
1022
  ext
2044
- ), /* @__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(
2045
- 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,
2046
1025
  {
2047
1026
  mode: "bleed",
2048
1027
  tone: "critical",
2049
- icon: import_icons.TrashIcon,
1028
+ icon: _icons.TrashIcon,
2050
1029
  padding: 2,
2051
1030
  onClick: () => handleRemoveFile(file)
2052
1031
  }
2053
1032
  )));
2054
- })), /* @__PURE__ */ import_react5.default.createElement(
2055
- import_ui4.Box,
1033
+ })), /* @__PURE__ */ _react2.default.createElement(
1034
+ _ui.Box,
2056
1035
  {
2057
1036
  onDragEnter: handleDragEnter,
2058
1037
  onDragOver: handleDragOver,
@@ -2067,7 +1046,7 @@ var BatchUploadFonts = () => {
2067
1046
  transition: "border-color 0.12s, background 0.12s"
2068
1047
  }
2069
1048
  },
2070
- /* @__PURE__ */ import_react5.default.createElement(
1049
+ /* @__PURE__ */ _react2.default.createElement(
2071
1050
  "input",
2072
1051
  {
2073
1052
  ref: fileInputRef,
@@ -2078,8 +1057,8 @@ var BatchUploadFonts = () => {
2078
1057
  onChange: handleFileSelect
2079
1058
  }
2080
1059
  ),
2081
- /* @__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(
2082
- 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,
2083
1062
  {
2084
1063
  mode: "bleed",
2085
1064
  tone: "primary",
@@ -2092,29 +1071,30 @@ var BatchUploadFonts = () => {
2092
1071
  }
2093
1072
  }
2094
1073
  ))
2095
- ), /* @__PURE__ */ import_react5.default.createElement(
2096
- import_ui4.Button,
1074
+ ), /* @__PURE__ */ _react2.default.createElement(
1075
+ _ui.Button,
2097
1076
  {
2098
1077
  mode: "ghost",
2099
1078
  tone: "primary",
2100
- icon: import_icons.UploadIcon,
1079
+ icon: _icons.UploadIcon,
2101
1080
  text: `Upload ${pendingFiles.length} Font${pendingFiles.length === 1 ? "" : "s"}`,
2102
1081
  style: { width: "100%" },
2103
1082
  onClick: handleConfirmUpload
2104
1083
  }
2105
1084
  ));
2106
1085
  };
2107
- 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(
2108
1088
  StatusDisplay_default,
2109
1089
  {
2110
1090
  status,
2111
1091
  error,
2112
- action: /* @__PURE__ */ import_react5.default.createElement(
2113
- import_ui4.Button,
1092
+ action: /* @__PURE__ */ _react2.default.createElement(
1093
+ _ui.Button,
2114
1094
  {
2115
1095
  mode: showUtilities ? "default" : "ghost",
2116
1096
  tone: "primary",
2117
- icon: import_icons.ControlsIcon,
1097
+ icon: _icons.ControlsIcon,
2118
1098
  text: "Utilities",
2119
1099
  fontSize: 1,
2120
1100
  padding: 2,
@@ -2122,17 +1102,32 @@ var BatchUploadFonts = () => {
2122
1102
  }
2123
1103
  )
2124
1104
  }
2125
- ), /* @__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(
2126
- import_ui4.Switch,
1105
+ ), /* @__PURE__ */ _react2.default.createElement(
1106
+ _ui.Button,
2127
1107
  {
2128
- checked: preserveShortenedNames,
2129
- 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%" }
2130
1116
  }
2131
- ), renderTooltipLabel(
2132
- "Preserve shortened names",
2133
- 'Abbreviations in font names are kept as-is (e.g. "XNarrow" stays "XNarrow", "Bd" stays "Bd").'
2134
- )), 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(
2135
- 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,
2136
1131
  {
2137
1132
  checked: preserveShortenedNames,
2138
1133
  onChange: (e) => setPreserveShortenedNames(e.target.checked)
@@ -2140,44 +1135,35 @@ var BatchUploadFonts = () => {
2140
1135
  ), renderTooltipLabel(
2141
1136
  "Preserve shortened names",
2142
1137
  'Abbreviations in font names are kept as-is (e.g. "XNarrow" stays "XNarrow", "Bd" stays "Bd").'
2143
- )), /* @__PURE__ */ import_react5.default.createElement(import_ui4.Flex, { align: "center", gap: 2 }, /* @__PURE__ */ import_react5.default.createElement(
2144
- import_ui4.Switch,
2145
- {
2146
- checked: preserveFileNames,
2147
- onChange: (e) => setPreserveFileNames(e.target.checked)
2148
- }
2149
- ), renderTooltipLabel(
2150
- "Preserve file names",
2151
- "Original filename capitalisation is used for asset naming instead of the normalised font title."
2152
- )))), /* @__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 }))))));
2153
1139
  };
2154
1140
 
2155
1141
  // src/components/GenerateCollectionsPairsComponent.jsx
2156
- var import_react6 = __toESM(require("react"));
2157
- var import_ui5 = require("@sanity/ui");
2158
- var import_sanity4 = require("sanity");
2159
- var import_slugify2 = __toESM(require("slugify"));
2160
- var import_nanoid6 = require("nanoid");
1142
+
1143
+
1144
+
1145
+ var _slugify = require('slugify'); var _slugify2 = _interopRequireDefault(_slugify);
1146
+
2161
1147
  var GenerateCollectionsPairsComponent = () => {
2162
- const [status, setStatus] = (0, import_react6.useState)("ready");
2163
- const [ready, setReady] = (0, import_react6.useState)(true);
2164
- 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,
2165
1151
  process.env.SANITY_STUDIO_DEFAULT_COLLECTION_PRICE || 20
2166
1152
  );
2167
- const [pairPrice, setPairPrice] = (0, import_react6.useState)(
1153
+ const [pairPrice, setPairPrice] = _react.useState.call(void 0,
2168
1154
  process.env.SANITY_STUDIO_DEFAULT_PAIR_PRICE || 75
2169
1155
  );
2170
1156
  const client = useSanityClient();
2171
- const doc_id = (0, import_sanity4.useFormValue)(["_id"]);
2172
- const title = (0, import_sanity4.useFormValue)(["title"]);
2173
- const slug = (0, import_sanity4.useFormValue)(["slug"]);
2174
- const stylesObject = (0, import_sanity4.useFormValue)(["styles"]);
2175
- 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) => {
2176
1162
  const newSlug = collectionSlug.toLowerCase().trim();
2177
1163
  const fontRefs = fontsList.map((font) => ({
2178
- _key: (0, import_nanoid6.nanoid)(),
1164
+ _key: _nanoid.nanoid.call(void 0, ),
2179
1165
  _type: "reference",
2180
- _ref: font._id ?? font._ref,
1166
+ _ref: _nullishCoalesce(font._id, () => ( font._ref)),
2181
1167
  _weak: true
2182
1168
  }));
2183
1169
  let preferredStyle = { weight: fontsList[0].weight, style: fontsList[0].style, _ref: fontsList[0]._ref };
@@ -2191,7 +1177,7 @@ var GenerateCollectionsPairsComponent = () => {
2191
1177
  });
2192
1178
  const price = (collectionPrice ? Number(collectionPrice) : 0) * fontRefs.length;
2193
1179
  await client.createOrReplace({
2194
- _key: (0, import_nanoid6.nanoid)(),
1180
+ _key: _nanoid.nanoid.call(void 0, ),
2195
1181
  _id: newSlug,
2196
1182
  _type: "collection",
2197
1183
  state: "active",
@@ -2204,18 +1190,18 @@ var GenerateCollectionsPairsComponent = () => {
2204
1190
  }).catch((err) => {
2205
1191
  console.error("Error creating collection:", err.message);
2206
1192
  });
2207
- 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, ) };
2208
1194
  }, [collectionPrice, client]);
2209
- const createSanityPair = (0, import_react6.useCallback)(async (pair, pairSlug, newTitle) => {
1195
+ const createSanityPair = _react.useCallback.call(void 0, async (pair, pairSlug, newTitle) => {
2210
1196
  const newSlug = pairSlug.toLowerCase().trim();
2211
1197
  const fontRefs = pair.map((font) => ({
2212
- _key: (0, import_nanoid6.nanoid)(),
1198
+ _key: _nanoid.nanoid.call(void 0, ),
2213
1199
  _type: "reference",
2214
1200
  _ref: font._id,
2215
1201
  _weak: true
2216
1202
  }));
2217
1203
  await client.createOrReplace({
2218
- _key: (0, import_nanoid6.nanoid)(),
1204
+ _key: _nanoid.nanoid.call(void 0, ),
2219
1205
  _id: newSlug,
2220
1206
  _type: "pair",
2221
1207
  preferredStyle: { _type: "reference", _ref: fontRefs[0]._ref, _weak: true },
@@ -2226,9 +1212,9 @@ var GenerateCollectionsPairsComponent = () => {
2226
1212
  }).catch((err) => {
2227
1213
  console.error("Error creating pair:", err.message);
2228
1214
  });
2229
- 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, ) };
2230
1216
  }, [pairPrice, client]);
2231
- const handleGenerateCollections = (0, import_react6.useCallback)(async () => {
1217
+ const handleGenerateCollections = _react.useCallback.call(void 0, async () => {
2232
1218
  setStatus("Generating collections...");
2233
1219
  setReady(false);
2234
1220
  try {
@@ -2236,8 +1222,8 @@ var GenerateCollectionsPairsComponent = () => {
2236
1222
  `*[_type == "typeface" && _id == $id]{ "fonts": styles.fonts[] -> }[0]`,
2237
1223
  { id: doc_id }
2238
1224
  );
2239
- const sanityFonts = (result == null ? void 0 : result.fonts) ?? [];
2240
- 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), () => ( []));
2241
1227
  const totalCollections = subfamilies.length + 3;
2242
1228
  const fullFamily = [], uprights = [], italics = [];
2243
1229
  for (const font of sanityFonts) {
@@ -2264,7 +1250,7 @@ var GenerateCollectionsPairsComponent = () => {
2264
1250
  setStatus(`[${i + 4}/${totalCollections}] Generating ${subfamilies[i].title} collection`);
2265
1251
  const ref = await createSanityCollection(
2266
1252
  subfamilies[i].fonts,
2267
- `${slug.current}-${(0, import_slugify2.default)(subfamilies[i].title)}-family`,
1253
+ `${slug.current}-${_slugify2.default.call(void 0, subfamilies[i].title)}-family`,
2268
1254
  `${title} ${subfamilies[i].title} Family`
2269
1255
  );
2270
1256
  if (ref) typefacePatch.push(ref);
@@ -2277,7 +1263,7 @@ var GenerateCollectionsPairsComponent = () => {
2277
1263
  }
2278
1264
  setReady(true);
2279
1265
  }, [doc_id, title, slug, stylesObject, collectionPrice, client, createSanityCollection]);
2280
- const handleGeneratePairs = (0, import_react6.useCallback)(async () => {
1266
+ const handleGeneratePairs = _react.useCallback.call(void 0, async () => {
2281
1267
  var _a;
2282
1268
  setStatus("Generating pairs...");
2283
1269
  setReady(false);
@@ -2286,7 +1272,7 @@ var GenerateCollectionsPairsComponent = () => {
2286
1272
  `*[_type == "typeface" && _id == $id]{ "fonts": styles.fonts[] -> }[0]`,
2287
1273
  { id: doc_id }
2288
1274
  );
2289
- const sanityFonts = (result == null ? void 0 : result.fonts) ?? [];
1275
+ const sanityFonts = _nullishCoalesce((result == null ? void 0 : result.fonts), () => ( []));
2290
1276
  const regular = [], italic = [];
2291
1277
  for (const font of sanityFonts) {
2292
1278
  if (font.style === "Regular") regular.push(font);
@@ -2306,21 +1292,21 @@ var GenerateCollectionsPairsComponent = () => {
2306
1292
  let pairSlug, pairTitle;
2307
1293
  if (reg.subfamily && reg.subfamily !== "") {
2308
1294
  if (reg.subfamily === "Regular") {
2309
- pairSlug = `${slug.current}-${(0, import_slugify2.default)(reg.weightName)}s`;
1295
+ pairSlug = `${slug.current}-${_slugify2.default.call(void 0, reg.weightName)}s`;
2310
1296
  pairTitle = `${title} ${reg.weightName}s`;
2311
1297
  } else {
2312
- 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`;
2313
1299
  pairTitle = `${title} ${reg.subfamily} ${reg.weightName}s`;
2314
1300
  }
2315
1301
  } else {
2316
- pairSlug = `${slug.current}-${(0, import_slugify2.default)(reg.weightName)}s`;
1302
+ pairSlug = `${slug.current}-${_slugify2.default.call(void 0, reg.weightName)}s`;
2317
1303
  pairTitle = `${title} ${reg.weightName}s`;
2318
1304
  }
2319
1305
  setStatus(`[${i + 1}/${pairs.length}] Generating ${pairTitle}`);
2320
1306
  const ref = await createSanityPair(pairs[i], pairSlug, pairTitle);
2321
1307
  if (ref) typefacePatch.push(ref);
2322
1308
  }
2323
- const preferredStyle = ((_a = regular[0]) == null ? void 0 : _a._id) ?? "";
1309
+ const preferredStyle = _nullishCoalesce(((_a = regular[0]) == null ? void 0 : _a._id), () => ( ""));
2324
1310
  await client.patch(doc_id).set({
2325
1311
  preferredStyle: { _ref: preferredStyle, _type: "reference", _weak: true },
2326
1312
  styles: { ...stylesObject, pairs: typefacePatch }
@@ -2333,7 +1319,7 @@ var GenerateCollectionsPairsComponent = () => {
2333
1319
  setReady(true);
2334
1320
  }, [doc_id, title, slug, stylesObject, pairPrice, client, createSanityPair]);
2335
1321
  if (!title || !slug) return null;
2336
- 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(
2337
1323
  "input",
2338
1324
  {
2339
1325
  value: collectionPrice,
@@ -2341,7 +1327,7 @@ var GenerateCollectionsPairsComponent = () => {
2341
1327
  type: "number",
2342
1328
  style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
2343
1329
  }
2344
- ))), /* @__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(
2345
1331
  "input",
2346
1332
  {
2347
1333
  value: pairPrice,
@@ -2349,27 +1335,27 @@ var GenerateCollectionsPairsComponent = () => {
2349
1335
  type: "number",
2350
1336
  style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
2351
1337
  }
2352
- )))), /* @__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))));
2353
1339
  };
2354
1340
 
2355
1341
  // src/components/UpdateScriptsComponent.jsx
2356
- var import_react7 = __toESM(require("react"));
2357
- var import_ui6 = require("@sanity/ui");
2358
- var import_sanity5 = require("sanity");
1342
+
1343
+
1344
+
2359
1345
  var UpdateScriptsComponent = (props) => {
2360
1346
  const { onChange } = props;
2361
1347
  const client = useSanityClient();
2362
- const scripts = (0, import_sanity5.useFormValue)(["scripts"]) || [];
2363
- const fonts = (0, import_sanity5.useFormValue)(["styles", "fonts"]);
2364
- const isReadyRef = (0, import_react7.useRef)(false);
2365
- const [message, setMessage] = (0, import_react7.useState)("");
2366
- (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, () => {
2367
1353
  const timer = setTimeout(() => {
2368
1354
  isReadyRef.current = true;
2369
1355
  }, 100);
2370
1356
  return () => clearTimeout(timer);
2371
1357
  }, []);
2372
- const updateFromFonts = (0, import_react7.useCallback)(async () => {
1358
+ const updateFromFonts = _react.useCallback.call(void 0, async () => {
2373
1359
  if (!fonts || fonts.length === 0) {
2374
1360
  setMessage("No fonts found to extract scripts from");
2375
1361
  return;
@@ -2393,11 +1379,11 @@ var UpdateScriptsComponent = (props) => {
2393
1379
  }
2394
1380
  return acc;
2395
1381
  }, []);
2396
- if (isReadyRef.current) onChange((0, import_sanity5.set)(newScripts));
1382
+ if (isReadyRef.current) onChange(_sanity.set.call(void 0, newScripts));
2397
1383
  setMessage("Scripts updated");
2398
1384
  }, [onChange, fonts, client]);
2399
- return /* @__PURE__ */ import_react7.default.createElement(import_ui6.Stack, { space: 3 }, /* @__PURE__ */ import_react7.default.createElement(
2400
- import_ui6.Button,
1385
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Stack, { space: 3 }, /* @__PURE__ */ _react2.default.createElement(
1386
+ _ui.Button,
2401
1387
  {
2402
1388
  mode: "ghost",
2403
1389
  tone: "primary",
@@ -2405,16 +1391,14 @@ var UpdateScriptsComponent = (props) => {
2405
1391
  text: "Update Scripts from Font Files",
2406
1392
  onClick: updateFromFonts
2407
1393
  }
2408
- ), 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));
2409
1395
  };
2410
1396
 
2411
1397
  // src/components/SingleUploaderTool.jsx
2412
- var import_react8 = __toESM(require("react"));
2413
- var import_ui7 = require("@sanity/ui");
2414
- var import_icons2 = require("@sanity/icons");
2415
- var import_sanity6 = require("sanity");
2416
- var import_buffer3 = require("buffer");
2417
- var fontkit5 = __toESM(require("fontkit"));
1398
+
1399
+
1400
+
1401
+
2418
1402
 
2419
1403
  // src/utils/generateFontFile.js
2420
1404
  async function generateFontFile({
@@ -2489,28 +1473,28 @@ var SingleUploaderTool = (props) => {
2489
1473
  var _a, _b, _c, _d;
2490
1474
  const client = useSanityClient();
2491
1475
  const { elementProps: { ref }, onChange } = props;
2492
- const [message, setMessage] = (0, import_react8.useState)("");
2493
- const [status, setStatus] = (0, import_react8.useState)("ready");
2494
- const [error, setError] = (0, import_react8.useState)(false);
2495
- const [filenames, setFilenames] = (0, import_react8.useState)({});
2496
- const [showAdvanced, setShowAdvanced] = (0, import_react8.useState)(false);
2497
- const fileInput = (0, import_sanity6.useFormValue)(["fileInput"]);
2498
- const doc_id = (0, import_sanity6.useFormValue)(["_id"]);
2499
- const doc_title = (0, import_sanity6.useFormValue)(["title"]);
2500
- const doc_typefaceName = (0, import_sanity6.useFormValue)(["typefaceName"]);
2501
- const doc_variableFont = (0, import_sanity6.useFormValue)(["variableFont"]);
2502
- const doc_weight = (0, import_sanity6.useFormValue)(["weight"]);
2503
- const doc_style = (0, import_sanity6.useFormValue)(["style"]);
2504
- const doc_slug = (0, import_sanity6.useFormValue)(["slug"]);
2505
- const doc_metaData = (0, import_sanity6.useFormValue)(["metaData"]);
2506
- const { weightKeywordList, italicKeywordList } = (0, import_react8.useMemo)(() => generateStyleKeywords(), []);
2507
- (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, () => {
2508
1492
  handleSetFilenames();
2509
1493
  }, [fileInput]);
2510
- const handleSetFilenames = (0, import_react8.useCallback)(async () => {
1494
+ const handleSetFilenames = _react.useCallback.call(void 0, async () => {
2511
1495
  var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
2512
- const woff2WebRef = ((_b2 = (_a2 = fileInput == null ? void 0 : fileInput.woff2_web) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref) ?? null;
2513
- 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));
2514
1498
  const assetIds = [
2515
1499
  (_f = (_e = fileInput == null ? void 0 : fileInput.ttf) == null ? void 0 : _e.asset) == null ? void 0 : _f._ref,
2516
1500
  (_h = (_g = fileInput == null ? void 0 : fileInput.otf) == null ? void 0 : _g.asset) == null ? void 0 : _h._ref,
@@ -2544,7 +1528,7 @@ var SingleUploaderTool = (props) => {
2544
1528
  }, {});
2545
1529
  setFilenames(fontNames);
2546
1530
  }, [fileInput, client]);
2547
- const handleGenerateCssFile = (0, import_react8.useCallback)(async () => {
1531
+ const handleGenerateCssFile = _react.useCallback.call(void 0, async () => {
2548
1532
  var _a2, _b2;
2549
1533
  setMessage("Building CSS: " + doc_title + ".css");
2550
1534
  setStatus("Building CSS file");
@@ -2557,7 +1541,7 @@ var SingleUploaderTool = (props) => {
2557
1541
  { id: woff2AssetRef }
2558
1542
  );
2559
1543
  const blob = await (await fetch(woff2Asset.url)).blob();
2560
- const newFileInput = await generateCssFile({
1544
+ const newFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
2561
1545
  woff2File: blob,
2562
1546
  fileInput,
2563
1547
  fontName: doc_title,
@@ -2572,7 +1556,7 @@ var SingleUploaderTool = (props) => {
2572
1556
  setMessage("");
2573
1557
  setStatus("ready");
2574
1558
  }, 2e3);
2575
- onChange((0, import_sanity6.set)(newFileInput));
1559
+ onChange(_sanity.set.call(void 0, newFileInput));
2576
1560
  } catch (err) {
2577
1561
  console.error("Error building CSS file:", err);
2578
1562
  setMessage("Error building CSS file: " + err.message);
@@ -2585,7 +1569,7 @@ var SingleUploaderTool = (props) => {
2585
1569
  }, 3e3);
2586
1570
  }
2587
1571
  }, [fileInput, onChange, doc_title, doc_variableFont, doc_weight, client]);
2588
- const handleGenerateFontFile = (0, import_react8.useCallback)(async (code, sourceFile) => {
1572
+ const handleGenerateFontFile = _react.useCallback.call(void 0, async (code, sourceFile) => {
2589
1573
  var _a2;
2590
1574
  const isMissing = Array.isArray(code);
2591
1575
  const label = code === "all" ? "all font files" : isMissing ? "missing files" : code + " file";
@@ -2625,7 +1609,7 @@ var SingleUploaderTool = (props) => {
2625
1609
  }, 3e3);
2626
1610
  }
2627
1611
  }, [doc_id, doc_title, doc_variableFont, doc_style, doc_weight, doc_slug, fileInput, client]);
2628
- const handleGenerateFontData = (0, import_react8.useCallback)(async () => {
1612
+ const handleGenerateFontData = _react.useCallback.call(void 0, async () => {
2629
1613
  var _a2, _b2;
2630
1614
  setMessage("Building font data...");
2631
1615
  setStatus("Building font data");
@@ -2648,16 +1632,16 @@ var SingleUploaderTool = (props) => {
2648
1632
  );
2649
1633
  if (!(ttfAsset == null ? void 0 : ttfAsset.url)) throw new Error("Could not fetch TTF file URL");
2650
1634
  const arrayBuffer = await (await fetch(ttfAsset.url)).arrayBuffer();
2651
- const font = fontkit5.create(import_buffer3.Buffer.from(arrayBuffer));
2652
- 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,
2653
1637
  font,
2654
1638
  doc_typefaceName,
2655
1639
  weightKeywordList,
2656
1640
  italicKeywordList
2657
1641
  );
2658
- const weight = determineWeight(font, weightName);
1642
+ const weight = _chunkFH4QKHOHjs.determineWeight.call(void 0, font, weightName);
2659
1643
  await client.patch(doc_id).set({ weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
2660
- const fontData = await generateFontData({
1644
+ const fontData = await _chunkFH4QKHOHjs.generateFontData.call(void 0, {
2661
1645
  url: ttfAsset.url,
2662
1646
  fontKit: font,
2663
1647
  fontId: doc_id,
@@ -2671,7 +1655,7 @@ var SingleUploaderTool = (props) => {
2671
1655
  variableFont,
2672
1656
  variableInstances: fontData.variableInstances
2673
1657
  };
2674
- const instanceMappings = await parseVariableFontInstances(fontObj, client);
1658
+ const instanceMappings = await _chunkFH4QKHOHjs.parseVariableFontInstances.call(void 0, fontObj, client);
2675
1659
  if (instanceMappings.length > 0) {
2676
1660
  await client.patch(doc_id).set({ variableInstanceReferences: instanceMappings }).commit();
2677
1661
  }
@@ -2694,7 +1678,7 @@ var SingleUploaderTool = (props) => {
2694
1678
  }, 3e3);
2695
1679
  }
2696
1680
  }, [fileInput, doc_id, doc_typefaceName, client, weightKeywordList, italicKeywordList]);
2697
- const handleGenerateSubsetAndWeb = (0, import_react8.useCallback)(async () => {
1681
+ const handleGenerateSubsetAndWeb = _react.useCallback.call(void 0, async () => {
2698
1682
  var _a2, _b2;
2699
1683
  try {
2700
1684
  const woff2AssetRef = (_b2 = (_a2 = fileInput == null ? void 0 : fileInput.woff2) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref;
@@ -2733,7 +1717,7 @@ var SingleUploaderTool = (props) => {
2733
1717
  }, 3e3);
2734
1718
  }
2735
1719
  }, [fileInput, doc_id, doc_title, doc_variableFont, doc_style, doc_weight, doc_slug, client]);
2736
- const handleUploadTopLevelFile = (0, import_react8.useCallback)(async (event, fieldName) => {
1720
+ const handleUploadTopLevelFile = _react.useCallback.call(void 0, async (event, fieldName) => {
2737
1721
  try {
2738
1722
  const file = event.target.files[0];
2739
1723
  if (!file) return;
@@ -2747,7 +1731,7 @@ var SingleUploaderTool = (props) => {
2747
1731
  ...fileInput,
2748
1732
  [fieldName]: { _type: "file", asset: { _ref: asset._id, _type: "reference" } }
2749
1733
  };
2750
- onChange((0, import_sanity6.set)(newFileInput));
1734
+ onChange(_sanity.set.call(void 0, newFileInput));
2751
1735
  setMessage(`${fieldName} uploaded`);
2752
1736
  setStatus(`${fieldName} uploaded successfully`);
2753
1737
  setTimeout(() => {
@@ -2766,7 +1750,7 @@ var SingleUploaderTool = (props) => {
2766
1750
  }, 3e3);
2767
1751
  }
2768
1752
  }, [fileInput, onChange, doc_slug, client]);
2769
- const handleUpload = (0, import_react8.useCallback)(async (event, code) => {
1753
+ const handleUpload = _react.useCallback.call(void 0, async (event, code) => {
2770
1754
  try {
2771
1755
  const file = event.target.files[0];
2772
1756
  if (!file) {
@@ -2790,7 +1774,7 @@ var SingleUploaderTool = (props) => {
2790
1774
  if (code === "woff2") {
2791
1775
  setMessage("Building CSS: " + doc_title + ".css");
2792
1776
  setStatus("Building CSS file");
2793
- newFileInput = await generateCssFile({
1777
+ newFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
2794
1778
  woff2File: file,
2795
1779
  fileInput: newFileInput,
2796
1780
  fontName: doc_title,
@@ -2804,19 +1788,19 @@ var SingleUploaderTool = (props) => {
2804
1788
  setStatus("CSS file built successfully");
2805
1789
  }
2806
1790
  if (code === "ttf") {
2807
- const fontBuffer = await readFontFile(file);
2808
- const font = fontkit5.create(fontBuffer);
2809
- 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,
2810
1794
  font,
2811
1795
  doc_typefaceName,
2812
1796
  weightKeywordList,
2813
1797
  italicKeywordList
2814
1798
  );
2815
- const weight = determineWeight(font, weightName);
1799
+ const weight = _chunkFH4QKHOHjs.determineWeight.call(void 0, font, weightName);
2816
1800
  const normalizedId = doc_id.startsWith("drafts.") ? doc_id.replace("drafts.", "") : doc_id;
2817
1801
  await client.patch(normalizedId).set({ weightName, subfamily: subfamilyName, style, variableFont, weight }).commit();
2818
1802
  }
2819
- onChange((0, import_sanity6.set)(newFileInput));
1803
+ onChange(_sanity.set.call(void 0, newFileInput));
2820
1804
  setTimeout(() => {
2821
1805
  setMessage("");
2822
1806
  setStatus("ready");
@@ -2833,7 +1817,7 @@ var SingleUploaderTool = (props) => {
2833
1817
  }, 3e3);
2834
1818
  }
2835
1819
  }, [fileInput, onChange, doc_title, doc_typefaceName, doc_variableFont, doc_weight, doc_slug, doc_id, client, weightKeywordList, italicKeywordList]);
2836
- const handleDelete = (0, import_react8.useCallback)(async (code) => {
1820
+ const handleDelete = _react.useCallback.call(void 0, async (code) => {
2837
1821
  var _a2, _b2;
2838
1822
  try {
2839
1823
  setMessage(`Deleting ${code} file...`);
@@ -2846,7 +1830,7 @@ var SingleUploaderTool = (props) => {
2846
1830
  setError(true);
2847
1831
  return;
2848
1832
  }
2849
- onChange((0, import_sanity6.unset)([code]));
1833
+ onChange(_sanity.unset.call(void 0, [code]));
2850
1834
  await client.delete(asset);
2851
1835
  setMessage(`${code} file deleted`);
2852
1836
  setStatus(`${code} file deleted successfully`);
@@ -2866,7 +1850,7 @@ var SingleUploaderTool = (props) => {
2866
1850
  }, 3e3);
2867
1851
  }
2868
1852
  }, [fileInput, onChange, client]);
2869
- const handleDeleteTopLevel = (0, import_react8.useCallback)(async (fieldName) => {
1853
+ const handleDeleteTopLevel = _react.useCallback.call(void 0, async (fieldName) => {
2870
1854
  var _a2, _b2;
2871
1855
  try {
2872
1856
  setMessage(`Deleting ${fieldName}...`);
@@ -2879,7 +1863,7 @@ var SingleUploaderTool = (props) => {
2879
1863
  setError(true);
2880
1864
  return;
2881
1865
  }
2882
- onChange((0, import_sanity6.unset)([fieldName]));
1866
+ onChange(_sanity.unset.call(void 0, [fieldName]));
2883
1867
  await client.delete(asset);
2884
1868
  setMessage(`${fieldName} deleted`);
2885
1869
  setStatus(`${fieldName} deleted successfully`);
@@ -2899,12 +1883,12 @@ var SingleUploaderTool = (props) => {
2899
1883
  }, 3e3);
2900
1884
  }
2901
1885
  }, [fileInput, onChange, client]);
2902
- const handleDeleteAll = (0, import_react8.useCallback)(async () => {
1886
+ const handleDeleteAll = _react.useCallback.call(void 0, async () => {
2903
1887
  try {
2904
1888
  setMessage("Deleting all files and metadata...");
2905
1889
  setStatus("Deleting all files and metadata");
2906
1890
  setError(false);
2907
- onChange((0, import_sanity6.unset)([]));
1891
+ onChange(_sanity.unset.call(void 0, []));
2908
1892
  await client.patch(doc_id).set({
2909
1893
  characterSet: { chars: [] },
2910
1894
  glyphCount: 0,
@@ -2953,30 +1937,30 @@ var SingleUploaderTool = (props) => {
2953
1937
  const formatUpper = format.toUpperCase();
2954
1938
  const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput[format]) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
2955
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;
2956
- 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) }))));
2957
1941
  };
2958
1942
  const renderTopLevelAssetSection = (label, fieldName, assetRef, filename, onBuild) => {
2959
1943
  const hasFile = !!assetRef;
2960
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;
2961
- 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) }))));
2962
1946
  };
2963
1947
  const renderCssSection = () => {
2964
1948
  var _a2, _b2;
2965
1949
  const hasFile = !!((_b2 = (_a2 = fileInput == null ? void 0 : fileInput.css) == null ? void 0 : _a2.asset) == null ? void 0 : _b2._ref);
2966
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;
2967
- 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") }))));
2968
1952
  };
2969
- 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" }))));
2970
- 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(
2971
1955
  StatusDisplay_default,
2972
1956
  {
2973
1957
  status,
2974
1958
  error,
2975
- action: /* @__PURE__ */ import_react8.default.createElement(
2976
- import_ui7.Button,
1959
+ action: /* @__PURE__ */ _react2.default.createElement(
1960
+ _ui.Button,
2977
1961
  {
2978
1962
  mode: "bleed",
2979
- icon: import_icons2.ControlsIcon,
1963
+ icon: _icons.ControlsIcon,
2980
1964
  padding: 2,
2981
1965
  tone: showAdvanced ? "primary" : "default",
2982
1966
  title: "Show advanced file formats",
@@ -2984,8 +1968,8 @@ var SingleUploaderTool = (props) => {
2984
1968
  }
2985
1969
  )
2986
1970
  }
2987
- ), 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(
2988
- 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,
2989
1973
  {
2990
1974
  mode: "ghost",
2991
1975
  tone: "primary",
@@ -2993,8 +1977,8 @@ var SingleUploaderTool = (props) => {
2993
1977
  text: "Rebuild All from TTF",
2994
1978
  style: { width: "100%" }
2995
1979
  }
2996
- ), /* @__PURE__ */ import_react8.default.createElement(
2997
- import_ui7.Button,
1980
+ ), /* @__PURE__ */ _react2.default.createElement(
1981
+ _ui.Button,
2998
1982
  {
2999
1983
  mode: "ghost",
3000
1984
  tone: "primary",
@@ -3013,19 +1997,18 @@ var SingleUploaderTool = (props) => {
3013
1997
  text: "Build Missing",
3014
1998
  style: { width: "100%" }
3015
1999
  }
3016
- )), 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%" } }));
3017
2001
  };
3018
2002
 
3019
2003
  // src/components/UploadScriptsComponent.jsx
3020
- var import_react10 = __toESM(require("react"));
3021
- var import_ui8 = require("@sanity/ui");
3022
- var fontkit6 = __toESM(require("fontkit"));
3023
- var import_slugify3 = __toESM(require("slugify"));
3024
- var import_sanity7 = require("sanity");
3025
- var import_nanoid7 = require("nanoid");
2004
+
2005
+
2006
+
2007
+
2008
+
3026
2009
 
3027
2010
  // src/utils/utils.js
3028
- var import_react9 = __toESM(require("react"));
2011
+
3029
2012
  var HtmlDescription = ({ children }) => {
3030
2013
  return children || "";
3031
2014
  };
@@ -3042,17 +2025,17 @@ var DISCOUNT_REQUIREMENT_TYPES_OBJECT = DISCOUNT_REQUIREMENT_TYPES.map((type) =>
3042
2025
  var UploadScriptsComponent = (props) => {
3043
2026
  const { elementProps: { ref } } = props;
3044
2027
  const client = useSanityClient();
3045
- const [selectedScript, setSelectedScript] = (0, import_react10.useState)("");
3046
- const [status, setStatus] = import_react10.default.useState("");
3047
- const [ready, setReady] = import_react10.default.useState(true);
3048
- let doc_id = (0, import_sanity7.useFormValue)(["_id"]);
3049
- const title = (0, import_sanity7.useFormValue)(["title"]);
3050
- const slug = (0, import_sanity7.useFormValue)(["slug"]);
3051
- const scripts = (0, import_sanity7.useFormValue)(["scripts"]) || [];
3052
- 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"]);
3053
2036
  let subfamiliesArray = (stylesObject == null ? void 0 : stylesObject.subfamilies) || [];
3054
- const { weightKeywordList, italicKeywordList } = (0, import_react10.useMemo)(
3055
- () => generateStyleKeywords(),
2037
+ const { weightKeywordList, italicKeywordList } = _react.useMemo.call(void 0,
2038
+ () => _chunkFH4QKHOHjs.generateStyleKeywords.call(void 0, ),
3056
2039
  []
3057
2040
  );
3058
2041
  const readFontFile3 = (file) => {
@@ -3067,8 +2050,7 @@ var UploadScriptsComponent = (props) => {
3067
2050
  reader.readAsArrayBuffer(file);
3068
2051
  });
3069
2052
  };
3070
- const handleUpload = (0, import_react10.useCallback)(async (event, script) => {
3071
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2053
+ const handleUpload = _react.useCallback.call(void 0, async (event, script) => {
3072
2054
  setReady(false);
3073
2055
  try {
3074
2056
  let failedFiles = [];
@@ -3085,21 +2067,22 @@ var UploadScriptsComponent = (props) => {
3085
2067
  for (var i = 0; i < event.target.files.length; i++) {
3086
2068
  const file = event.target.files[i];
3087
2069
  const fontBuffer = await readFontFile3(file);
3088
- const font = fontkit6.create(fontBuffer);
3089
- console.log("reading font : ", font.fullName + " " + file.name, font.name.records);
3090
- 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;
3091
- weightName = (weightName == null ? void 0 : weightName.en) ? weightName.en : weightName.constructor == Object ? weightName[Object.keys(weightName)[0]] : weightName;
3092
- weightName = weightName == null ? void 0 : weightName.replace("Italic", "").replace("It", "").trim();
3093
- if ((weightName == "" || weightName.toLowerCase() == "roman") && ((_h = (_g = font == null ? void 0 : font.name) == null ? void 0 : _g.records) == null ? void 0 : _h.fullName)) {
3094
- weightName = (_j = (_i = font == null ? void 0 : font.name) == null ? void 0 : _i.records) == null ? void 0 : _j.fullName;
3095
- weightName = (weightName == null ? void 0 : weightName.en) ? weightName.en : weightName.constructor == Object ? weightName[Object.keys(weightName)[0]] : weightName;
3096
- weightName = weightName == null ? void 0 : weightName.replace(title + " ", "").replace(title, "").trim();
3097
- 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();
3098
2079
  }
3099
- let variableFont = (font == null ? void 0 : font.variationAxes) && Object.keys(font.variationAxes).length > 0 ? true : false;
3100
- let subfamilyName = font.familyName.toLowerCase().trim().replace(title.toLowerCase().trim(), "").trim();
3101
- let fontTitle = font == null ? void 0 : font.fullName;
3102
- 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";
3103
2086
  if (fontTitle.toLowerCase().trim().includes(script)) {
3104
2087
  fontTitle = fontTitle.toLowerCase().trim().replace(script, "").trim();
3105
2088
  fontTitle = fontTitle.split(" ").map((word) => {
@@ -3134,17 +2117,17 @@ var UploadScriptsComponent = (props) => {
3134
2117
  }
3135
2118
  if (variableFont && !fontTitle.toLowerCase().trim().endsWith(" vf")) fontTitle = fontTitle + " VF";
3136
2119
  if (italicKW.length > 0) {
3137
- italicKW = italicKW.map((item) => reverseSpellingLookup(item));
2120
+ italicKW = italicKW.map((item) => _chunkFH4QKHOHjs.reverseSpellingLookup.call(void 0, item));
3138
2121
  fontTitle = fontTitle + italicKW.join(" ");
3139
2122
  style = "Italic";
3140
2123
  }
3141
- let id = (0, import_slugify3.default)(fontTitle.toLowerCase().trim());
2124
+ let id = _slugify2.default.call(void 0, fontTitle.toLowerCase().trim());
3142
2125
  console.log("=== Font Info ====");
3143
2126
  console.log(" ");
3144
2127
  console.log("font id : ", id);
3145
2128
  console.log("font title : ", fontTitle);
3146
- console.log("fontkit fullName : ", font.fullName);
3147
- console.log("fontkit family name: ", font.familyName);
2129
+ console.log("Full name:", fullName);
2130
+ console.log("Family name:", familyName);
3148
2131
  console.log("file name : ", file.name);
3149
2132
  console.log("subfamily : ", subfamilyName);
3150
2133
  console.log("style : ", style);
@@ -3158,18 +2141,17 @@ var UploadScriptsComponent = (props) => {
3158
2141
  fontsObjects[id].files = [...fontsObjects[id].files, file];
3159
2142
  } else {
3160
2143
  let fontObject = {
3161
- _key: (0, import_nanoid7.nanoid)(),
2144
+ _key: _nanoid.nanoid.call(void 0, ),
3162
2145
  _id: id,
3163
2146
  title: fontTitle,
3164
2147
  slug: { _type: "slug", current: id },
3165
2148
  typefaceName: title,
3166
2149
  // Change to match Typeface Document
3167
- style: (font == null ? void 0 : font.italicAngle) !== 0 || (font == null ? void 0 : font.fullName.toLowerCase().includes("italic")) ? "Italic" : "Regular",
2150
+ style,
3168
2151
  variableFont,
3169
2152
  weightName,
3170
2153
  normalWeight: true,
3171
- // TODO : check if weight is normal ??
3172
- 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),
3173
2155
  files: [file],
3174
2156
  fontKit: font,
3175
2157
  scriptFileInput: { [script]: {} }
@@ -3218,7 +2200,7 @@ var UploadScriptsComponent = (props) => {
3218
2200
  if (file.name.endsWith(".woff2")) {
3219
2201
  console.log("generating css file for: ", fontObject.title);
3220
2202
  setStatus("generating css file for: " + fontObject.title);
3221
- newFileInput = await generateCssFile({
2203
+ newFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
3222
2204
  woff2File: file,
3223
2205
  fileInput: newFileInput,
3224
2206
  // script: script,
@@ -3271,7 +2253,7 @@ var UploadScriptsComponent = (props) => {
3271
2253
  fontResponse = await client.patch(font._id).set({ scriptFileInput: font.scriptFileInput }).commit();
3272
2254
  } else {
3273
2255
  fontResponse = await client.createOrReplace({
3274
- _key: (0, import_nanoid7.nanoid)(),
2256
+ _key: _nanoid.nanoid.call(void 0, ),
3275
2257
  _id: font._id,
3276
2258
  _type: "font",
3277
2259
  ...font
@@ -3284,7 +2266,7 @@ var UploadScriptsComponent = (props) => {
3284
2266
  })];
3285
2267
  continue;
3286
2268
  }
3287
- 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 };
3288
2270
  console.log("font response : ", fontResponse);
3289
2271
  console.log("existing styles object : ", stylesObject);
3290
2272
  if (!font.variableFont) {
@@ -3352,8 +2334,8 @@ var UploadScriptsComponent = (props) => {
3352
2334
  console.log("failed files : ", failedFiles);
3353
2335
  const names = failedFiles.map((file) => file.name);
3354
2336
  console.log("names : ", failedFiles.map((file) => {
3355
- var _a2, _b2;
3356
- 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;
3357
2339
  }));
3358
2340
  setStatus("fonts uploaded with errors. Failed files : " + names.join(", "));
3359
2341
  } else {
@@ -3366,26 +2348,26 @@ var UploadScriptsComponent = (props) => {
3366
2348
  }
3367
2349
  setReady(true);
3368
2350
  }, [title, slug, doc_id]);
3369
- 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(
3370
- 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,
3371
2353
  {
3372
2354
  id: "menu-button-example",
3373
2355
  onChange: (e) => setSelectedScript(e.target.value)
3374
2356
  },
3375
- /* @__PURE__ */ import_react10.default.createElement("option", { key: "script-none", value: "" }, " "),
2357
+ /* @__PURE__ */ _react2.default.createElement("option", { key: "script-none", value: "" }, " "),
3376
2358
  SCRIPTS.map(
3377
2359
  (script, i) => {
3378
2360
  var _a;
3379
- 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));
3380
2362
  }
3381
2363
  )
3382
- ), !!(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(
3383
- 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,
3384
2366
  {
3385
2367
  style: { pointerEvents: "none" },
3386
2368
  text: "Upload (ttf/otf/woff/woff2/etc..)"
3387
2369
  }
3388
- )), /* @__PURE__ */ import_react10.default.createElement(
2370
+ )), /* @__PURE__ */ _react2.default.createElement(
3389
2371
  "input",
3390
2372
  {
3391
2373
  ref,
@@ -3400,9 +2382,9 @@ var UploadScriptsComponent = (props) => {
3400
2382
  };
3401
2383
 
3402
2384
  // src/components/FontScriptUploaderComponent.jsx
3403
- var import_react11 = __toESM(require("react"));
3404
- var import_ui9 = require("@sanity/ui");
3405
- var import_sanity8 = require("sanity");
2385
+
2386
+
2387
+
3406
2388
  var FontScriptUploaderComponent = (props) => {
3407
2389
  const client = useSanityClient();
3408
2390
  const {
@@ -3410,23 +2392,23 @@ var FontScriptUploaderComponent = (props) => {
3410
2392
  onChange,
3411
2393
  value = ""
3412
2394
  } = props;
3413
- const [expanded, setExpanded] = (0, import_react11.useState)(SCRIPTS.reduce((acc, language) => ({ ...acc, [language]: true }), {}));
3414
- const [message, setMessage] = (0, import_react11.useState)({});
3415
- const [status, setStatus] = (0, import_react11.useState)("ready");
3416
- const [filenames, setFilenames] = (0, import_react11.useState)({});
3417
- let scriptFileInput = (0, import_sanity8.useFormValue)(["scriptFileInput"]) || [];
3418
- let fileInput = (0, import_sanity8.useFormValue)(["fileInput"]);
3419
- let doc_id = (0, import_sanity8.useFormValue)(["_id"]);
3420
- let doc_title = (0, import_sanity8.useFormValue)(["title"]);
3421
- let doc_variableFont = (0, import_sanity8.useFormValue)(["variableFont"]);
3422
- let doc_weight = (0, import_sanity8.useFormValue)(["weight"]);
3423
- let doc_style = (0, import_sanity8.useFormValue)(["style"]);
3424
- let doc_slug = (0, import_sanity8.useFormValue)(["slug"]);
3425
- (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, () => {
3426
2408
  if (!scriptFileInput || Object.keys(scriptFileInput).length === 0) return;
3427
2409
  handleSetFilenames();
3428
2410
  }, [scriptFileInput]);
3429
- const handleSetFilenames = (0, import_react11.useCallback)(async () => {
2411
+ const handleSetFilenames = _react.useCallback.call(void 0, async () => {
3430
2412
  console.log("Set font names ", scriptFileInput);
3431
2413
  let allIds = [];
3432
2414
  const assetIds = SCRIPTS.reduce((acc, language) => {
@@ -3460,7 +2442,7 @@ var FontScriptUploaderComponent = (props) => {
3460
2442
  });
3461
2443
  setFilenames(fontNames);
3462
2444
  }, [scriptFileInput]);
3463
- const handleGenerateCssFile = (0, import_react11.useCallback)(async (language) => {
2445
+ const handleGenerateCssFile = _react.useCallback.call(void 0, async (language) => {
3464
2446
  var _a, _b, _c;
3465
2447
  setMessage({ ...message, [language]: "Generating css: " + doc_title + ".css" });
3466
2448
  const woff2AssetRef = (_c = (_b = (_a = scriptFileInput[language]) == null ? void 0 : _a.woff2) == null ? void 0 : _b.asset) == null ? void 0 : _c._ref;
@@ -3470,7 +2452,7 @@ var FontScriptUploaderComponent = (props) => {
3470
2452
  );
3471
2453
  let blob = await fetch(woff2Buffer.url);
3472
2454
  blob = await blob.blob();
3473
- let newFileInput = await generateCssFile({
2455
+ let newFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
3474
2456
  woff2File: blob,
3475
2457
  fileInput: scriptFileInput,
3476
2458
  language,
@@ -3485,9 +2467,9 @@ var FontScriptUploaderComponent = (props) => {
3485
2467
  setTimeout(() => {
3486
2468
  setMessage({});
3487
2469
  }, 2e3);
3488
- onChange((0, import_sanity8.set)(newFileInput));
2470
+ onChange(_sanity.set.call(void 0, newFileInput));
3489
2471
  }, [scriptFileInput, onChange, doc_title, doc_variableFont]);
3490
- const handleGenerateFontFile = (0, import_react11.useCallback)(async (code, sourceFile, language) => {
2472
+ const handleGenerateFontFile = _react.useCallback.call(void 0, async (code, sourceFile, language) => {
3491
2473
  var _a;
3492
2474
  setMessage({ ...message, [language]: "Generating files: ", code });
3493
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("-", ".")}`;
@@ -3524,7 +2506,7 @@ var FontScriptUploaderComponent = (props) => {
3524
2506
  setMessage({});
3525
2507
  }, 2e3);
3526
2508
  }, []);
3527
- const handleUpload = (0, import_react11.useCallback)(async (event, language, code) => {
2509
+ const handleUpload = _react.useCallback.call(void 0, async (event, language, code) => {
3528
2510
  console.log("Handle upload ", scriptFileInput, language, code);
3529
2511
  let file = event.target.files[0];
3530
2512
  let filename = doc_slug.current + "-" + language + "." + file.name.split(".").pop();
@@ -3555,7 +2537,7 @@ var FontScriptUploaderComponent = (props) => {
3555
2537
  if (code === "woff2") {
3556
2538
  console.log("woff2");
3557
2539
  setMessage({ ...message, [language]: "Generating Css: " + doc_title + ".css" });
3558
- newFileInput = await generateCssFile({
2540
+ newFileInput = await _chunkFH4QKHOHjs.generateCssFile.call(void 0, {
3559
2541
  woff2File: file,
3560
2542
  fileInput: newFileInput,
3561
2543
  language,
@@ -3568,16 +2550,16 @@ var FontScriptUploaderComponent = (props) => {
3568
2550
  });
3569
2551
  setMessage({ ...message, [language]: "" + doc_title + ".css generated!" });
3570
2552
  }
3571
- onChange((0, import_sanity8.set)(newFileInput));
2553
+ onChange(_sanity.set.call(void 0, newFileInput));
3572
2554
  }, [scriptFileInput, onChange, doc_title, doc_variableFont, doc_slug]);
3573
- const handleDelete = (0, import_react11.useCallback)(async (code, language) => {
2555
+ const handleDelete = _react.useCallback.call(void 0, async (code, language) => {
3574
2556
  var _a, _b;
3575
2557
  console.log("Delete : ", code, language);
3576
2558
  setMessage({ ...message, [language]: `deleting ${language} ${code}` });
3577
2559
  const asset = (_b = (_a = scriptFileInput[language][code]) == null ? void 0 : _a.asset) == null ? void 0 : _b._ref;
3578
2560
  let newFileInput = { ...scriptFileInput };
3579
2561
  delete newFileInput[language][code];
3580
- onChange((0, import_sanity8.unset)([language, code]));
2562
+ onChange(_sanity.unset.call(void 0, [language, code]));
3581
2563
  await client.delete(asset).then((result) => {
3582
2564
  setMessage({ ...message, [language]: "deleted asset: ", result });
3583
2565
  setTimeout(() => {
@@ -3588,10 +2570,10 @@ var FontScriptUploaderComponent = (props) => {
3588
2570
  setMessage({ ...message, [language]: "WARNING: " + e.message });
3589
2571
  });
3590
2572
  }, [doc_id, scriptFileInput, onChange]);
3591
- const handleDeleteAll = (0, import_react11.useCallback)(async (language) => {
2573
+ const handleDeleteAll = _react.useCallback.call(void 0, async (language) => {
3592
2574
  var _a, _b;
3593
2575
  setMessage({ ...message, [language]: "deleting..." });
3594
- onChange((0, import_sanity8.unset)([language]));
2576
+ onChange(_sanity.unset.call(void 0, [language]));
3595
2577
  console.log("Delete all : ", scriptFileInput[language]);
3596
2578
  for (var i = 0; i < Object.keys(scriptFileInput[language]).length; i++) {
3597
2579
  let refKey = Object.keys(scriptFileInput[language])[i];
@@ -3609,18 +2591,18 @@ var FontScriptUploaderComponent = (props) => {
3609
2591
  }
3610
2592
  }
3611
2593
  }, [scriptFileInput]);
3612
- 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) => {
3613
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;
3614
- 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")));
3615
2597
  }));
3616
2598
  };
3617
2599
 
3618
2600
  // src/components/UploadButton.jsx
3619
- var import_react12 = __toESM(require("react"));
3620
- var import_ui10 = require("@sanity/ui");
3621
- var UploadButton = (0, import_react12.forwardRef)(({ handleUpload }, ref) => {
3622
- return /* @__PURE__ */ import_react12.default.createElement(
3623
- import_ui10.Button,
2601
+
2602
+
2603
+ var UploadButton = _react.forwardRef.call(void 0, ({ handleUpload }, ref) => {
2604
+ return /* @__PURE__ */ _react2.default.createElement(
2605
+ _ui.Button,
3624
2606
  {
3625
2607
  mode: "ghost",
3626
2608
  tone: "primary",
@@ -3628,8 +2610,8 @@ var UploadButton = (0, import_react12.forwardRef)(({ handleUpload }, ref) => {
3628
2610
  padding: 3,
3629
2611
  style: { position: "relative" }
3630
2612
  },
3631
- /* @__PURE__ */ import_react12.default.createElement(import_ui10.Text, { align: "center" }, "Upload (ttf/otf/woff/woff2/etc...)"),
3632
- /* @__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(
3633
2615
  "input",
3634
2616
  {
3635
2617
  ref,
@@ -3653,84 +2635,84 @@ UploadButton.displayName = "UploadButton";
3653
2635
  var UploadButton_default = UploadButton;
3654
2636
 
3655
2637
  // src/components/KeyValueInput.jsx
3656
- var import_react13 = __toESM(require("react"));
3657
- var import_ui11 = require("@sanity/ui");
3658
- var import_icons3 = require("@sanity/icons");
3659
- var import_sanity9 = require("sanity");
2638
+
2639
+
2640
+
2641
+
3660
2642
  function KeyValueInput({ value = [], onChange }) {
3661
- const [pairs, setPairs] = (0, import_react13.useState)(value);
3662
- 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) => {
3663
2645
  const updatedPairs = pairs.map((pair, idx) => idx === index ? { ...pair, [field2]: fieldValue } : pair);
3664
2646
  setPairs(updatedPairs);
3665
- onChange((0, import_sanity9.set)(updatedPairs));
2647
+ onChange(_sanity.set.call(void 0, updatedPairs));
3666
2648
  }, [pairs, onChange]);
3667
- const handleAddPair = (0, import_react13.useCallback)(() => {
2649
+ const handleAddPair = _react.useCallback.call(void 0, () => {
3668
2650
  const newPair = { key: "", value: "", _key: Math.random().toString(36).substr(2, 9) };
3669
2651
  const updatedPairs = [...pairs, newPair];
3670
2652
  setPairs(updatedPairs);
3671
- onChange((0, import_sanity9.set)(updatedPairs));
2653
+ onChange(_sanity.set.call(void 0, updatedPairs));
3672
2654
  }, [pairs, onChange]);
3673
- const handleRemovePair = (0, import_react13.useCallback)((index) => {
2655
+ const handleRemovePair = _react.useCallback.call(void 0, (index) => {
3674
2656
  const updatedPairs = pairs.filter((_, idx) => idx !== index);
3675
2657
  setPairs(updatedPairs);
3676
- onChange((0, import_sanity9.set)(updatedPairs));
2658
+ onChange(_sanity.set.call(void 0, updatedPairs));
3677
2659
  }, [pairs, onChange]);
3678
- const handleMoveUp = (0, import_react13.useCallback)((index) => {
2660
+ const handleMoveUp = _react.useCallback.call(void 0, (index) => {
3679
2661
  if (index === 0) return;
3680
2662
  const updatedPairs = [...pairs];
3681
2663
  [updatedPairs[index], updatedPairs[index - 1]] = [updatedPairs[index - 1], updatedPairs[index]];
3682
2664
  setPairs(updatedPairs);
3683
- onChange((0, import_sanity9.set)(updatedPairs));
2665
+ onChange(_sanity.set.call(void 0, updatedPairs));
3684
2666
  }, [pairs, onChange]);
3685
- const handleMoveDown = (0, import_react13.useCallback)((index) => {
2667
+ const handleMoveDown = _react.useCallback.call(void 0, (index) => {
3686
2668
  if (index === pairs.length - 1) return;
3687
2669
  const updatedPairs = [...pairs];
3688
2670
  [updatedPairs[index], updatedPairs[index + 1]] = [updatedPairs[index + 1], updatedPairs[index]];
3689
2671
  setPairs(updatedPairs);
3690
- onChange((0, import_sanity9.set)(updatedPairs));
2672
+ onChange(_sanity.set.call(void 0, updatedPairs));
3691
2673
  }, [pairs, onChange]);
3692
- 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(
3693
- 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,
3694
2676
  {
3695
2677
  value: pair.key,
3696
2678
  onChange: (e) => handlePairChange(index, "key", e.target.value),
3697
2679
  placeholder: "Key"
3698
2680
  }
3699
- ), /* @__PURE__ */ import_react13.default.createElement("div", { style: { marginLeft: "-1px" } }, /* @__PURE__ */ import_react13.default.createElement(
3700
- import_ui11.TextInput,
2681
+ ), /* @__PURE__ */ _react2.default.createElement("div", { style: { marginLeft: "-1px" } }, /* @__PURE__ */ _react2.default.createElement(
2682
+ _ui.TextInput,
3701
2683
  {
3702
2684
  value: pair.value,
3703
2685
  onChange: (e) => handlePairChange(index, "value", e.target.value),
3704
2686
  placeholder: "Value"
3705
2687
  }
3706
- )), /* @__PURE__ */ import_react13.default.createElement(
2688
+ )), /* @__PURE__ */ _react2.default.createElement(
3707
2689
  "button",
3708
2690
  {
3709
2691
  className: "manualButton",
3710
2692
  onClick: () => handleRemovePair(index),
3711
2693
  style: { position: "absolute", top: "0", right: "-10px", transform: "translate(100%, 0%)" }
3712
2694
  },
3713
- /* @__PURE__ */ import_react13.default.createElement(import_icons3.TrashIcon, null)
3714
- ))), /* @__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" }));
3715
2697
  }
3716
2698
 
3717
2699
  // src/components/KeyValueReferenceInput.jsx
3718
- var import_react14 = __toESM(require("react"));
3719
- var import_ui12 = require("@sanity/ui");
3720
- var import_icons4 = require("@sanity/icons");
3721
- var import_sanity10 = require("sanity");
3722
- var import_nanoid8 = require("nanoid");
2700
+
2701
+
2702
+
2703
+
2704
+
3723
2705
  function KeyValueReferenceInput(props) {
3724
2706
  var _a, _b, _c, _d, _e, _f, _g, _h;
3725
2707
  const { value = [], onChange, schemaType, referenceType, fetchReferences, topActions } = props;
3726
- const [pairs, setPairs] = (0, import_react14.useState)(value);
3727
- const [referenceData, setReferenceData] = (0, import_react14.useState)({});
3728
- const [isDialogOpen, setIsDialogOpen] = (0, import_react14.useState)(false);
3729
- const [editingIndex, setEditingIndex] = (0, import_react14.useState)(null);
3730
- 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, []);
3731
2713
  const sanityClient = useSanityClient();
3732
- const formDocument = (0, import_sanity10.useFormValue)([]);
3733
- (0, import_react14.useEffect)(() => {
2714
+ const formDocument = _sanity.useFormValue.call(void 0, []);
2715
+ _react.useEffect.call(void 0, () => {
3734
2716
  const refIds = pairs.filter((p) => {
3735
2717
  var _a2;
3736
2718
  return (_a2 = p.value) == null ? void 0 : _a2._ref;
@@ -3759,36 +2741,36 @@ function KeyValueReferenceInput(props) {
3759
2741
  setReferenceData(fallback);
3760
2742
  });
3761
2743
  }, [pairs, sanityClient]);
3762
- const handlePairChange = (0, import_react14.useCallback)((index, field2, fieldValue) => {
2744
+ const handlePairChange = _react.useCallback.call(void 0, (index, field2, fieldValue) => {
3763
2745
  const updatedPairs = pairs.map((pair, idx) => idx === index ? { ...pair, [field2]: fieldValue } : pair);
3764
2746
  setPairs(updatedPairs);
3765
- onChange((0, import_sanity10.set)(updatedPairs));
2747
+ onChange(_sanity.set.call(void 0, updatedPairs));
3766
2748
  }, [pairs, onChange]);
3767
- const handleAddPair = (0, import_react14.useCallback)(() => {
3768
- 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, ) }];
3769
2751
  setPairs(updatedPairs);
3770
- onChange((0, import_sanity10.set)(updatedPairs));
2752
+ onChange(_sanity.set.call(void 0, updatedPairs));
3771
2753
  }, [pairs, onChange]);
3772
- const handleRemovePair = (0, import_react14.useCallback)((index) => {
2754
+ const handleRemovePair = _react.useCallback.call(void 0, (index) => {
3773
2755
  const updatedPairs = pairs.filter((_, idx) => idx !== index);
3774
2756
  setPairs(updatedPairs);
3775
- onChange((0, import_sanity10.set)(updatedPairs));
2757
+ onChange(_sanity.set.call(void 0, updatedPairs));
3776
2758
  }, [pairs, onChange]);
3777
- const handleMoveUp = (0, import_react14.useCallback)((index) => {
2759
+ const handleMoveUp = _react.useCallback.call(void 0, (index) => {
3778
2760
  if (index === 0) return;
3779
2761
  const updatedPairs = [...pairs];
3780
2762
  [updatedPairs[index], updatedPairs[index - 1]] = [updatedPairs[index - 1], updatedPairs[index]];
3781
2763
  setPairs(updatedPairs);
3782
- onChange((0, import_sanity10.set)(updatedPairs));
2764
+ onChange(_sanity.set.call(void 0, updatedPairs));
3783
2765
  }, [pairs, onChange]);
3784
- const handleMoveDown = (0, import_react14.useCallback)((index) => {
2766
+ const handleMoveDown = _react.useCallback.call(void 0, (index) => {
3785
2767
  if (index === pairs.length - 1) return;
3786
2768
  const updatedPairs = [...pairs];
3787
2769
  [updatedPairs[index], updatedPairs[index + 1]] = [updatedPairs[index + 1], updatedPairs[index]];
3788
2770
  setPairs(updatedPairs);
3789
- onChange((0, import_sanity10.set)(updatedPairs));
2771
+ onChange(_sanity.set.call(void 0, updatedPairs));
3790
2772
  }, [pairs, onChange]);
3791
- const openReferenceSelector = (0, import_react14.useCallback)(async (index) => {
2773
+ const openReferenceSelector = _react.useCallback.call(void 0, async (index) => {
3792
2774
  setEditingIndex(index);
3793
2775
  if (!sanityClient) {
3794
2776
  console.error("KeyValueReferenceInput: Sanity client not available");
@@ -3810,11 +2792,11 @@ function KeyValueReferenceInput(props) {
3810
2792
  console.error("Error fetching available references:", err);
3811
2793
  }
3812
2794
  }, [sanityClient, fetchReferences, referenceType, formDocument]);
3813
- const closeDialog = (0, import_react14.useCallback)(() => {
2795
+ const closeDialog = _react.useCallback.call(void 0, () => {
3814
2796
  setIsDialogOpen(false);
3815
2797
  setEditingIndex(null);
3816
2798
  }, []);
3817
- const handleReferenceSelect = (0, import_react14.useCallback)((reference) => {
2799
+ const handleReferenceSelect = _react.useCallback.call(void 0, (reference) => {
3818
2800
  if (editingIndex === null) return;
3819
2801
  handlePairChange(editingIndex, "value", { _type: "reference", _ref: reference._id, _weak: true });
3820
2802
  closeDialog();
@@ -3826,62 +2808,62 @@ function KeyValueReferenceInput(props) {
3826
2808
  const valueTitle = (valueField == null ? void 0 : valueField.title) || "Value";
3827
2809
  const keyPlaceholder = (keyField == null ? void 0 : keyField.placeholder) || "Enter key";
3828
2810
  const pickerLabel = referenceType || valueTitle.toLowerCase();
3829
- 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) => {
3830
2812
  var _a2;
3831
- 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(
3832
- 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,
3833
2815
  {
3834
2816
  value: pair.key,
3835
2817
  onChange: (e) => handlePairChange(index, "key", e.target.value),
3836
2818
  placeholder: keyPlaceholder
3837
2819
  }
3838
- )), /* @__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(
3839
- 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,
3840
2822
  {
3841
2823
  size: 2,
3842
2824
  style: { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", maxWidth: "90%" }
3843
2825
  },
3844
2826
  referenceData[pair.value._ref] || "Loading..."
3845
- ), /* @__PURE__ */ import_react14.default.createElement(
3846
- import_ui12.MenuButton,
2827
+ ), /* @__PURE__ */ _react2.default.createElement(
2828
+ _ui.MenuButton,
3847
2829
  {
3848
- 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" }),
3849
2831
  id: `ref-options-${index}`,
3850
- 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) })),
3851
2833
  popover: { portal: true, tone: "default", placement: "left" }
3852
2834
  }
3853
- ))) : /* @__PURE__ */ import_react14.default.createElement(
3854
- import_ui12.Box,
2835
+ ))) : /* @__PURE__ */ _react2.default.createElement(
2836
+ _ui.Box,
3855
2837
  {
3856
2838
  padding: 2,
3857
2839
  style: { minHeight: "100%", border: "1px dashed #ccc", borderRadius: "4px", display: "flex", alignItems: "center", justifyContent: "center", cursor: "pointer" },
3858
2840
  onClick: () => openReferenceSelector(index)
3859
2841
  },
3860
- /* @__PURE__ */ import_react14.default.createElement(import_ui12.Text, { muted: true, size: 2 }, "Click to select a ", pickerLabel)
3861
- ))), /* @__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(
3862
2844
  "button",
3863
2845
  {
3864
2846
  className: "manualButton",
3865
2847
  onClick: () => handleRemovePair(index),
3866
2848
  style: { position: "absolute", top: "0", right: "-7px", transform: "translate(100%, 0%)" }
3867
2849
  },
3868
- /* @__PURE__ */ import_react14.default.createElement(import_icons4.TrashIcon, null)
2850
+ /* @__PURE__ */ _react2.default.createElement(_icons.TrashIcon, null)
3869
2851
  ));
3870
- }))), /* @__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(
3871
- 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,
3872
2854
  {
3873
2855
  header: `Select a ${pickerLabel}`,
3874
2856
  id: "reference-selector-dialog",
3875
2857
  onClose: closeDialog,
3876
2858
  width: 1
3877
2859
  },
3878
- /* @__PURE__ */ import_react14.default.createElement(import_ui12.Box, { padding: 4 }, /* @__PURE__ */ import_react14.default.createElement(
3879
- import_ui12.Autocomplete,
2860
+ /* @__PURE__ */ _react2.default.createElement(_ui.Box, { padding: 4 }, /* @__PURE__ */ _react2.default.createElement(
2861
+ _ui.Autocomplete,
3880
2862
  {
3881
2863
  id: "reference-autocomplete",
3882
2864
  options: referenceOptions,
3883
2865
  placeholder: `Search ${pickerLabel}s...`,
3884
- 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)),
3885
2867
  renderValue: (val) => {
3886
2868
  var _a2;
3887
2869
  return ((_a2 = referenceOptions.find((o) => o.value === val)) == null ? void 0 : _a2.title) || "";
@@ -3898,19 +2880,19 @@ function KeyValueReferenceInput(props) {
3898
2880
  }
3899
2881
 
3900
2882
  // src/components/VariableInstanceReferencesInput.jsx
3901
- var import_react15 = __toESM(require("react"));
3902
- var import_ui13 = require("@sanity/ui");
3903
- var import_icons5 = require("@sanity/icons");
3904
- var import_sanity11 = require("sanity");
3905
- var import_nanoid9 = require("nanoid");
2883
+
2884
+
2885
+
2886
+
2887
+
3906
2888
  function VariableInstanceReferencesInput(props) {
3907
2889
  const { value = [], onChange } = props;
3908
- const [isAutofilling, setIsAutofilling] = (0, import_react15.useState)(false);
3909
- const [showConfirmDialog, setShowConfirmDialog] = (0, import_react15.useState)(false);
3910
- const [pendingAction, setPendingAction] = (0, import_react15.useState)(null);
3911
- 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, []);
3912
2894
  const sanityClient = useSanityClient();
3913
- const fetchReferences = (0, import_react15.useCallback)(async (client, doc) => {
2895
+ const fetchReferences = _react.useCallback.call(void 0, async (client, doc) => {
3914
2896
  const typefaceName = doc == null ? void 0 : doc.typefaceName;
3915
2897
  if (!typefaceName) {
3916
2898
  return client.fetch(`*[_type == 'font' && variableFont != true]{_id, title}`, {});
@@ -3920,27 +2902,27 @@ function VariableInstanceReferencesInput(props) {
3920
2902
  { typefaceName }
3921
2903
  );
3922
2904
  }, []);
3923
- const performAutofillWithMatching = (0, import_react15.useCallback)(async (mode) => {
2905
+ const performAutofillWithMatching = _react.useCallback.call(void 0, async (mode) => {
3924
2906
  setIsAutofilling(true);
3925
2907
  try {
3926
2908
  if (!(formDocument == null ? void 0 : formDocument.variableInstances)) {
3927
2909
  console.warn("Cannot autofill: no variableInstances data on this document");
3928
2910
  return;
3929
2911
  }
3930
- const mappings = await parseVariableFontInstances(formDocument, sanityClient);
2912
+ const mappings = await _chunkFH4QKHOHjs.parseVariableFontInstances.call(void 0, formDocument, sanityClient);
3931
2913
  if (mappings.length === 0) {
3932
2914
  console.warn("No variable instances could be parsed from this font");
3933
2915
  return;
3934
2916
  }
3935
2917
  const updatedPairs = mode === "replace" ? mappings : [...value, ...mappings.filter((m) => !value.some((p) => p.key === m.key))];
3936
- onChange((0, import_sanity11.set)(updatedPairs));
2918
+ onChange(_sanity.set.call(void 0, updatedPairs));
3937
2919
  } catch (err) {
3938
2920
  console.error("Error during autofill with matching:", err);
3939
2921
  } finally {
3940
2922
  setIsAutofilling(false);
3941
2923
  }
3942
2924
  }, [formDocument, sanityClient, value, onChange]);
3943
- const performAutofillKeysOnly = (0, import_react15.useCallback)(async (mode) => {
2925
+ const performAutofillKeysOnly = _react.useCallback.call(void 0, async (mode) => {
3944
2926
  setIsAutofilling(true);
3945
2927
  try {
3946
2928
  if (!(formDocument == null ? void 0 : formDocument.variableInstances)) {
@@ -3950,7 +2932,7 @@ function VariableInstanceReferencesInput(props) {
3950
2932
  let instances;
3951
2933
  try {
3952
2934
  instances = JSON.parse(formDocument.variableInstances);
3953
- } catch {
2935
+ } catch (e2) {
3954
2936
  console.error("Invalid variableInstances JSON on this document");
3955
2937
  return;
3956
2938
  }
@@ -3959,16 +2941,16 @@ function VariableInstanceReferencesInput(props) {
3959
2941
  console.warn("No variable instances found in JSON");
3960
2942
  return;
3961
2943
  }
3962
- 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, ) }));
3963
2945
  const updatedPairs = mode === "replace" ? keyOnlyPairs : [...value, ...keyOnlyPairs.filter((p) => !value.some((existing) => existing.key === p.key))];
3964
- onChange((0, import_sanity11.set)(updatedPairs));
2946
+ onChange(_sanity.set.call(void 0, updatedPairs));
3965
2947
  } catch (err) {
3966
2948
  console.error("Error during keys-only autofill:", err);
3967
2949
  } finally {
3968
2950
  setIsAutofilling(false);
3969
2951
  }
3970
2952
  }, [formDocument, value, onChange]);
3971
- const handleAutofillWithMatching = (0, import_react15.useCallback)(() => {
2953
+ const handleAutofillWithMatching = _react.useCallback.call(void 0, () => {
3972
2954
  if (value.length > 0) {
3973
2955
  setPendingAction("matching");
3974
2956
  setShowConfirmDialog(true);
@@ -3976,7 +2958,7 @@ function VariableInstanceReferencesInput(props) {
3976
2958
  }
3977
2959
  performAutofillWithMatching("replace");
3978
2960
  }, [value, performAutofillWithMatching]);
3979
- const handleAutofillKeysOnly = (0, import_react15.useCallback)(() => {
2961
+ const handleAutofillKeysOnly = _react.useCallback.call(void 0, () => {
3980
2962
  if (value.length > 0) {
3981
2963
  setPendingAction("keysOnly");
3982
2964
  setShowConfirmDialog(true);
@@ -3984,41 +2966,41 @@ function VariableInstanceReferencesInput(props) {
3984
2966
  }
3985
2967
  performAutofillKeysOnly("replace");
3986
2968
  }, [value, performAutofillKeysOnly]);
3987
- const handleConfirmChoice = (0, import_react15.useCallback)(async (choice) => {
2969
+ const handleConfirmChoice = _react.useCallback.call(void 0, async (choice) => {
3988
2970
  setShowConfirmDialog(false);
3989
2971
  if (pendingAction === "matching") await performAutofillWithMatching(choice);
3990
2972
  else if (pendingAction === "keysOnly") await performAutofillKeysOnly(choice);
3991
2973
  setPendingAction(null);
3992
2974
  }, [pendingAction, performAutofillWithMatching, performAutofillKeysOnly]);
3993
- const handleConfirmCancel = (0, import_react15.useCallback)(() => {
2975
+ const handleConfirmCancel = _react.useCallback.call(void 0, () => {
3994
2976
  setShowConfirmDialog(false);
3995
2977
  setPendingAction(null);
3996
2978
  }, []);
3997
2979
  const showAutofill = !!((formDocument == null ? void 0 : formDocument.variableFont) && (formDocument == null ? void 0 : formDocument.variableInstances));
3998
- const topActions = showAutofill ? /* @__PURE__ */ import_react15.default.createElement(import_ui13.Flex, { gap: 2 }, /* @__PURE__ */ import_react15.default.createElement(
3999
- import_ui13.Button,
2980
+ const topActions = showAutofill ? /* @__PURE__ */ _react2.default.createElement(_ui.Flex, { gap: 2 }, /* @__PURE__ */ _react2.default.createElement(
2981
+ _ui.Button,
4000
2982
  {
4001
2983
  tone: "primary",
4002
2984
  mode: "ghost",
4003
2985
  onClick: handleAutofillWithMatching,
4004
- icon: import_icons5.SyncIcon,
2986
+ icon: _icons.SyncIcon,
4005
2987
  text: "Autofill with Matching",
4006
2988
  disabled: isAutofilling,
4007
2989
  loading: isAutofilling
4008
2990
  }
4009
- ), /* @__PURE__ */ import_react15.default.createElement(
4010
- import_ui13.Button,
2991
+ ), /* @__PURE__ */ _react2.default.createElement(
2992
+ _ui.Button,
4011
2993
  {
4012
2994
  tone: "default",
4013
2995
  mode: "ghost",
4014
2996
  onClick: handleAutofillKeysOnly,
4015
- icon: import_icons5.DocumentTextIcon,
2997
+ icon: _icons.DocumentTextIcon,
4016
2998
  text: "Autofill Keys Only",
4017
2999
  disabled: isAutofilling,
4018
3000
  loading: isAutofilling
4019
3001
  }
4020
3002
  )) : null;
4021
- 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(
4022
3004
  KeyValueReferenceInput,
4023
3005
  {
4024
3006
  ...props,
@@ -4026,43 +3008,43 @@ function VariableInstanceReferencesInput(props) {
4026
3008
  fetchReferences,
4027
3009
  topActions
4028
3010
  }
4029
- ), showConfirmDialog && /* @__PURE__ */ import_react15.default.createElement(
4030
- import_ui13.Dialog,
3011
+ ), showConfirmDialog && /* @__PURE__ */ _react2.default.createElement(
3012
+ _ui.Dialog,
4031
3013
  {
4032
3014
  header: "Existing entries found",
4033
3015
  id: "autofill-confirm-dialog",
4034
3016
  onClose: handleConfirmCancel,
4035
3017
  width: 1
4036
3018
  },
4037
- /* @__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") }))))
4038
3020
  ));
4039
3021
  }
4040
3022
 
4041
3023
  // src/components/PrimaryCollectionGeneratorTypeface.jsx
4042
- var import_react16 = __toESM(require("react"));
4043
- var import_ui14 = require("@sanity/ui");
4044
- var import_sanity12 = require("sanity");
4045
- var import_nanoid10 = require("nanoid");
3024
+
3025
+
3026
+
3027
+
4046
3028
  var PrimaryCollectionGeneratorTypeface = () => {
4047
3029
  const client = useSanityClient();
4048
- const [status, setStatus] = (0, import_react16.useState)("ready");
4049
- const [ready, setReady] = (0, import_react16.useState)(true);
4050
- 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,
4051
3033
  process.env.SANITY_STUDIO_DEFAULT_COLLECTION_PRICE || 100
4052
3034
  );
4053
- const fonts = (0, import_sanity12.useFormValue)(["styles", "fonts"]);
4054
- const title = (0, import_sanity12.useFormValue)(["title"]);
4055
- const preferredStyle = (0, import_sanity12.useFormValue)(["preferredStyle"]);
4056
- const docId = (0, import_sanity12.useFormValue)(["_id"]);
4057
- const styles = (0, import_sanity12.useFormValue)(["styles"]);
4058
- 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 () => {
4059
3041
  setStatus("Generating collection...");
4060
3042
  setReady(false);
4061
3043
  let id = title.toLowerCase().replace(/\s+/g, "-").slice(0, 200);
4062
3044
  if (!id.includes("collection")) id += "-collection";
4063
3045
  const colTitle = id.replace(/-/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
4064
3046
  const collectionDoc = {
4065
- _key: (0, import_nanoid10.nanoid)(),
3047
+ _key: _nanoid.nanoid.call(void 0, ),
4066
3048
  _id: id,
4067
3049
  title: colTitle,
4068
3050
  slug: { _type: "slug", current: id },
@@ -4080,7 +3062,7 @@ var PrimaryCollectionGeneratorTypeface = () => {
4080
3062
  ...styles,
4081
3063
  collections: [{
4082
3064
  _type: "reference",
4083
- _key: (0, import_nanoid10.nanoid)(),
3065
+ _key: _nanoid.nanoid.call(void 0, ),
4084
3066
  _ref: sanityCollection._id,
4085
3067
  _weak: true
4086
3068
  }, ...collections]
@@ -4094,7 +3076,7 @@ var PrimaryCollectionGeneratorTypeface = () => {
4094
3076
  setReady(true);
4095
3077
  }, [docId, fonts, price, preferredStyle, styles, title, client]);
4096
3078
  if (!title || !fonts) return null;
4097
- 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(
4098
3080
  "input",
4099
3081
  {
4100
3082
  value: price,
@@ -4102,8 +3084,8 @@ var PrimaryCollectionGeneratorTypeface = () => {
4102
3084
  type: "number",
4103
3085
  style: { textAlign: "end", padding: "5px", maxWidth: "75px" }
4104
3086
  }
4105
- ), /* @__PURE__ */ import_react16.default.createElement(import_ui14.Text, { size: 1, muted: true }, "per full family")), /* @__PURE__ */ import_react16.default.createElement(
4106
- import_ui14.Button,
3087
+ ), /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1, muted: true }, "per full family")), /* @__PURE__ */ _react2.default.createElement(
3088
+ _ui.Button,
4107
3089
  {
4108
3090
  mode: "ghost",
4109
3091
  tone: "primary",
@@ -4111,19 +3093,19 @@ var PrimaryCollectionGeneratorTypeface = () => {
4111
3093
  onClick: generateCollection,
4112
3094
  text: "Generate Full Family Collection"
4113
3095
  }
4114
- )) : /* @__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))));
4115
3097
  };
4116
3098
 
4117
3099
  // src/components/SetOTF.jsx
4118
- var import_react17 = __toESM(require("react"));
4119
- var import_sanity13 = require("sanity");
4120
- var import_ui15 = require("@sanity/ui");
3100
+
3101
+
3102
+
4121
3103
  var SetOTF = (props) => {
4122
3104
  var _a, _b;
4123
3105
  const { onChange, value = {} } = props;
4124
3106
  const client = useSanityClient();
4125
- const stylesObject = (0, import_sanity13.useFormValue)(["styles"]);
4126
- 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, "");
4127
3109
  const detect = async () => {
4128
3110
  var _a2, _b2, _c;
4129
3111
  if (!((_a2 = stylesObject == null ? void 0 : stylesObject.fonts) == null ? void 0 : _a2.length)) {
@@ -4158,7 +3140,7 @@ var SetOTF = (props) => {
4158
3140
  if (approved) features.push(key);
4159
3141
  }
4160
3142
  });
4161
- onChange((0, import_sanity13.set)({ ...value, features }));
3143
+ onChange(_sanity.set.call(void 0, { ...value, features }));
4162
3144
  setMessage(`Features detected: ${features.length ? features.join(", ") : "none"}.`);
4163
3145
  setTimeout(() => setMessage(""), 5e3);
4164
3146
  } catch (err) {
@@ -4166,35 +3148,35 @@ var SetOTF = (props) => {
4166
3148
  console.error("SetOTF detect error:", err);
4167
3149
  }
4168
3150
  };
4169
- 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(
4170
- 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,
4171
3153
  {
4172
3154
  text: "Detect OTF",
4173
3155
  mode: "ghost",
4174
3156
  onClick: detect,
4175
3157
  style: { borderRadius: "0 3px 0 0", marginBottom: "1rem" }
4176
3158
  }
4177
- ), !!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));
4178
3160
  };
4179
3161
 
4180
3162
  // src/components/StyleCountInput.jsx
4181
- var import_react18 = __toESM(require("react"));
4182
- var import_ui16 = require("@sanity/ui");
4183
- var import_sanity14 = require("sanity");
3163
+
3164
+
3165
+
4184
3166
  var StyleCountInput = (props) => {
4185
- const styles = (0, import_sanity14.useFormValue)(["styles", "fonts"]) || [];
4186
- 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"]) || [];
4187
3169
  const count = styles.length + vfStyles.length;
4188
- return /* @__PURE__ */ import_react18.default.createElement(import_ui16.Text, { size: 1 }, count);
3170
+ return /* @__PURE__ */ _react2.default.createElement(_ui.Text, { size: 1 }, count);
4189
3171
  };
4190
3172
 
4191
3173
  // src/components/NestedObjectArraySelector.jsx
4192
- var import_react20 = __toESM(require("react"));
4193
- var import_ui17 = require("@sanity/ui");
3174
+
3175
+
4194
3176
 
4195
3177
  // src/hooks/useNestedObjects.js
4196
- var import_react19 = require("react");
4197
- var import_sanity15 = require("sanity");
3178
+
3179
+
4198
3180
  function useNestedObjects({
4199
3181
  sourceType,
4200
3182
  nestedField,
@@ -4203,11 +3185,11 @@ function useNestedObjects({
4203
3185
  filter = "",
4204
3186
  sortBy = ""
4205
3187
  }) {
4206
- const client = (0, import_sanity15.useClient)({ apiVersion: "2023-01-01" });
4207
- const [objects, setObjects] = (0, import_react19.useState)([]);
4208
- const [loading, setLoading] = (0, import_react19.useState)(true);
4209
- const [error, setError] = (0, import_react19.useState)(null);
4210
- (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, () => {
4211
3193
  if (!sourceType || !nestedField || !titleField || !valueField) {
4212
3194
  setError(new Error("Missing required configuration"));
4213
3195
  setLoading(false);
@@ -4261,8 +3243,8 @@ function useNestedObjects({
4261
3243
  }
4262
3244
 
4263
3245
  // src/components/NestedObjectArraySelector.jsx
4264
- var import_sanity16 = require("sanity");
4265
- var NestedObjectArraySelector = import_react20.default.forwardRef((props, ref) => {
3246
+
3247
+ var NestedObjectArraySelector = _react2.default.forwardRef((props, ref) => {
4266
3248
  const { value = [], onChange, schemaType } = props;
4267
3249
  const options = (schemaType == null ? void 0 : schemaType.options) || {};
4268
3250
  const {
@@ -4275,9 +3257,9 @@ var NestedObjectArraySelector = import_react20.default.forwardRef((props, ref) =
4275
3257
  emptyMessage = "No options found",
4276
3258
  searchPlaceholder = "Search..."
4277
3259
  } = options;
4278
- const [searchTerm, setSearchTerm] = (0, import_react20.useState)("");
3260
+ const [searchTerm, setSearchTerm] = _react.useState.call(void 0, "");
4279
3261
  const { objects, loading, error } = useNestedObjects({ sourceType, nestedField, titleField, valueField, filter, sortBy });
4280
- const filteredObjects = (0, import_react20.useMemo)(() => {
3262
+ const filteredObjects = _react.useMemo.call(void 0, () => {
4281
3263
  if (!searchTerm) return objects;
4282
3264
  const lower = searchTerm.toLowerCase();
4283
3265
  return objects.filter((obj) => {
@@ -4290,24 +3272,24 @@ var NestedObjectArraySelector = import_react20.default.forwardRef((props, ref) =
4290
3272
  const isSelected = currentValue.includes(itemValue);
4291
3273
  if (isSelected) {
4292
3274
  const newValue = currentValue.filter((v) => v !== itemValue);
4293
- 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, ));
4294
3276
  } else {
4295
- onChange((0, import_sanity16.set)([...currentValue, itemValue]));
3277
+ onChange(_sanity.set.call(void 0, [...currentValue, itemValue]));
4296
3278
  }
4297
3279
  };
4298
3280
  if (!sourceType || !nestedField || !titleField || !valueField) {
4299
- 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)"));
4300
3282
  }
4301
3283
  if (loading) {
4302
- 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..."))));
4303
3285
  }
4304
3286
  if (error) {
4305
- 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));
4306
3288
  }
4307
3289
  if (objects.length === 0) {
4308
- 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));
4309
3291
  }
4310
- 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(
4311
3293
  "input",
4312
3294
  {
4313
3295
  type: "text",
@@ -4316,39 +3298,39 @@ var NestedObjectArraySelector = import_react20.default.forwardRef((props, ref) =
4316
3298
  onChange: (e) => setSearchTerm(e.target.value),
4317
3299
  style: { width: "100%", padding: "8px 12px", border: "1px solid var(--card-border-color)", borderRadius: "4px", fontSize: "13px", fontFamily: "inherit" }
4318
3300
  }
4319
- )), /* @__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) => {
4320
3302
  const isSelected = value == null ? void 0 : value.includes(obj.value);
4321
3303
  const isLast = index === filteredObjects.length - 1;
4322
- return /* @__PURE__ */ import_react20.default.createElement(
4323
- import_ui17.Box,
3304
+ return /* @__PURE__ */ _react2.default.createElement(
3305
+ _ui.Box,
4324
3306
  {
4325
3307
  key: obj.value,
4326
3308
  padding: 3,
4327
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" },
4328
3310
  onClick: () => handleToggle(obj.value)
4329
3311
  },
4330
- /* @__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))
4331
3313
  );
4332
- })), (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")));
4333
3315
  });
4334
3316
  NestedObjectArraySelector.displayName = "NestedObjectArraySelector";
4335
3317
 
4336
3318
  // src/utils/getEmptyFontKit.js
4337
- var fontkit7 = __toESM(require("fontkit"));
4338
- var import_slugify4 = __toESM(require("slugify"));
3319
+
4339
3320
  async function getEmptyFontKit({ title, files, weightKeywordList, italicKeywordList }) {
4340
- var _a, _b, _c, _d, _e, _f;
4341
3321
  let fontNames = {};
4342
3322
  let subfamilies = {};
4343
3323
  for (var i = 0; i < files.length; i++) {
4344
3324
  const file = files[i];
4345
3325
  const fontBuffer = await readFontFile2(file);
4346
- const font = fontkit7.create(fontBuffer);
4347
- 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;
4348
- weightName = (weightName == null ? void 0 : weightName.en) ? weightName.en : weightName.constructor == Object ? weightName[Object.keys(weightName)[0]] : weightName;
4349
- let variableFont = (font == null ? void 0 : font.variationAxes) && Object.keys(font.variationAxes).length > 0 ? true : false;
4350
- let subfamilyName = font.familyName.toLowerCase().trim().replace(title.toLowerCase().trim(), "").trim();
4351
- 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();
4352
3334
  weightKeywordList.forEach((keyword) => {
4353
3335
  const kw = keyword.toLowerCase().trim();
4354
3336
  if (fontTitle.includes(kw)) {
@@ -4370,7 +3352,7 @@ async function getEmptyFontKit({ title, files, weightKeywordList, italicKeywordL
4370
3352
  fontTitle = fontTitle.trim().split(" ").map((word) => word[0].toUpperCase() + word.slice(1)).join(" ");
4371
3353
  subfamilyName = subfamilyName.trim();
4372
3354
  subfamilyName = subfamilyName == "" ? "Regular" : subfamilyName.split(" ").map((word) => word[0].toUpperCase() + word.slice(1)).join(" ");
4373
- let id = (0, import_slugify4.default)(fontTitle.toLowerCase().trim());
3355
+ let id = _slugify2.default.call(void 0, fontTitle.toLowerCase().trim());
4374
3356
  if (variableFont && !id.endsWith("-vf")) {
4375
3357
  id = id + "-vf";
4376
3358
  fontTitle = fontTitle + " VF";
@@ -4383,26 +3365,26 @@ async function getEmptyFontKit({ title, files, weightKeywordList, italicKeywordL
4383
3365
  if (!fontNames[id]) {
4384
3366
  fontNames[id] = [{
4385
3367
  file: file.name,
4386
- fullName: font.fullName,
4387
- familyName: font.familyName,
3368
+ fullName,
3369
+ familyName,
4388
3370
  subFamily: subfamilyName
4389
3371
  }];
4390
3372
  } else if (fontNames[id].indexOf(file.name) == -1) {
4391
3373
  fontNames[id].push({
4392
3374
  file: file.name,
4393
- fullName: font.fullName,
4394
- familyName: font.familyName,
3375
+ fullName,
3376
+ familyName,
4395
3377
  subFamily: subfamilyName
4396
3378
  });
4397
3379
  }
4398
3380
  }
4399
- console.log("font names : ", fontNames);
3381
+ console.log("Font names:", fontNames);
4400
3382
  }
4401
3383
  var readFontFile2 = (file) => {
4402
3384
  return new Promise((resolve, reject) => {
4403
3385
  const reader = new FileReader();
4404
3386
  reader.onload = (event) => {
4405
- resolve(new Uint8Array(event.target.result));
3387
+ resolve(event.target.result);
4406
3388
  };
4407
3389
  reader.onerror = (error) => {
4408
3390
  reject(error);
@@ -6565,7 +5547,7 @@ var styleCountField = {
6565
5547
  };
6566
5548
 
6567
5549
  // src/schema/stylisticSetField.js
6568
- var import_icons6 = require("@sanity/icons");
5550
+
6569
5551
  var stylisticSetField = {
6570
5552
  title: "Stylistic Features Section",
6571
5553
  name: "stylisticSet",
@@ -6582,7 +5564,7 @@ var stylisticSetField = {
6582
5564
  name: "featuredWord",
6583
5565
  title: "Words or Phrase",
6584
5566
  type: "object",
6585
- icon: import_icons6.StringIcon,
5567
+ icon: _icons.StringIcon,
6586
5568
  fields: [
6587
5569
  {
6588
5570
  type: "text",
@@ -6733,7 +5715,7 @@ var stylisticSetField = {
6733
5715
  name: "set",
6734
5716
  type: "object",
6735
5717
  title: "Stylistic Feature",
6736
- icon: import_icons6.StringIcon,
5718
+ icon: _icons.StringIcon,
6737
5719
  fields: [
6738
5720
  {
6739
5721
  name: "title",
@@ -6865,15 +5847,15 @@ var stylisticSetField = {
6865
5847
  };
6866
5848
 
6867
5849
  // src/schema/stylesField.js
6868
- var import_react21 = __toESM(require("react"));
6869
- var import_sanity_advanced_reference_array = require("@liiift-studio/sanity-advanced-reference-array");
5850
+
5851
+ var _sanityadvancedreferencearray = require('@liiift-studio/sanity-advanced-reference-array');
6870
5852
  var typefaceParams = (doc) => ({ typefaceName: (doc == null ? void 0 : doc.title) || "" });
6871
- var FontsRefArray = (props) => import_react21.default.createElement(import_sanity_advanced_reference_array.AdvancedRefArray, {
5853
+ var FontsRefArray = (props) => _react2.default.createElement(_sanityadvancedreferencearray.AdvancedRefArray, {
6872
5854
  ...props,
6873
5855
  filterGroq: "lower(typefaceName) == lower($typefaceName)",
6874
5856
  filterParams: typefaceParams
6875
5857
  });
6876
- var VariableFontsRefArray = (props) => import_react21.default.createElement(import_sanity_advanced_reference_array.AdvancedRefArray, {
5858
+ var VariableFontsRefArray = (props) => _react2.default.createElement(_sanityadvancedreferencearray.AdvancedRefArray, {
6877
5859
  ...props,
6878
5860
  filterGroq: "lower(typefaceName) == lower($typefaceName) && variableFont == true",
6879
5861
  filterParams: typefaceParams
@@ -7073,7 +6055,7 @@ function createStylesField({
7073
6055
  title: "Collections",
7074
6056
  name: "collections",
7075
6057
  type: "array",
7076
- components: { input: import_sanity_advanced_reference_array.AdvancedRefArray },
6058
+ components: { input: _sanityadvancedreferencearray.AdvancedRefArray },
7077
6059
  of: [{ type: "reference", weak: true, to: [{ type: "collection" }] }],
7078
6060
  options: { sortable: true },
7079
6061
  validation: (Rule) => Rule.unique()
@@ -7082,7 +6064,7 @@ function createStylesField({
7082
6064
  title: "Pairs",
7083
6065
  name: "pairs",
7084
6066
  type: "array",
7085
- components: { input: import_sanity_advanced_reference_array.AdvancedRefArray },
6067
+ components: { input: _sanityadvancedreferencearray.AdvancedRefArray },
7086
6068
  of: [{ type: "reference", weak: true, to: [{ type: "pair" }] }],
7087
6069
  options: { sortable: true },
7088
6070
  validation: (Rule) => Rule.unique(),
@@ -7098,62 +6080,97 @@ function createStylesField({
7098
6080
  options: { collapsible: true }
7099
6081
  };
7100
6082
  }
7101
- // Annotate the CommonJS export names for ESM import in node:
7102
- 0 && (module.exports = {
7103
- BatchUploadFonts,
7104
- DISCOUNT_REQUIREMENT_TYPES,
7105
- DISCOUNT_REQUIREMENT_TYPES_OBJECT,
7106
- FontScriptUploaderComponent,
7107
- GenerateCollectionsPairsComponent,
7108
- HtmlDescription,
7109
- KeyValueInput,
7110
- KeyValueReferenceInput,
7111
- NestedObjectArraySelector,
7112
- PriceInput,
7113
- PrimaryCollectionGeneratorTypeface,
7114
- RegenerateSubfamiliesComponent,
7115
- SCRIPTS,
7116
- SCRIPTS_OBJECT,
7117
- SetOTF,
7118
- SingleUploaderTool,
7119
- StatusDisplay,
7120
- StyleCountInput,
7121
- UpdateScriptsComponent,
7122
- UploadButton,
7123
- UploadScriptsComponent,
7124
- VariableInstanceReferencesInput,
7125
- addItalicToFontTitle,
7126
- createFontObject,
7127
- createStylesField,
7128
- determineWeight,
7129
- expandAbbreviations,
7130
- extractFontMetadata,
7131
- extractWeightFromFullName,
7132
- extractWeightName,
7133
- formatFontTitle,
7134
- generateCssFile,
7135
- generateFontData,
7136
- generateFontFile,
7137
- generateStyleKeywords,
7138
- generateSubset,
7139
- getEmptyFontKit,
7140
- logFontInfo,
7141
- openTypeField,
7142
- parseVariableFontInstances,
7143
- processFontFiles,
7144
- processItalicKeywords,
7145
- processSubfamilyName,
7146
- readFontFile,
7147
- removeWeightNames,
7148
- renameFontDocuments,
7149
- reverseSpellingLookup,
7150
- sanitizeForSanityId,
7151
- sortFontObjects,
7152
- styleCountField,
7153
- stylisticSetField,
7154
- updateFontPrices,
7155
- updateTypefaceDocument,
7156
- uploadFontFiles,
7157
- useNestedObjects,
7158
- useSanityClient
7159
- });
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;