@drghaliasri/butex 3.2.2 → 4.0.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.
@@ -534,6 +534,7 @@ function createInlineField2(value = "", mathObjects = [], options = {}, path = "
534
534
  opening: span.opening,
535
535
  closing: span.closing,
536
536
  source: span.source,
537
+ sourceSide: mode,
537
538
  math: fromMathObjectJson(mathJson, mode),
538
539
  editable: true,
539
540
  sourceOwner: "imported-structured"
@@ -1142,6 +1143,24 @@ var ATOMIC_OPERATOR_COMMANDS = {
1142
1143
  title: "\u0623\u0643\u0628\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
1143
1144
  svg_path: null
1144
1145
  },
1146
+ coloneqq: {
1147
+ id: "coloneqq",
1148
+ category: "operators1",
1149
+ Tex: "\\coloneqq",
1150
+ mirror: true,
1151
+ Label: "\u2254",
1152
+ title: "\u064A\u0639\u0631\u0641 \u0628\u0623\u0646\u0647 \u064A\u0633\u0627\u0648\u064A",
1153
+ svg_path: null
1154
+ },
1155
+ eqqcolon: {
1156
+ id: "eqqcolon",
1157
+ category: "operators1",
1158
+ Tex: "\\eqqcolon",
1159
+ mirror: true,
1160
+ Label: "\u2255",
1161
+ title: "\u064A\u0633\u0627\u0648\u064A \u0628\u0627\u0644\u062A\u0639\u0631\u064A\u0641",
1162
+ svg_path: null
1163
+ },
1145
1164
  ///// Operators 2
1146
1165
  propto: {
1147
1166
  id: "propto",
@@ -1308,6 +1327,60 @@ var ATOMIC_OPERATOR_COMMANDS = {
1308
1327
  title: "\u064A\u0643\u0627\u0641\u0626",
1309
1328
  svg_path: null
1310
1329
  },
1330
+ implies: {
1331
+ id: "implies",
1332
+ category: "operators3",
1333
+ Tex: "\\implies",
1334
+ mirror: true,
1335
+ Label: "\u21D2",
1336
+ title: "\u064A\u0633\u062A\u0644\u0632\u0645",
1337
+ svg_path: null
1338
+ },
1339
+ impliedby: {
1340
+ id: "impliedby",
1341
+ category: "operators3",
1342
+ Tex: "\\impliedby",
1343
+ mirror: true,
1344
+ Label: "\u21D0",
1345
+ title: "\u0645\u0633\u062A\u0644\u0632\u0645 \u0645\u0646",
1346
+ svg_path: null
1347
+ },
1348
+ iff: {
1349
+ id: "iff",
1350
+ category: "operators3",
1351
+ Tex: "\\iff",
1352
+ mirror: false,
1353
+ Label: "\u21D4",
1354
+ title: "\u0625\u0630\u0627 \u0648\u0641\u0642\u0637 \u0625\u0630\u0627",
1355
+ svg_path: null
1356
+ },
1357
+ Longrightarrow: {
1358
+ id: "Longrightarrow",
1359
+ category: "operators3",
1360
+ Tex: "\\Longrightarrow",
1361
+ mirror: true,
1362
+ Label: "\u27F9",
1363
+ title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0637\u0648\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
1364
+ svg_path: null
1365
+ },
1366
+ Longleftarrow: {
1367
+ id: "Longleftarrow",
1368
+ category: "operators3",
1369
+ Tex: "\\Longleftarrow",
1370
+ mirror: true,
1371
+ Label: "\u27F8",
1372
+ title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0637\u0648\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
1373
+ svg_path: null
1374
+ },
1375
+ to: {
1376
+ id: "to",
1377
+ category: "operators3",
1378
+ Tex: "\\to",
1379
+ mirror: true,
1380
+ Label: "\u2192",
1381
+ title: "\u064A\u0624\u0648\u0644 \u0625\u0644\u0649",
1382
+ svg_path: null
1383
+ },
1311
1384
  rightleftharpoons: {
1312
1385
  id: "rightleftharpoons",
1313
1386
  category: "operators3",
@@ -2390,6 +2463,321 @@ function undoRedoCanRedo(stacks) {
2390
2463
  return stacks.future.length > 0;
2391
2464
  }
2392
2465
 
2466
+ // src/editor/uiLocale.ts
2467
+ var ENGLISH_COMMAND_TITLES = {
2468
+ cos: "Cosine",
2469
+ sin: "Sine",
2470
+ tan: "Tangent",
2471
+ cot: "Cotangent",
2472
+ sec: "Secant",
2473
+ csc: "Cosecant",
2474
+ arccos: "Inverse cosine",
2475
+ arcsin: "Inverse sine",
2476
+ arctan: "Inverse tangent",
2477
+ arccot: "Inverse cotangent",
2478
+ arcsec: "Inverse secant",
2479
+ arccsc: "Inverse cosecant",
2480
+ cosh: "Hyperbolic cosine",
2481
+ sinh: "Hyperbolic sine",
2482
+ tanh: "Hyperbolic tangent",
2483
+ coth: "Hyperbolic cotangent",
2484
+ sum: "Sum",
2485
+ prod: "Product",
2486
+ lim: "Limit",
2487
+ max: "Maximum",
2488
+ min: "Minimum",
2489
+ sup: "Supremum",
2490
+ inf: "Infimum",
2491
+ pi: "Pi",
2492
+ exp: "Exponential",
2493
+ ln: "Natural logarithm",
2494
+ log: "Logarithm",
2495
+ det: "Determinant",
2496
+ N: "Natural numbers",
2497
+ Z: "Integers",
2498
+ Q: "Rational numbers",
2499
+ R: "Real numbers",
2500
+ C: "Complex numbers",
2501
+ H: "Quaternions",
2502
+ negThinSpace: "Negative thin space",
2503
+ mediumSpace: "Medium space",
2504
+ thickSpace: "Thick space",
2505
+ quadSpace: "Large space",
2506
+ qquadSpace: "Extra-large space"
2507
+ };
2508
+ var ENGLISH_OPERATOR_TITLES = {
2509
+ inf: "Infinity",
2510
+ times: "Multiplication",
2511
+ div: "Division",
2512
+ pm: "Plus or minus",
2513
+ mp: "Minus or plus",
2514
+ neq: "Not equal",
2515
+ approx: "Approximately equal",
2516
+ sim: "Similar",
2517
+ mid: "Divides",
2518
+ leq: "Less than or equal",
2519
+ geq: "Greater than or equal",
2520
+ coloneqq: "Defined as equal to",
2521
+ eqqcolon: "Equal by definition",
2522
+ propto: "Proportional to",
2523
+ in: "Element of",
2524
+ notin: "Not an element of",
2525
+ subset: "Subset of",
2526
+ supset: "Superset of",
2527
+ subseteq: "Subset of or equal",
2528
+ supseteq: "Superset of or equal",
2529
+ cap: "Intersection",
2530
+ cup: "Union",
2531
+ emptyset: "Empty set",
2532
+ nsubseteq: "Not a subset of or equal",
2533
+ nsupseteq: "Not a superset of or equal",
2534
+ ldots: "Horizontal dots",
2535
+ cdot: "Multiplication dot",
2536
+ cdots: "Centered horizontal dots",
2537
+ vdots: "Vertical dots",
2538
+ ddots: "Diagonal dots",
2539
+ leftrightarrowDouble: "Equivalent",
2540
+ implies: "Implies",
2541
+ impliedby: "Implied by",
2542
+ iff: "If and only if",
2543
+ Longrightarrow: "Long double arrow right",
2544
+ Longleftarrow: "Long double arrow left",
2545
+ to: "Maps to",
2546
+ rightleftharpoons: "Equilibrium",
2547
+ leftarrow: "Left arrow",
2548
+ rightarrow: "Right arrow",
2549
+ leftarrowDouble: "Double left arrow",
2550
+ rightarrowDouble: "Double right arrow",
2551
+ leftharpoonup: "Upper left harpoon",
2552
+ rightharpoonup: "Upper right harpoon",
2553
+ leftharpoondown: "Lower left harpoon",
2554
+ rightharpoondown: "Lower right harpoon",
2555
+ int: "Integral",
2556
+ iint: "Double integral",
2557
+ iiint: "Triple integral",
2558
+ iiiint: "Quadruple integral",
2559
+ oint: "Contour integral",
2560
+ oiint: "Closed surface integral",
2561
+ oiiint: "Closed volume integral"
2562
+ };
2563
+ var EQUATION_EDITOR_MESSAGES = {
2564
+ ar: {
2565
+ undoRedo: "\u062A\u0631\u0627\u062C\u0639 \u0648\u0625\u0639\u0627\u062F\u0629",
2566
+ undo: "\u062A\u0631\u0627\u062C\u0639",
2567
+ redo: "\u0625\u0639\u0627\u062F\u0629",
2568
+ clipboard: "\u0627\u0644\u062D\u0627\u0641\u0638\u0629",
2569
+ copy: "\u0646\u0633\u062E",
2570
+ cut: "\u0642\u0635",
2571
+ paste: "\u0644\u0635\u0642",
2572
+ editorSettings: "\u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0645\u062D\u0631\u0631",
2573
+ toggleSide: "\u062A\u0628\u062F\u064A\u0644 \u0639\u0631\u0628\u064A / \u0625\u0646\u062C\u0644\u064A\u0632\u064A",
2574
+ structures: "\u0627\u0644\u0628\u0646\u0649",
2575
+ insertDelimiters: "\u0625\u062F\u0631\u0627\u062C \u0645\u062D\u062F\u062F\u0627\u062A",
2576
+ insertParentheses: "\u0625\u062F\u0631\u0627\u062C \u0642\u0648\u0633\u064A\u0646",
2577
+ insertBrackets: "\u0625\u062F\u0631\u0627\u062C \u0645\u0639\u0642\u0648\u0641\u064A\u0646",
2578
+ insertBraces: "\u0625\u062F\u0631\u0627\u062C \u062D\u0627\u0635\u0631\u062A\u064A\u0646",
2579
+ insertFraction: "\u0625\u062F\u0631\u0627\u062C \u0643\u0633\u0631",
2580
+ insertRoot: "\u0625\u062F\u0631\u0627\u062C \u062C\u0630\u0631",
2581
+ environments: "\u0627\u0644\u0628\u064A\u0626\u0627\u062A",
2582
+ insertEnvironment: "\u0625\u062F\u0631\u0627\u062C \u0628\u064A\u0626\u0629 \u0634\u0628\u0643\u064A\u0629",
2583
+ environmentType: "\u0646\u0648\u0639 \u0627\u0644\u0628\u064A\u0626\u0629",
2584
+ matrix: "\u0645\u0635\u0641\u0648\u0641\u0629",
2585
+ array: "\u062C\u062F\u0648\u0644",
2586
+ aligned: "\u0645\u062D\u0627\u0630\u0627\u0629",
2587
+ matrixType: "\u0646\u0648\u0639 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629",
2588
+ chooseEnvironmentSize: "\u0627\u062E\u062A\u064A\u0627\u0631 \u062D\u062C\u0645 \u0627\u0644\u0628\u064A\u0626\u0629",
2589
+ rows: "\u0635\u0641\u0648\u0641",
2590
+ columns: "\u0623\u0639\u0645\u062F\u0629",
2591
+ row: "\u0635\u0641",
2592
+ column: "\u0639\u0645\u0648\u062F",
2593
+ insert: "\u0625\u062F\u0631\u0627\u062C",
2594
+ editSelectedEnvironment: "\u062A\u0639\u062F\u064A\u0644 \u0627\u0644\u0628\u064A\u0626\u0629 \u0627\u0644\u0645\u062D\u062F\u062F\u0629",
2595
+ applySelectedMatrixStyle: "\u062A\u0637\u0628\u064A\u0642 \u0627\u0644\u0646\u0645\u0637 \u0639\u0644\u0649 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u0645\u062D\u062F\u062F\u0629",
2596
+ applyStyle: "\u062A\u0637\u0628\u064A\u0642 \u0627\u0644\u0646\u0645\u0637",
2597
+ addRow: "\u0625\u0636\u0627\u0641\u0629 \u0635\u0641",
2598
+ removeRow: "\u062D\u0630\u0641 \u0635\u0641",
2599
+ addColumn: "\u0625\u0636\u0627\u0641\u0629 \u0639\u0645\u0648\u062F",
2600
+ removeColumn: "\u062D\u0630\u0641 \u0639\u0645\u0648\u062F",
2601
+ spaces: "\u0627\u0644\u0641\u0631\u0627\u063A\u0627\u062A",
2602
+ insertSpace: "\u0625\u062F\u0631\u0627\u062C \u0641\u0631\u0627\u063A",
2603
+ functions: "\u0627\u0644\u062F\u0648\u0627\u0644",
2604
+ insertFunction: "\u0625\u062F\u0631\u0627\u062C \u062F\u0627\u0644\u0629",
2605
+ insertLimitsSeries: "\u0625\u062F\u0631\u0627\u062C \u062D\u062F\u0648\u062F \u0648\u0645\u062A\u0633\u0644\u0633\u0644\u0627\u062A",
2606
+ insertAdditionalFunctions: "\u0625\u062F\u0631\u0627\u062C \u062F\u0648\u0627\u0644 \u0625\u0636\u0627\u0641\u064A\u0629",
2607
+ insertNumberSets: "\u0625\u062F\u0631\u0627\u062C \u0645\u062C\u0645\u0648\u0639\u0627\u062A \u0623\u0639\u062F\u0627\u062F",
2608
+ operations: "\u0627\u0644\u0639\u0645\u0644\u064A\u0627\u062A",
2609
+ insertOperation: "\u0625\u062F\u0631\u0627\u062C \u0631\u0645\u0632 \u0639\u0645\u0644\u064A\u0629",
2610
+ insertRelationsSets: "\u0625\u062F\u0631\u0627\u062C \u0631\u0645\u0648\u0632 \u0639\u0644\u0627\u0642\u0627\u062A \u0648\u0645\u062C\u0645\u0648\u0639\u0627\u062A",
2611
+ insertArrows: "\u0625\u062F\u0631\u0627\u062C \u0623\u0633\u0647\u0645",
2612
+ insertDots: "\u0625\u062F\u0631\u0627\u062C \u0646\u0642\u0627\u0637",
2613
+ insertIntegrals: "\u0625\u062F\u0631\u0627\u062C \u062A\u0643\u0627\u0645\u0644\u0627\u062A",
2614
+ scripts: "\u0627\u0644\u0623\u0633 \u0648\u0627\u0644\u0633\u0641\u0644\u064A",
2615
+ addSuperscript: "\u0625\u0636\u0627\u0641\u0629 \u0623\u0633",
2616
+ addSubscript: "\u0625\u0636\u0627\u0641\u0629 \u0633\u0641\u0644\u064A",
2617
+ removeSuperscript: "\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0623\u0633",
2618
+ removeSubscript: "\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0633\u0641\u0644\u064A",
2619
+ inputStyles: "\u0623\u0646\u0645\u0627\u0637 \u0627\u0644\u0625\u062F\u062E\u0627\u0644",
2620
+ deleteSelectedStructure: "\u062D\u0630\u0641 \u0627\u0644\u0628\u0646\u064A\u0629 \u0627\u0644\u0645\u062D\u062F\u062F\u0629",
2621
+ toggleLetterMerging: "\u062A\u0628\u062F\u064A\u0644 \u062F\u0645\u062C \u0627\u0644\u062D\u0631\u0648\u0641",
2622
+ disableLetterMerging: "\u062A\u0639\u0637\u064A\u0644 \u062F\u0645\u062C \u0627\u0644\u062D\u0631\u0648\u0641",
2623
+ enableLetterMerging: "\u062A\u0641\u0639\u064A\u0644 \u062F\u0645\u062C \u0627\u0644\u062D\u0631\u0648\u0641",
2624
+ chooseWritingFont: "\u0627\u062E\u062A\u064A\u0627\u0631 \u062E\u0637 \u0627\u0644\u0643\u062A\u0627\u0628\u0629",
2625
+ chooseDigitForm: "\u0627\u062E\u062A\u064A\u0627\u0631 \u0634\u0643\u0644 \u0627\u0644\u0623\u0631\u0642\u0627\u0645",
2626
+ defaultFont: "\u0627\u0644\u062E\u0637 \u0627\u0644\u0627\u0641\u062A\u0631\u0627\u0636\u064A",
2627
+ takweenFont: "\u062E\u0637 \u062A\u0643\u0648\u064A\u0646",
2628
+ diwaniFont: "\u062E\u0637 \u062F\u064A\u0648\u0627\u0646\u064A",
2629
+ diwaniOutlineFont: "\u062E\u0637 \u062F\u064A\u0648\u0627\u0646\u064A \u0645\u0638\u0644\u0644",
2630
+ writeDefaultFont: "\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u0627\u0644\u062E\u0637 \u0627\u0644\u0627\u0641\u062A\u0631\u0627\u0636\u064A",
2631
+ writeTakweenFont: "\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u062E\u0637 \u062A\u0643\u0648\u064A\u0646",
2632
+ westernDigits: "\u0623\u0631\u0642\u0627\u0645 \u063A\u0631\u0628\u064A\u0629",
2633
+ arabicIndicDigits: "\u0623\u0631\u0642\u0627\u0645 \u0639\u0631\u0628\u064A\u0629 \u0647\u0646\u062F\u064A\u0629",
2634
+ persianIndicDigits: "\u0623\u0631\u0642\u0627\u0645 \u0641\u0627\u0631\u0633\u064A\u0629 \u0647\u0646\u062F\u064A\u0629",
2635
+ equationEditor: "\u0645\u062D\u0631\u0631 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0627\u062A",
2636
+ renderPreview: "\u0645\u0639\u0627\u064A\u0646\u0629 \u0627\u0644\u0631\u0633\u0645",
2637
+ development: "\u062A\u0637\u0648\u064A\u0631",
2638
+ showDebugLog: "\u0625\u0638\u0647\u0627\u0631 \u0633\u062C\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",
2639
+ hideDebugLog: "\u0625\u062E\u0641\u0627\u0621 \u0633\u062C\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",
2640
+ copyDebugLog: "\u0646\u0633\u062E \u0633\u062C\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",
2641
+ empty: "\u0641\u0627\u0631\u063A",
2642
+ englishLatex: "LaTeX \u0625\u0646\u062C\u0644\u064A\u0632\u064A",
2643
+ arabicLatex: "LaTeX \u0639\u0631\u0628\u064A",
2644
+ inactiveEnglish: "\u0627\u0644\u0633\u0644\u0633\u0644\u0629 \u063A\u064A\u0631 \u0627\u0644\u0646\u0634\u0637\u0629 (\u0625\u0646\u062C\u0644\u064A\u0632\u064A)",
2645
+ inactiveArabic: "\u0627\u0644\u0633\u0644\u0633\u0644\u0629 \u063A\u064A\u0631 \u0627\u0644\u0646\u0634\u0637\u0629 (\u0639\u0631\u0628\u064A)",
2646
+ mathJaxError: "\u062E\u0637\u0623 MathJax",
2647
+ previewError: "\u062E\u0637\u0623 \u0641\u064A \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629",
2648
+ activeSide: "\u0627\u0644\u062C\u0627\u0646\u0628 \u0627\u0644\u0646\u0634\u0637",
2649
+ syncState: "\u062D\u0627\u0644\u0629 \u0627\u0644\u0645\u0632\u0627\u0645\u0646\u0629",
2650
+ arabicSide: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629",
2651
+ englishSide: "\u0627\u0644\u0625\u0646\u062C\u0644\u064A\u0632\u064A\u0629",
2652
+ synced: "\u0645\u062A\u0632\u0627\u0645\u0646",
2653
+ differentItems: "\u0639\u0646\u0627\u0635\u0631 \u0645\u062E\u062A\u0644\u0641\u0629",
2654
+ alignLeft: "\u064A\u0633\u0627\u0631",
2655
+ alignCenter: "\u0648\u0633\u0637",
2656
+ alignRight: "\u064A\u0645\u064A\u0646",
2657
+ alignColumnLeft: "\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0639\u0645\u0648\u062F \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
2658
+ alignColumnCenter: "\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0639\u0645\u0648\u062F \u0641\u064A \u0627\u0644\u0648\u0633\u0637",
2659
+ alignColumnRight: "\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0639\u0645\u0648\u062F \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
2660
+ matrixNoDelimiters: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u0644\u0627 \u0623\u0642\u0648\u0627\u0633",
2661
+ matrixParentheses: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u0642\u0648\u0633\u064A\u0646",
2662
+ matrixBrackets: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u0645\u0639\u0642\u0648\u0641\u064A\u0646",
2663
+ matrixBraces: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062D\u0627\u0635\u0631\u062A\u064A\u0646",
2664
+ matrixBars: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062E\u0637\u064A\u0646",
2665
+ matrixDoubleBars: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062E\u0637\u064A\u0646 \u0645\u0632\u062F\u0648\u062C\u064A\u0646"
2666
+ },
2667
+ en: {
2668
+ undoRedo: "Undo and redo",
2669
+ undo: "Undo",
2670
+ redo: "Redo",
2671
+ clipboard: "Clipboard",
2672
+ copy: "Copy",
2673
+ cut: "Cut",
2674
+ paste: "Paste",
2675
+ editorSettings: "Editor settings",
2676
+ toggleSide: "Switch Arabic / English equation side",
2677
+ structures: "Structures",
2678
+ insertDelimiters: "Insert delimiters",
2679
+ insertParentheses: "Insert parentheses",
2680
+ insertBrackets: "Insert brackets",
2681
+ insertBraces: "Insert braces",
2682
+ insertFraction: "Insert fraction",
2683
+ insertRoot: "Insert root",
2684
+ environments: "Environments",
2685
+ insertEnvironment: "Insert grid environment",
2686
+ environmentType: "Environment type",
2687
+ matrix: "Matrix",
2688
+ array: "Array",
2689
+ aligned: "Aligned",
2690
+ matrixType: "Matrix type",
2691
+ chooseEnvironmentSize: "Choose environment size",
2692
+ rows: "Rows",
2693
+ columns: "Columns",
2694
+ row: "Row",
2695
+ column: "Column",
2696
+ insert: "Insert",
2697
+ editSelectedEnvironment: "Edit selected environment",
2698
+ applySelectedMatrixStyle: "Apply style to selected matrix",
2699
+ applyStyle: "Apply style",
2700
+ addRow: "Add row",
2701
+ removeRow: "Remove row",
2702
+ addColumn: "Add column",
2703
+ removeColumn: "Remove column",
2704
+ spaces: "Spacing",
2705
+ insertSpace: "Insert space",
2706
+ functions: "Functions",
2707
+ insertFunction: "Insert function",
2708
+ insertLimitsSeries: "Insert limits and series",
2709
+ insertAdditionalFunctions: "Insert additional functions",
2710
+ insertNumberSets: "Insert number sets",
2711
+ operations: "Operators",
2712
+ insertOperation: "Insert operator",
2713
+ insertRelationsSets: "Insert relation or set symbol",
2714
+ insertArrows: "Insert arrow",
2715
+ insertDots: "Insert dots",
2716
+ insertIntegrals: "Insert integral",
2717
+ scripts: "Superscript and subscript",
2718
+ addSuperscript: "Add superscript",
2719
+ addSubscript: "Add subscript",
2720
+ removeSuperscript: "Remove superscript",
2721
+ removeSubscript: "Remove subscript",
2722
+ inputStyles: "Input styles",
2723
+ deleteSelectedStructure: "Delete selected structure",
2724
+ toggleLetterMerging: "Toggle letter merging",
2725
+ disableLetterMerging: "Disable letter merging",
2726
+ enableLetterMerging: "Enable letter merging",
2727
+ chooseWritingFont: "Choose writing font",
2728
+ chooseDigitForm: "Choose digit form",
2729
+ defaultFont: "Default font",
2730
+ takweenFont: "Takween font",
2731
+ diwaniFont: "Diwani font",
2732
+ diwaniOutlineFont: "Outlined Diwani font",
2733
+ writeDefaultFont: "Write with the default font",
2734
+ writeTakweenFont: "Write with Takween font",
2735
+ westernDigits: "Western digits",
2736
+ arabicIndicDigits: "Arabic-Indic digits",
2737
+ persianIndicDigits: "Persian digits",
2738
+ equationEditor: "Equation editor",
2739
+ renderPreview: "Rendered preview",
2740
+ development: "Development",
2741
+ showDebugLog: "Show debug log",
2742
+ hideDebugLog: "Hide debug log",
2743
+ copyDebugLog: "Copy debug log",
2744
+ empty: "Empty",
2745
+ englishLatex: "English LaTeX",
2746
+ arabicLatex: "Arabic LaTeX",
2747
+ inactiveEnglish: "Inactive chain (English)",
2748
+ inactiveArabic: "Inactive chain (Arabic)",
2749
+ mathJaxError: "MathJax error",
2750
+ previewError: "Preview error",
2751
+ activeSide: "Active side",
2752
+ syncState: "Sync state",
2753
+ arabicSide: "Arabic",
2754
+ englishSide: "English",
2755
+ synced: "Synced",
2756
+ differentItems: "different items",
2757
+ alignLeft: "Left",
2758
+ alignCenter: "Center",
2759
+ alignRight: "Right",
2760
+ alignColumnLeft: "Align column left",
2761
+ alignColumnCenter: "Align column center",
2762
+ alignColumnRight: "Align column right",
2763
+ matrixNoDelimiters: "Matrix without delimiters",
2764
+ matrixParentheses: "Matrix in parentheses",
2765
+ matrixBrackets: "Matrix in brackets",
2766
+ matrixBraces: "Matrix in braces",
2767
+ matrixBars: "Matrix between bars",
2768
+ matrixDoubleBars: "Matrix between double bars"
2769
+ }
2770
+ };
2771
+ function equationEditorMessages(locale) {
2772
+ return EQUATION_EDITOR_MESSAGES[locale];
2773
+ }
2774
+ function atomicCommandTitle(spec, locale) {
2775
+ return locale === "en" ? ENGLISH_COMMAND_TITLES[spec.id] ?? spec.title : spec.title;
2776
+ }
2777
+ function atomicOperatorCommandTitle(spec, locale) {
2778
+ return locale === "en" ? ENGLISH_OPERATOR_TITLES[spec.id] ?? spec.title : spec.title;
2779
+ }
2780
+
2393
2781
  // src/editor/state.ts
2394
2782
  function ensureSyncEntry(session, nodeId) {
2395
2783
  if (!session.sync[nodeId]) {
@@ -4086,8 +4474,8 @@ function spacingArrowForSide(spec, side) {
4086
4474
  }
4087
4475
  return side === "arabic" ? "\u2192" : "\u2190";
4088
4476
  }
4089
- function spacingTooltipForSide(spec, side) {
4090
- return `${spec.title} ${spacingArrowForSide(spec, side).repeat(spec.spacing.level)}`;
4477
+ function spacingTooltipForSide(spec, side, uiLocale = "ar") {
4478
+ return `${atomicCommandTitle(spec, uiLocale)} ${spacingArrowForSide(spec, side).repeat(spec.spacing.level)}`;
4091
4479
  }
4092
4480
  function buildFunctionAtomicCommandBody(node, side, spec) {
4093
4481
  const value = document.createElement("span");
@@ -4111,19 +4499,19 @@ function buildFunctionAtomicCommandBody(node, side, spec) {
4111
4499
  value.textContent = side === "arabic" ? spec?.arabicLabel ?? node.expr : spec?.englishTex.replace("\\", "") ?? node.expr;
4112
4500
  return value;
4113
4501
  }
4114
- function buildSpacingAtomicCommandBody(spec, side) {
4502
+ function buildSpacingAtomicCommandBody(spec, side, uiLocale) {
4115
4503
  const value = document.createElement("span");
4116
4504
  value.className = `atomic-spacing atomic-spacing--${spec.spacing.direction} atomic-spacing--level-${String(spec.spacing.level)}`;
4117
- value.title = spacingTooltipForSide(spec, side);
4505
+ value.title = spacingTooltipForSide(spec, side, uiLocale);
4118
4506
  const marker = document.createElement("span");
4119
4507
  marker.className = "atomic-spacing__marker";
4120
4508
  value.appendChild(marker);
4121
4509
  return value;
4122
4510
  }
4123
- function buildAtomicCommandNodeBody(node, side) {
4511
+ function buildAtomicCommandNodeBody(node, side, uiLocale = "ar") {
4124
4512
  const spec = atomicCommandSpec(node.expr);
4125
4513
  if (isSpacingCommandSpec(spec)) {
4126
- return buildSpacingAtomicCommandBody(spec, side);
4514
+ return buildSpacingAtomicCommandBody(spec, side, uiLocale);
4127
4515
  }
4128
4516
  return buildFunctionAtomicCommandBody(node, side, spec);
4129
4517
  }
@@ -4157,11 +4545,11 @@ function buildOperatorLabel(spec) {
4157
4545
  value.textContent = spec.Label;
4158
4546
  return value;
4159
4547
  }
4160
- function buildAtomicOperatorCommandNodeBody(node, side) {
4548
+ function buildAtomicOperatorCommandNodeBody(node, side, uiLocale = "ar") {
4161
4549
  const spec = atomicOperatorCommandSpec(node.expr);
4162
4550
  const value = document.createElement("span");
4163
4551
  value.className = "atomic-operator-command";
4164
- value.title = spec?.title ?? node.expr;
4552
+ value.title = spec ? atomicOperatorCommandTitle(spec, uiLocale) : node.expr;
4165
4553
  if (side === "arabic" && shouldMirrorOperatorDisplay(spec)) {
4166
4554
  value.classList.add("atomic-operator-command--mirrored");
4167
4555
  }
@@ -4215,7 +4603,7 @@ function buildNodeScripts(node, buildChain) {
4215
4603
  }
4216
4604
 
4217
4605
  // src/editor/display/index.ts
4218
- function buildNodeBody(node, buildChain, side, digitForm = "western") {
4606
+ function buildNodeBody(node, buildChain, side, digitForm = "western", uiLocale = "ar") {
4219
4607
  if (node.kind === "delimiter") {
4220
4608
  return buildDelimiterNodeBody(node, buildChain);
4221
4609
  }
@@ -4229,10 +4617,10 @@ function buildNodeBody(node, buildChain, side, digitForm = "western") {
4229
4617
  return buildMatrixEnvNodeBody(node, buildChain, side);
4230
4618
  }
4231
4619
  if (node.kind === "atomicCommand") {
4232
- return buildAtomicCommandNodeBody(node, side);
4620
+ return buildAtomicCommandNodeBody(node, side, uiLocale);
4233
4621
  }
4234
4622
  if (node.kind === "atomicOperatorCommand") {
4235
- return buildAtomicOperatorCommandNodeBody(node, side);
4623
+ return buildAtomicOperatorCommandNodeBody(node, side, uiLocale);
4236
4624
  }
4237
4625
  return buildBaseNodeBody(node, digitForm);
4238
4626
  }
@@ -4453,6 +4841,10 @@ function createEditorRuntime(options) {
4453
4841
  const buttonElements = options.buttonElements ?? {};
4454
4842
  const outsidePointerIgnoreSelectors = options.outsidePointerIgnoreSelectors ?? [];
4455
4843
  let session = options.initialSession ?? createStarterSession();
4844
+ let uiLocale = options.uiLocale ?? "ar";
4845
+ if (options.defaultSide) {
4846
+ session = { ...session, activeSide: options.defaultSide };
4847
+ }
4456
4848
  const undoRedo = createUndoRedoStacks();
4457
4849
  let lastInternalFragment = null;
4458
4850
  let initialKeyboardFocusPending = true;
@@ -4484,14 +4876,15 @@ function createEditorRuntime(options) {
4484
4876
  return index >= start && index < end;
4485
4877
  }
4486
4878
  function refreshUndoRedoButtons() {
4879
+ const messages = equationEditorMessages(uiLocale);
4487
4880
  if (buttonElements.undoBtn) {
4488
4881
  buttonElements.undoBtn.disabled = !undoRedoCanUndo(undoRedo);
4489
4882
  const arabicEquation = session.activeSide === "arabic";
4490
4883
  const undoArrow = arabicEquation ? "\u21B7" : "\u21B6";
4491
4884
  const vs = "\uFE0E";
4492
4885
  buttonElements.undoBtn.textContent = `${undoArrow}${vs}`;
4493
- buttonElements.undoBtn.title = "\u062A\u0631\u0627\u062C\u0639";
4494
- buttonElements.undoBtn.setAttribute("aria-label", "\u062A\u0631\u0627\u062C\u0639");
4886
+ buttonElements.undoBtn.title = messages.undo;
4887
+ buttonElements.undoBtn.setAttribute("aria-label", messages.undo);
4495
4888
  }
4496
4889
  if (buttonElements.redoBtn) {
4497
4890
  buttonElements.redoBtn.disabled = !undoRedoCanRedo(undoRedo);
@@ -4499,8 +4892,8 @@ function createEditorRuntime(options) {
4499
4892
  const redoArrow = arabicEquation ? "\u21B6" : "\u21B7";
4500
4893
  const vs = "\uFE0E";
4501
4894
  buttonElements.redoBtn.textContent = `${redoArrow}${vs}`;
4502
- buttonElements.redoBtn.title = "\u0625\u0639\u0627\u062F\u0629";
4503
- buttonElements.redoBtn.setAttribute("aria-label", "\u0625\u0639\u0627\u062F\u0629");
4895
+ buttonElements.redoBtn.title = messages.redo;
4896
+ buttonElements.redoBtn.setAttribute("aria-label", messages.redo);
4504
4897
  }
4505
4898
  }
4506
4899
  function refreshClipboardButtons() {
@@ -4519,9 +4912,10 @@ function createEditorRuntime(options) {
4519
4912
  return;
4520
4913
  }
4521
4914
  const mergeOn = !session.splitLeafTyping;
4915
+ const messages = equationEditorMessages(uiLocale);
4522
4916
  buttonElements.splitTypingBtn.textContent = mergeOn ? "\u0633\u0635\u0639" : "\u0633 \u0635 \u0639";
4523
- buttonElements.splitTypingBtn.title = mergeOn ? "\u062A\u0639\u0637\u064A\u0644 \u062F\u0645\u062C \u0627\u0644\u062D\u0631\u0648\u0641" : "\u062A\u0641\u0639\u064A\u0644 \u062F\u0645\u062C \u0627\u0644\u062D\u0631\u0648\u0641";
4524
- buttonElements.splitTypingBtn.setAttribute("aria-label", mergeOn ? "\u062A\u0639\u0637\u064A\u0644 \u062F\u0645\u062C \u0627\u0644\u062D\u0631\u0648\u0641" : "\u062A\u0641\u0639\u064A\u0644 \u062F\u0645\u062C \u0627\u0644\u062D\u0631\u0648\u0641");
4917
+ buttonElements.splitTypingBtn.title = mergeOn ? messages.disableLetterMerging : messages.enableLetterMerging;
4918
+ buttonElements.splitTypingBtn.setAttribute("aria-label", mergeOn ? messages.disableLetterMerging : messages.enableLetterMerging);
4525
4919
  buttonElements.splitTypingBtn.setAttribute("aria-pressed", mergeOn ? "true" : "false");
4526
4920
  buttonElements.splitTypingBtn.classList.toggle("accent", mergeOn);
4527
4921
  }
@@ -4530,9 +4924,10 @@ function createEditorRuntime(options) {
4530
4924
  return;
4531
4925
  }
4532
4926
  const takweenOn = (session.currentCharacterFont ?? "default") === "takween";
4927
+ const messages = equationEditorMessages(uiLocale);
4533
4928
  buttonElements.characterFontBtn.textContent = "\u062A\u0643";
4534
- buttonElements.characterFontBtn.title = takweenOn ? "\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u0627\u0644\u062E\u0637 \u0627\u0644\u0627\u0641\u062A\u0631\u0627\u0636\u064A" : "\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u062E\u0637 \u062A\u0643\u0648\u064A\u0646";
4535
- buttonElements.characterFontBtn.setAttribute("aria-label", takweenOn ? "\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u0627\u0644\u062E\u0637 \u0627\u0644\u0627\u0641\u062A\u0631\u0627\u0636\u064A" : "\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u062E\u0637 \u062A\u0643\u0648\u064A\u0646");
4929
+ buttonElements.characterFontBtn.title = takweenOn ? messages.writeDefaultFont : messages.writeTakweenFont;
4930
+ buttonElements.characterFontBtn.setAttribute("aria-label", takweenOn ? messages.writeDefaultFont : messages.writeTakweenFont);
4536
4931
  buttonElements.characterFontBtn.setAttribute("aria-pressed", takweenOn ? "true" : "false");
4537
4932
  buttonElements.characterFontBtn.classList.toggle("accent", takweenOn);
4538
4933
  }
@@ -4543,8 +4938,9 @@ function createEditorRuntime(options) {
4543
4938
  const digitForm = session.currentDigitForm ?? "western";
4544
4939
  const label = digitForm === "arabicIndic" ? "\u0664\u0665\u0666" : digitForm === "persianIndic" ? "\u06F4\u06F5\u06F6" : "456";
4545
4940
  buttonElements.digitFormBtn.textContent = label;
4546
- buttonElements.digitFormBtn.title = "\u0627\u062E\u062A\u064A\u0627\u0631 \u0634\u0643\u0644 \u0627\u0644\u0623\u0631\u0642\u0627\u0645";
4547
- buttonElements.digitFormBtn.setAttribute("aria-label", "\u0627\u062E\u062A\u064A\u0627\u0631 \u0634\u0643\u0644 \u0627\u0644\u0623\u0631\u0642\u0627\u0645");
4941
+ const messages = equationEditorMessages(uiLocale);
4942
+ buttonElements.digitFormBtn.title = messages.chooseDigitForm;
4943
+ buttonElements.digitFormBtn.setAttribute("aria-label", messages.chooseDigitForm);
4548
4944
  buttonElements.digitFormBtn.dataset.digitForm = digitForm;
4549
4945
  }
4550
4946
  function applyStructural(updater) {
@@ -4746,7 +5142,7 @@ function createEditorRuntime(options) {
4746
5142
  const atomicSpec = node.kind === "atomicCommand" ? atomicCommandSpec(node.expr) : null;
4747
5143
  if (isSpacingCommandSpec(atomicSpec)) {
4748
5144
  nodeEl.classList.add("node--atomic-spacing");
4749
- nodeEl.title = spacingTooltipForSide(atomicSpec, session.activeSide);
5145
+ nodeEl.title = spacingTooltipForSide(atomicSpec, session.activeSide, uiLocale);
4750
5146
  }
4751
5147
  if (session.selectedNodeId === node.id || session.selectedStructureNodeId === node.id) {
4752
5148
  nodeEl.classList.add("selected");
@@ -4776,7 +5172,7 @@ function createEditorRuntime(options) {
4776
5172
  });
4777
5173
  const body = document.createElement("span");
4778
5174
  body.className = "node-body";
4779
- body.appendChild(buildNodeBody(node, buildChain, session.activeSide, session.currentDigitForm ?? "western"));
5175
+ body.appendChild(buildNodeBody(node, buildChain, session.activeSide, session.currentDigitForm ?? "western", uiLocale));
4780
5176
  nodeEl.appendChild(body);
4781
5177
  const scripts = buildNodeScripts(node, buildChain);
4782
5178
  if (scripts) {
@@ -5057,6 +5453,13 @@ function createEditorRuntime(options) {
5057
5453
  session = next;
5058
5454
  render();
5059
5455
  },
5456
+ setUiLocale: (locale) => {
5457
+ if (uiLocale === locale) {
5458
+ return;
5459
+ }
5460
+ uiLocale = locale;
5461
+ render();
5462
+ },
5060
5463
  performUndo,
5061
5464
  performRedo,
5062
5465
  performCopy,
@@ -5532,15 +5935,15 @@ function mathNodeFromEditorSession(session, mathMode = "$", closing = "$") {
5532
5935
  }
5533
5936
 
5534
5937
  // src/document2/mathBridge.ts
5535
- function createEmptyArabicEquationSession() {
5938
+ function createEmptyEquationSession(side = "arabic") {
5536
5939
  const english = createEditorChain();
5537
5940
  const arabic = createEditorChain();
5538
5941
  arabic.id = english.id;
5539
- const session = createEditorSession(english, arabic, "arabic");
5942
+ const session = createEditorSession(english, arabic, side);
5540
5943
  session.sync = buildInitialSyncMap(session.englishTree, session.arabicTree);
5541
5944
  return session;
5542
5945
  }
5543
- function mathTokenToArabicEditorSession(math) {
5946
+ function mathTokenToEditorSession(math, side = "arabic") {
5544
5947
  if (!math) {
5545
5948
  return { editable: false, reason: "\u0647\u0630\u0647 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629 \u0645\u062D\u0641\u0648\u0638\u0629 \u0643\u0646\u0635 \u062E\u0627\u0645 \u0641\u0642\u0637 \u062D\u0627\u0644\u064A\u0627" };
5546
5949
  }
@@ -5548,12 +5951,12 @@ function mathTokenToArabicEditorSession(math) {
5548
5951
  if (!result.editable) {
5549
5952
  return result;
5550
5953
  }
5551
- result.session.activeSide = "arabic";
5954
+ result.session.activeSide = side;
5552
5955
  result.session.sync = buildInitialSyncMap(result.session.englishTree, result.session.arabicTree);
5553
5956
  return result;
5554
5957
  }
5555
- function mathSourceFromArabicSession(session, opening = "$", closing = "$") {
5556
- const inner = renderArabicLatexFromSession(session);
5958
+ function mathSourceFromSession(session, side, opening = "$", closing = "$") {
5959
+ const inner = side === "english" ? renderEnglishLatexFromSession(session) : renderArabicLatexFromSession(session);
5557
5960
  if (opening === "$" || opening === "\\(") {
5558
5961
  return opening + inner + closing;
5559
5962
  }
@@ -5566,13 +5969,26 @@ ${closing}`;
5566
5969
  ${inner}
5567
5970
  ${closing}`;
5568
5971
  }
5569
- function mathNodeFromArabicSession(session, opening = "$", closing = "$") {
5972
+ function mathNodeFromSession(session, opening = "$", closing = "$") {
5570
5973
  const converted = mathNodeFromEditorSession(session, opening, closing);
5571
5974
  if (converted.ok) {
5572
5975
  return converted.math;
5573
5976
  }
5574
5977
  return { nodeType: "MathObject", mathMode: opening, lines: [], closing };
5575
5978
  }
5979
+ function mathTokenSourceForSide(token, side) {
5980
+ if (!token.math || token.sourceOwner === "raw") {
5981
+ return token.source;
5982
+ }
5983
+ if (token.sourceSide === side) {
5984
+ return token.source;
5985
+ }
5986
+ const result = mathTokenToEditorSession(token.math, side);
5987
+ if (!result.editable) {
5988
+ return token.source;
5989
+ }
5990
+ return mathSourceFromSession(result.session, side, token.opening, token.closing);
5991
+ }
5576
5992
 
5577
5993
  // src/document2/commands.ts
5578
5994
  function cloneToken(token) {
@@ -5649,15 +6065,16 @@ function updateTextToken(document2, fieldId, tokenId, text) {
5649
6065
  });
5650
6066
  return next;
5651
6067
  }
5652
- function mathTokenFromSession(session, opening = "$", closing = "$") {
6068
+ function mathTokenFromSession(session, opening = "$", closing = "$", side = "arabic") {
5653
6069
  return {
5654
6070
  id: document2Id("math"),
5655
6071
  kind: "math",
5656
6072
  display: opening === "$$" || opening === "\\[" || opening.startsWith("\\begin{"),
5657
6073
  opening,
5658
6074
  closing,
5659
- source: mathSourceFromArabicSession(session, opening, closing),
5660
- math: mathNodeFromArabicSession(session, opening, closing),
6075
+ source: mathSourceFromSession(session, side, opening, closing),
6076
+ sourceSide: side,
6077
+ math: mathNodeFromSession(session, opening, closing),
5661
6078
  editable: true,
5662
6079
  sourceOwner: "editor"
5663
6080
  };
@@ -5733,9 +6150,9 @@ function splitTextTokenAt(token, offset) {
5733
6150
  { id: document2Id("text"), kind: "text", text: token.text.slice(safeOffset) }
5734
6151
  ];
5735
6152
  }
5736
- function insertMathTokenAtCaret(document2, fieldId, textTokenId, caretOffset, session, opening = "$", closing = "$") {
6153
+ function insertMathTokenAtCaret(document2, fieldId, textTokenId, caretOffset, session, opening = "$", closing = "$", side = "arabic") {
5737
6154
  const next = cloneDocument(document2);
5738
- const mathToken = mathTokenFromSession(session, opening, closing);
6155
+ const mathToken = mathTokenFromSession(session, opening, closing, side);
5739
6156
  visitFields(next.blocks, (field) => {
5740
6157
  if (field.id !== fieldId) {
5741
6158
  return false;
@@ -5760,7 +6177,7 @@ function insertMathTokenAtCaret(document2, fieldId, textTokenId, caretOffset, se
5760
6177
  });
5761
6178
  return next;
5762
6179
  }
5763
- function replaceMathTokenFromSession(document2, tokenId, session, opening, closing) {
6180
+ function replaceMathTokenFromSession(document2, tokenId, session, opening, closing, side = "arabic") {
5764
6181
  const next = cloneDocument(document2);
5765
6182
  visitFields(next.blocks, (field) => {
5766
6183
  const index = field.tokens.findIndex((token) => token.id === tokenId && token.kind === "math");
@@ -5770,7 +6187,7 @@ function replaceMathTokenFromSession(document2, tokenId, session, opening, closi
5770
6187
  const current = field.tokens[index];
5771
6188
  const open = opening ?? current.opening;
5772
6189
  const close = closing ?? current.closing;
5773
- field.tokens[index] = mathTokenFromSession(session, open, close);
6190
+ field.tokens[index] = mathTokenFromSession(session, open, close, side);
5774
6191
  field.tokens[index].id = current.id;
5775
6192
  return true;
5776
6193
  });
@@ -5982,23 +6399,20 @@ function document2HistoryCanRedo(stacks) {
5982
6399
  }
5983
6400
 
5984
6401
  // src/document2/previewModel.ts
5985
- function mathTex(token) {
6402
+ function mathTex(token, equationSide) {
5986
6403
  if (token.kind === "text") {
5987
6404
  return token.text;
5988
6405
  }
5989
- if (!token.math || token.sourceOwner === "raw" || token.sourceOwner === "editor") {
5990
- return token.source;
5991
- }
5992
- return renderMathNodeLatex(token.math);
6406
+ return mathTokenSourceForSide(token, equationSide);
5993
6407
  }
5994
- function previewInlines(field, islands, output) {
6408
+ function previewInlines(field, islands, output, equationSide) {
5995
6409
  return field.tokens.map((token) => {
5996
6410
  if (token.kind === "text") {
5997
6411
  return { kind: "text", text: token.text };
5998
6412
  }
5999
6413
  const island = {
6000
6414
  id: token.id,
6001
- tex: mathTex(token),
6415
+ tex: mathTex(token, equationSide),
6002
6416
  display: token.display,
6003
6417
  output,
6004
6418
  editable: token.editable
@@ -6007,21 +6421,21 @@ function previewInlines(field, islands, output) {
6007
6421
  return { kind: "math", ...island };
6008
6422
  });
6009
6423
  }
6010
- function textBlockPreview(block, islands, output) {
6424
+ function textBlockPreview(block, islands, output, equationSide) {
6011
6425
  if (block.command === "\\section") {
6012
- return { kind: "heading", id: block.id, level: 1, inlines: previewInlines(block.field, islands, output) };
6426
+ return { kind: "heading", id: block.id, level: 1, inlines: previewInlines(block.field, islands, output, equationSide) };
6013
6427
  }
6014
6428
  if (block.command === "\\subsection") {
6015
- return { kind: "heading", id: block.id, level: 2, inlines: previewInlines(block.field, islands, output) };
6429
+ return { kind: "heading", id: block.id, level: 2, inlines: previewInlines(block.field, islands, output, equationSide) };
6016
6430
  }
6017
6431
  if (block.command === "\\subsubsection") {
6018
- return { kind: "heading", id: block.id, level: 3, inlines: previewInlines(block.field, islands, output) };
6432
+ return { kind: "heading", id: block.id, level: 3, inlines: previewInlines(block.field, islands, output, equationSide) };
6019
6433
  }
6020
- return { kind: "paragraph", id: block.id, inlines: previewInlines(block.field, islands, output) };
6434
+ return { kind: "paragraph", id: block.id, inlines: previewInlines(block.field, islands, output, equationSide) };
6021
6435
  }
6022
- function blockPreview(block, islands, output) {
6436
+ function blockPreview(block, islands, output, equationSide) {
6023
6437
  if (block.kind === "textBlock") {
6024
- return textBlockPreview(block, islands, output);
6438
+ return textBlockPreview(block, islands, output, equationSide);
6025
6439
  }
6026
6440
  if (block.kind === "list") {
6027
6441
  return {
@@ -6030,23 +6444,23 @@ function blockPreview(block, islands, output) {
6030
6444
  ordered: block.command === "\\begin{enumerate}",
6031
6445
  items: block.items.map((item) => ({
6032
6446
  id: item.id,
6033
- inlines: previewInlines(item.field, islands, output),
6034
- blocks: item.blocks.map((child) => blockPreview(child, islands, output))
6447
+ inlines: previewInlines(item.field, islands, output, equationSide),
6448
+ blocks: item.blocks.map((child) => blockPreview(child, islands, output, equationSide))
6035
6449
  }))
6036
6450
  };
6037
6451
  }
6038
6452
  if (block.kind === "table") {
6039
- return { kind: "table", id: block.id, rows: block.rows.map((row) => row.map((cell) => previewInlines(cell, islands, output))) };
6453
+ return { kind: "table", id: block.id, rows: block.rows.map((row) => row.map((cell) => previewInlines(cell, islands, output, equationSide))) };
6040
6454
  }
6041
6455
  if (block.kind === "image") {
6042
6456
  return { kind: "image", id: block.id, src: block.value, options: block.options };
6043
6457
  }
6044
6458
  return { kind: "omit", id: block.id };
6045
6459
  }
6046
- function document2Preview(document2, output = "svg") {
6460
+ function document2Preview(document2, output = "svg", equationSide = "arabic") {
6047
6461
  const mathIslands = [];
6048
6462
  return {
6049
- blocks: document2.blocks.map((block) => blockPreview(block, mathIslands, output)),
6463
+ blocks: document2.blocks.map((block) => blockPreview(block, mathIslands, output, equationSide)),
6050
6464
  mathIslands
6051
6465
  };
6052
6466
  }
@@ -6481,11 +6895,166 @@ function MathIsland({ id, tex, display, output = "svg" }) {
6481
6895
  );
6482
6896
  }
6483
6897
 
6898
+ // src/react-document2/uiMessages.ts
6899
+ var DOCUMENT2_MESSAGES = {
6900
+ ar: {
6901
+ undoRedo: "\u062A\u0631\u0627\u062C\u0639 \u0648\u0625\u0639\u0627\u062F\u0629",
6902
+ undo: "\u062A\u0631\u0627\u062C\u0639",
6903
+ redo: "\u0625\u0639\u0627\u062F\u0629",
6904
+ structure: "\u0647\u064A\u0643\u0644",
6905
+ content: "\u0645\u062D\u062A\u0648\u0649",
6906
+ addSection: "\u0625\u0636\u0627\u0641\u0629 \u0642\u0633\u0645",
6907
+ addSubsection: "\u0625\u0636\u0627\u0641\u0629 \u0641\u0631\u0639",
6908
+ addSubsubsection: "\u0625\u0636\u0627\u0641\u0629 \u0641\u0631\u0639 \u0635\u063A\u064A\u0631",
6909
+ addParagraph: "\u0625\u0636\u0627\u0641\u0629 \u0641\u0642\u0631\u0629",
6910
+ inlineEquation: "\u0645\u0639\u0627\u062F\u0644\u0629 \u062F\u0627\u062E\u0644 \u0627\u0644\u0633\u0637\u0631",
6911
+ displayEquation: "\u0645\u0639\u0627\u062F\u0644\u0629 \u0645\u0639\u0631\u0648\u0636\u0629",
6912
+ bulletedList: "\u0642\u0627\u0626\u0645\u0629 \u0646\u0642\u0637\u064A\u0629",
6913
+ numberedList: "\u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0642\u0645\u0629",
6914
+ insertImage: "\u0625\u062F\u0631\u0627\u062C \u0635\u0648\u0631\u0629",
6915
+ insertTable: "\u0625\u062F\u0631\u0627\u062C \u062C\u062F\u0648\u0644",
6916
+ tableSize: "\u062D\u062C\u0645 \u0627\u0644\u062C\u062F\u0648\u0644",
6917
+ rows: "\u0635\u0641\u0648\u0641",
6918
+ columns: "\u0623\u0639\u0645\u062F\u0629",
6919
+ insert: "\u0625\u062F\u0631\u0627\u062C",
6920
+ panels: "\u0627\u0644\u0644\u0648\u062D\u0627\u062A",
6921
+ hideEditor: "\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u062A\u062D\u0631\u064A\u0631",
6922
+ editor: "\u062A\u062D\u0631\u064A\u0631",
6923
+ hidePreview: "\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629",
6924
+ preview: "\u0645\u0639\u0627\u064A\u0646\u0629",
6925
+ collapseBlocks: "\u0637\u064A \u0627\u0644\u0643\u062A\u0644",
6926
+ collapseAll: "\u0637\u064A \u0627\u0644\u0643\u0644",
6927
+ openAll: "\u0641\u062A\u062D \u0627\u0644\u0643\u0644",
6928
+ documentEditor: "\u062A\u062D\u0631\u064A\u0631 \u0627\u0644\u0645\u0633\u062A\u0646\u062F",
6929
+ documentPreview: "\u0645\u0639\u0627\u064A\u0646\u0629 \u0627\u0644\u0645\u0633\u062A\u0646\u062F",
6930
+ importWarnings: "\u062A\u0646\u0628\u064A\u0647\u0627\u062A \u0627\u0644\u0627\u0633\u062A\u064A\u0631\u0627\u062F (\u0648\u0636\u0639 \u0627\u0644\u062A\u0637\u0648\u064A\u0631)",
6931
+ emptyDocument: "\u0627\u0644\u0645\u0633\u062A\u0646\u062F \u0641\u0627\u0631\u063A",
6932
+ text: "\u0646\u0635",
6933
+ editEquation: "\u062A\u062D\u0631\u064A\u0631 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
6934
+ rawEquation: "\u0645\u0639\u0627\u062F\u0644\u0629 \u062E\u0627\u0645",
6935
+ deleteEquation: "\u062D\u0630\u0641 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
6936
+ equationUnavailable: "\u0647\u0630\u0647 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629 \u063A\u064A\u0631 \u0645\u062A\u0627\u062D\u0629 \u0644\u0644\u062A\u062D\u0631\u064A\u0631 \u062D\u0627\u0644\u064A\u0627",
6937
+ closeEquationDialog: "\u0625\u063A\u0644\u0627\u0642 \u0646\u0627\u0641\u0630\u0629 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
6938
+ equationEditorTitle: "\u062A\u062D\u0631\u064A\u0631 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
6939
+ close: "\u0625\u063A\u0644\u0627\u0642",
6940
+ equationType: "\u0646\u0648\u0639 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
6941
+ inline: "\u062F\u0627\u062E\u0644 \u0627\u0644\u0633\u0637\u0631",
6942
+ displayed: "\u0645\u0639\u0631\u0648\u0636\u0629",
6943
+ saveEquation: "\u062D\u0641\u0638 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
6944
+ section: "\u0642\u0633\u0645",
6945
+ subsection: "\u0641\u0631\u0639",
6946
+ subsubsection: "\u0641\u0631\u0639 \u0635\u063A\u064A\u0631",
6947
+ paragraph: "\u0641\u0642\u0631\u0629",
6948
+ list: "\u0642\u0627\u0626\u0645\u0629",
6949
+ table: "\u062C\u062F\u0648\u0644",
6950
+ image: "\u0635\u0648\u0631\u0629",
6951
+ raw: "\u062E\u0627\u0645",
6952
+ openBlock: "\u0641\u062A\u062D \u0627\u0644\u0643\u062A\u0644\u0629",
6953
+ collapseBlock: "\u0637\u064A \u0627\u0644\u0643\u062A\u0644\u0629",
6954
+ moveUp: "\u0646\u0642\u0644 \u0644\u0623\u0639\u0644\u0649",
6955
+ moveDown: "\u0646\u0642\u0644 \u0644\u0623\u0633\u0641\u0644",
6956
+ deleteBlock: "\u062D\u0630\u0641 \u0627\u0644\u0643\u062A\u0644\u0629",
6957
+ item: "\u0639\u0646\u0635\u0631",
6958
+ deleteItem: "\u062D\u0630\u0641 \u0627\u0644\u0639\u0646\u0635\u0631",
6959
+ addItem: "\u0639\u0646\u0635\u0631",
6960
+ imagePath: "\u0645\u0633\u0627\u0631 \u0627\u0644\u0645\u0644\u0641 (\\includegraphics)",
6961
+ imagePathLabel: "\u0645\u0633\u0627\u0631 \u0627\u0644\u0635\u0648\u0631\u0629",
6962
+ loadDocumentError: "\u062A\u0639\u0630\u0631 \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0633\u062A\u0646\u062F",
6963
+ importOrderMismatch: "\u062A\u0631\u062A\u064A\u0628 \u0623\u0648 \u0623\u0646\u0648\u0627\u0639 \u0627\u0644\u0645\u062D\u062F\u062F\u0627\u062A \u0641\u064A math_objects \u0644\u0627 \u062A\u0637\u0627\u0628\u0642 \u0645\u0627 \u0648\u0631\u062F \u0641\u064A \u0627\u0644\u0646\u0635.",
6964
+ importCountMismatch: "\u0639\u062F\u0645 \u062A\u0637\u0627\u0628\u0642 \u0628\u064A\u0646 \u0627\u0644\u0645\u0648\u0627\u0636\u0639 \u0627\u0644\u0631\u064A\u0627\u0636\u064A\u0629 \u0627\u0644\u0645\u0633\u062A\u062E\u0631\u062C\u0629 \u0645\u0646 \u0627\u0644\u0646\u0635 \u0648\u0639\u062F\u062F \u0639\u0646\u0627\u0635\u0631 math_objects.",
6965
+ importWarning: "\u062A\u0646\u0628\u064A\u0647 \u0627\u0644\u0627\u0633\u062A\u064A\u0631\u0627\u062F",
6966
+ path: "\u0627\u0644\u0645\u0633\u0627\u0631",
6967
+ sectionGlyph: "\u0642",
6968
+ subsectionGlyph: "\u0641",
6969
+ subsubsectionGlyph: "\u0635",
6970
+ paragraphGlyph: "\u0623\u0628\u062C"
6971
+ },
6972
+ en: {
6973
+ undoRedo: "Undo and redo",
6974
+ undo: "Undo",
6975
+ redo: "Redo",
6976
+ structure: "Structure",
6977
+ content: "Content",
6978
+ addSection: "Add section",
6979
+ addSubsection: "Add subsection",
6980
+ addSubsubsection: "Add subsubsection",
6981
+ addParagraph: "Add paragraph",
6982
+ inlineEquation: "Inline equation",
6983
+ displayEquation: "Display equation",
6984
+ bulletedList: "Bulleted list",
6985
+ numberedList: "Numbered list",
6986
+ insertImage: "Insert image",
6987
+ insertTable: "Insert table",
6988
+ tableSize: "Table size",
6989
+ rows: "Rows",
6990
+ columns: "Columns",
6991
+ insert: "Insert",
6992
+ panels: "Panels",
6993
+ hideEditor: "Hide editor",
6994
+ editor: "Editor",
6995
+ hidePreview: "Hide preview",
6996
+ preview: "Preview",
6997
+ collapseBlocks: "Collapse blocks",
6998
+ collapseAll: "Collapse all",
6999
+ openAll: "Open all",
7000
+ documentEditor: "Document editor",
7001
+ documentPreview: "Document preview",
7002
+ importWarnings: "Import warnings (development mode)",
7003
+ emptyDocument: "The document is empty",
7004
+ text: "Text",
7005
+ editEquation: "Edit equation",
7006
+ rawEquation: "Raw equation",
7007
+ deleteEquation: "Delete equation",
7008
+ equationUnavailable: "This equation is not currently available for editing",
7009
+ closeEquationDialog: "Close equation dialog",
7010
+ equationEditorTitle: "Edit equation",
7011
+ close: "Close",
7012
+ equationType: "Equation type",
7013
+ inline: "Inline",
7014
+ displayed: "Displayed",
7015
+ saveEquation: "Save equation",
7016
+ section: "Section",
7017
+ subsection: "Subsection",
7018
+ subsubsection: "Subsubsection",
7019
+ paragraph: "Paragraph",
7020
+ list: "List",
7021
+ table: "Table",
7022
+ image: "Image",
7023
+ raw: "Raw",
7024
+ openBlock: "Open block",
7025
+ collapseBlock: "Collapse block",
7026
+ moveUp: "Move up",
7027
+ moveDown: "Move down",
7028
+ deleteBlock: "Delete block",
7029
+ item: "Item",
7030
+ deleteItem: "Delete item",
7031
+ addItem: "Item",
7032
+ imagePath: "File path (\\includegraphics)",
7033
+ imagePathLabel: "Image path",
7034
+ loadDocumentError: "Could not load document",
7035
+ importOrderMismatch: "The math_objects delimiter order or types do not match the document text.",
7036
+ importCountMismatch: "The detected math positions do not match the number of math_objects entries.",
7037
+ importWarning: "Import warning",
7038
+ path: "Path",
7039
+ sectionGlyph: "H1",
7040
+ subsectionGlyph: "H2",
7041
+ subsubsectionGlyph: "H3",
7042
+ paragraphGlyph: "P"
7043
+ }
7044
+ };
7045
+ function document2Messages(locale) {
7046
+ return DOCUMENT2_MESSAGES[locale];
7047
+ }
7048
+
6484
7049
  // src/react-document2/MathChip.tsx
6485
7050
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
6486
7051
  function MathChip({
6487
7052
  token,
6488
7053
  output = "svg",
7054
+ documentDirection = "rtl",
7055
+ equationSide = "arabic",
7056
+ editable = true,
7057
+ uiLocale = "ar",
6489
7058
  buttonRef,
6490
7059
  onOpen,
6491
7060
  onDelete,
@@ -6493,7 +7062,14 @@ function MathChip({
6493
7062
  onRequestTextFocus,
6494
7063
  onTextInputFromFocus
6495
7064
  }) {
6496
- const tex = token.math && token.sourceOwner === "imported-structured" ? renderMathNodeLatex(token.math) : token.source;
7065
+ const messages = document2Messages(uiLocale);
7066
+ const tex = mathTokenSourceForSide(token, equationSide);
7067
+ const forwardArrowKey = documentDirection === "rtl" ? "ArrowLeft" : "ArrowRight";
7068
+ const backwardArrowKey = documentDirection === "rtl" ? "ArrowRight" : "ArrowLeft";
7069
+ const island = /* @__PURE__ */ jsx2(MathIsland, { id: token.id, tex, display: token.display, output });
7070
+ if (!editable) {
7071
+ return /* @__PURE__ */ jsx2("span", { className: "butex-document2-widget__math-chip-wrap", "data-display": token.display ? "true" : "false", children: /* @__PURE__ */ jsx2("span", { className: "butex-document2-widget__math-chip", "data-editable": "false", "data-display": token.display ? "true" : "false", children: island }) });
7072
+ }
6497
7073
  return /* @__PURE__ */ jsxs("span", { className: "butex-document2-widget__math-chip-wrap", "data-display": token.display ? "true" : "false", children: [
6498
7074
  /* @__PURE__ */ jsx2(
6499
7075
  "button",
@@ -6505,7 +7081,7 @@ function MathChip({
6505
7081
  "data-source-owner": token.sourceOwner,
6506
7082
  "data-math-token-id": token.id,
6507
7083
  ref: buttonRef,
6508
- title: token.editable ? "\u062A\u062D\u0631\u064A\u0631 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629" : token.reason ?? "\u0645\u0639\u0627\u062F\u0644\u0629 \u062E\u0627\u0645",
7084
+ title: token.editable ? messages.editEquation : messages.rawEquation,
6509
7085
  onClick: () => onOpen(token),
6510
7086
  onFocus: () => onFocus?.(token.id),
6511
7087
  onKeyDown: (event) => {
@@ -6514,12 +7090,12 @@ function MathChip({
6514
7090
  onOpen(token);
6515
7091
  return;
6516
7092
  }
6517
- if (event.key === "ArrowLeft") {
7093
+ if (event.key === forwardArrowKey) {
6518
7094
  event.preventDefault();
6519
7095
  onRequestTextFocus?.(token.id, 1);
6520
7096
  return;
6521
7097
  }
6522
- if (event.key === "ArrowRight") {
7098
+ if (event.key === backwardArrowKey) {
6523
7099
  event.preventDefault();
6524
7100
  onRequestTextFocus?.(token.id, -1);
6525
7101
  return;
@@ -6534,7 +7110,7 @@ function MathChip({
6534
7110
  onTextInputFromFocus?.(token.id, event.key);
6535
7111
  }
6536
7112
  },
6537
- children: /* @__PURE__ */ jsx2(MathIsland, { id: token.id, tex, display: token.display, output })
7113
+ children: island
6538
7114
  }
6539
7115
  ),
6540
7116
  onDelete ? /* @__PURE__ */ jsx2(
@@ -6542,8 +7118,8 @@ function MathChip({
6542
7118
  {
6543
7119
  type: "button",
6544
7120
  className: "butex-document2-widget__math-chip-delete",
6545
- title: "\u062D\u0630\u0641 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
6546
- "aria-label": "\u062D\u0630\u0641 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
7121
+ title: messages.deleteEquation,
7122
+ "aria-label": messages.deleteEquation,
6547
7123
  onClick: (event) => {
6548
7124
  event.stopPropagation();
6549
7125
  onDelete(token.id);
@@ -6574,7 +7150,11 @@ function fitTextareaHeight(element) {
6574
7150
  function InlineField({
6575
7151
  field,
6576
7152
  blockId,
7153
+ documentDirection = "rtl",
6577
7154
  mathOutput = "svg",
7155
+ equationSide = "arabic",
7156
+ editableEquations = true,
7157
+ uiLocale = "ar",
6578
7158
  onTextChange,
6579
7159
  onOpenMath,
6580
7160
  onDeleteMath,
@@ -6582,6 +7162,7 @@ function InlineField({
6582
7162
  onMathFocus,
6583
7163
  onFieldBlur
6584
7164
  }) {
7165
+ const messages = document2Messages(uiLocale);
6585
7166
  const textRefs = useRef2(/* @__PURE__ */ new Map());
6586
7167
  const mathRefs = useRef2(/* @__PURE__ */ new Map());
6587
7168
  function textTokenOffset(tokenId, fallback) {
@@ -6645,14 +7226,16 @@ function InlineField({
6645
7226
  onTextChange(field.id, textTokenId, nextText);
6646
7227
  focusTextToken(textTokenId, insertAtStart ? text.length : nextText.length);
6647
7228
  }
6648
- return /* @__PURE__ */ jsx3("div", { className: "butex-document2-widget__inline-field", children: field.tokens.map(
7229
+ const forwardArrowKey = documentDirection === "rtl" ? "ArrowLeft" : "ArrowRight";
7230
+ const backwardArrowKey = documentDirection === "rtl" ? "ArrowRight" : "ArrowLeft";
7231
+ return /* @__PURE__ */ jsx3("div", { className: "butex-document2-widget__inline-field", dir: documentDirection, "data-document-direction": documentDirection, children: field.tokens.map(
6649
7232
  (token) => token.kind === "text" ? /* @__PURE__ */ jsx3(
6650
7233
  "textarea",
6651
7234
  {
6652
7235
  className: "butex-document2-widget__inline-text",
6653
7236
  value: token.text,
6654
- dir: "rtl",
6655
- "aria-label": "\u0646\u0635",
7237
+ dir: documentDirection,
7238
+ "aria-label": messages.text,
6656
7239
  rows: 1,
6657
7240
  "data-field-id": field.id,
6658
7241
  "data-text-token-id": token.id,
@@ -6674,13 +7257,13 @@ function InlineField({
6674
7257
  if (!collapsed) {
6675
7258
  return;
6676
7259
  }
6677
- if (event.key === "ArrowLeft" && element.selectionStart === element.value.length) {
7260
+ if (editableEquations && event.key === forwardArrowKey && element.selectionStart === element.value.length) {
6678
7261
  const nextMathId = adjacentTokenId(token.id, 1, "math");
6679
7262
  if (nextMathId) {
6680
7263
  event.preventDefault();
6681
7264
  focusMathToken(nextMathId);
6682
7265
  }
6683
- } else if (event.key === "ArrowRight" && element.selectionStart === 0) {
7266
+ } else if (editableEquations && event.key === backwardArrowKey && element.selectionStart === 0) {
6684
7267
  const previousMathId = adjacentTokenId(token.id, -1, "math");
6685
7268
  if (previousMathId) {
6686
7269
  event.preventDefault();
@@ -6703,6 +7286,9 @@ function InlineField({
6703
7286
  {
6704
7287
  token,
6705
7288
  output: mathOutput,
7289
+ equationSide,
7290
+ editable: editableEquations,
7291
+ uiLocale,
6706
7292
  buttonRef: (element) => {
6707
7293
  if (element) {
6708
7294
  mathRefs.current.set(token.id, element);
@@ -6712,6 +7298,7 @@ function InlineField({
6712
7298
  },
6713
7299
  onOpen: onOpenMath,
6714
7300
  onDelete: onDeleteMath,
7301
+ documentDirection,
6715
7302
  onFocus: (tokenId) => {
6716
7303
  if (blockId && onMathFocus) {
6717
7304
  onMathFocus(blockId, field.id, tokenId);
@@ -6752,29 +7339,29 @@ function blockChromeClass(block) {
6752
7339
  }
6753
7340
  return `${root} ${root}--raw`;
6754
7341
  }
6755
- function blockLabel(block) {
7342
+ function blockLabel(block, messages) {
6756
7343
  if (block.kind === "textBlock") {
6757
7344
  if (block.command === "\\section") {
6758
- return "\u0642\u0633\u0645";
7345
+ return messages.section;
6759
7346
  }
6760
7347
  if (block.command === "\\subsection") {
6761
- return "\u0641\u0631\u0639";
7348
+ return messages.subsection;
6762
7349
  }
6763
7350
  if (block.command === "\\subsubsection") {
6764
- return "\u0641\u0631\u0639 \u0635\u063A\u064A\u0631";
7351
+ return messages.subsubsection;
6765
7352
  }
6766
- return "\u0641\u0642\u0631\u0629";
7353
+ return messages.paragraph;
6767
7354
  }
6768
7355
  if (block.kind === "list") {
6769
- return block.command === "\\begin{enumerate}" ? "\u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0642\u0645\u0629" : "\u0642\u0627\u0626\u0645\u0629";
7356
+ return block.command === "\\begin{enumerate}" ? messages.numberedList : messages.list;
6770
7357
  }
6771
7358
  if (block.kind === "table") {
6772
- return "\u062C\u062F\u0648\u0644";
7359
+ return messages.table;
6773
7360
  }
6774
7361
  if (block.kind === "image") {
6775
- return "\u0635\u0648\u0631\u0629";
7362
+ return messages.image;
6776
7363
  }
6777
- return "\u062E\u0627\u0645";
7364
+ return messages.raw;
6778
7365
  }
6779
7366
  function truncateSummary(value) {
6780
7367
  const normalized = value.replace(/\s+/g, " ").trim();
@@ -6811,7 +7398,11 @@ function BlockEditor({
6811
7398
  depth = 0,
6812
7399
  blockIndex = 0,
6813
7400
  blockCount = 1,
7401
+ documentDirection = "rtl",
6814
7402
  mathOutput = "svg",
7403
+ equationSide = "arabic",
7404
+ editableEquations = true,
7405
+ uiLocale = "ar",
6815
7406
  isCollapsed = false,
6816
7407
  onTextChange,
6817
7408
  onOpenMath,
@@ -6827,11 +7418,16 @@ function BlockEditor({
6827
7418
  onAddListItem,
6828
7419
  onRemoveListItem
6829
7420
  }) {
7421
+ const messages = document2Messages(uiLocale);
6830
7422
  const showChrome = depth === 0;
6831
7423
  const chromeClass = [blockChromeClass(block), isCollapsed ? "butex-document2-widget__block--collapsed" : ""].filter(Boolean).join(" ");
6832
7424
  const fieldProps = {
6833
7425
  blockId: block.id,
7426
+ documentDirection,
6834
7427
  mathOutput,
7428
+ equationSide,
7429
+ editableEquations,
7430
+ uiLocale,
6835
7431
  onTextChange,
6836
7432
  onOpenMath,
6837
7433
  onDeleteMath,
@@ -6847,7 +7443,7 @@ function BlockEditor({
6847
7443
  type: "button",
6848
7444
  className: "butex-document2-widget__block-collapse",
6849
7445
  "aria-expanded": !isCollapsed,
6850
- title: isCollapsed ? "\u0641\u062A\u062D \u0627\u0644\u0643\u062A\u0644\u0629" : "\u0637\u064A \u0627\u0644\u0643\u062A\u0644\u0629",
7446
+ title: isCollapsed ? messages.openBlock : messages.collapseBlock,
6851
7447
  onClick: (event) => {
6852
7448
  event.stopPropagation();
6853
7449
  onToggleCollapse(block.id);
@@ -6855,14 +7451,14 @@ function BlockEditor({
6855
7451
  children: isCollapsed ? "+" : "-"
6856
7452
  }
6857
7453
  ) : null,
6858
- /* @__PURE__ */ jsx4("span", { children: blockLabel(block) })
7454
+ /* @__PURE__ */ jsx4("span", { children: blockLabel(block, messages) })
6859
7455
  ] }),
6860
7456
  /* @__PURE__ */ jsxs2("span", { className: "butex-document2-widget__block-actions", children: [
6861
7457
  onMoveBlock ? /* @__PURE__ */ jsxs2(Fragment, { children: [
6862
- /* @__PURE__ */ jsx4("button", { type: "button", title: "\u0646\u0642\u0644 \u0644\u0623\u0639\u0644\u0649", "aria-label": "\u0646\u0642\u0644 \u0644\u0623\u0639\u0644\u0649", disabled: blockIndex <= 0, onClick: () => onMoveBlock(block.id, -1), children: "\u2191" }),
6863
- /* @__PURE__ */ jsx4("button", { type: "button", title: "\u0646\u0642\u0644 \u0644\u0623\u0633\u0641\u0644", "aria-label": "\u0646\u0642\u0644 \u0644\u0623\u0633\u0641\u0644", disabled: blockIndex >= blockCount - 1, onClick: () => onMoveBlock(block.id, 1), children: "\u2193" })
7458
+ /* @__PURE__ */ jsx4("button", { type: "button", title: messages.moveUp, "aria-label": messages.moveUp, disabled: blockIndex <= 0, onClick: () => onMoveBlock(block.id, -1), children: "\u2191" }),
7459
+ /* @__PURE__ */ jsx4("button", { type: "button", title: messages.moveDown, "aria-label": messages.moveDown, disabled: blockIndex >= blockCount - 1, onClick: () => onMoveBlock(block.id, 1), children: "\u2193" })
6864
7460
  ] }) : null,
6865
- onRemoveBlock ? /* @__PURE__ */ jsx4("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: () => onRemoveBlock(block.id), children: "\u062D\u0630\u0641 \u0627\u0644\u0643\u062A\u0644\u0629" }) : null
7461
+ onRemoveBlock ? /* @__PURE__ */ jsx4("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: () => onRemoveBlock(block.id), children: messages.deleteBlock }) : null
6866
7462
  ] })
6867
7463
  ] }) : null;
6868
7464
  if (isCollapsed && showChrome) {
@@ -6880,43 +7476,52 @@ function BlockEditor({
6880
7476
  if (block.kind === "list") {
6881
7477
  return /* @__PURE__ */ jsxs2("section", { className: chromeClass, children: [
6882
7478
  header,
6883
- block.items.map((item, index) => /* @__PURE__ */ jsxs2("div", { className: "butex-document2-widget__field", children: [
6884
- /* @__PURE__ */ jsx4("span", { className: "butex-document2-widget__toolbar-label", children: block.command === "\\begin{enumerate}" ? `\u0639\u0646\u0635\u0631 ${String(index + 1)}` : "\u0639\u0646\u0635\u0631" }),
6885
- /* @__PURE__ */ jsx4(InlineField, { field: item.field, ...fieldProps }),
6886
- item.blocks.map((child) => /* @__PURE__ */ jsx4(
6887
- BlockEditor,
6888
- {
6889
- block: child,
6890
- depth: depth + 1,
6891
- mathOutput,
6892
- onTextChange,
6893
- onOpenMath,
6894
- onDeleteMath,
6895
- onFieldFocus,
6896
- onMathFocus,
6897
- onFieldBlur,
6898
- onImageSrcChange,
6899
- onAddListItem,
6900
- onRemoveListItem
6901
- },
6902
- child.id
6903
- )),
6904
- onRemoveListItem && block.items.length > 1 ? /* @__PURE__ */ jsx4("div", { className: "butex-document2-widget__list-item-actions", children: /* @__PURE__ */ jsx4("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: () => onRemoveListItem(block.id, item.id), children: "\u062D\u0630\u0641 \u0627\u0644\u0639\u0646\u0635\u0631" }) }) : null
7479
+ block.items.map((item, index) => /* @__PURE__ */ jsxs2("div", { className: "butex-document2-widget__field", dir: "rtl", children: [
7480
+ /* @__PURE__ */ jsx4("span", { className: "butex-document2-widget__toolbar-label", children: block.command === "\\begin{enumerate}" ? `${messages.item} ${String(index + 1)}` : messages.item }),
7481
+ /* @__PURE__ */ jsxs2("div", { className: "butex-document2-widget__list-item-content", dir: documentDirection, children: [
7482
+ /* @__PURE__ */ jsx4(InlineField, { field: item.field, ...fieldProps }),
7483
+ item.blocks.map((child) => /* @__PURE__ */ jsx4(
7484
+ BlockEditor,
7485
+ {
7486
+ block: child,
7487
+ depth: depth + 1,
7488
+ documentDirection,
7489
+ mathOutput,
7490
+ equationSide,
7491
+ editableEquations,
7492
+ uiLocale,
7493
+ onTextChange,
7494
+ onOpenMath,
7495
+ onDeleteMath,
7496
+ onFieldFocus,
7497
+ onMathFocus,
7498
+ onFieldBlur,
7499
+ onImageSrcChange,
7500
+ onAddListItem,
7501
+ onRemoveListItem
7502
+ },
7503
+ child.id
7504
+ ))
7505
+ ] }),
7506
+ onRemoveListItem && block.items.length > 1 ? /* @__PURE__ */ jsx4("div", { className: "butex-document2-widget__list-item-actions", children: /* @__PURE__ */ jsx4("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: () => onRemoveListItem(block.id, item.id), children: messages.deleteItem }) }) : null
6905
7507
  ] }, item.id)),
6906
- onAddListItem ? /* @__PURE__ */ jsx4("div", { className: "butex-document2-widget__list-footer", children: /* @__PURE__ */ jsx4("button", { type: "button", onClick: () => onAddListItem(block.id), children: "+ \u0639\u0646\u0635\u0631" }) }) : null
7508
+ onAddListItem ? /* @__PURE__ */ jsx4("div", { className: "butex-document2-widget__list-footer", children: /* @__PURE__ */ jsxs2("button", { type: "button", onClick: () => onAddListItem(block.id), children: [
7509
+ "+ ",
7510
+ messages.addItem
7511
+ ] }) }) : null
6907
7512
  ] });
6908
7513
  }
6909
7514
  if (block.kind === "table") {
6910
7515
  return /* @__PURE__ */ jsxs2("section", { className: chromeClass, children: [
6911
7516
  header,
6912
- block.rows.map((row, rowIndex) => /* @__PURE__ */ jsx4("div", { className: "butex-document2-widget__row", children: row.map((cell) => /* @__PURE__ */ jsx4("div", { className: "butex-document2-widget__table-cell", children: /* @__PURE__ */ jsx4(InlineField, { field: cell, ...fieldProps }) }, cell.id)) }, rowIndex))
7517
+ block.rows.map((row, rowIndex) => /* @__PURE__ */ jsx4("div", { className: "butex-document2-widget__row", dir: documentDirection, children: row.map((cell) => /* @__PURE__ */ jsx4("div", { className: "butex-document2-widget__table-cell", dir: documentDirection, children: /* @__PURE__ */ jsx4(InlineField, { field: cell, ...fieldProps }) }, cell.id)) }, rowIndex))
6913
7518
  ] });
6914
7519
  }
6915
7520
  if (block.kind === "image") {
6916
7521
  const imageFieldId = `butex-d2-img-${block.id}`;
6917
7522
  return /* @__PURE__ */ jsxs2("section", { className: chromeClass, children: [
6918
7523
  header,
6919
- /* @__PURE__ */ jsx4("label", { className: "butex-document2-widget__image-src-label", htmlFor: imageFieldId, children: "\u0645\u0633\u0627\u0631 \u0627\u0644\u0645\u0644\u0641 (\\includegraphics)" }),
7524
+ /* @__PURE__ */ jsx4("label", { className: "butex-document2-widget__image-src-label", htmlFor: imageFieldId, children: messages.imagePath }),
6920
7525
  /* @__PURE__ */ jsx4(
6921
7526
  "textarea",
6922
7527
  {
@@ -6924,7 +7529,7 @@ function BlockEditor({
6924
7529
  className: "butex-document2-widget__inline-text",
6925
7530
  value: block.value,
6926
7531
  dir: "ltr",
6927
- "aria-label": "\u0645\u0633\u0627\u0631 \u0627\u0644\u0635\u0648\u0631\u0629",
7532
+ "aria-label": messages.imagePathLabel,
6928
7533
  rows: 1,
6929
7534
  ref: (element) => {
6930
7535
  if (element) {
@@ -6951,7 +7556,8 @@ function BlockEditor({
6951
7556
  // src/react-document2/TableInsertPopover.tsx
6952
7557
  import { useEffect as useEffect2, useRef as useRef3, useState as useState2 } from "react";
6953
7558
  import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
6954
- function TableInsertPopover({ onConfirm }) {
7559
+ function TableInsertPopover({ uiLocale = "ar", onConfirm }) {
7560
+ const messages = document2Messages(uiLocale);
6955
7561
  const [open, setOpen] = useState2(false);
6956
7562
  const [rows, setRows] = useState2("3");
6957
7563
  const [cols, setCols] = useState2("3");
@@ -6980,24 +7586,24 @@ function TableInsertPopover({ onConfirm }) {
6980
7586
  {
6981
7587
  type: "button",
6982
7588
  className: "butex-document2-widget__icon-btn",
6983
- title: "\u0625\u062F\u0631\u0627\u062C \u062C\u062F\u0648\u0644",
6984
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u062C\u062F\u0648\u0644",
7589
+ title: messages.insertTable,
7590
+ "aria-label": messages.insertTable,
6985
7591
  "aria-haspopup": "dialog",
6986
7592
  "aria-expanded": open,
6987
7593
  onClick: () => setOpen((value) => !value),
6988
7594
  children: "\u229E"
6989
7595
  }
6990
7596
  ),
6991
- open ? /* @__PURE__ */ jsxs3("div", { className: "butex-document2-widget__table-popover-panel", role: "dialog", "aria-label": "\u062D\u062C\u0645 \u0627\u0644\u062C\u062F\u0648\u0644", children: [
7597
+ open ? /* @__PURE__ */ jsxs3("div", { className: "butex-document2-widget__table-popover-panel", role: "dialog", "aria-label": messages.tableSize, children: [
6992
7598
  /* @__PURE__ */ jsxs3("label", { children: [
6993
- "\u0635\u0641\u0648\u0641",
7599
+ messages.rows,
6994
7600
  /* @__PURE__ */ jsx5("input", { type: "number", min: 1, max: 20, value: rows, onChange: (event) => setRows(event.currentTarget.value) })
6995
7601
  ] }),
6996
7602
  /* @__PURE__ */ jsxs3("label", { children: [
6997
- "\u0623\u0639\u0645\u062F\u0629",
7603
+ messages.columns,
6998
7604
  /* @__PURE__ */ jsx5("input", { type: "number", min: 1, max: 10, value: cols, onChange: (event) => setCols(event.currentTarget.value) })
6999
7605
  ] }),
7000
- /* @__PURE__ */ jsx5("button", { type: "button", onClick: confirm, children: "\u0625\u062F\u0631\u0627\u062C" })
7606
+ /* @__PURE__ */ jsx5("button", { type: "button", onClick: confirm, children: messages.insert })
7001
7607
  ] }) : null
7002
7608
  ] });
7003
7609
  }
@@ -7007,6 +7613,8 @@ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
7007
7613
  function DocumentInsertToolbar({
7008
7614
  canUndo,
7009
7615
  canRedo,
7616
+ editableEquations = true,
7617
+ uiLocale = "ar",
7010
7618
  onUndo,
7011
7619
  onRedo,
7012
7620
  onAddSection,
@@ -7020,24 +7628,25 @@ function DocumentInsertToolbar({
7020
7628
  onAddEnumerate,
7021
7629
  onAddFigure
7022
7630
  }) {
7631
+ const messages = document2Messages(uiLocale);
7023
7632
  return /* @__PURE__ */ jsxs4("div", { className: "butex-document2-widget__toolbar-insert", children: [
7024
- /* @__PURE__ */ jsxs4("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": "\u062A\u0631\u0627\u062C\u0639 \u0648\u0625\u0639\u0627\u062F\u0629", children: [
7025
- /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: "\u062A\u0631\u0627\u062C\u0639 (Ctrl+Z)", "aria-label": "\u062A\u0631\u0627\u062C\u0639", disabled: !canUndo, onClick: onUndo, children: "\u21B6" }),
7026
- /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: "\u0625\u0639\u0627\u062F\u0629 (Ctrl+Shift+Z)", "aria-label": "\u0625\u0639\u0627\u062F\u0629", disabled: !canRedo, onClick: onRedo, children: "\u21B7" })
7633
+ /* @__PURE__ */ jsxs4("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.undoRedo, children: [
7634
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.undo} (Ctrl+Z)`, "aria-label": messages.undo, disabled: !canUndo, onClick: onUndo, children: "\u21B6" }),
7635
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.redo} (Ctrl+Shift+Z)`, "aria-label": messages.redo, disabled: !canRedo, onClick: onRedo, children: "\u21B7" })
7027
7636
  ] }),
7028
- /* @__PURE__ */ jsxs4("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": "\u0647\u064A\u0643\u0644", children: [
7029
- /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn butex-document2-widget__icon-btn--h1", title: "\u0625\u0636\u0627\u0641\u0629 \u0642\u0633\u0645", "aria-label": "\u0625\u0636\u0627\u0641\u0629 \u0642\u0633\u0645", onClick: onAddSection, children: "\u0642" }),
7030
- /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn butex-document2-widget__icon-btn--h2", title: "\u0625\u0636\u0627\u0641\u0629 \u0641\u0631\u0639", "aria-label": "\u0625\u0636\u0627\u0641\u0629 \u0641\u0631\u0639", onClick: onAddSubsection, children: "\u0641" }),
7031
- /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn butex-document2-widget__icon-btn--h3", title: "\u0625\u0636\u0627\u0641\u0629 \u0641\u0631\u0639 \u0635\u063A\u064A\u0631", "aria-label": "\u0625\u0636\u0627\u0641\u0629 \u0641\u0631\u0639 \u0635\u063A\u064A\u0631", onClick: onAddSubsubsection, children: "\u0635" }),
7032
- /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: "\u0625\u0636\u0627\u0641\u0629 \u0641\u0642\u0631\u0629", "aria-label": "\u0625\u0636\u0627\u0641\u0629 \u0641\u0642\u0631\u0629", onClick: onAddParagraph, children: "\u0623\u0628\u062C" })
7637
+ /* @__PURE__ */ jsxs4("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.structure, children: [
7638
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn butex-document2-widget__icon-btn--h1", title: messages.addSection, "aria-label": messages.addSection, onClick: onAddSection, children: messages.sectionGlyph }),
7639
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn butex-document2-widget__icon-btn--h2", title: messages.addSubsection, "aria-label": messages.addSubsection, onClick: onAddSubsection, children: messages.subsectionGlyph }),
7640
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn butex-document2-widget__icon-btn--h3", title: messages.addSubsubsection, "aria-label": messages.addSubsubsection, onClick: onAddSubsubsection, children: messages.subsubsectionGlyph }),
7641
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.addParagraph, "aria-label": messages.addParagraph, onClick: onAddParagraph, children: messages.paragraphGlyph })
7033
7642
  ] }),
7034
- /* @__PURE__ */ jsxs4("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": "\u0645\u062D\u062A\u0648\u0649", children: [
7035
- /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: "\u0645\u0639\u0627\u062F\u0644\u0629 \u062F\u0627\u062E\u0644 \u0627\u0644\u0633\u0637\u0631 ($\u2026$)", "aria-label": "\u0645\u0639\u0627\u062F\u0644\u0629 \u062F\u0627\u062E\u0644 \u0627\u0644\u0633\u0637\u0631", onClick: onAddInlineEquation, children: /* @__PURE__ */ jsx6("span", { className: "butex-document2-widget__icon-math-inline", "aria-hidden": "true", children: "$=$" }) }),
7036
- /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: "\u0645\u0639\u0627\u062F\u0644\u0629 \u0645\u0639\u0631\u0648\u0636\u0629 (\\\\[\u2026\\\\])", "aria-label": "\u0645\u0639\u0627\u062F\u0644\u0629 \u0645\u0639\u0631\u0648\u0636\u0629", onClick: onAddDisplayEquation, children: /* @__PURE__ */ jsx6("span", { className: "butex-document2-widget__icon-math-display", "aria-hidden": "true", children: "\\[\xF7\\]" }) }),
7037
- /* @__PURE__ */ jsx6(TableInsertPopover, { onConfirm: onAddTable }),
7038
- /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: "\u0642\u0627\u0626\u0645\u0629 \u0646\u0642\u0637\u064A\u0629", "aria-label": "\u0642\u0627\u0626\u0645\u0629 \u0646\u0642\u0637\u064A\u0629", onClick: onAddList, children: "\u2022\u2261" }),
7039
- /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: "\u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0642\u0645\u0629", "aria-label": "\u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0642\u0645\u0629", onClick: onAddEnumerate, children: "1." }),
7040
- /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: "\u0625\u062F\u0631\u0627\u062C \u0635\u0648\u0631\u0629", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0635\u0648\u0631\u0629", onClick: onAddFigure, children: "\u{1F5BC}" })
7643
+ /* @__PURE__ */ jsxs4("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.content, children: [
7644
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.inlineEquation} ($\u2026$)`, "aria-label": messages.inlineEquation, disabled: !editableEquations, onClick: onAddInlineEquation, children: /* @__PURE__ */ jsx6("span", { className: "butex-document2-widget__icon-math-inline", "aria-hidden": "true", children: "$=$" }) }),
7645
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.displayEquation} (\\[\u2026\\])`, "aria-label": messages.displayEquation, disabled: !editableEquations, onClick: onAddDisplayEquation, children: /* @__PURE__ */ jsx6("span", { className: "butex-document2-widget__icon-math-display", "aria-hidden": "true", children: "\\[\xF7\\]" }) }),
7646
+ /* @__PURE__ */ jsx6(TableInsertPopover, { uiLocale, onConfirm: onAddTable }),
7647
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.bulletedList, "aria-label": messages.bulletedList, onClick: onAddList, children: "\u2022\u2261" }),
7648
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.numberedList, "aria-label": messages.numberedList, onClick: onAddEnumerate, children: "1." }),
7649
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.insertImage, "aria-label": messages.insertImage, onClick: onAddFigure, children: "\u{1F5BC}" })
7041
7650
  ] })
7042
7651
  ] });
7043
7652
  }
@@ -7075,8 +7684,14 @@ function PreviewBlock({ block, output }) {
7075
7684
  }
7076
7685
  return null;
7077
7686
  }
7078
- function DocumentPreview({ blocks, output }) {
7079
- return /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__preview", children: blocks.length === 0 ? /* @__PURE__ */ jsx7("p", { children: "\u0627\u0644\u0645\u0633\u062A\u0646\u062F \u0641\u0627\u0631\u063A" }) : blocks.map((block) => /* @__PURE__ */ jsx7(PreviewBlock, { block, output }, block.id)) });
7687
+ function DocumentPreview({
7688
+ blocks,
7689
+ output,
7690
+ documentDirection = "rtl",
7691
+ uiLocale = "ar"
7692
+ }) {
7693
+ const messages = document2Messages(uiLocale);
7694
+ return /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__preview", dir: documentDirection, children: blocks.length === 0 ? /* @__PURE__ */ jsx7("p", { children: messages.emptyDocument }) : blocks.map((block) => /* @__PURE__ */ jsx7(PreviewBlock, { block, output }, block.id)) });
7080
7695
  }
7081
7696
 
7082
7697
  // src/react-document2/EquationDrawer.tsx
@@ -8017,18 +8632,23 @@ function injectWidgetChromeCss(doc) {
8017
8632
  d.head.appendChild(style);
8018
8633
  }
8019
8634
 
8635
+ // src/uiLocale.ts
8636
+ function uiLocaleDirection(locale) {
8637
+ return locale === "ar" ? "rtl" : "ltr";
8638
+ }
8639
+
8020
8640
  // src/react/ButexEditor.tsx
8021
8641
  import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
8022
8642
  var DIGIT_FORM_OPTIONS = [
8023
- { id: "western", label: "456", title: "\u0623\u0631\u0642\u0627\u0645 \u063A\u0631\u0628\u064A\u0629" },
8024
- { id: "arabicIndic", label: "\u0664\u0665\u0666", title: "\u0623\u0631\u0642\u0627\u0645 \u0639\u0631\u0628\u064A\u0629 \u0647\u0646\u062F\u064A\u0629" },
8025
- { id: "persianIndic", label: "\u06F4\u06F5\u06F6", title: "\u0623\u0631\u0642\u0627\u0645 \u0641\u0627\u0631\u0633\u064A\u0629 \u0647\u0646\u062F\u064A\u0629" }
8643
+ { id: "western", label: "456" },
8644
+ { id: "arabicIndic", label: "\u0664\u0665\u0666" },
8645
+ { id: "persianIndic", label: "\u06F4\u06F5\u06F6" }
8026
8646
  ];
8027
8647
  var CHARACTER_FONT_OPTIONS = [
8028
- { id: "default", label: "\u0633", title: "\u0627\u0644\u062E\u0637 \u0627\u0644\u0627\u0641\u062A\u0631\u0627\u0636\u064A" },
8029
- { id: "takween", label: "\u062A\u0643", title: "\u062E\u0637 \u062A\u0643\u0648\u064A\u0646" },
8030
- { id: "diwani", label: "\u062F\u064A\u0648", title: "\u062E\u0637 \u062F\u064A\u0648\u0627\u0646\u064A" },
8031
- { id: "diwaniOutline", label: "\u0638\u0644", title: "\u062E\u0637 \u062F\u064A\u0648\u0627\u0646\u064A \u0645\u0638\u0644\u0644" }
8648
+ { id: "default", label: "\u0633" },
8649
+ { id: "takween", label: "\u062A\u0643" },
8650
+ { id: "diwani", label: "\u062F\u064A\u0648" },
8651
+ { id: "diwaniOutline", label: "\u0638\u0644" }
8032
8652
  ];
8033
8653
  var FUNCTION_COMMANDS = atomicCommandsByCategory("function");
8034
8654
  var LIMITS_SERIES_COMMANDS = atomicCommandsByCategory("limits_series");
@@ -8041,20 +8661,20 @@ var OPERATOR3_COMMANDS = atomicOperatorCommandsByCategory("operators3");
8041
8661
  var DOT_COMMANDS = atomicOperatorCommandsByCategory("dots");
8042
8662
  var INTEGRAL_COMMANDS = atomicOperatorCommandsByCategory("integrals");
8043
8663
  var MATRIX_STYLES = [
8044
- { id: "matrix", label: "\u25A1", title: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u0644\u0627 \u0623\u0642\u0648\u0627\u0633" },
8045
- { id: "pmatrix", label: "(\u25A1)", title: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u0642\u0648\u0633\u064A\u0646" },
8046
- { id: "bmatrix", label: "[\u25A1]", title: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u0645\u0639\u0642\u0648\u0641\u064A\u0646" },
8047
- { id: "Bmatrix", label: "{\u25A1}", title: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062D\u0627\u0635\u0631\u062A\u064A\u0646" },
8048
- { id: "vmatrix", label: "|\u25A1|", title: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062E\u0637\u064A\u0646" },
8049
- { id: "Vmatrix", label: "||\u25A1||", title: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062E\u0637\u064A\u0646 \u0645\u0632\u062F\u0648\u062C\u064A\u0646" }
8664
+ { id: "matrix", label: "\u25A1" },
8665
+ { id: "pmatrix", label: "(\u25A1)" },
8666
+ { id: "bmatrix", label: "[\u25A1]" },
8667
+ { id: "Bmatrix", label: "{\u25A1}" },
8668
+ { id: "vmatrix", label: "|\u25A1|" },
8669
+ { id: "Vmatrix", label: "||\u25A1||" }
8050
8670
  ];
8051
8671
  var ARRAY_ALIGNMENTS = [
8052
- { id: "l", label: "\u064A\u0633\u0627\u0631", title: "\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0639\u0645\u0648\u062F \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631" },
8053
- { id: "c", label: "\u0648\u0633\u0637", title: "\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0639\u0645\u0648\u062F \u0641\u064A \u0627\u0644\u0648\u0633\u0637" },
8054
- { id: "r", label: "\u064A\u0645\u064A\u0646", title: "\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0639\u0645\u0648\u062F \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646" }
8672
+ { id: "l" },
8673
+ { id: "c" },
8674
+ { id: "r" }
8055
8675
  ];
8056
- function matrixSizeLabel(rows, columns) {
8057
- return `${String(rows)} \u0635\u0641 \xD7 ${String(columns)} \u0639\u0645\u0648\u062F`;
8676
+ function matrixSizeLabel(rows, columns, messages) {
8677
+ return `${String(rows)} ${messages.row} \xD7 ${String(columns)} ${messages.column}`;
8058
8678
  }
8059
8679
  function clampMatrixSize(value) {
8060
8680
  return Math.max(1, Math.min(12, Math.trunc(value)));
@@ -8065,6 +8685,30 @@ function digitFormLabel(digitForm) {
8065
8685
  function characterFontOption(fontId) {
8066
8686
  return CHARACTER_FONT_OPTIONS.find((option) => option.id === fontId) ?? CHARACTER_FONT_OPTIONS[0];
8067
8687
  }
8688
+ function characterFontTitle(fontId, messages) {
8689
+ if (fontId === "takween") return messages.takweenFont;
8690
+ if (fontId === "diwani") return messages.diwaniFont;
8691
+ if (fontId === "diwaniOutline") return messages.diwaniOutlineFont;
8692
+ return messages.defaultFont;
8693
+ }
8694
+ function digitFormTitle(digitForm, messages) {
8695
+ if (digitForm === "arabicIndic") return messages.arabicIndicDigits;
8696
+ if (digitForm === "persianIndic") return messages.persianIndicDigits;
8697
+ return messages.westernDigits;
8698
+ }
8699
+ function matrixStyleTitle(style, messages) {
8700
+ if (style === "pmatrix") return messages.matrixParentheses;
8701
+ if (style === "bmatrix") return messages.matrixBrackets;
8702
+ if (style === "Bmatrix") return messages.matrixBraces;
8703
+ if (style === "vmatrix") return messages.matrixBars;
8704
+ if (style === "Vmatrix") return messages.matrixDoubleBars;
8705
+ return messages.matrixNoDelimiters;
8706
+ }
8707
+ function alignmentCopy(alignment, messages) {
8708
+ if (alignment === "l") return { label: messages.alignLeft, title: messages.alignColumnLeft };
8709
+ if (alignment === "r") return { label: messages.alignRight, title: messages.alignColumnRight };
8710
+ return { label: messages.alignCenter, title: messages.alignColumnCenter };
8711
+ }
8068
8712
  function spacingArrow(spec, side) {
8069
8713
  const pointsWithFlow = spec.spacing.direction === "positive";
8070
8714
  if (pointsWithFlow) {
@@ -8103,16 +8747,17 @@ function renderOperatorMenuButtonLabel(command, fallback) {
8103
8747
  }
8104
8748
  return /* @__PURE__ */ jsx8("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) });
8105
8749
  }
8106
- function passiveTreeText(session) {
8750
+ function passiveTreeText(session, messages) {
8107
8751
  const passive = session.activeSide === "arabic" ? session.englishTree : session.arabicTree;
8108
- const title = session.activeSide === "arabic" ? "\u0627\u0644\u0633\u0644\u0633\u0644\u0629 \u063A\u064A\u0631 \u0627\u0644\u0646\u0634\u0637\u0629 (\u0625\u0646\u062C\u0644\u064A\u0632\u064A)" : "\u0627\u0644\u0633\u0644\u0633\u0644\u0629 \u063A\u064A\u0631 \u0627\u0644\u0646\u0634\u0637\u0629 (\u0639\u0631\u0628\u064A)";
8752
+ const title = session.activeSide === "arabic" ? messages.inactiveEnglish : messages.inactiveArabic;
8109
8753
  const latex = session.activeSide === "arabic" ? renderChainEnglish(passive) : renderChainArabic(passive);
8110
8754
  return `${title}
8111
8755
 
8112
- ${latex || "\u0641\u0627\u0631\u063A"}`;
8756
+ ${latex || messages.empty}`;
8113
8757
  }
8114
8758
  var ButexEditor = forwardRef(
8115
- function ButexEditor2({ className, debug = false, initialSession, onSessionChange }, ref) {
8759
+ function ButexEditor2({ className, debug = false, defaultSide, uiLocale = "ar", initialSession, onSessionChange }, ref) {
8760
+ const messages = equationEditorMessages(uiLocale);
8116
8761
  const wrapperRef = useRef4(null);
8117
8762
  const surfaceRef = useRef4(null);
8118
8763
  const mathOutputRef = useRef4(null);
@@ -8130,6 +8775,8 @@ var ButexEditor = forwardRef(
8130
8775
  const runtimeRef = useRef4(null);
8131
8776
  const debugRef = useRef4(debug);
8132
8777
  debugRef.current = debug;
8778
+ const uiLocaleRef = useRef4(uiLocale);
8779
+ uiLocaleRef.current = uiLocale;
8133
8780
  const onSessionChangeRef = useRef4(onSessionChange);
8134
8781
  onSessionChangeRef.current = onSessionChange;
8135
8782
  const debugBodyHiddenRef = useRef4(false);
@@ -8171,14 +8818,15 @@ var ButexEditor = forwardRef(
8171
8818
  const arabic = renderArabicLatexFromSession(session);
8172
8819
  const activeLatex = session.activeSide === "arabic" ? arabic : english;
8173
8820
  if (debugRef.current && latexLinesEl) {
8174
- latexLinesEl.textContent = `LaTeX \u0625\u0646\u062C\u0644\u064A\u0632\u064A:
8175
- ${english || "\u0641\u0627\u0631\u063A"}
8821
+ const currentMessages = equationEditorMessages(uiLocaleRef.current);
8822
+ latexLinesEl.textContent = `${currentMessages.englishLatex}:
8823
+ ${english || currentMessages.empty}
8176
8824
 
8177
- LaTeX \u0639\u0631\u0628\u064A:
8178
- ${arabic || "\u0641\u0627\u0631\u063A"}`;
8825
+ ${currentMessages.arabicLatex}:
8826
+ ${arabic || currentMessages.empty}`;
8179
8827
  }
8180
8828
  if (debugRef.current && passivePreviewEl) {
8181
- passivePreviewEl.textContent = passiveTreeText(session);
8829
+ passivePreviewEl.textContent = passiveTreeText(session, equationEditorMessages(uiLocaleRef.current));
8182
8830
  passivePreviewEl.classList.toggle("passive--ltr", session.activeSide === "arabic");
8183
8831
  }
8184
8832
  if (debugRef.current && debugLogEl) {
@@ -8204,7 +8852,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8204
8852
  } catch (err) {
8205
8853
  const message = err instanceof Error ? err.message : String(err);
8206
8854
  renderErrorEl.hidden = false;
8207
- renderErrorEl.textContent = `\u062E\u0637\u0623 MathJax: ${message}`;
8855
+ renderErrorEl.textContent = `${equationEditorMessages(uiLocaleRef.current).mathJaxError}: ${message}`;
8208
8856
  if (runtimeRef.current) {
8209
8857
  runtimeRef.current.setSession(setRenderError(runtimeRef.current.getSession(), message));
8210
8858
  }
@@ -8222,6 +8870,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8222
8870
  const runtime = createEditorRuntime({
8223
8871
  surfaceEl,
8224
8872
  initialSession,
8873
+ defaultSide,
8874
+ uiLocale,
8225
8875
  buttonElements: {
8226
8876
  undoBtn: undoBtnRef.current,
8227
8877
  redoBtn: redoBtnRef.current,
@@ -8241,7 +8891,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8241
8891
  const el = renderErrorRef.current;
8242
8892
  if (el) {
8243
8893
  el.hidden = false;
8244
- el.textContent = `\u062E\u0637\u0623 \u0641\u064A \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629: ${message}`;
8894
+ el.textContent = `${equationEditorMessages(uiLocaleRef.current).previewError}: ${message}`;
8245
8895
  }
8246
8896
  });
8247
8897
  }
@@ -8266,6 +8916,13 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8266
8916
  runtimeRef.current = null;
8267
8917
  };
8268
8918
  }, []);
8919
+ useEffect3(() => {
8920
+ runtimeRef.current?.setUiLocale(uiLocale);
8921
+ const session = runtimeRef.current?.getSession();
8922
+ if (session) {
8923
+ void updatePreviewRef.current(session);
8924
+ }
8925
+ }, [uiLocale]);
8269
8926
  function focusSurface() {
8270
8927
  surfaceRef.current?.focus();
8271
8928
  }
@@ -8283,26 +8940,26 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8283
8940
  {
8284
8941
  ref: wrapperRef,
8285
8942
  className: `butex-widget ${className ?? ""}`.trim(),
8286
- dir: "rtl",
8287
- lang: "ar",
8943
+ dir: uiLocaleDirection(uiLocale),
8944
+ lang: uiLocale,
8288
8945
  children: /* @__PURE__ */ jsxs6("div", { className: "butex-widget-layout", children: [
8289
8946
  /* @__PURE__ */ jsxs6("section", { className: "panel", children: [
8290
8947
  /* @__PURE__ */ jsxs6("div", { className: "toolbar", children: [
8291
- /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-history", role: "group", "aria-label": "\u062A\u0631\u0627\u062C\u0639 \u0648\u0625\u0639\u0627\u062F\u0629", children: [
8292
- /* @__PURE__ */ jsx8("button", { ref: undoBtnRef, id: "btn-undo", type: "button", className: "icon-btn", title: "\u062A\u0631\u0627\u062C\u0639", "aria-label": "\u062A\u0631\u0627\u062C\u0639", children: "\u21B7" }),
8293
- /* @__PURE__ */ jsx8("button", { ref: redoBtnRef, id: "btn-redo", type: "button", className: "icon-btn", title: "\u0625\u0639\u0627\u062F\u0629", "aria-label": "\u0625\u0639\u0627\u062F\u0629", children: "\u21B6" })
8948
+ /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-history", role: "group", "aria-label": messages.undoRedo, children: [
8949
+ /* @__PURE__ */ jsx8("button", { ref: undoBtnRef, id: "btn-undo", type: "button", className: "icon-btn", title: messages.undo, "aria-label": messages.undo, children: "\u21B7" }),
8950
+ /* @__PURE__ */ jsx8("button", { ref: redoBtnRef, id: "btn-redo", type: "button", className: "icon-btn", title: messages.redo, "aria-label": messages.redo, children: "\u21B6" })
8294
8951
  ] }),
8295
- /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-clipboard", role: "group", "aria-label": "\u0627\u0644\u062D\u0627\u0641\u0638\u0629", children: [
8296
- /* @__PURE__ */ jsx8("button", { ref: copyBtnRef, id: "btn-copy", type: "button", className: "icon-btn", title: "\u0646\u0633\u062E", "aria-label": "\u0646\u0633\u062E", disabled: true, children: "\u29C9" }),
8297
- /* @__PURE__ */ jsx8("button", { ref: cutBtnRef, id: "btn-cut", type: "button", className: "icon-btn", title: "\u0642\u0635", "aria-label": "\u0642\u0635", disabled: true, children: "\u2702" }),
8952
+ /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-clipboard", role: "group", "aria-label": messages.clipboard, children: [
8953
+ /* @__PURE__ */ jsx8("button", { ref: copyBtnRef, id: "btn-copy", type: "button", className: "icon-btn", title: messages.copy, "aria-label": messages.copy, disabled: true, children: "\u29C9" }),
8954
+ /* @__PURE__ */ jsx8("button", { ref: cutBtnRef, id: "btn-cut", type: "button", className: "icon-btn", title: messages.cut, "aria-label": messages.cut, disabled: true, children: "\u2702" }),
8298
8955
  /* @__PURE__ */ jsx8(
8299
8956
  "button",
8300
8957
  {
8301
8958
  id: "btn-paste",
8302
8959
  type: "button",
8303
8960
  className: "icon-btn",
8304
- title: "\u0644\u0635\u0642",
8305
- "aria-label": "\u0644\u0635\u0642",
8961
+ title: messages.paste,
8962
+ "aria-label": messages.paste,
8306
8963
  onClick: () => {
8307
8964
  void runtimeRef.current?.performPaste().then(() => {
8308
8965
  focusSurface();
@@ -8312,8 +8969,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8312
8969
  }
8313
8970
  )
8314
8971
  ] }),
8315
- /* @__PURE__ */ jsx8("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": "\u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0645\u062D\u0631\u0631", children: /* @__PURE__ */ jsx8("button", { className: "icon-btn accent", type: "button", title: "\u062A\u0628\u062F\u064A\u0644 \u0639\u0631\u0628\u064A / \u0625\u0646\u062C\u0644\u064A\u0632\u064A", "aria-label": "\u062A\u0628\u062F\u064A\u0644 \u0639\u0631\u0628\u064A / \u0625\u0646\u062C\u0644\u064A\u0632\u064A", onClick: () => runtimeRef.current?.toggleSide(), children: "\u21C4" }) }),
8316
- /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-structures", role: "group", "aria-label": "\u0627\u0644\u0628\u0646\u0649", children: [
8972
+ /* @__PURE__ */ jsx8("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.editorSettings, children: /* @__PURE__ */ jsx8("button", { className: "icon-btn accent", type: "button", title: messages.toggleSide, "aria-label": messages.toggleSide, onClick: () => runtimeRef.current?.toggleSide(), children: "\u21C4" }) }),
8973
+ /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-structures", role: "group", "aria-label": messages.structures, children: [
8317
8974
  /* @__PURE__ */ jsxs6(
8318
8975
  "div",
8319
8976
  {
@@ -8330,15 +8987,15 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8330
8987
  {
8331
8988
  className: "icon-btn delimiter-command-btn",
8332
8989
  type: "button",
8333
- title: "\u0625\u062F\u0631\u0627\u062C \u0645\u062D\u062F\u062F\u0627\u062A",
8334
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0645\u062D\u062F\u062F\u0627\u062A",
8990
+ title: messages.insertDelimiters,
8991
+ "aria-label": messages.insertDelimiters,
8335
8992
  "aria-haspopup": "listbox",
8336
8993
  "aria-expanded": delimiterMenuOpen,
8337
8994
  onClick: () => setDelimiterMenuOpen((open) => !open),
8338
8995
  children: "()"
8339
8996
  }
8340
8997
  ),
8341
- /* @__PURE__ */ jsxs6("div", { className: "delimiter-command-options", role: "listbox", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0645\u062D\u062F\u062F\u0627\u062A", hidden: !delimiterMenuOpen, children: [
8998
+ /* @__PURE__ */ jsxs6("div", { className: "delimiter-command-options", role: "listbox", "aria-label": messages.insertDelimiters, hidden: !delimiterMenuOpen, children: [
8342
8999
  /* @__PURE__ */ jsx8(
8343
9000
  "button",
8344
9001
  {
@@ -8346,8 +9003,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8346
9003
  "data-delim": "paren",
8347
9004
  type: "button",
8348
9005
  role: "option",
8349
- title: "\u0625\u062F\u0631\u0627\u062C \u0642\u0648\u0633\u064A\u0646",
8350
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0642\u0648\u0633\u064A\u0646",
9006
+ title: messages.insertParentheses,
9007
+ "aria-label": messages.insertParentheses,
8351
9008
  onMouseDown: (event) => event.preventDefault(),
8352
9009
  onClick: () => {
8353
9010
  runtimeRef.current?.insertDelimiterByKind("paren");
@@ -8364,8 +9021,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8364
9021
  "data-delim": "bracket",
8365
9022
  type: "button",
8366
9023
  role: "option",
8367
- title: "\u0625\u062F\u0631\u0627\u062C \u0645\u0639\u0642\u0648\u0641\u064A\u0646",
8368
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0645\u0639\u0642\u0648\u0641\u064A\u0646",
9024
+ title: messages.insertBrackets,
9025
+ "aria-label": messages.insertBrackets,
8369
9026
  onMouseDown: (event) => event.preventDefault(),
8370
9027
  onClick: () => {
8371
9028
  runtimeRef.current?.insertDelimiterByKind("bracket");
@@ -8382,8 +9039,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8382
9039
  "data-delim": "brace",
8383
9040
  type: "button",
8384
9041
  role: "option",
8385
- title: "\u0625\u062F\u0631\u0627\u062C \u062D\u0627\u0635\u0631\u062A\u064A\u0646",
8386
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u062D\u0627\u0635\u0631\u062A\u064A\u0646",
9042
+ title: messages.insertBraces,
9043
+ "aria-label": messages.insertBraces,
8387
9044
  onMouseDown: (event) => event.preventDefault(),
8388
9045
  onClick: () => {
8389
9046
  runtimeRef.current?.insertDelimiterByKind("brace");
@@ -8397,19 +9054,19 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8397
9054
  ]
8398
9055
  }
8399
9056
  ),
8400
- /* @__PURE__ */ jsx8("button", { id: "insert-frac", className: "icon-btn frac-icon-btn", type: "button", title: "\u0625\u062F\u0631\u0627\u062C \u0643\u0633\u0631", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0643\u0633\u0631", onClick: () => {
9057
+ /* @__PURE__ */ jsx8("button", { id: "insert-frac", className: "icon-btn frac-icon-btn", type: "button", title: messages.insertFraction, "aria-label": messages.insertFraction, onClick: () => {
8401
9058
  runtimeRef.current?.insertFraction();
8402
9059
  focusSurface();
8403
9060
  }, children: /* @__PURE__ */ jsxs6("span", { className: "toolbar-frac-icon", "aria-hidden": "true", children: [
8404
9061
  /* @__PURE__ */ jsx8("span", { children: "\u0623" }),
8405
9062
  /* @__PURE__ */ jsx8("span", { children: "\u0628" })
8406
9063
  ] }) }),
8407
- /* @__PURE__ */ jsx8("button", { id: "insert-sqrt", className: "icon-btn", type: "button", title: "\u0625\u062F\u0631\u0627\u062C \u062C\u0630\u0631", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u062C\u0630\u0631", onClick: () => {
9064
+ /* @__PURE__ */ jsx8("button", { id: "insert-sqrt", className: "icon-btn", type: "button", title: messages.insertRoot, "aria-label": messages.insertRoot, onClick: () => {
8408
9065
  runtimeRef.current?.insertSqrt();
8409
9066
  focusSurface();
8410
9067
  }, children: /* @__PURE__ */ jsx8("span", { className: "toolbar-sqrt-icon", "aria-hidden": "true", children: "\u221A" }) })
8411
9068
  ] }),
8412
- /* @__PURE__ */ jsx8("div", { className: "toolbar-group toolbar-environments", role: "group", "aria-label": "\u0627\u0644\u0628\u064A\u0626\u0627\u062A", children: /* @__PURE__ */ jsxs6(
9069
+ /* @__PURE__ */ jsx8("div", { className: "toolbar-group toolbar-environments", role: "group", "aria-label": messages.environments, children: /* @__PURE__ */ jsxs6(
8413
9070
  "div",
8414
9071
  {
8415
9072
  className: "matrix-command-menu",
@@ -8425,8 +9082,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8425
9082
  {
8426
9083
  className: "icon-btn matrix-command-btn",
8427
9084
  type: "button",
8428
- title: "\u0625\u062F\u0631\u0627\u062C \u0628\u064A\u0626\u0629 \u0634\u0628\u0643\u064A\u0629",
8429
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0628\u064A\u0626\u0629 \u0634\u0628\u0643\u064A\u0629",
9085
+ title: messages.insertEnvironment,
9086
+ "aria-label": messages.insertEnvironment,
8430
9087
  "aria-haspopup": "dialog",
8431
9088
  "aria-expanded": matrixMenuOpen,
8432
9089
  onClick: () => setMatrixMenuOpen((open) => !open),
@@ -8438,11 +9095,11 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8438
9095
  ] })
8439
9096
  }
8440
9097
  ),
8441
- /* @__PURE__ */ jsxs6("div", { className: "matrix-command-popover", role: "dialog", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0628\u064A\u0626\u0629 \u0634\u0628\u0643\u064A\u0629", hidden: !matrixMenuOpen, children: [
8442
- /* @__PURE__ */ jsx8("div", { className: "matrix-style-options", role: "listbox", "aria-label": "\u0646\u0648\u0639 \u0627\u0644\u0628\u064A\u0626\u0629", children: [
8443
- { id: "matrix", label: "\u0645\u0635\u0641\u0648\u0641\u0629" },
8444
- { id: "array", label: "\u062C\u062F\u0648\u0644" },
8445
- { id: "aligned", label: "\u0645\u062D\u0627\u0630\u0627\u0629" }
9098
+ /* @__PURE__ */ jsxs6("div", { className: "matrix-command-popover", role: "dialog", "aria-label": messages.insertEnvironment, hidden: !matrixMenuOpen, children: [
9099
+ /* @__PURE__ */ jsx8("div", { className: "matrix-style-options", role: "listbox", "aria-label": messages.environmentType, children: [
9100
+ { id: "matrix", label: messages.matrix },
9101
+ { id: "array", label: messages.array },
9102
+ { id: "aligned", label: messages.aligned }
8446
9103
  ].map((option) => /* @__PURE__ */ jsx8(
8447
9104
  "button",
8448
9105
  {
@@ -8461,14 +9118,14 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8461
9118
  },
8462
9119
  option.id
8463
9120
  )) }),
8464
- envPaletteMode === "matrix" ? /* @__PURE__ */ jsx8("div", { className: "matrix-style-options", role: "listbox", "aria-label": "\u0646\u0648\u0639 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629", children: MATRIX_STYLES.map((style) => /* @__PURE__ */ jsx8(
9121
+ envPaletteMode === "matrix" ? /* @__PURE__ */ jsx8("div", { className: "matrix-style-options", role: "listbox", "aria-label": messages.matrixType, children: MATRIX_STYLES.map((style) => /* @__PURE__ */ jsx8(
8465
9122
  "button",
8466
9123
  {
8467
9124
  type: "button",
8468
9125
  role: "option",
8469
9126
  "aria-selected": matrixStyle === style.id,
8470
9127
  className: "matrix-style-option",
8471
- title: style.title,
9128
+ title: matrixStyleTitle(style.id, messages),
8472
9129
  onMouseDown: (event) => event.preventDefault(),
8473
9130
  onClick: () => {
8474
9131
  setMatrixStyle(style.id);
@@ -8477,8 +9134,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8477
9134
  },
8478
9135
  style.id
8479
9136
  )) }) : null,
8480
- /* @__PURE__ */ jsx8("div", { className: "matrix-size-readout", children: matrixHover ? matrixSizeLabel(matrixHover.rows, matrixHover.columns) : matrixSizeLabel(matrixRows, matrixColumns) }),
8481
- /* @__PURE__ */ jsx8("div", { className: "matrix-grid-picker", "aria-label": "\u0627\u062E\u062A\u064A\u0627\u0631 \u062D\u062C\u0645 \u0627\u0644\u0628\u064A\u0626\u0629", children: Array.from(
9137
+ /* @__PURE__ */ jsx8("div", { className: "matrix-size-readout", children: matrixHover ? matrixSizeLabel(matrixHover.rows, matrixHover.columns, messages) : matrixSizeLabel(matrixRows, matrixColumns, messages) }),
9138
+ /* @__PURE__ */ jsx8("div", { className: "matrix-grid-picker", "aria-label": messages.chooseEnvironmentSize, children: Array.from(
8482
9139
  { length: 8 },
8483
9140
  (_, rowIndex) => Array.from({ length: 8 }, (_2, columnIndex) => {
8484
9141
  const rows = rowIndex + 1;
@@ -8490,8 +9147,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8490
9147
  {
8491
9148
  type: "button",
8492
9149
  className: rows <= activeRows && columns <= activeColumns ? "matrix-grid-cell active" : "matrix-grid-cell",
8493
- title: matrixSizeLabel(rows, columns),
8494
- "aria-label": matrixSizeLabel(rows, columns),
9150
+ title: matrixSizeLabel(rows, columns, messages),
9151
+ "aria-label": matrixSizeLabel(rows, columns, messages),
8495
9152
  onMouseEnter: () => setMatrixHover({ rows, columns }),
8496
9153
  onMouseDown: (event) => event.preventDefault(),
8497
9154
  onClick: () => {
@@ -8509,7 +9166,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8509
9166
  ) }),
8510
9167
  /* @__PURE__ */ jsxs6("div", { className: "matrix-custom-size", children: [
8511
9168
  /* @__PURE__ */ jsxs6("label", { children: [
8512
- "\u0635\u0641",
9169
+ messages.row,
8513
9170
  /* @__PURE__ */ jsx8(
8514
9171
  "input",
8515
9172
  {
@@ -8522,7 +9179,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8522
9179
  )
8523
9180
  ] }),
8524
9181
  /* @__PURE__ */ jsxs6("label", { children: [
8525
- "\u0639\u0645\u0648\u062F",
9182
+ messages.column,
8526
9183
  /* @__PURE__ */ jsx8(
8527
9184
  "input",
8528
9185
  {
@@ -8548,15 +9205,15 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8548
9205
  setMatrixHover(null);
8549
9206
  focusSurface();
8550
9207
  },
8551
- children: "\u0625\u062F\u0631\u0627\u062C"
9208
+ children: messages.insert
8552
9209
  }
8553
9210
  )
8554
9211
  ] }),
8555
- /* @__PURE__ */ jsxs6("div", { className: "matrix-edit-actions", "aria-label": "\u062A\u0639\u062F\u064A\u0644 \u0627\u0644\u0628\u064A\u0626\u0629 \u0627\u0644\u0645\u062D\u062F\u062F\u0629", children: [
8556
- envPaletteMode === "matrix" ? /* @__PURE__ */ jsx8("button", { type: "button", title: "\u062A\u0637\u0628\u064A\u0642 \u0627\u0644\u0646\u0645\u0637 \u0639\u0644\u0649 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u0645\u062D\u062F\u062F\u0629", onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.setMatrixEnvStyle(matrixStyle), children: "\u062A\u0637\u0628\u064A\u0642 \u0627\u0644\u0646\u0645\u0637" }) : null,
9212
+ /* @__PURE__ */ jsxs6("div", { className: "matrix-edit-actions", "aria-label": messages.editSelectedEnvironment, children: [
9213
+ envPaletteMode === "matrix" ? /* @__PURE__ */ jsx8("button", { type: "button", title: messages.applySelectedMatrixStyle, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.setMatrixEnvStyle(matrixStyle), children: messages.applyStyle }) : null,
8557
9214
  envPaletteMode === "array" ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
8558
9215
  /* @__PURE__ */ jsxs6("label", { children: [
8559
- "\u0639\u0645\u0648\u062F",
9216
+ messages.column,
8560
9217
  /* @__PURE__ */ jsx8(
8561
9218
  "input",
8562
9219
  {
@@ -8572,24 +9229,36 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8572
9229
  "button",
8573
9230
  {
8574
9231
  type: "button",
8575
- title: alignment.title,
9232
+ title: alignmentCopy(alignment.id, messages).title,
8576
9233
  onMouseDown: (event) => event.preventDefault(),
8577
9234
  onClick: () => runtimeRef.current?.setArrayColumnAlignment(arrayAlignmentColumn - 1, alignment.id),
8578
- children: alignment.label
9235
+ children: alignmentCopy(alignment.id, messages).label
8579
9236
  },
8580
9237
  alignment.id
8581
9238
  ))
8582
9239
  ] }) : null,
8583
- /* @__PURE__ */ jsx8("button", { type: "button", title: "\u0625\u0636\u0627\u0641\u0629 \u0635\u0641", onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixRow(), children: "+\u0635\u0641" }),
8584
- /* @__PURE__ */ jsx8("button", { type: "button", title: "\u062D\u0630\u0641 \u0635\u0641", onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixRow(), children: "-\u0635\u0641" }),
8585
- /* @__PURE__ */ jsx8("button", { type: "button", title: "\u0625\u0636\u0627\u0641\u0629 \u0639\u0645\u0648\u062F", onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixColumn(), children: "+\u0639\u0645\u0648\u062F" }),
8586
- /* @__PURE__ */ jsx8("button", { type: "button", title: "\u062D\u0630\u0641 \u0639\u0645\u0648\u062F", onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixColumn(), children: "-\u0639\u0645\u0648\u062F" })
9240
+ /* @__PURE__ */ jsxs6("button", { type: "button", title: messages.addRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixRow(), children: [
9241
+ "+",
9242
+ messages.row
9243
+ ] }),
9244
+ /* @__PURE__ */ jsxs6("button", { type: "button", title: messages.removeRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixRow(), children: [
9245
+ "-",
9246
+ messages.row
9247
+ ] }),
9248
+ /* @__PURE__ */ jsxs6("button", { type: "button", title: messages.addColumn, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixColumn(), children: [
9249
+ "+",
9250
+ messages.column
9251
+ ] }),
9252
+ /* @__PURE__ */ jsxs6("button", { type: "button", title: messages.removeColumn, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixColumn(), children: [
9253
+ "-",
9254
+ messages.column
9255
+ ] })
8587
9256
  ] })
8588
9257
  ] })
8589
9258
  ]
8590
9259
  }
8591
9260
  ) }),
8592
- /* @__PURE__ */ jsx8("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": "\u0627\u0644\u0641\u0631\u0627\u063A\u0627\u062A", children: /* @__PURE__ */ jsxs6(
9261
+ /* @__PURE__ */ jsx8("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.spaces, children: /* @__PURE__ */ jsxs6(
8593
9262
  "div",
8594
9263
  {
8595
9264
  className: `spacing-command-menu spacing-command-menu--${activeEditorSide}`,
@@ -8605,8 +9274,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8605
9274
  {
8606
9275
  className: "icon-btn spacing-command-btn",
8607
9276
  type: "button",
8608
- title: "\u0625\u062F\u0631\u0627\u062C \u0641\u0631\u0627\u063A",
8609
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0641\u0631\u0627\u063A",
9277
+ title: messages.insertSpace,
9278
+ "aria-label": messages.insertSpace,
8610
9279
  "aria-haspopup": "listbox",
8611
9280
  "aria-expanded": spacingMenuOpen,
8612
9281
  onClick: () => setSpacingMenuOpen((open) => !open),
@@ -8616,13 +9285,13 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8616
9285
  ] })
8617
9286
  }
8618
9287
  ),
8619
- /* @__PURE__ */ jsx8("div", { className: "spacing-command-options", role: "listbox", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0641\u0631\u0627\u063A", hidden: !spacingMenuOpen, children: SPACING_COMMANDS.map((command) => /* @__PURE__ */ jsxs6(
9288
+ /* @__PURE__ */ jsx8("div", { className: "spacing-command-options", role: "listbox", "aria-label": messages.insertSpace, hidden: !spacingMenuOpen, children: SPACING_COMMANDS.map((command) => /* @__PURE__ */ jsxs6(
8620
9289
  "button",
8621
9290
  {
8622
9291
  type: "button",
8623
9292
  role: "option",
8624
9293
  className: `spacing-command-option spacing-command-option--${command.spacing.direction}`,
8625
- title: command.title,
9294
+ title: atomicCommandTitle(command, uiLocale),
8626
9295
  onMouseDown: (event) => event.preventDefault(),
8627
9296
  onClick: () => {
8628
9297
  runtimeRef.current?.insertAtomicCommand(command.id);
@@ -8635,7 +9304,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8635
9304
  /* @__PURE__ */ jsx8("span", { className: "spacing-command-glyph__bar" }),
8636
9305
  command.spacing.direction === "positive" ? /* @__PURE__ */ jsx8("span", { className: "spacing-command-glyph__arrow", children: spacingArrow(command, activeEditorSide) }) : null
8637
9306
  ] }),
8638
- /* @__PURE__ */ jsx8("span", { className: "spacing-command-option__name", children: command.title })
9307
+ /* @__PURE__ */ jsx8("span", { className: "spacing-command-option__name", children: atomicCommandTitle(command, uiLocale) })
8639
9308
  ]
8640
9309
  },
8641
9310
  command.id
@@ -8643,7 +9312,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8643
9312
  ]
8644
9313
  }
8645
9314
  ) }),
8646
- /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-functions", role: "group", "aria-label": "\u0627\u0644\u062F\u0648\u0627\u0644", children: [
9315
+ /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-functions", role: "group", "aria-label": messages.functions, children: [
8647
9316
  /* @__PURE__ */ jsxs6(
8648
9317
  "div",
8649
9318
  {
@@ -8660,22 +9329,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8660
9329
  {
8661
9330
  className: "icon-btn function-command-btn",
8662
9331
  type: "button",
8663
- title: "\u0625\u062F\u0631\u0627\u062C \u062F\u0627\u0644\u0629",
8664
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u062F\u0627\u0644\u0629",
9332
+ title: messages.insertFunction,
9333
+ "aria-label": messages.insertFunction,
8665
9334
  "aria-haspopup": "listbox",
8666
9335
  "aria-expanded": functionMenuOpen,
8667
9336
  onClick: () => setFunctionMenuOpen((open) => !open),
8668
9337
  children: FUNCTION_COMMANDS[0]?.arabicLabel ?? "\u062F"
8669
9338
  }
8670
9339
  ),
8671
- /* @__PURE__ */ jsx8("div", { className: "function-command-options", role: "listbox", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u062F\u0627\u0644\u0629", hidden: !functionMenuOpen, children: FUNCTION_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
9340
+ /* @__PURE__ */ jsx8("div", { className: "function-command-options", role: "listbox", "aria-label": messages.insertFunction, hidden: !functionMenuOpen, children: FUNCTION_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
8672
9341
  "button",
8673
9342
  {
8674
9343
  className: "function-command-option",
8675
9344
  type: "button",
8676
9345
  role: "option",
8677
- title: command.title,
8678
- "aria-label": command.title,
9346
+ title: atomicCommandTitle(command, uiLocale),
9347
+ "aria-label": atomicCommandTitle(command, uiLocale),
8679
9348
  onMouseDown: (event) => event.preventDefault(),
8680
9349
  onClick: () => {
8681
9350
  runtimeRef.current?.insertAtomicCommand(command.id);
@@ -8705,22 +9374,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8705
9374
  {
8706
9375
  className: "icon-btn function-command-btn",
8707
9376
  type: "button",
8708
- title: "\u0625\u062F\u0631\u0627\u062C \u062D\u062F\u0648\u062F \u0648\u0645\u062A\u0633\u0644\u0633\u0644\u0627\u062A",
8709
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u062D\u062F\u0648\u062F \u0648\u0645\u062A\u0633\u0644\u0633\u0644\u0627\u062A",
9377
+ title: messages.insertLimitsSeries,
9378
+ "aria-label": messages.insertLimitsSeries,
8710
9379
  "aria-haspopup": "listbox",
8711
9380
  "aria-expanded": limitsSeriesMenuOpen,
8712
9381
  onClick: () => setLimitsSeriesMenuOpen((open) => !open),
8713
9382
  children: LIMITS_SERIES_COMMANDS[0]?.arabicLabel ?? "\u062D\u062F"
8714
9383
  }
8715
9384
  ),
8716
- /* @__PURE__ */ jsx8("div", { className: "function-command-options", role: "listbox", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u062D\u062F\u0648\u062F \u0648\u0645\u062A\u0633\u0644\u0633\u0644\u0627\u062A", hidden: !limitsSeriesMenuOpen, children: LIMITS_SERIES_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
9385
+ /* @__PURE__ */ jsx8("div", { className: "function-command-options", role: "listbox", "aria-label": messages.insertLimitsSeries, hidden: !limitsSeriesMenuOpen, children: LIMITS_SERIES_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
8717
9386
  "button",
8718
9387
  {
8719
9388
  className: "function-command-option",
8720
9389
  type: "button",
8721
9390
  role: "option",
8722
- title: command.title,
8723
- "aria-label": command.title,
9391
+ title: atomicCommandTitle(command, uiLocale),
9392
+ "aria-label": atomicCommandTitle(command, uiLocale),
8724
9393
  onMouseDown: (event) => event.preventDefault(),
8725
9394
  onClick: () => {
8726
9395
  runtimeRef.current?.insertAtomicCommand(command.id);
@@ -8750,22 +9419,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8750
9419
  {
8751
9420
  className: "icon-btn function-command-btn",
8752
9421
  type: "button",
8753
- title: "\u0625\u062F\u0631\u0627\u062C \u062F\u0648\u0627\u0644 \u0625\u0636\u0627\u0641\u064A\u0629",
8754
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u062F\u0648\u0627\u0644 \u0625\u0636\u0627\u0641\u064A\u0629",
9422
+ title: messages.insertAdditionalFunctions,
9423
+ "aria-label": messages.insertAdditionalFunctions,
8755
9424
  "aria-haspopup": "listbox",
8756
9425
  "aria-expanded": function2MenuOpen,
8757
9426
  onClick: () => setFunction2MenuOpen((open) => !open),
8758
9427
  children: FUNCTION2_COMMANDS[0]?.arabicLabel ?? "\u062F"
8759
9428
  }
8760
9429
  ),
8761
- /* @__PURE__ */ jsx8("div", { className: "function-command-options", role: "listbox", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u062F\u0648\u0627\u0644 \u0625\u0636\u0627\u0641\u064A\u0629", hidden: !function2MenuOpen, children: FUNCTION2_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
9430
+ /* @__PURE__ */ jsx8("div", { className: "function-command-options", role: "listbox", "aria-label": messages.insertAdditionalFunctions, hidden: !function2MenuOpen, children: FUNCTION2_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
8762
9431
  "button",
8763
9432
  {
8764
9433
  className: "function-command-option",
8765
9434
  type: "button",
8766
9435
  role: "option",
8767
- title: command.title,
8768
- "aria-label": command.title,
9436
+ title: atomicCommandTitle(command, uiLocale),
9437
+ "aria-label": atomicCommandTitle(command, uiLocale),
8769
9438
  onMouseDown: (event) => event.preventDefault(),
8770
9439
  onClick: () => {
8771
9440
  runtimeRef.current?.insertAtomicCommand(command.id);
@@ -8795,22 +9464,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8795
9464
  {
8796
9465
  className: "icon-btn function-command-btn",
8797
9466
  type: "button",
8798
- title: "\u0625\u062F\u0631\u0627\u062C \u0645\u062C\u0645\u0648\u0639\u0627\u062A \u0623\u0639\u062F\u0627\u062F",
8799
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0645\u062C\u0645\u0648\u0639\u0627\u062A \u0623\u0639\u062F\u0627\u062F",
9467
+ title: messages.insertNumberSets,
9468
+ "aria-label": messages.insertNumberSets,
8800
9469
  "aria-haspopup": "listbox",
8801
9470
  "aria-expanded": groupMenuOpen,
8802
9471
  onClick: () => setGroupMenuOpen((open) => !open),
8803
9472
  children: GROUP_COMMANDS[0]?.arabicLabel ?? "\u0645"
8804
9473
  }
8805
9474
  ),
8806
- /* @__PURE__ */ jsx8("div", { className: "function-command-options", role: "listbox", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0645\u062C\u0645\u0648\u0639\u0627\u062A \u0623\u0639\u062F\u0627\u062F", hidden: !groupMenuOpen, children: GROUP_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
9475
+ /* @__PURE__ */ jsx8("div", { className: "function-command-options", role: "listbox", "aria-label": messages.insertNumberSets, hidden: !groupMenuOpen, children: GROUP_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
8807
9476
  "button",
8808
9477
  {
8809
9478
  className: "function-command-option",
8810
9479
  type: "button",
8811
9480
  role: "option",
8812
- title: command.title,
8813
- "aria-label": command.title,
9481
+ title: atomicCommandTitle(command, uiLocale),
9482
+ "aria-label": atomicCommandTitle(command, uiLocale),
8814
9483
  onMouseDown: (event) => event.preventDefault(),
8815
9484
  onClick: () => {
8816
9485
  runtimeRef.current?.insertAtomicCommand(command.id);
@@ -8825,7 +9494,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8825
9494
  }
8826
9495
  )
8827
9496
  ] }),
8828
- /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-operators", role: "group", "aria-label": "\u0627\u0644\u0639\u0645\u0644\u064A\u0627\u062A", children: [
9497
+ /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-operators", role: "group", "aria-label": messages.operations, children: [
8829
9498
  /* @__PURE__ */ jsxs6(
8830
9499
  "div",
8831
9500
  {
@@ -8842,22 +9511,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8842
9511
  {
8843
9512
  className: "icon-btn function-command-btn operator-command-btn",
8844
9513
  type: "button",
8845
- title: "\u0625\u062F\u0631\u0627\u062C \u0631\u0645\u0632 \u0639\u0645\u0644\u064A\u0629",
8846
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0631\u0645\u0632 \u0639\u0645\u0644\u064A\u0629",
9514
+ title: messages.insertOperation,
9515
+ "aria-label": messages.insertOperation,
8847
9516
  "aria-haspopup": "listbox",
8848
9517
  "aria-expanded": operatorMenuOpen,
8849
9518
  onClick: () => setOperatorMenuOpen((open) => !open),
8850
9519
  children: renderOperatorMenuButtonLabel(OPERATOR_COMMANDS[0], "\u2217")
8851
9520
  }
8852
9521
  ),
8853
- /* @__PURE__ */ jsx8("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0631\u0645\u0632 \u0639\u0645\u0644\u064A\u0629", hidden: !operatorMenuOpen, children: OPERATOR_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
9522
+ /* @__PURE__ */ jsx8("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": messages.insertOperation, hidden: !operatorMenuOpen, children: OPERATOR_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
8854
9523
  "button",
8855
9524
  {
8856
9525
  className: "function-command-option operator-command-option",
8857
9526
  type: "button",
8858
9527
  role: "option",
8859
- title: command.title,
8860
- "aria-label": command.title,
9528
+ title: atomicOperatorCommandTitle(command, uiLocale),
9529
+ "aria-label": atomicOperatorCommandTitle(command, uiLocale),
8861
9530
  onMouseDown: (event) => event.preventDefault(),
8862
9531
  onClick: () => {
8863
9532
  runtimeRef.current?.insertAtomicOperatorCommand(command.id);
@@ -8887,22 +9556,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8887
9556
  {
8888
9557
  className: "icon-btn function-command-btn operator-command-btn",
8889
9558
  type: "button",
8890
- title: "\u0625\u062F\u0631\u0627\u062C \u0631\u0645\u0648\u0632 \u0639\u0644\u0627\u0642\u0627\u062A \u0648\u0645\u062C\u0645\u0648\u0639\u0627\u062A",
8891
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0631\u0645\u0648\u0632 \u0639\u0644\u0627\u0642\u0627\u062A \u0648\u0645\u062C\u0645\u0648\u0639\u0627\u062A",
9559
+ title: messages.insertRelationsSets,
9560
+ "aria-label": messages.insertRelationsSets,
8892
9561
  "aria-haspopup": "listbox",
8893
9562
  "aria-expanded": operator2MenuOpen,
8894
9563
  onClick: () => setOperator2MenuOpen((open) => !open),
8895
9564
  children: "\u2229"
8896
9565
  }
8897
9566
  ),
8898
- /* @__PURE__ */ jsx8("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0631\u0645\u0648\u0632 \u0639\u0644\u0627\u0642\u0627\u062A \u0648\u0645\u062C\u0645\u0648\u0639\u0627\u062A", hidden: !operator2MenuOpen, children: OPERATOR2_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
9567
+ /* @__PURE__ */ jsx8("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": messages.insertRelationsSets, hidden: !operator2MenuOpen, children: OPERATOR2_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
8899
9568
  "button",
8900
9569
  {
8901
9570
  className: "function-command-option operator-command-option",
8902
9571
  type: "button",
8903
9572
  role: "option",
8904
- title: command.title,
8905
- "aria-label": command.title,
9573
+ title: atomicOperatorCommandTitle(command, uiLocale),
9574
+ "aria-label": atomicOperatorCommandTitle(command, uiLocale),
8906
9575
  onMouseDown: (event) => event.preventDefault(),
8907
9576
  onClick: () => {
8908
9577
  runtimeRef.current?.insertAtomicOperatorCommand(command.id);
@@ -8932,22 +9601,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8932
9601
  {
8933
9602
  className: "icon-btn function-command-btn operator-command-btn",
8934
9603
  type: "button",
8935
- title: "\u0625\u062F\u0631\u0627\u062C \u0623\u0633\u0647\u0645",
8936
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0623\u0633\u0647\u0645",
9604
+ title: messages.insertArrows,
9605
+ "aria-label": messages.insertArrows,
8937
9606
  "aria-haspopup": "listbox",
8938
9607
  "aria-expanded": operator3MenuOpen,
8939
9608
  onClick: () => setOperator3MenuOpen((open) => !open),
8940
9609
  children: renderOperatorMenuButtonLabel(OPERATOR3_COMMANDS[0], "\u21D2")
8941
9610
  }
8942
9611
  ),
8943
- /* @__PURE__ */ jsx8("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0623\u0633\u0647\u0645", hidden: !operator3MenuOpen, children: OPERATOR3_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
9612
+ /* @__PURE__ */ jsx8("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": messages.insertArrows, hidden: !operator3MenuOpen, children: OPERATOR3_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
8944
9613
  "button",
8945
9614
  {
8946
9615
  className: "function-command-option operator-command-option",
8947
9616
  type: "button",
8948
9617
  role: "option",
8949
- title: command.title,
8950
- "aria-label": command.title,
9618
+ title: atomicOperatorCommandTitle(command, uiLocale),
9619
+ "aria-label": atomicOperatorCommandTitle(command, uiLocale),
8951
9620
  onMouseDown: (event) => event.preventDefault(),
8952
9621
  onClick: () => {
8953
9622
  runtimeRef.current?.insertAtomicOperatorCommand(command.id);
@@ -8977,22 +9646,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
8977
9646
  {
8978
9647
  className: "icon-btn function-command-btn operator-command-btn",
8979
9648
  type: "button",
8980
- title: "\u0625\u062F\u0631\u0627\u062C \u0646\u0642\u0627\u0637",
8981
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0646\u0642\u0627\u0637",
9649
+ title: messages.insertDots,
9650
+ "aria-label": messages.insertDots,
8982
9651
  "aria-haspopup": "listbox",
8983
9652
  "aria-expanded": dotMenuOpen,
8984
9653
  onClick: () => setDotMenuOpen((open) => !open),
8985
9654
  children: renderOperatorMenuButtonLabel(DOT_COMMANDS[0], "\u2026")
8986
9655
  }
8987
9656
  ),
8988
- /* @__PURE__ */ jsx8("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u0646\u0642\u0627\u0637", hidden: !dotMenuOpen, children: DOT_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
9657
+ /* @__PURE__ */ jsx8("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": messages.insertDots, hidden: !dotMenuOpen, children: DOT_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
8989
9658
  "button",
8990
9659
  {
8991
9660
  className: "function-command-option operator-command-option",
8992
9661
  type: "button",
8993
9662
  role: "option",
8994
- title: command.title,
8995
- "aria-label": command.title,
9663
+ title: atomicOperatorCommandTitle(command, uiLocale),
9664
+ "aria-label": atomicOperatorCommandTitle(command, uiLocale),
8996
9665
  onMouseDown: (event) => event.preventDefault(),
8997
9666
  onClick: () => {
8998
9667
  runtimeRef.current?.insertAtomicOperatorCommand(command.id);
@@ -9022,22 +9691,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
9022
9691
  {
9023
9692
  className: "icon-btn function-command-btn operator-command-btn",
9024
9693
  type: "button",
9025
- title: "\u0625\u062F\u0631\u0627\u062C \u062A\u0643\u0627\u0645\u0644\u0627\u062A",
9026
- "aria-label": "\u0625\u062F\u0631\u0627\u062C \u062A\u0643\u0627\u0645\u0644\u0627\u062A",
9694
+ title: messages.insertIntegrals,
9695
+ "aria-label": messages.insertIntegrals,
9027
9696
  "aria-haspopup": "listbox",
9028
9697
  "aria-expanded": integralMenuOpen,
9029
9698
  onClick: () => setIntegralMenuOpen((open) => !open),
9030
9699
  children: renderOperatorMenuButtonLabel(INTEGRAL_COMMANDS[0], "\u222B")
9031
9700
  }
9032
9701
  ),
9033
- /* @__PURE__ */ jsx8("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": "\u0625\u062F\u0631\u0627\u062C \u062A\u0643\u0627\u0645\u0644\u0627\u062A", hidden: !integralMenuOpen, children: INTEGRAL_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
9702
+ /* @__PURE__ */ jsx8("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": messages.insertIntegrals, hidden: !integralMenuOpen, children: INTEGRAL_COMMANDS.map((command) => /* @__PURE__ */ jsx8(
9034
9703
  "button",
9035
9704
  {
9036
9705
  className: "function-command-option operator-command-option",
9037
9706
  type: "button",
9038
9707
  role: "option",
9039
- title: command.title,
9040
- "aria-label": command.title,
9708
+ title: atomicOperatorCommandTitle(command, uiLocale),
9709
+ "aria-label": atomicOperatorCommandTitle(command, uiLocale),
9041
9710
  onMouseDown: (event) => event.preventDefault(),
9042
9711
  onClick: () => {
9043
9712
  runtimeRef.current?.insertAtomicOperatorCommand(command.id);
@@ -9052,27 +9721,27 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
9052
9721
  }
9053
9722
  )
9054
9723
  ] }),
9055
- /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-scripts", role: "group", "aria-label": "\u0627\u0644\u0623\u0633 \u0648\u0627\u0644\u0633\u0641\u0644\u064A", children: [
9056
- /* @__PURE__ */ jsx8("button", { className: "icon-btn script-icon-btn", type: "button", title: "\u0625\u0636\u0627\u0641\u0629 \u0623\u0633", "aria-label": "\u0625\u0636\u0627\u0641\u0629 \u0623\u0633", onClick: () => runtimeRef.current?.addSup(), children: /* @__PURE__ */ jsxs6("span", { className: "toolbar-script-icon toolbar-script-icon--sup", "aria-hidden": "true", children: [
9724
+ /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-scripts", role: "group", "aria-label": messages.scripts, children: [
9725
+ /* @__PURE__ */ jsx8("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSuperscript, "aria-label": messages.addSuperscript, onClick: () => runtimeRef.current?.addSup(), children: /* @__PURE__ */ jsxs6("span", { className: "toolbar-script-icon toolbar-script-icon--sup", "aria-hidden": "true", children: [
9057
9726
  /* @__PURE__ */ jsx8("span", { children: "\u0646" }),
9058
9727
  /* @__PURE__ */ jsx8("span", { children: "\u0633" })
9059
9728
  ] }) }),
9060
- /* @__PURE__ */ jsx8("button", { className: "icon-btn script-icon-btn", type: "button", title: "\u0625\u0636\u0627\u0641\u0629 \u0633\u0641\u0644\u064A", "aria-label": "\u0625\u0636\u0627\u0641\u0629 \u0633\u0641\u0644\u064A", onClick: () => runtimeRef.current?.addSub(), children: /* @__PURE__ */ jsxs6("span", { className: "toolbar-script-icon toolbar-script-icon--sub", "aria-hidden": "true", children: [
9729
+ /* @__PURE__ */ jsx8("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSubscript, "aria-label": messages.addSubscript, onClick: () => runtimeRef.current?.addSub(), children: /* @__PURE__ */ jsxs6("span", { className: "toolbar-script-icon toolbar-script-icon--sub", "aria-hidden": "true", children: [
9061
9730
  /* @__PURE__ */ jsx8("span", { children: "\u0646" }),
9062
9731
  /* @__PURE__ */ jsx8("span", { children: "\u0633" })
9063
9732
  ] }) }),
9064
- /* @__PURE__ */ jsx8("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: "\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0623\u0633", "aria-label": "\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0623\u0633", onClick: () => runtimeRef.current?.removeSup(), children: /* @__PURE__ */ jsxs6("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sup", "aria-hidden": "true", children: [
9733
+ /* @__PURE__ */ jsx8("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: messages.removeSuperscript, "aria-label": messages.removeSuperscript, onClick: () => runtimeRef.current?.removeSup(), children: /* @__PURE__ */ jsxs6("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sup", "aria-hidden": "true", children: [
9065
9734
  /* @__PURE__ */ jsx8("span", { children: "\u0646" }),
9066
9735
  /* @__PURE__ */ jsx8("span", { children: "\xD7" })
9067
9736
  ] }) }),
9068
- /* @__PURE__ */ jsx8("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: "\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0633\u0641\u0644\u064A", "aria-label": "\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0633\u0641\u0644\u064A", onClick: () => runtimeRef.current?.removeSub(), children: /* @__PURE__ */ jsxs6("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sub", "aria-hidden": "true", children: [
9737
+ /* @__PURE__ */ jsx8("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: messages.removeSubscript, "aria-label": messages.removeSubscript, onClick: () => runtimeRef.current?.removeSub(), children: /* @__PURE__ */ jsxs6("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sub", "aria-hidden": "true", children: [
9069
9738
  /* @__PURE__ */ jsx8("span", { children: "\u0646" }),
9070
9739
  /* @__PURE__ */ jsx8("span", { children: "\xD7" })
9071
9740
  ] }) })
9072
9741
  ] }),
9073
- /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": "\u0623\u0646\u0645\u0627\u0637 \u0627\u0644\u0625\u062F\u062E\u0627\u0644", children: [
9074
- /* @__PURE__ */ jsx8("button", { className: "icon-btn delete-node-btn", type: "button", title: "\u062D\u0630\u0641 \u0627\u0644\u0628\u0646\u064A\u0629 \u0627\u0644\u0645\u062D\u062F\u062F\u0629", "aria-label": "\u062D\u0630\u0641 \u0627\u0644\u0628\u0646\u064A\u0629 \u0627\u0644\u0645\u062D\u062F\u062F\u0629", onClick: () => runtimeRef.current?.deleteStructure(), children: "\xD7" }),
9075
- /* @__PURE__ */ jsx8("button", { ref: splitTypingBtnRef, id: "toggle-split-leaf-typing", className: "icon-btn ligature-btn", type: "button", title: "\u062A\u0628\u062F\u064A\u0644 \u062F\u0645\u062C \u0627\u0644\u062D\u0631\u0648\u0641", "aria-label": "\u062A\u0628\u062F\u064A\u0644 \u062F\u0645\u062C \u0627\u0644\u062D\u0631\u0648\u0641", onClick: () => runtimeRef.current?.toggleSplitLeafTyping(), children: "\u0633\u0635\u0639" }),
9742
+ /* @__PURE__ */ jsxs6("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.inputStyles, children: [
9743
+ /* @__PURE__ */ jsx8("button", { className: "icon-btn delete-node-btn", type: "button", title: messages.deleteSelectedStructure, "aria-label": messages.deleteSelectedStructure, onClick: () => runtimeRef.current?.deleteStructure(), children: "\xD7" }),
9744
+ /* @__PURE__ */ jsx8("button", { ref: splitTypingBtnRef, id: "toggle-split-leaf-typing", className: "icon-btn ligature-btn", type: "button", title: messages.toggleLetterMerging, "aria-label": messages.toggleLetterMerging, onClick: () => runtimeRef.current?.toggleSplitLeafTyping(), children: "\u0633\u0635\u0639" }),
9076
9745
  /* @__PURE__ */ jsxs6(
9077
9746
  "div",
9078
9747
  {
@@ -9091,22 +9760,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
9091
9760
  id: "select-character-font",
9092
9761
  className: `icon-btn font-mode-btn font-mode-btn--${selectedCharacterFont}`,
9093
9762
  type: "button",
9094
- title: characterFontOption(selectedCharacterFont).title,
9095
- "aria-label": "\u0627\u062E\u062A\u064A\u0627\u0631 \u062E\u0637 \u0627\u0644\u0643\u062A\u0627\u0628\u0629",
9763
+ title: characterFontTitle(selectedCharacterFont, messages),
9764
+ "aria-label": messages.chooseWritingFont,
9096
9765
  "aria-haspopup": "listbox",
9097
9766
  "aria-expanded": characterFontMenuOpen,
9098
9767
  onClick: () => setCharacterFontMenuOpen((open) => !open),
9099
9768
  children: characterFontOption(selectedCharacterFont).label
9100
9769
  }
9101
9770
  ),
9102
- /* @__PURE__ */ jsx8("div", { className: "character-font-options", role: "listbox", "aria-label": "\u0627\u062E\u062A\u064A\u0627\u0631 \u062E\u0637 \u0627\u0644\u0643\u062A\u0627\u0628\u0629", hidden: !characterFontMenuOpen, children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx8(
9771
+ /* @__PURE__ */ jsx8("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx8(
9103
9772
  "button",
9104
9773
  {
9105
9774
  type: "button",
9106
9775
  role: "option",
9107
9776
  "aria-selected": selectedCharacterFont === option.id,
9108
9777
  className: `character-font-option character-font-option--${option.id}`,
9109
- title: option.title,
9778
+ title: characterFontTitle(option.id, messages),
9110
9779
  onMouseDown: (event) => event.preventDefault(),
9111
9780
  onClick: () => {
9112
9781
  runtimeRef.current?.setCurrentCharacterFont(option.id);
@@ -9139,22 +9808,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
9139
9808
  id: "select-digit-form",
9140
9809
  className: "icon-btn digit-form-btn",
9141
9810
  type: "button",
9142
- title: "\u0627\u062E\u062A\u064A\u0627\u0631 \u0634\u0643\u0644 \u0627\u0644\u0623\u0631\u0642\u0627\u0645",
9143
- "aria-label": "\u0627\u062E\u062A\u064A\u0627\u0631 \u0634\u0643\u0644 \u0627\u0644\u0623\u0631\u0642\u0627\u0645",
9811
+ title: messages.chooseDigitForm,
9812
+ "aria-label": messages.chooseDigitForm,
9144
9813
  "aria-haspopup": "listbox",
9145
9814
  "aria-expanded": digitMenuOpen,
9146
9815
  onClick: () => setDigitMenuOpen((open) => !open),
9147
9816
  children: digitFormLabel(selectedDigitForm2)
9148
9817
  }
9149
9818
  ),
9150
- /* @__PURE__ */ jsx8("div", { className: "digit-form-options", role: "listbox", "aria-label": "\u0627\u062E\u062A\u064A\u0627\u0631 \u0634\u0643\u0644 \u0627\u0644\u0623\u0631\u0642\u0627\u0645", hidden: !digitMenuOpen, children: DIGIT_FORM_OPTIONS.map((option) => /* @__PURE__ */ jsx8(
9819
+ /* @__PURE__ */ jsx8("div", { className: "digit-form-options", role: "listbox", "aria-label": messages.chooseDigitForm, hidden: !digitMenuOpen, children: DIGIT_FORM_OPTIONS.map((option) => /* @__PURE__ */ jsx8(
9151
9820
  "button",
9152
9821
  {
9153
9822
  type: "button",
9154
9823
  role: "option",
9155
9824
  "aria-selected": selectedDigitForm2 === option.id,
9156
9825
  className: "digit-form-option",
9157
- title: option.title,
9826
+ title: digitFormTitle(option.id, messages),
9158
9827
  onMouseDown: (event) => event.preventDefault(),
9159
9828
  onClick: () => {
9160
9829
  runtimeRef.current?.setCurrentDigitForm(option.id);
@@ -9178,15 +9847,15 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
9178
9847
  id: "butex-editor-surface",
9179
9848
  className: "surface surface--arabic",
9180
9849
  tabIndex: 0,
9181
- "aria-label": "\u0645\u062D\u0631\u0631 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0627\u062A"
9850
+ "aria-label": messages.equationEditor
9182
9851
  }
9183
9852
  ),
9184
9853
  /* @__PURE__ */ jsx8("div", { ref: renderErrorRef, className: "error", hidden: true })
9185
9854
  ] }),
9186
- /* @__PURE__ */ jsx8("section", { className: "panel panel-preview", "aria-label": "\u0645\u0639\u0627\u064A\u0646\u0629 \u0627\u0644\u0631\u0633\u0645", children: /* @__PURE__ */ jsx8("div", { ref: mathOutputRef, className: "preview-box" }) }),
9855
+ /* @__PURE__ */ jsx8("section", { className: "panel panel-preview", "aria-label": messages.renderPreview, children: /* @__PURE__ */ jsx8("div", { ref: mathOutputRef, className: "preview-box" }) }),
9187
9856
  debug ? /* @__PURE__ */ jsxs6("section", { className: "panel", children: [
9188
9857
  /* @__PURE__ */ jsxs6("div", { className: "dev-strip", children: [
9189
- /* @__PURE__ */ jsx8("span", { className: "dev-badge", children: "\u062A\u0637\u0648\u064A\u0631" }),
9858
+ /* @__PURE__ */ jsx8("span", { className: "dev-badge", children: messages.development }),
9190
9859
  /* @__PURE__ */ jsx8("div", { ref: latexLinesRef, className: "ascii" }),
9191
9860
  /* @__PURE__ */ jsx8("div", { ref: passivePreviewRef, className: "passive-preview-text" })
9192
9861
  ] }),
@@ -9209,7 +9878,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
9209
9878
  return next;
9210
9879
  });
9211
9880
  },
9212
- children: debugBodyHidden ? "\u0625\u0638\u0647\u0627\u0631 \u0633\u062C\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D" : "\u0625\u062E\u0641\u0627\u0621 \u0633\u062C\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D"
9881
+ children: debugBodyHidden ? messages.showDebugLog : messages.hideDebugLog
9213
9882
  }
9214
9883
  ),
9215
9884
  /* @__PURE__ */ jsx8(
@@ -9223,7 +9892,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
9223
9892
  } catch {
9224
9893
  }
9225
9894
  },
9226
- children: "\u0646\u0633\u062E \u0633\u062C\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D"
9895
+ children: messages.copyDebugLog
9227
9896
  }
9228
9897
  )
9229
9898
  ] }),
@@ -9244,11 +9913,14 @@ function EquationDrawer({
9244
9913
  reason,
9245
9914
  mathMode,
9246
9915
  canDelete = false,
9916
+ equationSide = "arabic",
9917
+ uiLocale = "ar",
9247
9918
  onMathModeChange,
9248
9919
  onClose,
9249
9920
  onSave,
9250
9921
  onDelete
9251
9922
  }) {
9923
+ const messages = document2Messages(uiLocale);
9252
9924
  const latestSession = useRef5(session);
9253
9925
  useEffect4(() => {
9254
9926
  const onKeyDown = (event) => {
@@ -9265,7 +9937,7 @@ function EquationDrawer({
9265
9937
  {
9266
9938
  type: "button",
9267
9939
  className: "butex-document2-widget__equation-modal-backdrop",
9268
- "aria-label": "\u0625\u063A\u0644\u0627\u0642 \u0646\u0627\u0641\u0630\u0629 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
9940
+ "aria-label": messages.closeEquationDialog,
9269
9941
  onClick: onClose
9270
9942
  }
9271
9943
  ),
@@ -9276,30 +9948,39 @@ function EquationDrawer({
9276
9948
  role: "dialog",
9277
9949
  "aria-modal": "true",
9278
9950
  "aria-labelledby": "butex-document2-equation-modal-title",
9279
- dir: "rtl",
9951
+ dir: uiLocaleDirection(uiLocale),
9952
+ lang: uiLocale,
9280
9953
  children: [
9281
9954
  /* @__PURE__ */ jsxs7("div", { className: "butex-document2-widget__row", children: [
9282
- /* @__PURE__ */ jsx9("strong", { id: "butex-document2-equation-modal-title", children: "\u062A\u062D\u0631\u064A\u0631 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629" }),
9283
- /* @__PURE__ */ jsx9("button", { type: "button", onClick: onClose, children: "\u0625\u063A\u0644\u0627\u0642" })
9955
+ /* @__PURE__ */ jsx9("strong", { id: "butex-document2-equation-modal-title", children: messages.equationEditorTitle }),
9956
+ /* @__PURE__ */ jsx9("button", { type: "button", onClick: onClose, children: messages.close })
9284
9957
  ] }),
9285
- /* @__PURE__ */ jsxs7("div", { className: "butex-document2-widget__row", role: "group", "aria-label": "\u0646\u0648\u0639 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629", children: [
9286
- /* @__PURE__ */ jsx9("button", { type: "button", "aria-pressed": mathMode === "inline", onClick: () => onMathModeChange("inline"), children: "\u062F\u0627\u062E\u0644 \u0627\u0644\u0633\u0637\u0631 ($)" }),
9287
- /* @__PURE__ */ jsx9("button", { type: "button", "aria-pressed": mathMode === "display", onClick: () => onMathModeChange("display"), children: "\u0645\u0639\u0631\u0648\u0636\u0629 (\\\\[)" })
9958
+ /* @__PURE__ */ jsxs7("div", { className: "butex-document2-widget__row", role: "group", "aria-label": messages.equationType, children: [
9959
+ /* @__PURE__ */ jsxs7("button", { type: "button", "aria-pressed": mathMode === "inline", onClick: () => onMathModeChange("inline"), children: [
9960
+ messages.inline,
9961
+ " ($)"
9962
+ ] }),
9963
+ /* @__PURE__ */ jsxs7("button", { type: "button", "aria-pressed": mathMode === "display", onClick: () => onMathModeChange("display"), children: [
9964
+ messages.displayed,
9965
+ " (\\\\[)"
9966
+ ] })
9288
9967
  ] }),
9289
- reason ? /* @__PURE__ */ jsx9("p", { className: "butex-document2-widget__error", children: reason }) : null,
9968
+ reason ? /* @__PURE__ */ jsx9("p", { className: "butex-document2-widget__error", children: uiLocale === "en" ? messages.equationUnavailable : reason }) : null,
9290
9969
  /* @__PURE__ */ jsx9(
9291
9970
  ButexEditor,
9292
9971
  {
9293
9972
  debug: false,
9973
+ defaultSide: equationSide,
9974
+ uiLocale,
9294
9975
  initialSession: session,
9295
9976
  onSessionChange: (nextSession) => {
9296
- latestSession.current = { ...nextSession, activeSide: "arabic" };
9977
+ latestSession.current = nextSession;
9297
9978
  }
9298
9979
  }
9299
9980
  ),
9300
9981
  /* @__PURE__ */ jsxs7("div", { className: "butex-document2-widget__row", children: [
9301
- canDelete && onDelete ? /* @__PURE__ */ jsx9("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: onDelete, children: "\u062D\u0630\u0641 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629" }) : null,
9302
- /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => onSave({ ...latestSession.current, activeSide: "arabic" }), children: "\u062D\u0641\u0638 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629" })
9982
+ canDelete && onDelete ? /* @__PURE__ */ jsx9("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: onDelete, children: messages.deleteEquation }) : null,
9983
+ /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => onSave({ ...latestSession.current, activeSide: equationSide }), children: messages.saveEquation })
9303
9984
  ] })
9304
9985
  ]
9305
9986
  }
@@ -9725,6 +10406,12 @@ var DOCUMENT2_WIDGET_CSS = `
9725
10406
  margin-block-start: 6px;
9726
10407
  }
9727
10408
 
10409
+ .butex-document2-widget__list-item-content {
10410
+ display: grid;
10411
+ gap: 8px;
10412
+ min-width: 0;
10413
+ }
10414
+
9728
10415
  .butex-document2-widget__list-footer {
9729
10416
  border-block-start: 1px dashed color-mix(in srgb, var(--butex-document2-border) 85%, transparent);
9730
10417
  margin-block-start: 10px;
@@ -9883,6 +10570,7 @@ var DOCUMENT2_WIDGET_CSS = `
9883
10570
  overflow-wrap: break-word;
9884
10571
  overflow-y: hidden;
9885
10572
  resize: none;
10573
+ text-align: start;
9886
10574
  white-space: pre-wrap;
9887
10575
  width: auto;
9888
10576
  word-break: break-word;
@@ -9938,13 +10626,13 @@ var DOCUMENT2_WIDGET_CSS = `
9938
10626
  .butex-document2-widget__preview {
9939
10627
  background: var(--butex-document2-preview-bg);
9940
10628
  color: var(--butex-document2-preview-fg);
9941
- direction: rtl;
9942
10629
  font-family: var(--butex-document2-preview-font);
9943
10630
  font-size: 1.08rem;
9944
10631
  line-height: 1.9;
9945
10632
  max-width: 100%;
9946
10633
  min-width: 0;
9947
10634
  overflow-wrap: break-word;
10635
+ text-align: start;
9948
10636
  word-break: break-word;
9949
10637
  }
9950
10638
 
@@ -10329,21 +11017,21 @@ function topLevelBlockIdForField(document2, fieldId) {
10329
11017
  function topLevelBlockIdForToken(document2, tokenId) {
10330
11018
  return document2.blocks.find((block) => blockHasToken(block, tokenId))?.id ?? null;
10331
11019
  }
10332
- function formatDocument2DiagnosticArabic(d) {
11020
+ function formatDocument2Diagnostic(d, messages) {
10333
11021
  if (d.message === "math_objects order mismatch") {
10334
- return `\u062A\u0631\u062A\u064A\u0628 \u0623\u0648 \u0623\u0646\u0648\u0627\u0639 \u0627\u0644\u0645\u062D\u062F\u062F\u0627\u062A \u0641\u064A math_objects \u0644\u0627 \u062A\u0637\u0627\u0628\u0642 \u0645\u0627 \u0648\u0631\u062F \u0641\u064A \u0627\u0644\u0646\u0635. \u0627\u0644\u0645\u0633\u0627\u0631: ${d.path}`;
11022
+ return `${messages.importOrderMismatch} ${messages.path}: ${d.path}`;
10335
11023
  }
10336
11024
  const countMismatch = /^math_objects count mismatch: detected (\d+), got (\d+)$/.exec(d.message);
10337
11025
  if (countMismatch) {
10338
11026
  const [, detected, got] = countMismatch;
10339
- return `\u0639\u062F\u0645 \u062A\u0637\u0627\u0628\u0642 \u0628\u064A\u0646 \u0627\u0644\u0645\u0648\u0627\u0636\u0639 \u0627\u0644\u0631\u064A\u0627\u0636\u064A\u0629 \u0627\u0644\u0645\u0633\u062A\u062E\u0631\u062C\u0629 \u0645\u0646 \u0627\u0644\u0646\u0635 (${detected}) \u0648\u0639\u062F\u062F \u0639\u0646\u0627\u0635\u0631 math_objects (${got}). \u0627\u0644\u0645\u0633\u0627\u0631: ${d.path}`;
11027
+ return `${messages.importCountMismatch} (${detected}/${got}) ${messages.path}: ${d.path}`;
10340
11028
  }
10341
- return `\u062A\u0646\u0628\u064A\u0647 \u0627\u0644\u0627\u0633\u062A\u064A\u0631\u0627\u062F: ${d.message} \u2014 ${d.path}`;
11029
+ return `${messages.importWarning}: ${d.message} \u2014 ${messages.path}: ${d.path}`;
10342
11030
  }
10343
11031
  function isDocument2Node(value) {
10344
11032
  return typeof value === "object" && value !== null && value.nodeType === "DocumentObject" && Array.isArray(value.blocks) && Array.isArray(value.diagnostics);
10345
11033
  }
10346
- function resolveInitialDocument2(initialDocument) {
11034
+ function resolveInitialDocument2(initialDocument, uiLocale = "ar") {
10347
11035
  if (!initialDocument) {
10348
11036
  return { document: createEmptyDocument2(), error: null };
10349
11037
  }
@@ -10354,18 +11042,23 @@ function resolveInitialDocument2(initialDocument) {
10354
11042
  return { document: fromDocumentJson2(initialDocument), error: null };
10355
11043
  } catch (err) {
10356
11044
  const detail = err instanceof Error ? err.message : String(err);
10357
- return { document: createEmptyDocument2(), error: `\u062A\u0639\u0630\u0631 \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0633\u062A\u0646\u062F: ${detail}` };
11045
+ return { document: createEmptyDocument2(), error: `${document2Messages(uiLocale).loadDocumentError}: ${detail}` };
10358
11046
  }
10359
11047
  }
10360
11048
  function ButexDocumentEditor2({
10361
11049
  initialDocument,
10362
11050
  className,
10363
11051
  debug = false,
11052
+ documentDirection = "rtl",
11053
+ equationSide = "arabic",
11054
+ editableEquations = true,
11055
+ uiLocale = "ar",
10364
11056
  mathOutput = "svg",
10365
11057
  onDocumentChange,
10366
11058
  onLatexChange
10367
11059
  }) {
10368
- const initialState = useMemo(() => resolveInitialDocument2(initialDocument), [initialDocument]);
11060
+ const messages = document2Messages(uiLocale);
11061
+ const initialState = useMemo(() => resolveInitialDocument2(initialDocument, uiLocale), [initialDocument]);
10369
11062
  const [documentNode, setDocumentNode] = useState4(initialState.document);
10370
11063
  const [error, setError] = useState4(initialState.error);
10371
11064
  const [editorOpen, setEditorOpen] = useState4(true);
@@ -10382,7 +11075,10 @@ function ButexDocumentEditor2({
10382
11075
  const pendingFocusRef = useRef6(null);
10383
11076
  documentRef.current = documentNode;
10384
11077
  const latex = document2Latex(documentNode);
10385
- const preview = useMemo(() => document2Preview(documentNode, mathOutput), [documentNode, mathOutput]);
11078
+ const preview = useMemo(
11079
+ () => document2Preview(documentNode, mathOutput, equationSide),
11080
+ [documentNode, equationSide, mathOutput]
11081
+ );
10386
11082
  const debugEnabled = useMemo(() => {
10387
11083
  if (debug) {
10388
11084
  return true;
@@ -10398,7 +11094,12 @@ function ButexDocumentEditor2({
10398
11094
  injectBuTeXDocument2Styles();
10399
11095
  }, []);
10400
11096
  useEffect5(() => {
10401
- const next = resolveInitialDocument2(initialDocument);
11097
+ if (!editableEquations) {
11098
+ setSelectedMath(null);
11099
+ }
11100
+ }, [editableEquations]);
11101
+ useEffect5(() => {
11102
+ const next = resolveInitialDocument2(initialDocument, uiLocale);
10402
11103
  setDocumentNode(next.document);
10403
11104
  setError(next.error);
10404
11105
  setSelectedMath(null);
@@ -10540,7 +11241,7 @@ function ButexDocumentEditor2({
10540
11241
  openBlock(blockId);
10541
11242
  setEditorFocus({ blockId, fieldId, textTokenId, caretOffset });
10542
11243
  }
10543
- function rememberMathFocus(blockId, fieldId, _tokenId) {
11244
+ function rememberMathFocus(blockId, fieldId) {
10544
11245
  openBlock(blockId);
10545
11246
  setEditorFocus({ blockId, fieldId, textTokenId: null, caretOffset: 0 });
10546
11247
  }
@@ -10552,6 +11253,9 @@ function ButexDocumentEditor2({
10552
11253
  textSnapshotArmedRef.current = false;
10553
11254
  }
10554
11255
  function openNewEquation(mode) {
11256
+ if (!editableEquations) {
11257
+ return;
11258
+ }
10555
11259
  const target = resolveInsertField(documentRef.current, editorFocus);
10556
11260
  if (target?.fieldId) {
10557
11261
  openBlock(topLevelBlockIdForField(documentRef.current, target.fieldId));
@@ -10562,13 +11266,16 @@ function ButexDocumentEditor2({
10562
11266
  textTokenId: target?.textTokenId ?? null,
10563
11267
  insertAt: target?.caretOffset ?? 0,
10564
11268
  mathMode: mode,
10565
- session: createEmptyArabicEquationSession(),
11269
+ session: createEmptyEquationSession(equationSide),
10566
11270
  reason: null
10567
11271
  });
10568
11272
  }
10569
11273
  function openMath(token) {
11274
+ if (!editableEquations) {
11275
+ return;
11276
+ }
10570
11277
  openBlock(topLevelBlockIdForToken(documentRef.current, token.id));
10571
- const result = mathTokenToArabicEditorSession(token.math);
11278
+ const result = mathTokenToEditorSession(token.math, equationSide);
10572
11279
  const mode = token.display ? "display" : "inline";
10573
11280
  if (!result.editable) {
10574
11281
  setSelectedMath({
@@ -10577,7 +11284,7 @@ function ButexDocumentEditor2({
10577
11284
  insertAt: 0,
10578
11285
  textTokenId: null,
10579
11286
  mathMode: mode,
10580
- session: createEmptyArabicEquationSession(),
11287
+ session: createEmptyEquationSession(equationSide),
10581
11288
  reason: result.reason
10582
11289
  });
10583
11290
  return;
@@ -10614,7 +11321,14 @@ function ButexDocumentEditor2({
10614
11321
  }
10615
11322
  const delimiters = mathDelimiters(selectedMath.mathMode);
10616
11323
  if (selectedMath.tokenId) {
10617
- const next2 = replaceMathTokenFromSession(documentRef.current, selectedMath.tokenId, session, delimiters.opening, delimiters.closing);
11324
+ const next2 = replaceMathTokenFromSession(
11325
+ documentRef.current,
11326
+ selectedMath.tokenId,
11327
+ session,
11328
+ delimiters.opening,
11329
+ delimiters.closing,
11330
+ equationSide
11331
+ );
10618
11332
  pendingFocusRef.current = { kind: "math", tokenId: selectedMath.tokenId };
10619
11333
  applyDocument(next2, "immediate");
10620
11334
  setSelectedMath(null);
@@ -10639,7 +11353,16 @@ function ButexDocumentEditor2({
10639
11353
  textTokenId = field.tokens.find((token) => token.kind === "text")?.id ?? null;
10640
11354
  insertAt = 0;
10641
11355
  }
10642
- const next = insertMathTokenAtCaret(current, fieldId, textTokenId, insertAt, session, delimiters.opening, delimiters.closing);
11356
+ const next = insertMathTokenAtCaret(
11357
+ current,
11358
+ fieldId,
11359
+ textTokenId,
11360
+ insertAt,
11361
+ session,
11362
+ delimiters.opening,
11363
+ delimiters.closing,
11364
+ equationSide
11365
+ );
10643
11366
  const trailingTextTokenId = trailingTextTokenAfterInsertedMath(current, next, fieldId, textTokenId, insertAt);
10644
11367
  if (trailingTextTokenId) {
10645
11368
  pendingFocusRef.current = { kind: "text", fieldId, textTokenId: trailingTextTokenId, caretOffset: 0 };
@@ -10663,110 +11386,127 @@ function ButexDocumentEditor2({
10663
11386
  pendingFocusRef.current = focusAfterDeletedMath(current, next, tokenId);
10664
11387
  applyDocument(next, "immediate");
10665
11388
  }
10666
- return /* @__PURE__ */ jsx10("div", { ref: widgetRef, className: ["butex-document2-widget", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__shell", children: [
10667
- /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__toolbar", children: [
10668
- /* @__PURE__ */ jsx10(
10669
- DocumentInsertToolbar,
10670
- {
10671
- canUndo,
10672
- canRedo,
10673
- onUndo: undoDocument,
10674
- onRedo: redoDocument,
10675
- onAddSection: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\section", afterBlockId()), "immediate"),
10676
- onAddSubsection: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\subsection", afterBlockId()), "immediate"),
10677
- onAddSubsubsection: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\subsubsection", afterBlockId()), "immediate"),
10678
- onAddParagraph: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\paragraph", afterBlockId()), "immediate"),
10679
- onAddInlineEquation: () => openNewEquation("inline"),
10680
- onAddDisplayEquation: () => openNewEquation("display"),
10681
- onAddTable: (rowCount, colCount) => applyDocument(addDocument2TableBlock(documentRef.current, "l".repeat(colCount), rowCount, colCount, afterBlockId()), "immediate"),
10682
- onAddList: () => applyDocument(addDocument2ListBlock(documentRef.current, false, afterBlockId()), "immediate"),
10683
- onAddEnumerate: () => applyDocument(addDocument2ListBlock(documentRef.current, true, afterBlockId()), "immediate"),
10684
- onAddFigure: () => applyDocument(addDocument2ImageBlock(documentRef.current, "", afterBlockId()), "immediate")
10685
- }
10686
- ),
10687
- /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": "\u0627\u0644\u0644\u0648\u062D\u0627\u062A", children: [
10688
- /* @__PURE__ */ jsx10("button", { type: "button", "aria-pressed": editorOpen, onClick: toggleEditorPanel, children: editorOpen ? "\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u062A\u062D\u0631\u064A\u0631" : "\u062A\u062D\u0631\u064A\u0631" }),
10689
- /* @__PURE__ */ jsx10("button", { type: "button", "aria-pressed": previewOpen, onClick: togglePreviewPanel, children: previewOpen ? "\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629" : "\u0645\u0639\u0627\u064A\u0646\u0629" })
10690
- ] }),
10691
- /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": "\u0637\u064A \u0627\u0644\u0643\u062A\u0644", children: [
10692
- /* @__PURE__ */ jsx10("button", { type: "button", onClick: collapseAllBlocks, children: "\u0637\u064A \u0627\u0644\u0643\u0644" }),
10693
- /* @__PURE__ */ jsx10("button", { type: "button", onClick: openAllBlocks, children: "\u0641\u062A\u062D \u0627\u0644\u0643\u0644" })
10694
- ] })
10695
- ] }),
10696
- error ? /* @__PURE__ */ jsx10("p", { className: "butex-document2-widget__error", children: error }) : null,
10697
- /* @__PURE__ */ jsxs8(
10698
- "div",
10699
- {
10700
- className: `butex-document2-widget__layout butex-document2-widget__layout--editor-${editorOpen ? "open" : "closed"} butex-document2-widget__layout--preview-${previewOpen ? "open" : "closed"}`,
10701
- children: [
11389
+ return /* @__PURE__ */ jsx10(
11390
+ "div",
11391
+ {
11392
+ ref: widgetRef,
11393
+ className: ["butex-document2-widget", className].filter(Boolean).join(" "),
11394
+ dir: uiLocaleDirection(uiLocale),
11395
+ lang: uiLocale,
11396
+ children: /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__shell", children: [
11397
+ /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__toolbar", children: [
10702
11398
  /* @__PURE__ */ jsx10(
10703
- "section",
11399
+ DocumentInsertToolbar,
10704
11400
  {
10705
- className: "butex-document2-widget__panel butex-document2-widget__editor-panel",
10706
- "aria-label": "\u062A\u062D\u0631\u064A\u0631 \u0627\u0644\u0645\u0633\u062A\u0646\u062F",
10707
- "aria-hidden": !editorOpen,
10708
- children: /* @__PURE__ */ jsx10("div", { className: "butex-document2-widget__blocks", children: documentNode.blocks.map((block, blockIndex) => /* @__PURE__ */ jsx10(
10709
- BlockEditor,
10710
- {
10711
- block,
10712
- blockIndex,
10713
- blockCount: documentNode.blocks.length,
10714
- mathOutput,
10715
- isCollapsed: collapsedBlockIds.has(block.id),
10716
- onTextChange: (fieldId, tokenId, text) => applyDocument(updateTextToken(documentRef.current, fieldId, tokenId, text), "text"),
10717
- onOpenMath: openMath,
10718
- onDeleteMath: deleteMathToken,
10719
- onRemoveBlock: (blockId) => applyDocument(removeDocument2BlockById(documentRef.current, blockId), "immediate"),
10720
- onMoveBlock: (blockId, direction) => applyDocument(moveDocument2BlockById(documentRef.current, blockId, direction), "immediate"),
10721
- onToggleCollapse: toggleBlockCollapse,
10722
- onBlockFocus: rememberBlockFocus,
10723
- onFieldFocus: rememberFieldFocus,
10724
- onMathFocus: rememberMathFocus,
10725
- onFieldBlur,
10726
- onImageSrcChange: (blockId, value) => applyDocument(updateDocument2ImageValue(documentRef.current, blockId, value), "text"),
10727
- onAddListItem: (listBlockId) => applyDocument(addDocument2ListItem(documentRef.current, listBlockId), "immediate"),
10728
- onRemoveListItem: (listBlockId, itemId) => applyDocument(removeDocument2ListItem(documentRef.current, listBlockId, itemId), "immediate")
10729
- },
10730
- block.id
10731
- )) })
11401
+ canUndo,
11402
+ canRedo,
11403
+ editableEquations,
11404
+ uiLocale,
11405
+ onUndo: undoDocument,
11406
+ onRedo: redoDocument,
11407
+ onAddSection: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\section", afterBlockId()), "immediate"),
11408
+ onAddSubsection: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\subsection", afterBlockId()), "immediate"),
11409
+ onAddSubsubsection: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\subsubsection", afterBlockId()), "immediate"),
11410
+ onAddParagraph: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\paragraph", afterBlockId()), "immediate"),
11411
+ onAddInlineEquation: () => openNewEquation("inline"),
11412
+ onAddDisplayEquation: () => openNewEquation("display"),
11413
+ onAddTable: (rowCount, colCount) => applyDocument(addDocument2TableBlock(documentRef.current, "l".repeat(colCount), rowCount, colCount, afterBlockId()), "immediate"),
11414
+ onAddList: () => applyDocument(addDocument2ListBlock(documentRef.current, false, afterBlockId()), "immediate"),
11415
+ onAddEnumerate: () => applyDocument(addDocument2ListBlock(documentRef.current, true, afterBlockId()), "immediate"),
11416
+ onAddFigure: () => applyDocument(addDocument2ImageBlock(documentRef.current, "", afterBlockId()), "immediate")
10732
11417
  }
10733
11418
  ),
10734
- /* @__PURE__ */ jsx10(
10735
- "section",
10736
- {
10737
- className: "butex-document2-widget__panel butex-document2-widget__preview-panel",
10738
- "aria-label": "\u0645\u0639\u0627\u064A\u0646\u0629 \u0627\u0644\u0645\u0633\u062A\u0646\u062F",
10739
- "aria-hidden": !previewOpen,
10740
- children: /* @__PURE__ */ jsx10(DocumentPreview, { blocks: preview.blocks, output: mathOutput })
10741
- }
10742
- )
10743
- ]
10744
- }
10745
- ),
10746
- debugEnabled ? /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__dev", children: [
10747
- debugEnabled && documentNode.diagnostics.length > 0 ? /* @__PURE__ */ jsxs8(Fragment4, { children: [
10748
- /* @__PURE__ */ jsx10("strong", { children: "\u062A\u0646\u0628\u064A\u0647\u0627\u062A \u0627\u0644\u0627\u0633\u062A\u064A\u0631\u0627\u062F (\u0648\u0636\u0639 \u0627\u0644\u062A\u0637\u0648\u064A\u0631)" }),
10749
- documentNode.diagnostics.map((diagnostic) => /* @__PURE__ */ jsx10("p", { className: "butex-document2-widget__dev-diagnostic", children: formatDocument2DiagnosticArabic(diagnostic) }, `${diagnostic.path}-${diagnostic.message}`))
10750
- ] }) : null,
10751
- /* @__PURE__ */ jsx10("strong", { children: "LaTeX" }),
10752
- /* @__PURE__ */ jsx10("pre", { children: latex }),
10753
- /* @__PURE__ */ jsx10("strong", { children: "AST" }),
10754
- /* @__PURE__ */ jsx10("pre", { children: JSON.stringify(documentNode, null, 2) })
10755
- ] }) : null,
10756
- selectedMath ? /* @__PURE__ */ jsx10(
10757
- EquationDrawer,
10758
- {
10759
- session: selectedMath.session,
10760
- reason: selectedMath.reason,
10761
- mathMode: selectedMath.mathMode,
10762
- canDelete: Boolean(selectedMath.tokenId),
10763
- onMathModeChange: (mode) => setSelectedMath((current) => current ? { ...current, mathMode: mode } : current),
10764
- onClose: () => setSelectedMath(null),
10765
- onSave: saveEquation,
10766
- onDelete: deleteSelectedEquation
10767
- }
10768
- ) : null
10769
- ] }) });
11419
+ /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.panels, children: [
11420
+ /* @__PURE__ */ jsx10("button", { type: "button", "aria-pressed": editorOpen, onClick: toggleEditorPanel, children: editorOpen ? messages.hideEditor : messages.editor }),
11421
+ /* @__PURE__ */ jsx10("button", { type: "button", "aria-pressed": previewOpen, onClick: togglePreviewPanel, children: previewOpen ? messages.hidePreview : messages.preview })
11422
+ ] }),
11423
+ /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.collapseBlocks, children: [
11424
+ /* @__PURE__ */ jsx10("button", { type: "button", onClick: collapseAllBlocks, children: messages.collapseAll }),
11425
+ /* @__PURE__ */ jsx10("button", { type: "button", onClick: openAllBlocks, children: messages.openAll })
11426
+ ] })
11427
+ ] }),
11428
+ error ? /* @__PURE__ */ jsx10("p", { className: "butex-document2-widget__error", children: error }) : null,
11429
+ /* @__PURE__ */ jsxs8(
11430
+ "div",
11431
+ {
11432
+ className: `butex-document2-widget__layout butex-document2-widget__layout--editor-${editorOpen ? "open" : "closed"} butex-document2-widget__layout--preview-${previewOpen ? "open" : "closed"}`,
11433
+ children: [
11434
+ /* @__PURE__ */ jsx10(
11435
+ "section",
11436
+ {
11437
+ className: "butex-document2-widget__panel butex-document2-widget__editor-panel",
11438
+ "aria-label": messages.documentEditor,
11439
+ "aria-hidden": !editorOpen,
11440
+ children: /* @__PURE__ */ jsx10("div", { className: "butex-document2-widget__blocks", children: documentNode.blocks.map((block, blockIndex) => /* @__PURE__ */ jsx10(
11441
+ BlockEditor,
11442
+ {
11443
+ block,
11444
+ blockIndex,
11445
+ blockCount: documentNode.blocks.length,
11446
+ documentDirection,
11447
+ mathOutput,
11448
+ equationSide,
11449
+ editableEquations,
11450
+ uiLocale,
11451
+ isCollapsed: collapsedBlockIds.has(block.id),
11452
+ onTextChange: (fieldId, tokenId, text) => applyDocument(updateTextToken(documentRef.current, fieldId, tokenId, text), "text"),
11453
+ onOpenMath: openMath,
11454
+ onDeleteMath: editableEquations ? deleteMathToken : void 0,
11455
+ onRemoveBlock: (blockId) => applyDocument(removeDocument2BlockById(documentRef.current, blockId), "immediate"),
11456
+ onMoveBlock: (blockId, direction) => applyDocument(moveDocument2BlockById(documentRef.current, blockId, direction), "immediate"),
11457
+ onToggleCollapse: toggleBlockCollapse,
11458
+ onBlockFocus: rememberBlockFocus,
11459
+ onFieldFocus: rememberFieldFocus,
11460
+ onMathFocus: rememberMathFocus,
11461
+ onFieldBlur,
11462
+ onImageSrcChange: (blockId, value) => applyDocument(updateDocument2ImageValue(documentRef.current, blockId, value), "text"),
11463
+ onAddListItem: (listBlockId) => applyDocument(addDocument2ListItem(documentRef.current, listBlockId), "immediate"),
11464
+ onRemoveListItem: (listBlockId, itemId) => applyDocument(removeDocument2ListItem(documentRef.current, listBlockId, itemId), "immediate")
11465
+ },
11466
+ block.id
11467
+ )) })
11468
+ }
11469
+ ),
11470
+ /* @__PURE__ */ jsx10(
11471
+ "section",
11472
+ {
11473
+ className: "butex-document2-widget__panel butex-document2-widget__preview-panel",
11474
+ "aria-label": messages.documentPreview,
11475
+ "aria-hidden": !previewOpen,
11476
+ children: /* @__PURE__ */ jsx10(DocumentPreview, { blocks: preview.blocks, output: mathOutput, documentDirection, uiLocale })
11477
+ }
11478
+ )
11479
+ ]
11480
+ }
11481
+ ),
11482
+ debugEnabled ? /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__dev", children: [
11483
+ debugEnabled && documentNode.diagnostics.length > 0 ? /* @__PURE__ */ jsxs8(Fragment4, { children: [
11484
+ /* @__PURE__ */ jsx10("strong", { children: messages.importWarnings }),
11485
+ documentNode.diagnostics.map((diagnostic) => /* @__PURE__ */ jsx10("p", { className: "butex-document2-widget__dev-diagnostic", children: formatDocument2Diagnostic(diagnostic, messages) }, `${diagnostic.path}-${diagnostic.message}`))
11486
+ ] }) : null,
11487
+ /* @__PURE__ */ jsx10("strong", { children: "LaTeX" }),
11488
+ /* @__PURE__ */ jsx10("pre", { children: latex }),
11489
+ /* @__PURE__ */ jsx10("strong", { children: "AST" }),
11490
+ /* @__PURE__ */ jsx10("pre", { children: JSON.stringify(documentNode, null, 2) })
11491
+ ] }) : null,
11492
+ selectedMath ? /* @__PURE__ */ jsx10(
11493
+ EquationDrawer,
11494
+ {
11495
+ session: selectedMath.session,
11496
+ reason: selectedMath.reason,
11497
+ mathMode: selectedMath.mathMode,
11498
+ canDelete: Boolean(selectedMath.tokenId),
11499
+ equationSide,
11500
+ uiLocale,
11501
+ onMathModeChange: (mode) => setSelectedMath((current) => current ? { ...current, mathMode: mode } : current),
11502
+ onClose: () => setSelectedMath(null),
11503
+ onSave: saveEquation,
11504
+ onDelete: deleteSelectedEquation
11505
+ }
11506
+ ) : null
11507
+ ] })
11508
+ }
11509
+ );
10770
11510
  }
10771
11511
  export {
10772
11512
  ButexDocumentEditor2,