@sanity/code-input 2.30.1 → 3.0.0-studio-v3.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 (51) hide show
  1. package/README.md +65 -9
  2. package/lib/cjs/index.js +1348 -0
  3. package/lib/cjs/index.js.map +1 -0
  4. package/lib/esm/index.js +1340 -0
  5. package/lib/esm/index.js.map +1 -0
  6. package/lib/types/index.d.ts +48 -0
  7. package/lib/types/index.d.ts.map +1 -0
  8. package/package.json +53 -15
  9. package/src/CodeInput.tsx +332 -0
  10. package/src/PreviewCode.tsx +88 -0
  11. package/src/config.ts +46 -0
  12. package/src/createHighlightMarkers.ts +24 -0
  13. package/src/editorSupport.ts +31 -0
  14. package/src/getMedia.tsx +95 -0
  15. package/src/groq.ts +630 -0
  16. package/src/index.ts +12 -0
  17. package/src/schema.tsx +69 -0
  18. package/src/types.ts +26 -0
  19. package/dist/dts/CodeInput.d.ts +0 -22
  20. package/dist/dts/CodeInput.d.ts.map +0 -1
  21. package/dist/dts/PreviewCode.d.ts +0 -9
  22. package/dist/dts/PreviewCode.d.ts.map +0 -1
  23. package/dist/dts/config.d.ts +0 -16
  24. package/dist/dts/config.d.ts.map +0 -1
  25. package/dist/dts/createHighlightMarkers.d.ts +0 -4
  26. package/dist/dts/createHighlightMarkers.d.ts.map +0 -1
  27. package/dist/dts/deprecatedSchema.d.ts +0 -12
  28. package/dist/dts/deprecatedSchema.d.ts.map +0 -1
  29. package/dist/dts/editorSupport.d.ts +0 -28
  30. package/dist/dts/editorSupport.d.ts.map +0 -1
  31. package/dist/dts/getMedia.d.ts +0 -3
  32. package/dist/dts/getMedia.d.ts.map +0 -1
  33. package/dist/dts/groq.d.ts +0 -376
  34. package/dist/dts/groq.d.ts.map +0 -1
  35. package/dist/dts/schema.d.ts +0 -44
  36. package/dist/dts/schema.d.ts.map +0 -1
  37. package/dist/dts/types.d.ts +0 -29
  38. package/dist/dts/types.d.ts.map +0 -1
  39. package/lib/@types/css.d.js +0 -1
  40. package/lib/CodeInput.js +0 -325
  41. package/lib/PreviewCode.js +0 -79
  42. package/lib/config.js +0 -103
  43. package/lib/createHighlightMarkers.js +0 -31
  44. package/lib/deprecatedSchema.js +0 -26
  45. package/lib/editorSupport.js +0 -55
  46. package/lib/getMedia.js +0 -110
  47. package/lib/groq.js +0 -414
  48. package/lib/schema.js +0 -69
  49. package/lib/types.js +0 -5
  50. package/sanity.json +0 -28
  51. package/tsconfig.json +0 -26
@@ -0,0 +1,1340 @@
1
+ import {createPlugin as $gGrEF$createPlugin, useColorScheme as $gGrEF$useColorScheme} from "sanity";
2
+ import {jsx as $gGrEF$jsx, jsxs as $gGrEF$jsxs} from "react/jsx-runtime";
3
+ import {useRef as $gGrEF$useRef, useMemo as $gGrEF$useMemo, useImperativeHandle as $gGrEF$useImperativeHandle, useCallback as $gGrEF$useCallback, useEffect as $gGrEF$useEffect} from "react";
4
+ import {CodeBlockIcon as $gGrEF$CodeBlockIcon} from "@sanity/icons";
5
+ import {set as $gGrEF$set, setIfMissing as $gGrEF$setIfMissing, unset as $gGrEF$unset, MemberField as $gGrEF$MemberField} from "sanity/form";
6
+ import {Card as $gGrEF$Card, Select as $gGrEF$Select, Stack as $gGrEF$Stack, Box as $gGrEF$Box} from "@sanity/ui";
7
+ import $gGrEF$reactace from "react-ace";
8
+ import $gGrEF$styledcomponents, {css as $gGrEF$css} from "styled-components";
9
+ import "ace-builds/src-noconflict/mode-batchfile";
10
+ import "ace-builds/src-noconflict/mode-csharp";
11
+ import "ace-builds/src-noconflict/mode-css";
12
+ import "ace-builds/src-noconflict/mode-golang";
13
+ import "ace-builds/src-noconflict/mode-html";
14
+ import "ace-builds/src-noconflict/mode-java";
15
+ import "ace-builds/src-noconflict/mode-javascript";
16
+ import "ace-builds/src-noconflict/mode-json";
17
+ import "ace-builds/src-noconflict/mode-jsx";
18
+ import "ace-builds/src-noconflict/mode-markdown";
19
+ import "ace-builds/src-noconflict/mode-mysql";
20
+ import "ace-builds/src-noconflict/mode-php";
21
+ import "ace-builds/src-noconflict/mode-python";
22
+ import "ace-builds/src-noconflict/mode-ruby";
23
+ import "ace-builds/src-noconflict/mode-sass";
24
+ import "ace-builds/src-noconflict/mode-scss";
25
+ import "ace-builds/src-noconflict/mode-sh";
26
+ import "ace-builds/src-noconflict/mode-text";
27
+ import "ace-builds/src-noconflict/mode-tsx";
28
+ import "ace-builds/src-noconflict/mode-typescript";
29
+ import "ace-builds/src-noconflict/mode-xml";
30
+ import "ace-builds/src-noconflict/mode-yaml";
31
+ import "ace-builds/src-noconflict/theme-github";
32
+ import "ace-builds/src-noconflict/theme-monokai";
33
+ import "ace-builds/src-noconflict/theme-terminal";
34
+ import "ace-builds/src-noconflict/theme-tomorrow";
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+ const $b67a72b22aed35f4$export$ac98e174937d3154 = (0, $gGrEF$css)`
48
+ .ace_editor_markers_highlight {
49
+ position: absolute;
50
+ background-color: ${({ theme: theme })=>theme.sanity.color.solid.primary.enabled.bg};
51
+ opacity: 0.2;
52
+ width: 100% !important;
53
+ border-radius: 0 !important;
54
+ }
55
+ `;
56
+ function $b67a72b22aed35f4$export$2e2bcd8739ae039(rows) {
57
+ return rows.map((row)=>({
58
+ startRow: Number(row) - 1,
59
+ startCol: 0,
60
+ endRow: Number(row) - 1,
61
+ endCol: Infinity,
62
+ className: "ace_editor_markers_highlight",
63
+ type: "screenLine",
64
+ inFront: true
65
+ }));
66
+ }
67
+
68
+
69
+ // Grammar from https://github.com/sanity-io/vscode-sanity
70
+ const $78995292efb69282$var$rules = {
71
+ start: [
72
+ {
73
+ include: "#query"
74
+ },
75
+ {
76
+ include: "#value"
77
+ },
78
+ {
79
+ include: "#pair"
80
+ },
81
+ ],
82
+ "#query": [
83
+ {
84
+ include: "#nullary-access-operator"
85
+ },
86
+ {
87
+ include: "#arraylike"
88
+ },
89
+ {
90
+ include: "#pipe"
91
+ },
92
+ {
93
+ include: "#sort-order"
94
+ },
95
+ {
96
+ include: "#filter"
97
+ },
98
+ ],
99
+ "#variable": [
100
+ {
101
+ token: "variable.other.groq",
102
+ regex: /\$[_A-Za-z][_0-9A-Za-z]*/
103
+ },
104
+ ],
105
+ "#keyword": [
106
+ {
107
+ token: "keyword.other.groq",
108
+ regex: /\b(?:asc|desc|in|match)\b/
109
+ },
110
+ ],
111
+ "#comparison": [
112
+ {
113
+ token: "keyword.operator.comparison.groq",
114
+ // eslint-disable-next-line no-div-regex
115
+ regex: /==|!=|>=|<=|<!=>|<|>/
116
+ },
117
+ ],
118
+ "#operator": [
119
+ {
120
+ token: "keyword.operator.arithmetic.groq",
121
+ regex: /\+|-|\*{1,2}|\/|%/
122
+ },
123
+ ],
124
+ "#pipe": [
125
+ {
126
+ token: "keyword.operator.pipe.groq",
127
+ regex: /\|/
128
+ },
129
+ ],
130
+ "#logical": [
131
+ {
132
+ token: "keyword.operator.logical.groq",
133
+ regex: /!|&&|\|\|/
134
+ },
135
+ ],
136
+ "#reference": [
137
+ {
138
+ token: "keyword.operator.reference.groq",
139
+ regex: /->/
140
+ },
141
+ ],
142
+ "#pair": [
143
+ {
144
+ include: "#identifier"
145
+ },
146
+ {
147
+ include: "#value"
148
+ },
149
+ {
150
+ include: "#filter"
151
+ },
152
+ {
153
+ token: "keyword.operator.pair.groq",
154
+ regex: /[=]>/
155
+ },
156
+ ],
157
+ "#arraylike": [
158
+ {
159
+ token: "punctuation.definition.bracket.begin.groq",
160
+ regex: /\[/,
161
+ push: [
162
+ {
163
+ token: [
164
+ "text",
165
+ "keyword.operator.descendant.groq"
166
+ ],
167
+ regex: /(\])((?:\s*\.)?)/,
168
+ next: "pop"
169
+ },
170
+ {
171
+ include: "#range"
172
+ },
173
+ {
174
+ include: "#filter"
175
+ },
176
+ {
177
+ include: "#array-values"
178
+ },
179
+ ]
180
+ },
181
+ ],
182
+ "#array": [
183
+ {
184
+ token: "punctuation.definition.bracket.begin.groq",
185
+ regex: /\[/,
186
+ push: [
187
+ {
188
+ token: "punctuation.definition.bracket.end.groq",
189
+ regex: /\]/,
190
+ next: "pop"
191
+ },
192
+ {
193
+ include: "#array-values"
194
+ },
195
+ {
196
+ defaultToken: "meta.structure.array.groq"
197
+ },
198
+ ]
199
+ },
200
+ ],
201
+ "#range": [
202
+ {
203
+ token: [
204
+ "meta.structure.range.groq",
205
+ "constant.numeric.groq",
206
+ "meta.structure.range.groq",
207
+ "keyword.operator.range.groq",
208
+ "meta.structure.range.groq",
209
+ "constant.numeric.groq",
210
+ "meta.structure.range.groq",
211
+ ],
212
+ regex: /(\s*)(\d+)(\s*)(\.{2,3})(\s*)(\d+)(\s*)/
213
+ },
214
+ ],
215
+ "#spread": [
216
+ {
217
+ token: "punctuation.definition.spread.begin.groq",
218
+ regex: /\.\.\./,
219
+ push: [
220
+ {
221
+ include: "#array"
222
+ },
223
+ {
224
+ include: "#function-call"
225
+ },
226
+ {
227
+ include: "#projection"
228
+ },
229
+ {
230
+ token: "punctuation.definition.spread.end.groq",
231
+ regex: /(?=.)/,
232
+ next: "pop"
233
+ },
234
+ {
235
+ defaultToken: "meta.structure.spread.groq"
236
+ },
237
+ ]
238
+ },
239
+ ],
240
+ "#array-values": [
241
+ {
242
+ include: "#value"
243
+ },
244
+ {
245
+ include: "#spread"
246
+ },
247
+ {
248
+ token: "punctuation.separator.array.groq",
249
+ regex: /,/
250
+ },
251
+ {
252
+ token: "invalid.illegal.expected-array-separator.groq",
253
+ regex: /[^\s\]]/
254
+ },
255
+ ],
256
+ "#filter": [
257
+ {
258
+ include: "#function-call"
259
+ },
260
+ {
261
+ include: "#keyword"
262
+ },
263
+ {
264
+ include: "#constant"
265
+ },
266
+ {
267
+ include: "#identifier"
268
+ },
269
+ {
270
+ include: "#value"
271
+ },
272
+ {
273
+ include: "#comparison"
274
+ },
275
+ {
276
+ include: "#operator"
277
+ },
278
+ {
279
+ include: "#logical"
280
+ },
281
+ ],
282
+ "#comments": [
283
+ {
284
+ token: [
285
+ "punctuation.definition.comment.groq",
286
+ "comment.line.double-slash.js"
287
+ ],
288
+ regex: /(\/\/)(.*$)/
289
+ },
290
+ ],
291
+ "#nullary-access-operator": [
292
+ {
293
+ token: "constant.language.groq",
294
+ regex: /[*@^]/
295
+ },
296
+ ],
297
+ "#constant": [
298
+ {
299
+ token: "constant.language.groq",
300
+ regex: /\b(?:true|false|null)\b/
301
+ },
302
+ ],
303
+ "#number": [
304
+ {
305
+ token: "constant.numeric.groq",
306
+ regex: /-?(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:[eE][+-]?\d+)?)?/
307
+ },
308
+ ],
309
+ "#named-projection": [
310
+ {
311
+ include: "#identifier"
312
+ },
313
+ {
314
+ include: "#objectkey"
315
+ },
316
+ {
317
+ include: "#projection"
318
+ },
319
+ ],
320
+ "#projection": [
321
+ {
322
+ token: "punctuation.definition.projection.begin.groq",
323
+ regex: /\{/,
324
+ push: [
325
+ {
326
+ token: "punctuation.definition.projection.end.groq",
327
+ regex: /\}/,
328
+ next: "pop"
329
+ },
330
+ {
331
+ include: "#identifier"
332
+ },
333
+ {
334
+ include: "#objectkey"
335
+ },
336
+ {
337
+ include: "#named-projection"
338
+ },
339
+ {
340
+ include: "#comments"
341
+ },
342
+ {
343
+ include: "#spread"
344
+ },
345
+ {
346
+ include: "#pair"
347
+ },
348
+ {
349
+ token: "punctuation.separator.projection.key-value.groq",
350
+ regex: /:/,
351
+ push: [
352
+ {
353
+ token: "punctuation.separator.projection.pair.groq",
354
+ regex: /,|(?=\})/,
355
+ next: "pop"
356
+ },
357
+ {
358
+ include: "#nullary-access-operator"
359
+ },
360
+ {
361
+ include: "#arraylike"
362
+ },
363
+ {
364
+ include: "#value"
365
+ },
366
+ {
367
+ include: "#spread"
368
+ },
369
+ {
370
+ include: "#identifier"
371
+ },
372
+ {
373
+ include: "#operator"
374
+ },
375
+ {
376
+ include: "#comparison"
377
+ },
378
+ {
379
+ include: "#pair"
380
+ },
381
+ {
382
+ token: "invalid.illegal.expected-projection-separator.groq",
383
+ regex: /[^\s,]/
384
+ },
385
+ {
386
+ defaultToken: "meta.structure.projection.value.groq"
387
+ },
388
+ ]
389
+ },
390
+ {
391
+ token: "invalid.illegal.expected-projection-separator.groq",
392
+ regex: /[^\s},]/
393
+ },
394
+ {
395
+ defaultToken: "meta.structure.projection.groq"
396
+ },
397
+ ]
398
+ },
399
+ ],
400
+ "#string": [
401
+ {
402
+ include: "#single-string"
403
+ },
404
+ {
405
+ include: "#double-string"
406
+ },
407
+ ],
408
+ "#double-string": [
409
+ {
410
+ token: "punctuation.definition.string.begin.groq",
411
+ regex: /"/,
412
+ push: [
413
+ {
414
+ token: "punctuation.definition.string.end.groq",
415
+ regex: /"/,
416
+ next: "pop"
417
+ },
418
+ {
419
+ include: "#stringcontent"
420
+ },
421
+ {
422
+ defaultToken: "string.quoted.double.groq"
423
+ },
424
+ ]
425
+ },
426
+ ],
427
+ "#single-string": [
428
+ {
429
+ token: "punctuation.definition.string.single.begin.groq",
430
+ regex: /'/,
431
+ push: [
432
+ {
433
+ token: "punctuation.definition.string.single.end.groq",
434
+ regex: /'/,
435
+ next: "pop"
436
+ },
437
+ {
438
+ include: "#stringcontent"
439
+ },
440
+ {
441
+ defaultToken: "string.quoted.single.groq"
442
+ },
443
+ ]
444
+ },
445
+ ],
446
+ "#objectkey": [
447
+ {
448
+ include: "#string"
449
+ },
450
+ ],
451
+ "#stringcontent": [
452
+ {
453
+ token: "constant.character.escape.groq",
454
+ regex: /\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4})/
455
+ },
456
+ {
457
+ token: "invalid.illegal.unrecognized-string-escape.groq",
458
+ regex: /\\./
459
+ },
460
+ ],
461
+ "#sort-pair": [
462
+ {
463
+ token: [
464
+ "variable.other.readwrite.groq",
465
+ "text",
466
+ "keyword.other.groq"
467
+ ],
468
+ regex: /([_A-Za-z][_0-9A-Za-z]*)(?:(\s*)(asc|desc))?/
469
+ },
470
+ {
471
+ token: [
472
+ "constant.language.groq",
473
+ "punctuation.definition.bracket.begin.groq"
474
+ ],
475
+ regex: /(@)(\[)/,
476
+ push: [
477
+ {
478
+ token: [
479
+ "punctuation.definition.bracket.begin.groq",
480
+ "text",
481
+ "keyword.other.groq"
482
+ ],
483
+ regex: /(\])(?:(\s*)(asc|desc))?/,
484
+ next: "pop"
485
+ },
486
+ {
487
+ include: "#string"
488
+ },
489
+ ]
490
+ },
491
+ ],
492
+ "#sort-order": [
493
+ {
494
+ token: "support.function.sortorder.begin.groq",
495
+ regex: /\border\s*\(/,
496
+ push: [
497
+ {
498
+ token: "support.function.sortorder.end.groq",
499
+ regex: /\)/,
500
+ next: "pop"
501
+ },
502
+ {
503
+ include: "#sort-pair"
504
+ },
505
+ {
506
+ token: "punctuation.separator.array.groq",
507
+ regex: /,/
508
+ },
509
+ {
510
+ token: "invalid.illegal.expected-sort-separator.groq",
511
+ regex: /[^\s\]]/
512
+ },
513
+ {
514
+ defaultToken: "support.function.sortorder.groq"
515
+ },
516
+ ]
517
+ },
518
+ ],
519
+ "#function-call": [
520
+ {
521
+ include: "#function-var-arg"
522
+ },
523
+ {
524
+ include: "#function-single-arg"
525
+ },
526
+ {
527
+ include: "#function-round"
528
+ },
529
+ ],
530
+ "#function-var-arg": [
531
+ {
532
+ token: "support.function.vararg.begin.groq",
533
+ regex: /\b(?:coalesce|select)\s*\(/,
534
+ push: [
535
+ {
536
+ token: "support.function.vararg.end.groq",
537
+ regex: /\)/,
538
+ next: "pop"
539
+ },
540
+ {
541
+ include: "#value"
542
+ },
543
+ {
544
+ include: "#identifier"
545
+ },
546
+ {
547
+ include: "#filter"
548
+ },
549
+ {
550
+ include: "#pair"
551
+ },
552
+ {
553
+ token: "punctuation.separator.array.groq",
554
+ regex: /,/
555
+ },
556
+ {
557
+ defaultToken: "support.function.vararg.groq"
558
+ },
559
+ ]
560
+ },
561
+ ],
562
+ "#function-single-arg": [
563
+ {
564
+ token: "support.function.singlearg.begin.groq",
565
+ regex: /\b(?:count|defined|length|path|references)\s*\(/,
566
+ push: [
567
+ {
568
+ token: "support.function.singlearg.end.groq",
569
+ regex: /\)/,
570
+ next: "pop"
571
+ },
572
+ {
573
+ include: "#query"
574
+ },
575
+ {
576
+ include: "#identifier"
577
+ },
578
+ {
579
+ include: "#value"
580
+ },
581
+ {
582
+ include: "#pair"
583
+ },
584
+ {
585
+ defaultToken: "support.function.singlearg.groq"
586
+ },
587
+ ]
588
+ },
589
+ ],
590
+ "#identifier": [
591
+ {
592
+ token: [
593
+ "variable.other.readwrite.groq",
594
+ "text",
595
+ "punctuation.definition.block.js",
596
+ "text",
597
+ "keyword.operator.reference.groq",
598
+ ],
599
+ regex: /([_A-Za-z][_0-9A-Za-z]*)(\s*)((?:\[\s*\])?)(\s*)(->)/
600
+ },
601
+ {
602
+ token: [
603
+ "variable.other.readwrite.groq",
604
+ "constant.language.groq",
605
+ "text",
606
+ "punctuation.definition.block.js",
607
+ "text",
608
+ "keyword.operator.descendant.groq",
609
+ ],
610
+ regex: /(?:([_A-Za-z][_0-9A-Za-z]*)|([@^]))(\s*)((?:\[\s*\])?)(\s*)(\.)/
611
+ },
612
+ {
613
+ token: "variable.other.readwrite.groq",
614
+ regex: /[_A-Za-z][_0-9A-Za-z]*/
615
+ },
616
+ ],
617
+ "#value": [
618
+ {
619
+ include: "#constant"
620
+ },
621
+ {
622
+ include: "#number"
623
+ },
624
+ {
625
+ include: "#string"
626
+ },
627
+ {
628
+ include: "#array"
629
+ },
630
+ {
631
+ include: "#variable"
632
+ },
633
+ {
634
+ include: "#projection"
635
+ },
636
+ {
637
+ include: "#comments"
638
+ },
639
+ {
640
+ include: "#function-call"
641
+ },
642
+ ]
643
+ };
644
+ ace.define("ace/mode/groq_highlight_rules", [
645
+ "require",
646
+ "exports",
647
+ "module",
648
+ "ace/lib/oop",
649
+ "ace/mode/text_highlight_rules"
650
+ ], (acequire, exports, _module)=>{
651
+ const oop = acequire("../lib/oop");
652
+ const TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
653
+ const GroqHighlightRules = function() {
654
+ /* eslint-disable @typescript-eslint/ban-ts-comment */ // @ts-ignore
655
+ this.$rules = $78995292efb69282$var$rules;
656
+ // @ts-ignore
657
+ this.normalizeRules();
658
+ /* eslint-enable @typescript-eslint/ban-ts-comment */ };
659
+ oop.inherits(GroqHighlightRules, TextHighlightRules);
660
+ exports.GroqHighlightRules = GroqHighlightRules;
661
+ });
662
+ ace.define("ace/mode/groq", [
663
+ "require",
664
+ "exports",
665
+ "module",
666
+ "ace/lib/oop",
667
+ "ace/mode/text",
668
+ "ace/tokenizer",
669
+ "ace/mode/groq_highlight_rules",
670
+ "ace/mode/folding/cstyle",
671
+ ], (acequire, exports, _module)=>{
672
+ // eslint-disable-next-line strict
673
+ "use strict";
674
+ const oop = acequire("../lib/oop");
675
+ const TextMode = acequire("./text").Mode;
676
+ const Tokenizer = acequire("../tokenizer").Tokenizer;
677
+ const GroqHighlightRules = acequire("./groq_highlight_rules").GroqHighlightRules;
678
+ const FoldMode = acequire("./folding/cstyle").FoldMode;
679
+ const Mode = function() {
680
+ /* eslint-disable @typescript-eslint/ban-ts-comment */ const highlighter = new GroqHighlightRules();
681
+ // @ts-ignore
682
+ this.foldingRules = new FoldMode();
683
+ // @ts-ignore
684
+ this.$tokenizer = new Tokenizer(highlighter.getRules());
685
+ // @ts-ignore
686
+ this.$keywordList = highlighter.$keywordList;
687
+ /* eslint-enable @typescript-eslint/ban-ts-comment */ };
688
+ oop.inherits(Mode, TextMode);
689
+ (function() {
690
+ /* eslint-disable @typescript-eslint/ban-ts-comment */ // @ts-ignore
691
+ this.lineCommentStart = "'";
692
+ /* eslint-enable @typescript-eslint/ban-ts-comment */ }).call(Mode.prototype);
693
+ exports.Mode = Mode;
694
+ });
695
+
696
+
697
+
698
+
699
+
700
+
701
+
702
+
703
+
704
+
705
+
706
+
707
+
708
+
709
+
710
+
711
+
712
+
713
+
714
+
715
+
716
+
717
+
718
+
719
+
720
+
721
+
722
+
723
+
724
+
725
+ const $513a6452b1f07fd5$export$7c77c3a9bb93870d = [
726
+ {
727
+ title: "Batch file",
728
+ value: "batchfile"
729
+ },
730
+ {
731
+ title: "C#",
732
+ value: "csharp"
733
+ },
734
+ {
735
+ title: "CSS",
736
+ value: "css"
737
+ },
738
+ {
739
+ title: "Go",
740
+ value: "golang"
741
+ },
742
+ {
743
+ title: "GROQ",
744
+ value: "groq"
745
+ },
746
+ {
747
+ title: "HTML",
748
+ value: "html"
749
+ },
750
+ {
751
+ title: "Java",
752
+ value: "java"
753
+ },
754
+ {
755
+ title: "JavaScript",
756
+ value: "javascript"
757
+ },
758
+ {
759
+ title: "JSON",
760
+ value: "json"
761
+ },
762
+ {
763
+ title: "JSX",
764
+ value: "jsx"
765
+ },
766
+ {
767
+ title: "Markdown",
768
+ value: "markdown"
769
+ },
770
+ {
771
+ title: "MySQL",
772
+ value: "mysql"
773
+ },
774
+ {
775
+ title: "PHP",
776
+ value: "php"
777
+ },
778
+ {
779
+ title: "Plain text",
780
+ value: "text"
781
+ },
782
+ {
783
+ title: "Python",
784
+ value: "python"
785
+ },
786
+ {
787
+ title: "Ruby",
788
+ value: "ruby"
789
+ },
790
+ {
791
+ title: "SASS",
792
+ value: "sass"
793
+ },
794
+ {
795
+ title: "SCSS",
796
+ value: "scss"
797
+ },
798
+ {
799
+ title: "sh",
800
+ value: "sh"
801
+ },
802
+ {
803
+ title: "TSX",
804
+ value: "tsx"
805
+ },
806
+ {
807
+ title: "TypeScript",
808
+ value: "typescript"
809
+ },
810
+ {
811
+ title: "XML",
812
+ value: "xml"
813
+ },
814
+ {
815
+ title: "YAML",
816
+ value: "yaml"
817
+ },
818
+ ];
819
+ const $513a6452b1f07fd5$export$eee7619b712ad3ea = {
820
+ js: "javascript"
821
+ };
822
+ const $513a6452b1f07fd5$export$b524d09a6fa74640 = [
823
+ "github",
824
+ "monokai",
825
+ "terminal",
826
+ "tomorrow"
827
+ ];
828
+ const $513a6452b1f07fd5$export$2faeed762aac6741 = "tomorrow";
829
+ const $513a6452b1f07fd5$export$5932020c8339f18b = "monokai";
830
+ const $513a6452b1f07fd5$export$1d910bb34606e145 = {
831
+ useSoftTabs: true,
832
+ navigateWithinSoftTabs: true
833
+ };
834
+ const $513a6452b1f07fd5$export$24aa1be5d8c3cd08 = {
835
+ $blockScrolling: true
836
+ };
837
+ const $513a6452b1f07fd5$export$ed1ca6559dfc13f7 = [
838
+ "language"
839
+ ];
840
+ const $513a6452b1f07fd5$export$e1d3cf7d57c23d0f = [
841
+ "code"
842
+ ];
843
+ const $513a6452b1f07fd5$export$4f74600301fa25db = [
844
+ "filename"
845
+ ];
846
+
847
+
848
+
849
+ const $a1d4bfd2763f687f$var$EditorContainer = (0, $gGrEF$styledcomponents)((0, $gGrEF$Card))`
850
+ position: relative;
851
+ box-sizing: border-box;
852
+ overflow: hidden;
853
+ z-index: 0;
854
+
855
+ .ace_editor {
856
+ font-family: ${({ theme: theme })=>theme.sanity.fonts.code.family};
857
+ font-size: ${({ theme: theme })=>theme.sanity.fonts.code.sizes[1]};
858
+ line-height: inherit;
859
+ }
860
+
861
+ ${(0, $b67a72b22aed35f4$export$ac98e174937d3154)}
862
+
863
+ &:not([disabled]):not([readonly]) {
864
+ &:focus,
865
+ &:focus-within {
866
+ box-shadow: 0 0 0 2px ${({ theme: theme })=>theme.sanity.color.base.focusRing};
867
+ background-color: ${({ theme: theme })=>theme.sanity.color.base.bg};
868
+ border-color: ${({ theme: theme })=>theme.sanity.color.base.focusRing};
869
+ }
870
+ }
871
+ `;
872
+ // Returns a string with the mode name if supported (because aliases), otherwise false
873
+ function $a1d4bfd2763f687f$var$isSupportedLanguage(mode) {
874
+ const alias = (0, $513a6452b1f07fd5$export$eee7619b712ad3ea)[mode];
875
+ if (alias) return alias;
876
+ const isSupported = (0, $513a6452b1f07fd5$export$7c77c3a9bb93870d).find((lang)=>lang.value === mode);
877
+ if (isSupported) return mode;
878
+ return false;
879
+ }
880
+ function $a1d4bfd2763f687f$export$20d4ca75cb144ab0(props) {
881
+ const { focusRef: focusRef , members: members , onBlur: onBlur , onChange: onChange , onFocusPath: onFocusPath , readOnly: readOnly , renderField: renderField , renderInput: renderInput , renderItem: renderItem , schemaType: type , value: value , } = props;
882
+ const aceEditorRef = (0, $gGrEF$useRef)();
883
+ const fieldMembers = (0, $gGrEF$useMemo)(()=>members.filter((member)=>member.kind === "field"), [
884
+ members
885
+ ]);
886
+ const languageFieldMember = fieldMembers.find((member)=>member.name === "language");
887
+ const filenameMember = fieldMembers.find((member)=>member.name === "filename");
888
+ const codeFieldMember = fieldMembers.find((member)=>member.name === "code");
889
+ (0, $gGrEF$useImperativeHandle)(focusRef, ()=>({
890
+ focus: ()=>{
891
+ aceEditorRef?.current?.editor?.focus();
892
+ }
893
+ }));
894
+ const handleCodeFocus = (0, $gGrEF$useCallback)(()=>{
895
+ onFocusPath((0, $513a6452b1f07fd5$export$e1d3cf7d57c23d0f));
896
+ }, [
897
+ onFocusPath
898
+ ]);
899
+ const { scheme: scheme } = (0, $gGrEF$useColorScheme)();
900
+ const theme = (0, $gGrEF$useMemo)(()=>{
901
+ const isLight = scheme === "light";
902
+ const preferredTheme = isLight ? type.options?.theme : type.options?.darkTheme;
903
+ const defaultTheme = isLight ? (0, $513a6452b1f07fd5$export$2faeed762aac6741) : (0, $513a6452b1f07fd5$export$5932020c8339f18b);
904
+ return preferredTheme && (0, $513a6452b1f07fd5$export$b524d09a6fa74640).find((t)=>t === preferredTheme) ? preferredTheme : defaultTheme;
905
+ }, [
906
+ type,
907
+ scheme
908
+ ]);
909
+ const handleToggleSelectLine = (0, $gGrEF$useCallback)((lineNumber)=>{
910
+ const editorSession = aceEditorRef.current?.editor?.getSession();
911
+ const backgroundMarkers = editorSession?.getMarkers(true);
912
+ const currentHighlightedLines = Object.keys(backgroundMarkers).filter((key)=>backgroundMarkers[key].type === "screenLine").map((key)=>backgroundMarkers[key].range.start.row);
913
+ const currentIndex = currentHighlightedLines.indexOf(lineNumber);
914
+ if (currentIndex > -1) // toggle remove
915
+ currentHighlightedLines.splice(currentIndex, 1);
916
+ else {
917
+ // toggle add
918
+ currentHighlightedLines.push(lineNumber);
919
+ currentHighlightedLines.sort();
920
+ }
921
+ onChange((0, $gGrEF$set)(currentHighlightedLines.map((line)=>// ace starts at line (row) 0, but we store it starting at line 1
922
+ line + 1), [
923
+ "highlightedLines"
924
+ ]));
925
+ }, [
926
+ aceEditorRef,
927
+ onChange
928
+ ]);
929
+ const handleGutterMouseDown = (0, $gGrEF$useCallback)((event)=>{
930
+ const target = event.domEvent.target;
931
+ if (target.classList.contains("ace_gutter-cell")) {
932
+ const row = event.getDocumentPosition().row;
933
+ handleToggleSelectLine(row);
934
+ }
935
+ }, [
936
+ handleToggleSelectLine
937
+ ]);
938
+ (0, $gGrEF$useEffect)(()=>{
939
+ const editor = aceEditorRef?.current?.editor;
940
+ return ()=>{
941
+ editor?.session?.removeListener("guttermousedown", handleGutterMouseDown);
942
+ };
943
+ }, [
944
+ aceEditorRef,
945
+ handleGutterMouseDown
946
+ ]);
947
+ const handleEditorLoad = (0, $gGrEF$useCallback)((editor)=>{
948
+ editor?.on("guttermousedown", handleGutterMouseDown);
949
+ }, [
950
+ handleGutterMouseDown
951
+ ]);
952
+ const getLanguageAlternatives = (0, $gGrEF$useCallback)(()=>{
953
+ const languageAlternatives = type.options?.languageAlternatives;
954
+ if (!languageAlternatives) return 0, $513a6452b1f07fd5$export$7c77c3a9bb93870d;
955
+ if (!Array.isArray(languageAlternatives)) throw new Error(`'options.languageAlternatives' should be an array, got ${typeof languageAlternatives}`);
956
+ return languageAlternatives.reduce((acc, { title: title , value: val , mode: mode })=>{
957
+ const alias = (0, $513a6452b1f07fd5$export$eee7619b712ad3ea)[val];
958
+ if (alias) {
959
+ // eslint-disable-next-line no-console
960
+ console.warn(`'options.languageAlternatives' lists a language with value "%s", which is an alias of "%s" - please replace the value to read "%s"`, val, alias, alias);
961
+ return acc.concat({
962
+ title: title,
963
+ value: alias,
964
+ mode: mode
965
+ });
966
+ }
967
+ if (!mode && !(0, $513a6452b1f07fd5$export$7c77c3a9bb93870d).find((lang)=>lang.value === val)) // eslint-disable-next-line no-console
968
+ console.warn(`'options.languageAlternatives' lists a language which is not supported: "%s", syntax highlighting will be disabled.`, val);
969
+ return acc.concat({
970
+ title: title,
971
+ value: val,
972
+ mode: mode
973
+ });
974
+ }, []);
975
+ }, [
976
+ type
977
+ ]);
978
+ const handleCodeChange = (0, $gGrEF$useCallback)((code)=>{
979
+ const path = (0, $513a6452b1f07fd5$export$e1d3cf7d57c23d0f);
980
+ const fixedLanguage = type.options?.language;
981
+ onChange([
982
+ (0, $gGrEF$setIfMissing)({
983
+ _type: type.name,
984
+ language: fixedLanguage
985
+ }),
986
+ code ? (0, $gGrEF$set)(code, path) : (0, $gGrEF$unset)(path),
987
+ ]);
988
+ }, [
989
+ onChange,
990
+ type
991
+ ]);
992
+ const languages = getLanguageAlternatives().slice();
993
+ const fixedLanguage1 = type.options?.language;
994
+ const language = value?.language || fixedLanguage1;
995
+ // the language config from the schema
996
+ const configured = languages.find((entry)=>entry.value === language);
997
+ // is the language officially supported (e.g. we import the mode by default)
998
+ const supported = language && $a1d4bfd2763f687f$var$isSupportedLanguage(language);
999
+ const mode1 = configured?.mode || (supported ? language : "text");
1000
+ const renderLanguageInput = (0, $gGrEF$useCallback)((inputProps)=>{
1001
+ return /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Select), {
1002
+ ...inputProps,
1003
+ onChange: (e)=>{
1004
+ const newValue = e.currentTarget.value;
1005
+ inputProps.onChange(newValue ? (0, $gGrEF$set)(newValue) : (0, $gGrEF$unset)());
1006
+ },
1007
+ children: languages.map((lang)=>/*#__PURE__*/ (0, $gGrEF$jsx)("option", {
1008
+ value: lang.value,
1009
+ children: lang.title
1010
+ }, lang.value))
1011
+ });
1012
+ }, [
1013
+ languages
1014
+ ]);
1015
+ const renderCodeInput = (0, $gGrEF$useCallback)((inputProps)=>{
1016
+ return /*#__PURE__*/ (0, $gGrEF$jsx)($a1d4bfd2763f687f$var$EditorContainer, {
1017
+ radius: 1,
1018
+ shadow: 1,
1019
+ readOnly: readOnly,
1020
+ children: /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$reactace), {
1021
+ ref: aceEditorRef,
1022
+ mode: mode1,
1023
+ theme: theme,
1024
+ width: "100%",
1025
+ onChange: handleCodeChange,
1026
+ name: inputProps.id,
1027
+ value: inputProps.value,
1028
+ markers: value && value.highlightedLines ? (0, $b67a72b22aed35f4$export$2e2bcd8739ae039)(value.highlightedLines) : undefined,
1029
+ onLoad: handleEditorLoad,
1030
+ readOnly: readOnly,
1031
+ tabSize: 2,
1032
+ wrapEnabled: true,
1033
+ setOptions: (0, $513a6452b1f07fd5$export$1d910bb34606e145),
1034
+ editorProps: (0, $513a6452b1f07fd5$export$24aa1be5d8c3cd08),
1035
+ onFocus: handleCodeFocus,
1036
+ onBlur: onBlur
1037
+ })
1038
+ });
1039
+ }, [
1040
+ theme,
1041
+ handleCodeChange,
1042
+ handleCodeFocus,
1043
+ handleEditorLoad,
1044
+ mode1,
1045
+ onBlur,
1046
+ readOnly,
1047
+ value
1048
+ ]);
1049
+ return /*#__PURE__*/ (0, $gGrEF$jsxs)((0, $gGrEF$Stack), {
1050
+ space: 4,
1051
+ children: [
1052
+ languageFieldMember && /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$MemberField), {
1053
+ member: languageFieldMember,
1054
+ renderItem: renderItem,
1055
+ renderField: renderField,
1056
+ renderInput: renderLanguageInput
1057
+ }),
1058
+ type.options?.withFilename && filenameMember && /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$MemberField), {
1059
+ member: filenameMember,
1060
+ renderItem: renderItem,
1061
+ renderField: renderField,
1062
+ renderInput: renderInput
1063
+ }),
1064
+ codeFieldMember && /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$MemberField), {
1065
+ member: codeFieldMember,
1066
+ renderInput: renderCodeInput,
1067
+ renderItem: renderItem,
1068
+ renderField: renderField
1069
+ })
1070
+ ]
1071
+ });
1072
+ }
1073
+
1074
+
1075
+
1076
+
1077
+
1078
+
1079
+
1080
+
1081
+
1082
+
1083
+ const $0fe3fd43374a598c$var$PreviewContainer = (0, $gGrEF$styledcomponents)((0, $gGrEF$Box))`
1084
+ position: relative;
1085
+ `;
1086
+ const $0fe3fd43374a598c$var$PreviewInner = (0, $gGrEF$styledcomponents)((0, $gGrEF$Box))`
1087
+ background-color: #272822;
1088
+
1089
+ .ace_editor {
1090
+ box-sizing: border-box;
1091
+ cursor: default;
1092
+ pointer-events: none;
1093
+ }
1094
+
1095
+ .ace_content {
1096
+ box-sizing: border-box;
1097
+ overflow: hidden;
1098
+ }
1099
+ `;
1100
+ function $0fe3fd43374a598c$export$2e2bcd8739ae039(props) {
1101
+ const aceEditorRef = (0, $gGrEF$useRef)();
1102
+ (0, $gGrEF$useEffect)(()=>{
1103
+ if (!aceEditorRef?.current) return;
1104
+ const editor = aceEditorRef.current?.editor;
1105
+ if (editor) {
1106
+ // Avoid cursor and focus tracking by Ace
1107
+ editor.renderer.$cursorLayer.element.style.opacity = 0;
1108
+ editor.textInput.getElement().disabled = true;
1109
+ }
1110
+ }, []);
1111
+ const handleEditorChange = (0, $gGrEF$useCallback)(()=>{
1112
+ // do nothing when the editor changes
1113
+ }, []);
1114
+ const { value: value , type: type } = props;
1115
+ const fixedLanguage = type?.options?.language;
1116
+ const mode = value?.language || fixedLanguage || "text";
1117
+ return /*#__PURE__*/ (0, $gGrEF$jsx)($0fe3fd43374a598c$var$PreviewContainer, {
1118
+ children: /*#__PURE__*/ (0, $gGrEF$jsx)($0fe3fd43374a598c$var$PreviewInner, {
1119
+ padding: 4,
1120
+ children: /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$reactace), {
1121
+ ref: aceEditorRef,
1122
+ focus: false,
1123
+ mode: mode,
1124
+ theme: "monokai",
1125
+ width: "100%",
1126
+ onChange: handleEditorChange,
1127
+ maxLines: 200,
1128
+ readOnly: true,
1129
+ wrapEnabled: true,
1130
+ showPrintMargin: false,
1131
+ highlightActiveLine: false,
1132
+ cursorStart: -1,
1133
+ value: value && value.code || "",
1134
+ markers: value && value.highlightedLines ? (0, $b67a72b22aed35f4$export$2e2bcd8739ae039)(value.highlightedLines) : undefined,
1135
+ tabSize: 2,
1136
+ showGutter: false,
1137
+ setOptions: (0, $513a6452b1f07fd5$export$1d910bb34606e145),
1138
+ editorProps: (0, $513a6452b1f07fd5$export$24aa1be5d8c3cd08)
1139
+ })
1140
+ })
1141
+ });
1142
+ }
1143
+
1144
+
1145
+
1146
+
1147
+ function $a7f1af2d8cb566bf$export$a854ab43349813f2(language) {
1148
+ if (language === "jsx") return /*#__PURE__*/ (0, $gGrEF$jsx)("svg", {
1149
+ xmlns: "http://www.w3.org/2000/svg",
1150
+ viewBox: "0 0 128 128",
1151
+ children: /*#__PURE__*/ (0, $gGrEF$jsxs)("g", {
1152
+ fill: "#61DAFB",
1153
+ children: [
1154
+ /*#__PURE__*/ (0, $gGrEF$jsx)("circle", {
1155
+ cx: "64",
1156
+ cy: "64",
1157
+ r: "11.4"
1158
+ }),
1159
+ /*#__PURE__*/ (0, $gGrEF$jsx)("path", {
1160
+ d: "M107.3 45.2c-2.2-.8-4.5-1.6-6.9-2.3.6-2.4 1.1-4.8 1.5-7.1 2.1-13.2-.2-22.5-6.6-26.1-1.9-1.1-4-1.6-6.4-1.6-7 0-15.9 5.2-24.9 13.9-9-8.7-17.9-13.9-24.9-13.9-2.4 0-4.5.5-6.4 1.6-6.4 3.7-8.7 13-6.6 26.1.4 2.3.9 4.7 1.5 7.1-2.4.7-4.7 1.4-6.9 2.3C8.2 50 1.4 56.6 1.4 64s6.9 14 19.3 18.8c2.2.8 4.5 1.6 6.9 2.3-.6 2.4-1.1 4.8-1.5 7.1-2.1 13.2.2 22.5 6.6 26.1 1.9 1.1 4 1.6 6.4 1.6 7.1 0 16-5.2 24.9-13.9 9 8.7 17.9 13.9 24.9 13.9 2.4 0 4.5-.5 6.4-1.6 6.4-3.7 8.7-13 6.6-26.1-.4-2.3-.9-4.7-1.5-7.1 2.4-.7 4.7-1.4 6.9-2.3 12.5-4.8 19.3-11.4 19.3-18.8s-6.8-14-19.3-18.8zM92.5 14.7c4.1 2.4 5.5 9.8 3.8 20.3-.3 2.1-.8 4.3-1.4 6.6-5.2-1.2-10.7-2-16.5-2.5-3.4-4.8-6.9-9.1-10.4-13 7.4-7.3 14.9-12.3 21-12.3 1.3 0 2.5.3 3.5.9zM81.3 74c-1.8 3.2-3.9 6.4-6.1 9.6-3.7.3-7.4.4-11.2.4-3.9 0-7.6-.1-11.2-.4-2.2-3.2-4.2-6.4-6-9.6-1.9-3.3-3.7-6.7-5.3-10 1.6-3.3 3.4-6.7 5.3-10 1.8-3.2 3.9-6.4 6.1-9.6 3.7-.3 7.4-.4 11.2-.4 3.9 0 7.6.1 11.2.4 2.2 3.2 4.2 6.4 6 9.6 1.9 3.3 3.7 6.7 5.3 10-1.7 3.3-3.4 6.6-5.3 10zm8.3-3.3c1.5 3.5 2.7 6.9 3.8 10.3-3.4.8-7 1.4-10.8 1.9 1.2-1.9 2.5-3.9 3.6-6 1.2-2.1 2.3-4.2 3.4-6.2zM64 97.8c-2.4-2.6-4.7-5.4-6.9-8.3 2.3.1 4.6.2 6.9.2 2.3 0 4.6-.1 6.9-.2-2.2 2.9-4.5 5.7-6.9 8.3zm-18.6-15c-3.8-.5-7.4-1.1-10.8-1.9 1.1-3.3 2.3-6.8 3.8-10.3 1.1 2 2.2 4.1 3.4 6.1 1.2 2.2 2.4 4.1 3.6 6.1zm-7-25.5c-1.5-3.5-2.7-6.9-3.8-10.3 3.4-.8 7-1.4 10.8-1.9-1.2 1.9-2.5 3.9-3.6 6-1.2 2.1-2.3 4.2-3.4 6.2zM64 30.2c2.4 2.6 4.7 5.4 6.9 8.3-2.3-.1-4.6-.2-6.9-.2-2.3 0-4.6.1-6.9.2 2.2-2.9 4.5-5.7 6.9-8.3zm22.2 21l-3.6-6c3.8.5 7.4 1.1 10.8 1.9-1.1 3.3-2.3 6.8-3.8 10.3-1.1-2.1-2.2-4.2-3.4-6.2zM31.7 35c-1.7-10.5-.3-17.9 3.8-20.3 1-.6 2.2-.9 3.5-.9 6 0 13.5 4.9 21 12.3-3.5 3.8-7 8.2-10.4 13-5.8.5-11.3 1.4-16.5 2.5-.6-2.3-1-4.5-1.4-6.6zM7 64c0-4.7 5.7-9.7 15.7-13.4 2-.8 4.2-1.5 6.4-2.1 1.6 5 3.6 10.3 6 15.6-2.4 5.3-4.5 10.5-6 15.5C15.3 75.6 7 69.6 7 64zm28.5 49.3c-4.1-2.4-5.5-9.8-3.8-20.3.3-2.1.8-4.3 1.4-6.6 5.2 1.2 10.7 2 16.5 2.5 3.4 4.8 6.9 9.1 10.4 13-7.4 7.3-14.9 12.3-21 12.3-1.3 0-2.5-.3-3.5-.9zM96.3 93c1.7 10.5.3 17.9-3.8 20.3-1 .6-2.2.9-3.5.9-6 0-13.5-4.9-21-12.3 3.5-3.8 7-8.2 10.4-13 5.8-.5 11.3-1.4 16.5-2.5.6 2.3 1 4.5 1.4 6.6zm9-15.6c-2 .8-4.2 1.5-6.4 2.1-1.6-5-3.6-10.3-6-15.6 2.4-5.3 4.5-10.5 6-15.5 13.8 4 22.1 10 22.1 15.6 0 4.7-5.8 9.7-15.7 13.4z"
1161
+ })
1162
+ ]
1163
+ })
1164
+ });
1165
+ if (language === "javascript") return /*#__PURE__*/ (0, $gGrEF$jsxs)("svg", {
1166
+ xmlns: "http://www.w3.org/2000/svg",
1167
+ viewBox: "0 0 128 128",
1168
+ children: [
1169
+ /*#__PURE__*/ (0, $gGrEF$jsx)("path", {
1170
+ fill: "#F0DB4F",
1171
+ d: "M1.408 1.408h125.184v125.185H1.408z"
1172
+ }),
1173
+ /*#__PURE__*/ (0, $gGrEF$jsx)("path", {
1174
+ fill: "#323330",
1175
+ d: "M116.347 96.736c-.917-5.711-4.641-10.508-15.672-14.981-3.832-1.761-8.104-3.022-9.377-5.926-.452-1.69-.512-2.642-.226-3.665.821-3.32 4.784-4.355 7.925-3.403 2.023.678 3.938 2.237 5.093 4.724 5.402-3.498 5.391-3.475 9.163-5.879-1.381-2.141-2.118-3.129-3.022-4.045-3.249-3.629-7.676-5.498-14.756-5.355l-3.688.477c-3.534.893-6.902 2.748-8.877 5.235-5.926 6.724-4.236 18.492 2.975 23.335 7.104 5.332 17.54 6.545 18.873 11.531 1.297 6.104-4.486 8.08-10.234 7.378-4.236-.881-6.592-3.034-9.139-6.949-4.688 2.713-4.688 2.713-9.508 5.485 1.143 2.499 2.344 3.63 4.26 5.795 9.068 9.198 31.76 8.746 35.83-5.176.165-.478 1.261-3.666.38-8.581zM69.462 58.943H57.753l-.048 30.272c0 6.438.333 12.34-.714 14.149-1.713 3.558-6.152 3.117-8.175 2.427-2.059-1.012-3.106-2.451-4.319-4.485-.333-.584-.583-1.036-.667-1.071l-9.52 5.83c1.583 3.249 3.915 6.069 6.902 7.901 4.462 2.678 10.459 3.499 16.731 2.059 4.082-1.189 7.604-3.652 9.448-7.401 2.666-4.915 2.094-10.864 2.07-17.444.06-10.735.001-21.468.001-32.237z"
1176
+ })
1177
+ ]
1178
+ });
1179
+ if (language === "php") return /*#__PURE__*/ (0, $gGrEF$jsx)("svg", {
1180
+ xmlns: "http://www.w3.org/2000/svg",
1181
+ viewBox: "0 0 800 400",
1182
+ children: /*#__PURE__*/ (0, $gGrEF$jsx)("g", {
1183
+ transform: "translate(-44.632 -141.55)",
1184
+ children: /*#__PURE__*/ (0, $gGrEF$jsxs)("g", {
1185
+ transform: "matrix(8.3528 0 0 8.3119 -727.13 -3759.5)",
1186
+ children: [
1187
+ /*#__PURE__*/ (0, $gGrEF$jsx)("path", {
1188
+ d: "m99.974 479.48h14.204c4.1693 0.0354 7.1903 1.2367 9.063 3.604 1.8726 2.3674 2.491 5.6004 1.855 9.699-0.24737 1.8727-0.79504 3.71-1.643 5.512-0.8127 1.802-1.9434 3.4273-3.392 4.876-1.7667 1.8373-3.657 3.0033-5.671 3.498-2.014 0.49467-4.0987 0.742-6.254 0.742h-6.36l-2.014 10.07h-7.367l7.579-38.001m6.201 6.042-3.18 15.9c0.21198 0.0353 0.42398 0.053 0.636 0.053h0.742c3.392 0.0353 6.2186-0.30033 8.48-1.007 2.2613-0.74199 3.7806-3.3213 4.558-7.738 0.63597-3.71-0.00003-5.8476-1.908-6.413-1.8727-0.56531-4.2224-0.83031-7.049-0.795-0.42402 0.0353-0.83035 0.053-1.219 0.053-0.35335 0.00002-0.72435 0.00002-1.113 0l0.053-0.053"
1189
+ }),
1190
+ /*#__PURE__*/ (0, $gGrEF$jsx)("path", {
1191
+ d: "m133.49 469.36h7.314l-2.067 10.123h6.572c3.604 0.0707 6.2893 0.81269 8.056 2.226 1.802 1.4134 2.332 4.0987 1.59 8.056l-3.551 17.649h-7.42l3.392-16.854c0.35328-1.7666 0.2473-3.021-0.318-3.763-0.56536-0.74198-1.7844-1.113-3.657-1.113l-5.883-0.053-4.346 21.783h-7.314l7.632-38.054"
1192
+ }),
1193
+ /*#__PURE__*/ (0, $gGrEF$jsx)("path", {
1194
+ d: "m162.81 479.48h14.204c4.1693 0.0354 7.1903 1.2367 9.063 3.604 1.8726 2.3674 2.491 5.6004 1.855 9.699-0.24737 1.8727-0.79503 3.71-1.643 5.512-0.8127 1.802-1.9434 3.4273-3.392 4.876-1.7667 1.8373-3.657 3.0033-5.671 3.498-2.014 0.49467-4.0987 0.742-6.254 0.742h-6.36l-2.014 10.07h-7.367l7.579-38.001m6.201 6.042-3.18 15.9c0.21199 0.0353 0.42399 0.053 0.636 0.053h0.742c3.392 0.0353 6.2186-0.30033 8.48-1.007 2.2613-0.74199 3.7806-3.3213 4.558-7.738 0.63597-3.71-0.00003-5.8476-1.908-6.413-1.8727-0.56531-4.2224-0.83031-7.049-0.795-0.42402 0.0353-0.83035 0.053-1.219 0.053-0.35335 0.00002-0.72435 0.00002-1.113 0l0.053-0.053"
1195
+ })
1196
+ ]
1197
+ })
1198
+ })
1199
+ });
1200
+ if (language === "json") return /*#__PURE__*/ (0, $gGrEF$jsxs)("svg", {
1201
+ xmlns: "http://www.w3.org/2000/svg",
1202
+ xmlnsXlink: "http://www.w3.org/1999/xlink",
1203
+ viewBox: "0 0 160 160",
1204
+ children: [
1205
+ /*#__PURE__*/ (0, $gGrEF$jsxs)("defs", {
1206
+ children: [
1207
+ /*#__PURE__*/ (0, $gGrEF$jsxs)("linearGradient", {
1208
+ id: "a",
1209
+ children: [
1210
+ /*#__PURE__*/ (0, $gGrEF$jsx)("stop", {
1211
+ offset: "0"
1212
+ }),
1213
+ /*#__PURE__*/ (0, $gGrEF$jsx)("stop", {
1214
+ offset: "1",
1215
+ stopColor: "#fff"
1216
+ })
1217
+ ]
1218
+ }),
1219
+ /*#__PURE__*/ (0, $gGrEF$jsx)("linearGradient", {
1220
+ x1: "-553.27",
1221
+ y1: "525.908",
1222
+ x2: "-666.116",
1223
+ y2: "413.045",
1224
+ id: "c",
1225
+ xlinkHref: "#a",
1226
+ gradientUnits: "userSpaceOnUse",
1227
+ gradientTransform: "matrix(.99884 0 0 .9987 689.008 -388.844)"
1228
+ }),
1229
+ /*#__PURE__*/ (0, $gGrEF$jsx)("linearGradient", {
1230
+ x1: "-666.117",
1231
+ y1: "413.045",
1232
+ x2: "-553.27",
1233
+ y2: "525.908",
1234
+ id: "b",
1235
+ xlinkHref: "#a",
1236
+ gradientUnits: "userSpaceOnUse",
1237
+ gradientTransform: "matrix(.99884 0 0 .9987 689.008 -388.844)"
1238
+ })
1239
+ ]
1240
+ }),
1241
+ /*#__PURE__*/ (0, $gGrEF$jsx)("path", {
1242
+ d: "M79.865 119.1c35.397 48.255 70.04-13.469 69.988-50.587-.06-43.886-44.54-68.414-70.017-68.414C38.943.1 0 33.895 0 80.135 0 131.531 44.64 160 79.836 160c-7.965-1.147-34.507-6.834-34.863-67.967-.24-41.346 13.487-57.865 34.805-50.599.477.177 23.514 9.265 23.514 38.95 0 29.56-23.427 38.716-23.427 38.716z",
1243
+ style: {
1244
+ marker: "none"
1245
+ },
1246
+ color: "#000",
1247
+ fill: "url(#b)",
1248
+ fillRule: "evenodd",
1249
+ overflow: "visible"
1250
+ }),
1251
+ /*#__PURE__*/ (0, $gGrEF$jsx)("path", {
1252
+ d: "M79.823 41.4C56.433 33.34 27.78 52.618 27.78 91.23c0 63.048 46.72 68.77 52.384 68.77C121.057 160 160 126.204 160 79.964 160 28.568 115.36.1 80.164.1c9.749-1.35 52.541 10.55 52.541 69.037 0 38.141-31.953 58.905-52.735 50.033-.478-.177-23.514-9.264-23.514-38.95 0-29.56 23.367-38.818 23.367-38.818z",
1253
+ style: {
1254
+ marker: "none"
1255
+ },
1256
+ color: "#000",
1257
+ fill: "url(#c)",
1258
+ fillRule: "evenodd",
1259
+ overflow: "visible"
1260
+ })
1261
+ ]
1262
+ });
1263
+ return undefined;
1264
+ }
1265
+
1266
+
1267
+ const $8907530ce2ae75d0$var$Preview = (props)=>{
1268
+ return /*#__PURE__*/ (0, $gGrEF$jsx)((0, $0fe3fd43374a598c$export$2e2bcd8739ae039), {
1269
+ ...props
1270
+ });
1271
+ };
1272
+ var $8907530ce2ae75d0$export$2e2bcd8739ae039 = {
1273
+ name: "code",
1274
+ type: "object",
1275
+ title: "Code",
1276
+ components: {
1277
+ input: (0, $a1d4bfd2763f687f$export$20d4ca75cb144ab0)
1278
+ },
1279
+ icon: (0, $gGrEF$CodeBlockIcon),
1280
+ fields: [
1281
+ {
1282
+ name: "language",
1283
+ title: "Language",
1284
+ type: "string"
1285
+ },
1286
+ {
1287
+ name: "filename",
1288
+ title: "Filename",
1289
+ type: "string"
1290
+ },
1291
+ {
1292
+ title: "Code",
1293
+ name: "code",
1294
+ type: "text"
1295
+ },
1296
+ {
1297
+ title: "Highlighted lines",
1298
+ name: "highlightedLines",
1299
+ type: "array",
1300
+ of: [
1301
+ {
1302
+ type: "number",
1303
+ title: "Highlighted line"
1304
+ },
1305
+ ]
1306
+ },
1307
+ ],
1308
+ preview: {
1309
+ select: {
1310
+ language: "language",
1311
+ code: "code",
1312
+ filename: "filename",
1313
+ highlightedLines: "highlightedLines"
1314
+ },
1315
+ prepare: (value)=>{
1316
+ return {
1317
+ title: value.filename || (value.language || "unknown").toUpperCase(),
1318
+ media: (0, $a7f1af2d8cb566bf$export$a854ab43349813f2)(value?.language),
1319
+ extendedPreview: /*#__PURE__*/ (0, $gGrEF$jsx)($8907530ce2ae75d0$var$Preview, {
1320
+ value: value
1321
+ })
1322
+ };
1323
+ }
1324
+ }
1325
+ };
1326
+
1327
+
1328
+
1329
+ const $df9eabe9bda49ea8$export$d18430c17c97a000 = (0, $gGrEF$createPlugin)({
1330
+ name: "@sanity/code-input",
1331
+ schema: {
1332
+ types: [
1333
+ (0, $8907530ce2ae75d0$export$2e2bcd8739ae039)
1334
+ ]
1335
+ }
1336
+ });
1337
+
1338
+
1339
+ export {$df9eabe9bda49ea8$export$d18430c17c97a000 as codeInput, $0fe3fd43374a598c$export$2e2bcd8739ae039 as PreviewCode};
1340
+ //# sourceMappingURL=index.js.map