@drghaliasri/butex 8.1.5 → 8.2.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.
@@ -11967,7 +11967,7 @@ function focusArticleMetaPanel(panel) {
11967
11967
  import { forwardRef as forwardRef3, useCallback as useCallback3, useRef as useRef16 } from "react";
11968
11968
 
11969
11969
  // src/react-document/ButexDocumentEditor.tsx
11970
- import { forwardRef as forwardRef2, useCallback as useCallback2, useEffect as useEffect13, useImperativeHandle as useImperativeHandle2, useMemo as useMemo2, useRef as useRef15, useState as useState14 } from "react";
11970
+ import { forwardRef as forwardRef2, useCallback as useCallback2, useEffect as useEffect13, useImperativeHandle as useImperativeHandle2, useMemo as useMemo2, useRef as useRef15, useState as useState15 } from "react";
11971
11971
 
11972
11972
  // src/debugJson.ts
11973
11973
  function lineColumnForPosition(text, position) {
@@ -14257,18 +14257,674 @@ function DocumentInsertToolbar({
14257
14257
  }
14258
14258
 
14259
14259
  // src/react-document/DocumentMobileToolbar.tsx
14260
- import { useId as useId2, useRef as useRef8, useState as useState7 } from "react";
14261
- import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
14262
- var DIGIT_FORMS2 = ["western", "arabicIndic", "persianIndic"];
14263
- function digitFormLabel2(digitForm) {
14264
- if (digitForm === "arabicIndic") {
14265
- return "\u0664\u0665\u0666";
14260
+ import { useId as useId2, useRef as useRef8, useState as useState8 } from "react";
14261
+
14262
+ // src/react/mobileCommandUi.tsx
14263
+ import { useLayoutEffect as useLayoutEffect2 } from "react";
14264
+
14265
+ // src/react/mobileCommandPortal.tsx
14266
+ import { useLayoutEffect, useState as useState7 } from "react";
14267
+ import { createPortal } from "react-dom";
14268
+
14269
+ // src/react/visibleViewport.ts
14270
+ function positiveFinite(value, fallback) {
14271
+ return Number.isFinite(value) && value > 0 ? value : fallback;
14272
+ }
14273
+ function finiteOffset(value) {
14274
+ return Number.isFinite(value) ? value : 0;
14275
+ }
14276
+ function visibleViewportSnapshot(view) {
14277
+ const fallbackWidth = positiveFinite(view.innerWidth, 1);
14278
+ const fallbackHeight = positiveFinite(view.innerHeight, 1);
14279
+ const visualViewport = view.visualViewport;
14280
+ if (visualViewport && Number.isFinite(visualViewport.width) && visualViewport.width > 0 && Number.isFinite(visualViewport.height) && visualViewport.height > 0) {
14281
+ return {
14282
+ width: visualViewport.width,
14283
+ height: visualViewport.height,
14284
+ offsetLeft: finiteOffset(visualViewport.offsetLeft),
14285
+ offsetTop: finiteOffset(visualViewport.offsetTop),
14286
+ scale: positiveFinite(visualViewport.scale, 1),
14287
+ source: "visual-viewport"
14288
+ };
14266
14289
  }
14267
- if (digitForm === "persianIndic") {
14268
- return "\u06F4\u06F5\u06F6";
14290
+ return {
14291
+ width: fallbackWidth,
14292
+ height: fallbackHeight,
14293
+ offsetLeft: 0,
14294
+ offsetTop: 0,
14295
+ scale: 1,
14296
+ source: "layout-viewport"
14297
+ };
14298
+ }
14299
+ function reasonPriority(reason) {
14300
+ if (reason === "orientation") return 3;
14301
+ if (reason === "resize") return 2;
14302
+ if (reason === "scroll") return 1;
14303
+ return 0;
14304
+ }
14305
+ function observeVisibleViewport(view, onChange) {
14306
+ let previous = visibleViewportSnapshot(view);
14307
+ let frame = null;
14308
+ let pendingReason = "scroll";
14309
+ onChange({
14310
+ snapshot: previous,
14311
+ initial: true,
14312
+ sizeChanged: false,
14313
+ offsetChanged: false,
14314
+ reason: "initial"
14315
+ });
14316
+ const emit = () => {
14317
+ frame = null;
14318
+ const next = visibleViewportSnapshot(view);
14319
+ const sizeChanged = next.width !== previous.width || next.height !== previous.height || next.scale !== previous.scale || next.source !== previous.source;
14320
+ const offsetChanged = next.offsetLeft !== previous.offsetLeft || next.offsetTop !== previous.offsetTop;
14321
+ const reason = pendingReason;
14322
+ pendingReason = "scroll";
14323
+ previous = next;
14324
+ onChange({ snapshot: next, initial: false, sizeChanged, offsetChanged, reason });
14325
+ };
14326
+ const schedule = (reason) => {
14327
+ if (reasonPriority(reason) > reasonPriority(pendingReason)) {
14328
+ pendingReason = reason;
14329
+ }
14330
+ if (frame !== null) {
14331
+ return;
14332
+ }
14333
+ frame = view.requestAnimationFrame(emit);
14334
+ };
14335
+ const onResize = () => schedule("resize");
14336
+ const onScroll = () => schedule("scroll");
14337
+ const onOrientation = () => schedule("orientation");
14338
+ const visualViewport = view.visualViewport;
14339
+ visualViewport?.addEventListener("resize", onResize);
14340
+ visualViewport?.addEventListener("scroll", onScroll);
14341
+ view.addEventListener("resize", onResize);
14342
+ view.addEventListener("orientationchange", onOrientation);
14343
+ return () => {
14344
+ visualViewport?.removeEventListener("resize", onResize);
14345
+ visualViewport?.removeEventListener("scroll", onScroll);
14346
+ view.removeEventListener("resize", onResize);
14347
+ view.removeEventListener("orientationchange", onOrientation);
14348
+ if (frame !== null) {
14349
+ view.cancelAnimationFrame(frame);
14350
+ frame = null;
14351
+ }
14352
+ };
14353
+ }
14354
+
14355
+ // src/react/mobileCommandPortal.tsx
14356
+ var scrollLocks = /* @__PURE__ */ new WeakMap();
14357
+ function lockBackground(doc) {
14358
+ let lock = scrollLocks.get(doc);
14359
+ if (!lock) {
14360
+ lock = {
14361
+ count: 0,
14362
+ overflow: doc.body.style.overflow,
14363
+ overscroll: doc.documentElement.style.overscrollBehavior
14364
+ };
14365
+ scrollLocks.set(doc, lock);
14366
+ doc.body.style.overflow = "hidden";
14367
+ doc.documentElement.style.overscrollBehavior = "none";
14269
14368
  }
14270
- return "456";
14369
+ lock.count += 1;
14370
+ return () => {
14371
+ if (!lock) return;
14372
+ lock.count -= 1;
14373
+ if (lock.count === 0) {
14374
+ doc.body.style.overflow = lock.overflow;
14375
+ doc.documentElement.style.overscrollBehavior = lock.overscroll;
14376
+ scrollLocks.delete(doc);
14377
+ }
14378
+ };
14379
+ }
14380
+ function ViewportModalPortal({ sourceRef, scopeClassName, children }) {
14381
+ const [host, setHost] = useState7(null);
14382
+ useLayoutEffect(() => {
14383
+ const doc = sourceRef?.current?.ownerDocument ?? document;
14384
+ const source = sourceRef?.current?.closest(`.${scopeClassName}`) ?? doc.documentElement;
14385
+ const view = doc.defaultView;
14386
+ if (!view) return;
14387
+ const computed = view.getComputedStyle(source);
14388
+ const layer = doc.createElement("div");
14389
+ layer.className = `${scopeClassName} butex-mobile-command-portal`;
14390
+ layer.dataset.responsiveMode = source.dataset.responsiveMode ?? "auto";
14391
+ layer.dir = source.dir || computed.direction;
14392
+ layer.lang = source.lang || doc.documentElement.lang;
14393
+ for (let i = 0; i < computed.length; i += 1) {
14394
+ const name = computed.item(i);
14395
+ if (name.startsWith("--")) layer.style.setProperty(name, computed.getPropertyValue(name));
14396
+ }
14397
+ layer.style.fontFamily = computed.fontFamily;
14398
+ layer.style.fontSize = computed.fontSize;
14399
+ layer.style.lineHeight = computed.lineHeight;
14400
+ layer.style.color = computed.color;
14401
+ layer.style.direction = computed.direction;
14402
+ layer.style.position = "fixed";
14403
+ layer.style.inset = "auto";
14404
+ layer.style.maxWidth = "none";
14405
+ layer.style.minWidth = "0";
14406
+ layer.style.containerType = "normal";
14407
+ layer.style.contain = "none";
14408
+ layer.style.isolation = "isolate";
14409
+ layer.style.zIndex = "2147483000";
14410
+ const stopObserving = observeVisibleViewport(view, ({ snapshot }) => {
14411
+ layer.style.left = `${String(snapshot.offsetLeft)}px`;
14412
+ layer.style.top = `${String(snapshot.offsetTop)}px`;
14413
+ layer.style.width = `${String(snapshot.width)}px`;
14414
+ layer.style.height = `${String(snapshot.height)}px`;
14415
+ });
14416
+ doc.body.appendChild(layer);
14417
+ const unlock = lockBackground(doc);
14418
+ setHost(layer);
14419
+ return () => {
14420
+ stopObserving();
14421
+ unlock();
14422
+ layer.remove();
14423
+ };
14424
+ }, [sourceRef, scopeClassName]);
14425
+ return host ? createPortal(children, host) : null;
14426
+ }
14427
+ var mobileCommandBackdropStyle = { position: "absolute" };
14428
+ var mobileCommandSheetStyle = { maxHeight: "min(720px, 100%)" };
14429
+ var MobileCommandPortal = ViewportModalPortal;
14430
+
14431
+ // src/react/mobileCommandCss.ts
14432
+ var MOBILE_COMMAND_CSS = String.raw`
14433
+ /* A single visual language for document and equation command portals (mobile only). */
14434
+ .butex-document-widget.butex-mobile-command-portal {
14435
+ --butex-mobile-panel: var(--butex-document-panel);
14436
+ --butex-mobile-fg: var(--butex-document-fg);
14437
+ --butex-mobile-muted: var(--butex-document-muted);
14438
+ --butex-mobile-border: var(--butex-document-border);
14439
+ --butex-mobile-accent: var(--butex-document-accent);
14440
+ --butex-mobile-soft: var(--butex-document-accent-bg);
14441
+ --butex-mobile-danger: var(--butex-document-danger);
14442
+ }
14443
+ .butex-widget.butex-mobile-command-portal {
14444
+ --butex-mobile-panel: var(--butex-panel);
14445
+ --butex-mobile-fg: var(--butex-fg);
14446
+ --butex-mobile-muted: var(--butex-muted);
14447
+ --butex-mobile-border: var(--butex-border);
14448
+ --butex-mobile-accent: var(--butex-accent);
14449
+ --butex-mobile-soft: var(--butex-toolbar-hover-bg);
14450
+ --butex-mobile-danger: var(--butex-danger);
14451
+ }
14452
+ .butex-mobile-command-portal .butex-mobile-sheet__backdrop {
14453
+ display: flex;
14454
+ align-items: flex-end;
14455
+ justify-content: center;
14456
+ inset: 0;
14457
+ padding: max(10px, var(--butex-safe-area-top, env(safe-area-inset-top, 0px)))
14458
+ max(8px, var(--butex-safe-area-right, env(safe-area-inset-right, 0px)))
14459
+ var(--butex-safe-area-bottom, env(safe-area-inset-bottom, 0px))
14460
+ max(8px, var(--butex-safe-area-left, env(safe-area-inset-left, 0px)));
14461
+ background: color-mix(in srgb, #0f172a 40%, transparent);
14462
+ z-index: 1;
14463
+ }
14464
+ .butex-mobile-command-portal .butex-mobile-sheet__panel {
14465
+ display: grid;
14466
+ grid-template-rows: auto minmax(0, 1fr);
14467
+ width: 100%;
14468
+ max-width: 620px;
14469
+ min-height: 0;
14470
+ min-width: 0;
14471
+ overflow: hidden;
14472
+ border: 1px solid var(--butex-mobile-border);
14473
+ border-block-end: 0;
14474
+ border-radius: 20px 20px 0 0;
14475
+ background: var(--butex-mobile-panel);
14476
+ color: var(--butex-mobile-fg);
14477
+ box-shadow: 0 -20px 60px color-mix(in srgb, #0f172a 24%, transparent);
14478
+ }
14479
+ .butex-mobile-command-portal .butex-mobile-sheet__header {
14480
+ display: grid;
14481
+ grid-template-columns: minmax(64px, 1fr) minmax(0, 2fr) minmax(44px, 1fr);
14482
+ gap: 8px;
14483
+ align-items: center;
14484
+ min-height: 66px;
14485
+ padding: 11px 16px 9px;
14486
+ text-align: center;
14487
+ background: var(--butex-mobile-panel);
14488
+ border-block-end: 1px solid var(--butex-mobile-border);
14489
+ }
14490
+ .butex-mobile-command-portal .butex-mobile-sheet__header strong {
14491
+ display: block;
14492
+ font-size: 1.18rem;
14493
+ font-weight: 750;
14494
+ line-height: 1.45;
14495
+ overflow-wrap: anywhere;
14496
+ }
14497
+ .butex-mobile-command-portal .butex-mobile-sheet__header-spacer { display: block; }
14498
+ .butex-mobile-command-portal .butex-mobile-sheet__back,
14499
+ .butex-mobile-command-portal .butex-mobile-sheet__close {
14500
+ display: inline-flex;
14501
+ align-items: center;
14502
+ justify-content: center;
14503
+ gap: 5px;
14504
+ min-height: 44px;
14505
+ min-width: 44px;
14506
+ padding: 6px;
14507
+ border-radius: 11px;
14508
+ border: 1px solid transparent;
14509
+ background: transparent;
14510
+ color: var(--butex-mobile-fg);
14511
+ cursor: pointer;
14512
+ font: inherit;
14513
+ font-size: .88rem;
14514
+ }
14515
+ .butex-mobile-command-portal .butex-mobile-sheet__back { justify-self: start; }
14516
+ .butex-mobile-command-portal .butex-mobile-sheet__close {
14517
+ justify-self: end;
14518
+ background: var(--butex-mobile-soft);
14519
+ }
14520
+ .butex-mobile-command-portal .butex-mobile-sheet__body {
14521
+ display: grid;
14522
+ align-content: start;
14523
+ gap: 16px;
14524
+ min-height: 0;
14525
+ min-width: 0;
14526
+ overflow-y: auto;
14527
+ overscroll-behavior: contain;
14528
+ scrollbar-width: thin;
14529
+ padding: 16px clamp(12px, 3vw, 20px) max(20px, var(--butex-safe-area-bottom, env(safe-area-inset-bottom, 0px)));
14530
+ }
14531
+ .butex-mobile-command-portal .butex-mobile-command__section {
14532
+ display: grid;
14533
+ min-width: 0;
14534
+ gap: 10px;
14535
+ padding-block-end: 15px;
14536
+ border-block-end: 1px solid color-mix(in srgb, var(--butex-mobile-border) 74%, transparent);
14537
+ }
14538
+ .butex-mobile-command-portal .butex-mobile-command__section:last-child { border-block-end: 0; padding-block-end: 0; }
14539
+ .butex-mobile-command-portal .butex-mobile-command__section-title {
14540
+ margin: 0;
14541
+ display: flex;
14542
+ align-items: center;
14543
+ gap: 9px;
14544
+ color: var(--butex-mobile-fg);
14545
+ font-size: 1.08rem;
14546
+ font-weight: 750;
14547
+ line-height: 1.55;
14548
+ }
14549
+ .butex-mobile-command-portal .butex-mobile-command__section-title > svg {
14550
+ color: var(--butex-mobile-accent);
14551
+ flex: none;
14552
+ }
14553
+ .butex-mobile-command-portal .butex-mobile-command__grid {
14554
+ display: grid;
14555
+ grid-template-columns: repeat(2, minmax(0, 1fr));
14556
+ gap: 8px;
14557
+ min-width: 0;
14558
+ }
14559
+ .butex-mobile-command-portal .butex-mobile-command__grid--dense {
14560
+ grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
14561
+ }
14562
+ .butex-mobile-command-portal .butex-mobile-command__choice-row {
14563
+ display: grid;
14564
+ grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
14565
+ gap: 8px;
14566
+ min-width: 0;
14567
+ }
14568
+ .butex-mobile-command-portal .butex-mobile-command__choice {
14569
+ min-height: 44px;
14570
+ min-width: 0;
14571
+ padding: 7px 10px;
14572
+ border: 1px solid var(--butex-mobile-border);
14573
+ border-radius: 10px;
14574
+ background: var(--butex-mobile-panel);
14575
+ color: var(--butex-mobile-fg);
14576
+ text-align: center;
14577
+ font: inherit;
14578
+ font-size: .91rem;
14579
+ cursor: pointer;
14580
+ }
14581
+ .butex-mobile-command-portal .butex-mobile-command__choice[aria-pressed="true"] {
14582
+ background: var(--butex-mobile-soft);
14583
+ border-color: var(--butex-mobile-accent);
14584
+ }
14585
+ .butex-mobile-command-portal .butex-mobile-sheet__panel .butex-mobile-command__action,
14586
+ .butex-mobile-command-portal .butex-mobile-sheet__panel .butex-mobile-command__category {
14587
+ display: flex;
14588
+ align-items: center;
14589
+ justify-content: flex-start;
14590
+ gap: 10px;
14591
+ min-height: 48px;
14592
+ min-width: 0;
14593
+ width: 100%;
14594
+ text-align: start;
14595
+ padding: 9px 11px;
14596
+ border: 1px solid var(--butex-mobile-border);
14597
+ border-radius: 12px;
14598
+ background: var(--butex-mobile-panel);
14599
+ color: var(--butex-mobile-fg);
14600
+ cursor: pointer;
14601
+ font: inherit;
14602
+ font-size: 1rem;
14603
+ font-weight: 560;
14604
+ line-height: 1.5;
14605
+ white-space: normal;
14606
+ overflow-wrap: anywhere;
14607
+ }
14608
+ .butex-mobile-command-portal .butex-mobile-command__action .butex-mobile-command__icon {
14609
+ flex: 0 0 20px;
14610
+ color: var(--butex-mobile-accent);
14611
+ }
14612
+ .butex-mobile-command-portal .butex-mobile-command__action-label {
14613
+ flex: 1 1 0;
14614
+ min-width: 0;
14615
+ }
14616
+ .butex-mobile-command-portal .butex-mobile-command__action--danger { color: var(--butex-mobile-danger); }
14617
+ .butex-mobile-command-portal .butex-mobile-command__action--danger svg { color: currentColor; }
14618
+ .butex-mobile-command-portal .butex-mobile-command__category {
14619
+ min-height: 64px;
14620
+ padding: 10px 12px;
14621
+ font-weight: 680;
14622
+ background: color-mix(in srgb, var(--butex-mobile-panel) 94%, var(--butex-mobile-accent));
14623
+ }
14624
+ .butex-mobile-command-portal .butex-mobile-command__category-icon {
14625
+ display: inline-flex;
14626
+ align-items: center;
14627
+ justify-content: center;
14628
+ width: 36px;
14629
+ height: 36px;
14630
+ flex: 0 0 36px;
14631
+ border-radius: 10px;
14632
+ background: var(--butex-mobile-soft);
14633
+ color: var(--butex-mobile-accent);
14634
+ }
14635
+ .butex-mobile-command-portal .butex-mobile-command__category-label { flex: 1; min-width: 0; }
14636
+ .butex-mobile-command-portal .butex-mobile-command__category > svg { color: var(--butex-mobile-muted); flex: 0 0 auto; }
14637
+ .butex-mobile-command-portal[dir="rtl"] .butex-mobile-command__category > svg,
14638
+ .butex-mobile-command-portal[dir="rtl"] .butex-mobile-sheet__back > svg { transform: scaleX(-1); }
14639
+ .butex-mobile-command-portal .butex-mobile-command__action[aria-pressed="true"],
14640
+ .butex-mobile-command-portal .butex-mobile-command__action[aria-selected="true"],
14641
+ .butex-mobile-command-portal .butex-mobile-command__category[aria-pressed="true"] {
14642
+ border-color: var(--butex-mobile-accent);
14643
+ background: var(--butex-mobile-soft);
14644
+ }
14645
+ .butex-mobile-command-portal .butex-mobile-command__action:disabled,
14646
+ .butex-mobile-command-portal .butex-mobile-command__category:disabled { opacity: .45; cursor: not-allowed; }
14647
+ .butex-mobile-command-portal .butex-mobile-command__action:focus-visible,
14648
+ .butex-mobile-command-portal .butex-mobile-command__category:focus-visible,
14649
+ .butex-mobile-command-portal .butex-mobile-sheet__back:focus-visible,
14650
+ .butex-mobile-command-portal .butex-mobile-sheet__close:focus-visible,
14651
+ .butex-mobile-command-portal .butex-mobile-sheet__body button:focus-visible {
14652
+ outline: 2px solid var(--butex-mobile-accent);
14653
+ outline-offset: 2px;
14654
+ }
14655
+ .butex-mobile-command-portal .butex-mobile-command__digits {
14656
+ display: grid; gap: 8px; padding-block-start: 4px;
14657
+ }
14658
+ .butex-mobile-command-portal .butex-widget__sheet-section {
14659
+ display: grid;
14660
+ gap: 10px;
14661
+ min-width: 0;
14662
+ padding-block: 3px 14px;
14663
+ border-block-end: 1px solid var(--butex-mobile-border);
14664
+ }
14665
+ .butex-mobile-command-portal .butex-widget__sheet-section h4 {
14666
+ margin: 0;
14667
+ font-size: 1rem;
14668
+ font-weight: 740;
14669
+ line-height: 1.5;
14670
+ color: var(--butex-mobile-fg);
14671
+ }
14672
+ .butex-mobile-command-portal .butex-widget__sheet-command-grid,
14673
+ .butex-mobile-command-portal .butex-widget__sheet-choice-row,
14674
+ .butex-mobile-command-portal .butex-widget__sheet-command-list {
14675
+ display: grid;
14676
+ gap: 8px;
14677
+ grid-template-columns: repeat(2, minmax(0, 1fr));
14678
+ min-width: 0;
14679
+ }
14680
+ .butex-mobile-command-portal .butex-widget__sheet-choice-row {
14681
+ grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
14682
+ }
14683
+ .butex-mobile-command-portal .butex-mobile-command__math-glyphs {
14684
+ display: grid;
14685
+ grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
14686
+ gap: 8px;
14687
+ }
14688
+ .butex-mobile-command-portal .butex-mobile-command__math-glyphs button {
14689
+ min-width: 0;
14690
+ min-height: 46px;
14691
+ justify-content: center;
14692
+ overflow-wrap: anywhere;
14693
+ }
14694
+ .butex-mobile-command-portal .butex-mobile-sheet__body > nav > .butex-mobile-command__grid {
14695
+ margin-top: 2px;
14696
+ }
14697
+ .butex-mobile-command-portal .butex-mobile-command__grid--dense > button {
14698
+ min-height: 48px; min-width: 0;
14699
+ text-align: center; overflow-wrap: anywhere;
14700
+ }
14701
+ .butex-mobile-command-portal .butex-widget__sheet-command-grid.butex-mobile-command__grid--dense {
14702
+ grid-template-columns: repeat(auto-fit, minmax(66px, 1fr));
14703
+ }
14704
+ .butex-mobile-command-portal .butex-mobile-command__section > .butex-widget__sheet-command-grid {
14705
+ margin-block-start: 0;
14706
+ }
14707
+ .butex-mobile-command-portal .butex-mobile-sheet__body button:not(.butex-mobile-command__action):not(.butex-mobile-command__category) {
14708
+ min-height: 44px;
14709
+ }
14710
+ .butex-mobile-command-portal .butex-mobile-sheet__body .butex-widget__sheet-command-grid,
14711
+ .butex-mobile-command-portal .butex-mobile-sheet__body .butex-widget__sheet-choice-row,
14712
+ .butex-mobile-command-portal .butex-mobile-sheet__body .butex-widget__sheet-command-list {
14713
+ min-width: 0;
14714
+ }
14715
+ @media (max-width: 430px) {
14716
+ .butex-mobile-command-portal .butex-mobile-sheet__panel { border-radius: 18px 18px 0 0; }
14717
+ .butex-mobile-command-portal .butex-mobile-sheet__header { padding-inline: 10px; }
14718
+ .butex-mobile-command-portal .butex-mobile-sheet__body { padding-inline: 12px; }
14719
+ }
14720
+ @media (hover: hover) {
14721
+ .butex-mobile-command-portal .butex-mobile-command__action:hover:not(:disabled),
14722
+ .butex-mobile-command-portal .butex-mobile-command__category:hover:not(:disabled),
14723
+ .butex-mobile-command-portal .butex-mobile-command__choice:hover:not(:disabled) {
14724
+ border-color: var(--butex-mobile-accent);
14725
+ background: color-mix(in srgb, var(--butex-mobile-panel) 94%, var(--butex-mobile-accent));
14726
+ }
14727
+ }
14728
+ @media (forced-colors: active) {
14729
+ .butex-mobile-command-portal .butex-mobile-command__action[aria-pressed="true"],
14730
+ .butex-mobile-command-portal .butex-mobile-command__category[aria-pressed="true"] { outline: 2px solid Highlight; }
14731
+ }
14732
+ @media (prefers-reduced-motion: reduce) {
14733
+ .butex-mobile-command-portal .butex-mobile-sheet__panel,
14734
+ .butex-mobile-command-portal .butex-mobile-sheet__body,
14735
+ .butex-mobile-command-portal .butex-mobile-sheet__body button { animation: none; transition: none; scroll-behavior: auto; }
14736
+ }
14737
+ `.trim();
14738
+ var STYLE_ID = "butex-mobile-command-ui-css";
14739
+ function injectMobileCommandCss(doc) {
14740
+ if (doc.getElementById(STYLE_ID)) return;
14741
+ const style = doc.createElement("style");
14742
+ style.id = STYLE_ID;
14743
+ style.textContent = MOBILE_COMMAND_CSS;
14744
+ doc.head.appendChild(style);
14745
+ }
14746
+
14747
+ // src/react/mobileCommandUi.tsx
14748
+ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
14749
+ var MOBILE_DIGIT_CHOICES = [
14750
+ { id: "western", label: "456" },
14751
+ { id: "arabicIndic", label: "\u0664\u0665\u0666" },
14752
+ { id: "persianIndic", label: "\u06F4\u06F5\u06F6" }
14753
+ ];
14754
+ var iconPaths = {
14755
+ bold: "M7 4h6a4 4 0 0 1 0 8H7zm0 8h7a4 4 0 0 1 0 8H7z",
14756
+ italic: "M14 4h6M4 20h6M15 4 9 20",
14757
+ underline: "M6 4v7a6 6 0 0 0 12 0V4M4 21h16",
14758
+ heading: "M4 5v14M14 5v14M4 12h10M18 7h3v12",
14759
+ paragraph: "M19 4H9a5 5 0 0 0 0 10h3v6M16 4v16",
14760
+ math: "M18 5H6l6 7-6 7h12",
14761
+ table: "M4 5h16v14H4zM4 10h16M4 15h16M10 5v14",
14762
+ image: "M4 5h16v14H4zM7 15l4-4 3 3 2-2 4 4M9 9h.01",
14763
+ list: "M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01",
14764
+ "ordered-list": "M9 6h11M9 12h11M9 18h11M3 4h2v5M3 15h2l-2 3h2",
14765
+ citation: "M9 5H4v7h5v5H4M20 5h-5v7h5v5h-5",
14766
+ reference: "M5 4h14v16l-7-4-7 4z",
14767
+ book: "M5 4h7v16H5a2 2 0 0 0-2 2V6a2 2 0 0 1 2-2zm7 0h7a2 2 0 0 1 2 2v16a2 2 0 0 0-2-2h-7",
14768
+ collapse: "M5 9l7-6 7 6M5 15l7-6 7 6M4 21h16",
14769
+ expand: "M5 6l7 6 7-6M5 12l7 6 7-6",
14770
+ up: "M12 20V4M5 11l7-7 7 7",
14771
+ down: "M12 4v16M5 13l7 7 7-7",
14772
+ trash: "M4 7h16M9 7V4h6v3M7 7l1 13h8l1-13M10 11v6M14 11v6",
14773
+ structure: "M12 3v6M5 9h14M5 9v5M19 9v5M2 14h6v6H2zM16 14h6v6h-6z",
14774
+ functions: "M4 20c5-4 3-12 8-16M6 10h11M17 9l5 9M22 9l-5 9",
14775
+ operators: "M4 8h8M8 4v8M16 8h6M16 16h6M16 20h6",
14776
+ matrices: "M7 4H4v16h3M17 4h3v16h-3M10 7h.01M14 7h.01M10 12h.01M14 12h.01M10 17h.01M14 17h.01",
14777
+ typography: "M3 6V4h18v2M12 4v16M8 20h8",
14778
+ spacing: "M4 7v10M20 7v10M7 12h10M10 9l-3 3 3 3M14 9l3 3-3 3",
14779
+ digits: "M4 7h4v10M13 7h7v5h-7v5h7",
14780
+ copy: "M8 8h12v13H8zM5 17H4V4h12v1",
14781
+ cut: "M4 6l16 12M20 6 4 18M7 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0M7 18a2 2 0 1 1-4 0 2 2 0 0 1 4 0",
14782
+ paste: "M9 4h6l1 3H8zM7 6H5v15h14V6h-2M9 13h6M9 17h5",
14783
+ chevron: "M9 5l6 7-6 7",
14784
+ back: "M19 12H5M12 5l-7 7 7 7",
14785
+ close: "M5 5l14 14M19 5 5 19",
14786
+ fraction: "M5 12h14M8 4h8M8 20h8",
14787
+ delimiters: "M9 3c-5 4-5 14 0 18M15 3c5 4 5 14 0 18"
14788
+ };
14789
+ function MobileIcon({ name, size = 20 }) {
14790
+ return /* @__PURE__ */ jsx11(
14791
+ "svg",
14792
+ {
14793
+ "aria-hidden": "true",
14794
+ focusable: "false",
14795
+ className: "butex-mobile-command__icon",
14796
+ width: size,
14797
+ height: size,
14798
+ viewBox: "0 0 24 24",
14799
+ fill: "none",
14800
+ stroke: "currentColor",
14801
+ strokeWidth: "1.8",
14802
+ strokeLinecap: "round",
14803
+ strokeLinejoin: "round",
14804
+ children: /* @__PURE__ */ jsx11("path", { d: iconPaths[name] })
14805
+ }
14806
+ );
14807
+ }
14808
+ function MobileAction({ command }) {
14809
+ return /* @__PURE__ */ jsxs10(
14810
+ "button",
14811
+ {
14812
+ type: "button",
14813
+ className: "butex-mobile-command__action" + (command.danger ? " butex-mobile-command__action--danger" : ""),
14814
+ disabled: command.disabled,
14815
+ "aria-label": command.label,
14816
+ "aria-pressed": command.pressed,
14817
+ title: command.hint ?? command.label,
14818
+ onMouseDown: command.preserveSelection ? (event) => event.preventDefault() : void 0,
14819
+ onClick: command.onSelect,
14820
+ children: [
14821
+ /* @__PURE__ */ jsx11(MobileIcon, { name: command.icon }),
14822
+ /* @__PURE__ */ jsx11("span", { className: "butex-mobile-command__action-label", children: command.label })
14823
+ ]
14824
+ }
14825
+ );
14826
+ }
14827
+ function MobileSection({ title, icon, children, id }) {
14828
+ return /* @__PURE__ */ jsxs10("section", { className: "butex-mobile-command__section", "aria-label": id ? void 0 : title, "aria-labelledby": id, children: [
14829
+ /* @__PURE__ */ jsxs10("h3", { className: "butex-mobile-command__section-title", id, children: [
14830
+ icon ? /* @__PURE__ */ jsx11(MobileIcon, { name: icon, size: 18 }) : null,
14831
+ /* @__PURE__ */ jsx11("span", { children: title })
14832
+ ] }),
14833
+ children
14834
+ ] });
14835
+ }
14836
+ function MobileGrid({ children, dense = false, className = "" }) {
14837
+ return /* @__PURE__ */ jsx11("div", { className: "butex-mobile-command__grid" + (dense ? " butex-mobile-command__grid--dense" : "") + (className ? " " + className : ""), children });
14838
+ }
14839
+ function MobileChoice({ label, title, pressed, onClick, disabled, className = "" }) {
14840
+ return /* @__PURE__ */ jsx11(
14841
+ "button",
14842
+ {
14843
+ type: "button",
14844
+ className: "butex-mobile-command__choice " + className,
14845
+ title,
14846
+ "aria-pressed": pressed,
14847
+ disabled,
14848
+ onClick,
14849
+ children: label
14850
+ }
14851
+ );
14852
+ }
14853
+ function MobileCategory({ label, icon, onClick }) {
14854
+ return /* @__PURE__ */ jsxs10("button", { type: "button", className: "butex-mobile-command__category", onClick, children: [
14855
+ /* @__PURE__ */ jsx11("span", { className: "butex-mobile-command__category-icon", children: /* @__PURE__ */ jsx11(MobileIcon, { name: icon }) }),
14856
+ /* @__PURE__ */ jsx11("span", { className: "butex-mobile-command__category-label", children: label }),
14857
+ /* @__PURE__ */ jsx11(MobileIcon, { name: "chevron", size: 16 })
14858
+ ] });
14859
+ }
14860
+ function MobileCommandSheet({
14861
+ scope,
14862
+ sourceRef,
14863
+ dialogRef,
14864
+ titleId,
14865
+ title,
14866
+ closeLabel,
14867
+ onClose,
14868
+ backLabel,
14869
+ onBack,
14870
+ backRef,
14871
+ bodyClassName,
14872
+ children
14873
+ }) {
14874
+ useLayoutEffect2(() => {
14875
+ const doc = sourceRef.current?.ownerDocument ?? document;
14876
+ injectMobileCommandCss(doc);
14877
+ }, [sourceRef]);
14878
+ const stopBackdropClick = (event) => {
14879
+ if (event.currentTarget === event.target) onClose();
14880
+ };
14881
+ return /* @__PURE__ */ jsx11(MobileCommandPortal, { sourceRef, scopeClassName: scope, children: /* @__PURE__ */ jsx11(
14882
+ "div",
14883
+ {
14884
+ className: scope + "__command-sheet-backdrop butex-mobile-sheet__backdrop",
14885
+ style: mobileCommandBackdropStyle,
14886
+ role: "presentation",
14887
+ onClick: stopBackdropClick,
14888
+ children: /* @__PURE__ */ jsxs10(
14889
+ "section",
14890
+ {
14891
+ ref: dialogRef,
14892
+ className: scope + "__command-sheet butex-mobile-sheet__panel",
14893
+ style: mobileCommandSheetStyle,
14894
+ role: "dialog",
14895
+ "aria-modal": "true",
14896
+ "aria-labelledby": titleId,
14897
+ tabIndex: -1,
14898
+ children: [
14899
+ /* @__PURE__ */ jsxs10("header", { className: scope + "__command-sheet-header butex-mobile-sheet__header", children: [
14900
+ onBack ? /* @__PURE__ */ jsxs10("button", { type: "button", className: "butex-mobile-sheet__back", ref: backRef, onClick: onBack, children: [
14901
+ /* @__PURE__ */ jsx11(MobileIcon, { name: "back", size: 18 }),
14902
+ /* @__PURE__ */ jsx11("span", { children: backLabel })
14903
+ ] }) : /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", className: "butex-mobile-sheet__header-spacer" }),
14904
+ /* @__PURE__ */ jsx11("strong", { id: titleId, children: title }),
14905
+ /* @__PURE__ */ jsx11(
14906
+ "button",
14907
+ {
14908
+ type: "button",
14909
+ className: "butex-mobile-sheet__close",
14910
+ "data-dialog-initial-focus": true,
14911
+ "aria-label": closeLabel,
14912
+ title: closeLabel,
14913
+ onClick: onClose,
14914
+ children: /* @__PURE__ */ jsx11(MobileIcon, { name: "close", size: 19 })
14915
+ }
14916
+ )
14917
+ ] }),
14918
+ /* @__PURE__ */ jsx11("div", { className: scope + "__command-sheet-body butex-mobile-sheet__body" + (bodyClassName ? " " + bodyClassName : ""), children })
14919
+ ]
14920
+ }
14921
+ )
14922
+ }
14923
+ ) });
14271
14924
  }
14925
+
14926
+ // src/react-document/DocumentMobileToolbar.tsx
14927
+ import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
14272
14928
  function DocumentMobileToolbar({
14273
14929
  mode = "article",
14274
14930
  mobileView,
@@ -14310,10 +14966,10 @@ function DocumentMobileToolbar({
14310
14966
  onOpenAll
14311
14967
  }) {
14312
14968
  const messages = documentMessages(uiLocale);
14313
- const [sheetOpen, setSheetOpen] = useState7(false);
14314
- const [sheetView, setSheetView] = useState7("commands");
14315
- const [rows, setRows] = useState7("3");
14316
- const [cols, setCols] = useState7("3");
14969
+ const [sheetOpen, setSheetOpen] = useState8(false);
14970
+ const [sheetView, setSheetView] = useState8("commands");
14971
+ const [rows, setRows] = useState8("3");
14972
+ const [cols, setCols] = useState8("3");
14317
14973
  const triggerRef = useRef8(null);
14318
14974
  const dialogRef = useRef8(null);
14319
14975
  const titleId = useId2();
@@ -14344,10 +15000,93 @@ function DocumentMobileToolbar({
14344
15000
  return messages.westernDigits;
14345
15001
  }
14346
15002
  const showContextRow = selectionCount > 0 || canFormatText;
14347
- return /* @__PURE__ */ jsxs10("div", { className: "butex-document-widget__mobile-toolbar", children: [
14348
- /* @__PURE__ */ jsxs10("div", { className: "butex-document-widget__mobile-toolbar-primary", children: [
14349
- /* @__PURE__ */ jsxs10("div", { className: "butex-document-widget__mobile-view", role: "group", "aria-label": messages.mobileViews, children: [
14350
- /* @__PURE__ */ jsx11(
15003
+ const formatStyles = ["bold", "italic", "underline"];
15004
+ const formatIcons = { bold: "bold", italic: "italic", underline: "underline" };
15005
+ const groups = [
15006
+ {
15007
+ id: "format",
15008
+ label: messages.textFormatting,
15009
+ icon: "bold",
15010
+ commands: formatStyles.map((style) => ({
15011
+ id: style,
15012
+ label: messages[style],
15013
+ icon: formatIcons[style],
15014
+ pressed: activeTextStyles[style] === true,
15015
+ disabled: !canFormatText,
15016
+ preserveSelection: true,
15017
+ onSelect: () => runAction(() => onToggleTextStyle(style))
15018
+ }))
15019
+ },
15020
+ {
15021
+ id: "structure",
15022
+ label: messages.structure,
15023
+ icon: "heading",
15024
+ commands: [
15025
+ ...mode === "article" ? [{ id: "meta", label: messages.articleMetaTitle, icon: "book", onSelect: () => runAction(onOpenArticleMeta) }] : [],
15026
+ { id: "section", label: messages.addSection, icon: "heading", onSelect: () => runAction(onAddSection) },
15027
+ { id: "subsection", label: messages.addSubsection, icon: "heading", onSelect: () => runAction(onAddSubsection) },
15028
+ { id: "subsubsection", label: messages.addSubsubsection, icon: "heading", onSelect: () => runAction(onAddSubsubsection) },
15029
+ { id: "paragraph", label: messages.addParagraph, icon: "paragraph", onSelect: () => runAction(onAddParagraph) }
15030
+ ]
15031
+ },
15032
+ {
15033
+ id: "equations",
15034
+ label: messages.equations,
15035
+ icon: "math",
15036
+ commands: [
15037
+ { id: "inline", label: messages.inlineEquation, icon: "math", disabled: !editableEquations, onSelect: () => runAction(onAddInlineEquation) },
15038
+ { id: "display", label: messages.displayEquation, icon: "fraction", disabled: !editableEquations, onSelect: () => runAction(onAddDisplayEquation) }
15039
+ ]
15040
+ },
15041
+ {
15042
+ id: "content",
15043
+ label: messages.content,
15044
+ icon: "image",
15045
+ commands: [
15046
+ { id: "bullets", label: messages.bulletedList, icon: "list", onSelect: () => runAction(onAddList) },
15047
+ { id: "numbers", label: messages.numberedList, icon: "ordered-list", onSelect: () => runAction(onAddEnumerate) },
15048
+ { id: "table", label: messages.insertTable, icon: "table", onSelect: () => setSheetView("table") },
15049
+ { id: "figure", label: messages.insertImage, icon: "image", onSelect: () => runAction(onAddFigure) }
15050
+ ]
15051
+ },
15052
+ {
15053
+ id: "references",
15054
+ label: messages.citations,
15055
+ icon: "citation",
15056
+ commands: [
15057
+ { id: "cite", label: messages.insertCitation, icon: "citation", onSelect: () => runAction(onInsertCitation, false) },
15058
+ { id: "ref", label: messages.insertInternalRef, icon: "reference", onSelect: () => runAction(onInsertInternalRef, false) },
15059
+ ...mode === "article" ? [
15060
+ { id: "bibliography", label: messages.insertBibliography, icon: "book", onSelect: () => runAction(onInsertBibliography) },
15061
+ { id: "manage-refs", label: messages.manageReferences, icon: "citation", onSelect: () => runAction(() => onManageReferences(triggerRef.current), false) }
15062
+ ] : [],
15063
+ { id: "labels", label: messages.manageLabels, icon: "reference", onSelect: () => runAction(() => onManageLabels(triggerRef.current), false) }
15064
+ ]
15065
+ },
15066
+ {
15067
+ id: "document",
15068
+ label: messages.documentActions,
15069
+ icon: "collapse",
15070
+ commands: [
15071
+ { id: "collapse", label: messages.collapseAll, icon: "collapse", onSelect: () => runAction(onCollapseAll) },
15072
+ { id: "expand", label: messages.openAll, icon: "expand", onSelect: () => runAction(onOpenAll) }
15073
+ ]
15074
+ },
15075
+ ...selectionCount > 0 ? [{
15076
+ id: "selection",
15077
+ label: messages.blockSelection,
15078
+ icon: "structure",
15079
+ commands: [
15080
+ { id: "up", label: messages.moveUp, icon: "up", disabled: !canMoveSelectionUp, onSelect: () => runAction(onMoveSelectionUp) },
15081
+ { id: "down", label: messages.moveDown, icon: "down", disabled: !canMoveSelectionDown, onSelect: () => runAction(onMoveSelectionDown) },
15082
+ { id: "delete", label: messages.deleteBlock, icon: "trash", danger: true, onSelect: () => runAction(onDeleteSelection) }
15083
+ ]
15084
+ }] : []
15085
+ ];
15086
+ return /* @__PURE__ */ jsxs11("div", { className: "butex-document-widget__mobile-toolbar", children: [
15087
+ /* @__PURE__ */ jsxs11("div", { className: "butex-document-widget__mobile-toolbar-primary", children: [
15088
+ /* @__PURE__ */ jsxs11("div", { className: "butex-document-widget__mobile-view", role: "group", "aria-label": messages.mobileViews, children: [
15089
+ /* @__PURE__ */ jsx12(
14351
15090
  "button",
14352
15091
  {
14353
15092
  type: "button",
@@ -14356,7 +15095,7 @@ function DocumentMobileToolbar({
14356
15095
  children: messages.editor
14357
15096
  }
14358
15097
  ),
14359
- /* @__PURE__ */ jsx11(
15098
+ /* @__PURE__ */ jsx12(
14360
15099
  "button",
14361
15100
  {
14362
15101
  type: "button",
@@ -14366,10 +15105,10 @@ function DocumentMobileToolbar({
14366
15105
  }
14367
15106
  )
14368
15107
  ] }),
14369
- /* @__PURE__ */ jsxs10("div", { className: "butex-document-widget__mobile-toolbar-actions", role: "group", "aria-label": messages.mobileToolbar, children: [
14370
- /* @__PURE__ */ jsx11("button", { type: "button", className: "butex-document-widget__icon-btn", title: messages.undo, "aria-label": messages.undo, disabled: !canUndo, onClick: onUndo, children: "\u21B6" }),
14371
- /* @__PURE__ */ jsx11("button", { type: "button", className: "butex-document-widget__icon-btn", title: messages.redo, "aria-label": messages.redo, disabled: !canRedo, onClick: onRedo, children: "\u21B7" }),
14372
- /* @__PURE__ */ jsx11(
15108
+ /* @__PURE__ */ jsxs11("div", { className: "butex-document-widget__mobile-toolbar-actions", role: "group", "aria-label": messages.mobileToolbar, children: [
15109
+ /* @__PURE__ */ jsx12("button", { type: "button", className: "butex-document-widget__icon-btn", title: messages.undo, "aria-label": messages.undo, disabled: !canUndo, onClick: onUndo, children: "\u21B6" }),
15110
+ /* @__PURE__ */ jsx12("button", { type: "button", className: "butex-document-widget__icon-btn", title: messages.redo, "aria-label": messages.redo, disabled: !canRedo, onClick: onRedo, children: "\u21B7" }),
15111
+ /* @__PURE__ */ jsx12(
14373
15112
  "button",
14374
15113
  {
14375
15114
  ref: triggerRef,
@@ -14385,18 +15124,18 @@ function DocumentMobileToolbar({
14385
15124
  )
14386
15125
  ] })
14387
15126
  ] }),
14388
- showContextRow ? /* @__PURE__ */ jsxs10("div", { className: "butex-document-widget__mobile-context", "aria-label": messages.contextActions, children: [
14389
- selectionCount > 0 ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
14390
- /* @__PURE__ */ jsxs10("span", { className: "butex-document-widget__selection-count", children: [
15127
+ showContextRow ? /* @__PURE__ */ jsxs11("div", { className: "butex-document-widget__mobile-context", "aria-label": messages.contextActions, children: [
15128
+ selectionCount > 0 ? /* @__PURE__ */ jsxs11(Fragment3, { children: [
15129
+ /* @__PURE__ */ jsxs11("span", { className: "butex-document-widget__selection-count", children: [
14391
15130
  selectionCount,
14392
15131
  " ",
14393
15132
  messages.selectedBlockCount
14394
15133
  ] }),
14395
- /* @__PURE__ */ jsx11("button", { type: "button", className: "butex-document-widget__icon-btn", title: messages.moveUp, "aria-label": messages.moveUp, disabled: !canMoveSelectionUp, onClick: onMoveSelectionUp, children: "\u2191" }),
14396
- /* @__PURE__ */ jsx11("button", { type: "button", className: "butex-document-widget__icon-btn", title: messages.moveDown, "aria-label": messages.moveDown, disabled: !canMoveSelectionDown, onClick: onMoveSelectionDown, children: "\u2193" }),
14397
- /* @__PURE__ */ jsx11("button", { type: "button", className: "butex-document-widget__button--danger", onClick: onDeleteSelection, children: messages.deleteBlock })
15134
+ /* @__PURE__ */ jsx12("button", { type: "button", className: "butex-document-widget__icon-btn", title: messages.moveUp, "aria-label": messages.moveUp, disabled: !canMoveSelectionUp, onClick: onMoveSelectionUp, children: "\u2191" }),
15135
+ /* @__PURE__ */ jsx12("button", { type: "button", className: "butex-document-widget__icon-btn", title: messages.moveDown, "aria-label": messages.moveDown, disabled: !canMoveSelectionDown, onClick: onMoveSelectionDown, children: "\u2193" }),
15136
+ /* @__PURE__ */ jsx12("button", { type: "button", className: "butex-document-widget__button--danger", onClick: onDeleteSelection, children: messages.deleteBlock })
14398
15137
  ] }) : null,
14399
- canFormatText ? /* @__PURE__ */ jsx11(Fragment3, { children: ["bold", "italic", "underline"].map((styleName) => /* @__PURE__ */ jsx11(
15138
+ canFormatText ? /* @__PURE__ */ jsx12(Fragment3, { children: ["bold", "italic", "underline"].map((styleName) => /* @__PURE__ */ jsx12(
14400
15139
  "button",
14401
15140
  {
14402
15141
  type: "button",
@@ -14410,121 +15149,52 @@ function DocumentMobileToolbar({
14410
15149
  styleName
14411
15150
  )) }) : null
14412
15151
  ] }) : null,
14413
- sheetOpen ? /* @__PURE__ */ jsx11("div", { className: "butex-document-widget__command-sheet-backdrop", role: "presentation", onClick: closeSheet, children: /* @__PURE__ */ jsxs10(
14414
- "section",
15152
+ sheetOpen ? /* @__PURE__ */ jsx12(
15153
+ MobileCommandSheet,
14415
15154
  {
14416
- ref: dialogRef,
14417
- className: "butex-document-widget__command-sheet",
14418
- role: "dialog",
14419
- "aria-modal": "true",
14420
- "aria-labelledby": titleId,
14421
- tabIndex: -1,
14422
- onClick: (event) => event.stopPropagation(),
14423
- children: [
14424
- /* @__PURE__ */ jsxs10("header", { className: "butex-document-widget__command-sheet-header", children: [
14425
- /* @__PURE__ */ jsx11("strong", { id: titleId, children: sheetView === "table" ? messages.tableSize : messages.moreActions }),
14426
- /* @__PURE__ */ jsx11("button", { type: "button", "data-dialog-initial-focus": true, "aria-label": messages.close, onClick: closeSheet, children: "\xD7" })
15155
+ scope: "butex-document-widget",
15156
+ sourceRef: triggerRef,
15157
+ dialogRef,
15158
+ titleId,
15159
+ title: sheetView === "table" ? messages.tableSize : messages.moreActions,
15160
+ closeLabel: messages.close,
15161
+ onClose: closeSheet,
15162
+ backLabel: sheetView === "table" ? messages.backToActions : void 0,
15163
+ onBack: sheetView === "table" ? () => setSheetView("commands") : void 0,
15164
+ bodyClassName: sheetView === "table" ? "butex-document-widget__mobile-table-form" : void 0,
15165
+ children: sheetView === "table" ? /* @__PURE__ */ jsxs11(Fragment3, { children: [
15166
+ /* @__PURE__ */ jsxs11("label", { children: [
15167
+ /* @__PURE__ */ jsx12("span", { children: messages.rows }),
15168
+ /* @__PURE__ */ jsx12("input", { type: "number", min: 1, max: 20, value: rows, onChange: (event) => setRows(event.currentTarget.value) })
14427
15169
  ] }),
14428
- sheetView === "table" ? /* @__PURE__ */ jsxs10("div", { className: "butex-document-widget__command-sheet-body butex-document-widget__mobile-table-form", children: [
14429
- /* @__PURE__ */ jsx11("button", { type: "button", className: "butex-document-widget__sheet-back", onClick: () => setSheetView("commands"), children: messages.backToActions }),
14430
- /* @__PURE__ */ jsxs10("label", { children: [
14431
- /* @__PURE__ */ jsx11("span", { children: messages.rows }),
14432
- /* @__PURE__ */ jsx11("input", { type: "number", min: 1, max: 20, value: rows, onChange: (event) => setRows(event.currentTarget.value) })
14433
- ] }),
14434
- /* @__PURE__ */ jsxs10("label", { children: [
14435
- /* @__PURE__ */ jsx11("span", { children: messages.columns }),
14436
- /* @__PURE__ */ jsx11("input", { type: "number", min: 1, max: 10, value: cols, onChange: (event) => setCols(event.currentTarget.value) })
14437
- ] }),
14438
- /* @__PURE__ */ jsx11("button", { type: "button", className: "butex-document-widget__primary-btn", onClick: insertTable, children: messages.insertTable })
14439
- ] }) : /* @__PURE__ */ jsxs10("div", { className: "butex-document-widget__command-sheet-body", children: [
14440
- /* @__PURE__ */ jsxs10("section", { className: "butex-document-widget__command-group", "aria-labelledby": `${titleId}-format`, children: [
14441
- /* @__PURE__ */ jsx11("h3", { id: `${titleId}-format`, children: messages.textFormatting }),
14442
- /* @__PURE__ */ jsx11("div", { className: "butex-document-widget__command-grid", children: ["bold", "italic", "underline"].map((styleName) => /* @__PURE__ */ jsx11(
14443
- "button",
14444
- {
14445
- type: "button",
14446
- "aria-pressed": activeTextStyles[styleName] === true,
14447
- disabled: !canFormatText,
14448
- onMouseDown: (event) => event.preventDefault(),
14449
- onClick: () => runAction(() => onToggleTextStyle(styleName)),
14450
- children: messages[styleName]
14451
- },
14452
- styleName
14453
- )) })
14454
- ] }),
14455
- /* @__PURE__ */ jsxs10("section", { className: "butex-document-widget__command-group", "aria-labelledby": `${titleId}-structure`, children: [
14456
- /* @__PURE__ */ jsx11("h3", { id: `${titleId}-structure`, children: messages.structure }),
14457
- /* @__PURE__ */ jsxs10("div", { className: "butex-document-widget__command-grid", children: [
14458
- mode === "article" ? /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(onOpenArticleMeta), children: messages.articleMetaTitle }) : null,
14459
- /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(onAddSection), children: messages.addSection }),
14460
- /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(onAddSubsection), children: messages.addSubsection }),
14461
- /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(onAddSubsubsection), children: messages.addSubsubsection }),
14462
- /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(onAddParagraph), children: messages.addParagraph })
14463
- ] })
14464
- ] }),
14465
- /* @__PURE__ */ jsxs10("section", { className: "butex-document-widget__command-group", "aria-labelledby": `${titleId}-equations`, children: [
14466
- /* @__PURE__ */ jsx11("h3", { id: `${titleId}-equations`, children: messages.equations }),
14467
- /* @__PURE__ */ jsxs10("div", { className: "butex-document-widget__command-grid", children: [
14468
- /* @__PURE__ */ jsx11("button", { type: "button", disabled: !editableEquations, onClick: () => runAction(onAddInlineEquation), children: messages.inlineEquation }),
14469
- /* @__PURE__ */ jsx11("button", { type: "button", disabled: !editableEquations, onClick: () => runAction(onAddDisplayEquation), children: messages.displayEquation })
14470
- ] }),
14471
- /* @__PURE__ */ jsx11("span", { className: "butex-document-widget__command-subtitle", children: messages.chooseDigitForm }),
14472
- /* @__PURE__ */ jsx11("div", { className: "butex-document-widget__command-grid butex-document-widget__command-grid--digits", role: "listbox", "aria-label": messages.chooseDigitForm, children: DIGIT_FORMS2.map((id) => /* @__PURE__ */ jsx11(
14473
- "button",
14474
- {
14475
- type: "button",
14476
- role: "option",
14477
- "aria-selected": digitForm === id,
14478
- title: digitTitle2(id),
14479
- onClick: () => runAction(() => onDigitFormChange(id), false),
14480
- children: digitFormLabel2(id)
14481
- },
14482
- id
14483
- )) })
14484
- ] }),
14485
- /* @__PURE__ */ jsxs10("section", { className: "butex-document-widget__command-group", "aria-labelledby": `${titleId}-content`, children: [
14486
- /* @__PURE__ */ jsx11("h3", { id: `${titleId}-content`, children: messages.content }),
14487
- /* @__PURE__ */ jsxs10("div", { className: "butex-document-widget__command-grid", children: [
14488
- /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(onAddList), children: messages.bulletedList }),
14489
- /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(onAddEnumerate), children: messages.numberedList }),
14490
- /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => setSheetView("table"), children: messages.insertTable }),
14491
- /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(onAddFigure), children: messages.insertImage })
14492
- ] })
14493
- ] }),
14494
- /* @__PURE__ */ jsxs10("section", { className: "butex-document-widget__command-group", "aria-labelledby": `${titleId}-references`, children: [
14495
- /* @__PURE__ */ jsx11("h3", { id: `${titleId}-references`, children: messages.citations }),
14496
- /* @__PURE__ */ jsxs10("div", { className: "butex-document-widget__command-grid", children: [
14497
- /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(onInsertCitation, false), children: messages.insertCitation }),
14498
- /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(onInsertInternalRef, false), children: messages.insertInternalRef }),
14499
- mode === "article" ? /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(onInsertBibliography), children: messages.insertBibliography }) : null,
14500
- mode === "article" ? /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(() => onManageReferences(triggerRef.current), false), children: messages.manageReferences }) : null,
14501
- /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(() => onManageLabels(triggerRef.current), false), children: messages.manageLabels })
14502
- ] })
14503
- ] }),
14504
- /* @__PURE__ */ jsxs10("section", { className: "butex-document-widget__command-group", "aria-labelledby": `${titleId}-document`, children: [
14505
- /* @__PURE__ */ jsx11("h3", { id: `${titleId}-document`, children: messages.documentActions }),
14506
- /* @__PURE__ */ jsxs10("div", { className: "butex-document-widget__command-grid", children: [
14507
- /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(onCollapseAll), children: messages.collapseAll }),
14508
- /* @__PURE__ */ jsx11("button", { type: "button", onClick: () => runAction(onOpenAll), children: messages.openAll })
14509
- ] })
14510
- ] }),
14511
- selectionCount > 0 ? /* @__PURE__ */ jsxs10("section", { className: "butex-document-widget__command-group", "aria-labelledby": `${titleId}-selection`, children: [
14512
- /* @__PURE__ */ jsx11("h3", { id: `${titleId}-selection`, children: messages.blockSelection }),
14513
- /* @__PURE__ */ jsxs10("div", { className: "butex-document-widget__command-grid", children: [
14514
- /* @__PURE__ */ jsx11("button", { type: "button", disabled: !canMoveSelectionUp, onClick: () => runAction(onMoveSelectionUp), children: messages.moveUp }),
14515
- /* @__PURE__ */ jsx11("button", { type: "button", disabled: !canMoveSelectionDown, onClick: () => runAction(onMoveSelectionDown), children: messages.moveDown }),
14516
- /* @__PURE__ */ jsx11("button", { type: "button", className: "butex-document-widget__button--danger", onClick: () => runAction(onDeleteSelection), children: messages.deleteBlock })
14517
- ] })
14518
- ] }) : null
14519
- ] })
14520
- ]
15170
+ /* @__PURE__ */ jsxs11("label", { children: [
15171
+ /* @__PURE__ */ jsx12("span", { children: messages.columns }),
15172
+ /* @__PURE__ */ jsx12("input", { type: "number", min: 1, max: 10, value: cols, onChange: (event) => setCols(event.currentTarget.value) })
15173
+ ] }),
15174
+ /* @__PURE__ */ jsx12("button", { type: "button", className: "butex-document-widget__primary-btn", onClick: insertTable, children: messages.insertTable })
15175
+ ] }) : /* @__PURE__ */ jsx12(Fragment3, { children: groups.map((group) => /* @__PURE__ */ jsxs11(MobileSection, { id: titleId + "-" + group.id, title: group.label, icon: group.icon, children: [
15176
+ /* @__PURE__ */ jsx12(MobileGrid, { children: group.commands.map((command) => /* @__PURE__ */ jsx12(MobileAction, { command }, command.id)) }),
15177
+ group.id === "equations" ? /* @__PURE__ */ jsxs11("div", { className: "butex-mobile-command__digits", children: [
15178
+ /* @__PURE__ */ jsx12("span", { className: "butex-document-widget__command-subtitle", children: messages.chooseDigitForm }),
15179
+ /* @__PURE__ */ jsx12("div", { className: "butex-mobile-command__choice-row", role: "group", "aria-label": messages.chooseDigitForm, children: MOBILE_DIGIT_CHOICES.map((option) => /* @__PURE__ */ jsx12(
15180
+ MobileChoice,
15181
+ {
15182
+ label: option.label,
15183
+ title: digitTitle2(option.id),
15184
+ pressed: digitForm === option.id,
15185
+ onClick: () => runAction(() => onDigitFormChange(option.id), false)
15186
+ },
15187
+ option.id
15188
+ )) })
15189
+ ] }) : null
15190
+ ] }, group.id)) })
14521
15191
  }
14522
- ) }) : null
15192
+ ) : null
14523
15193
  ] });
14524
15194
  }
14525
15195
 
14526
15196
  // src/react-document/DocumentPreview.tsx
14527
- import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
15197
+ import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
14528
15198
  var REF_KIND_NAMES = [
14529
15199
  { names: ["\u0627\u0644\u0634\u0643\u0644", "\u0634\u0643\u0644", "Figure", "figure"], prefixes: ["\u0627\u0644\u0634\u0643\u0644 ", "Figure "] },
14530
15200
  { names: ["\u0627\u0644\u062C\u062F\u0648\u0644", "\u062C\u062F\u0648\u0644", "Table", "table"], prefixes: ["\u0627\u0644\u062C\u062F\u0648\u0644 ", "Table "] },
@@ -14548,29 +15218,29 @@ function contextualRefLabel(inlines, index, label) {
14548
15218
  return label;
14549
15219
  }
14550
15220
  function PreviewInlines({ inlines, output }) {
14551
- return /* @__PURE__ */ jsx12(Fragment4, { children: inlines.map((inline, index) => {
15221
+ return /* @__PURE__ */ jsx13(Fragment4, { children: inlines.map((inline, index) => {
14552
15222
  if (inline.kind === "text") {
14553
- let content = /* @__PURE__ */ jsx12("span", { children: inline.text });
15223
+ let content = /* @__PURE__ */ jsx13("span", { children: inline.text });
14554
15224
  if (inline.style?.bold) {
14555
- content = /* @__PURE__ */ jsx12("strong", { children: content });
15225
+ content = /* @__PURE__ */ jsx13("strong", { children: content });
14556
15226
  }
14557
15227
  if (inline.style?.italic) {
14558
- content = /* @__PURE__ */ jsx12("em", { children: content });
15228
+ content = /* @__PURE__ */ jsx13("em", { children: content });
14559
15229
  }
14560
15230
  if (inline.style?.underline) {
14561
- content = /* @__PURE__ */ jsx12("span", { className: "butex-document-widget__preview-underline", children: content });
15231
+ content = /* @__PURE__ */ jsx13("span", { className: "butex-document-widget__preview-underline", children: content });
14562
15232
  }
14563
- return /* @__PURE__ */ jsx12("span", { children: content }, index);
15233
+ return /* @__PURE__ */ jsx13("span", { children: content }, index);
14564
15234
  }
14565
15235
  if (inline.kind === "cite") {
14566
- return /* @__PURE__ */ jsx12("span", { className: "butex-document-widget__preview-cite", children: inline.label }, inline.id);
15236
+ return /* @__PURE__ */ jsx13("span", { className: "butex-document-widget__preview-cite", children: inline.label }, inline.id);
14567
15237
  }
14568
15238
  if (inline.kind === "ref") {
14569
- return /* @__PURE__ */ jsx12("span", { className: "butex-document-widget__preview-cite butex-document-widget__preview-ref", children: contextualRefLabel(inlines, index, inline.label) }, inline.id);
15239
+ return /* @__PURE__ */ jsx13("span", { className: "butex-document-widget__preview-cite butex-document-widget__preview-ref", children: contextualRefLabel(inlines, index, inline.label) }, inline.id);
14570
15240
  }
14571
- return /* @__PURE__ */ jsxs11("span", { className: "butex-document-widget__preview-math-numbered", children: [
14572
- /* @__PURE__ */ jsx12(MathIsland, { id: inline.id, tex: inline.tex, display: inline.display, output }),
14573
- inline.numberLabel ? /* @__PURE__ */ jsxs11("span", { className: "butex-document-widget__preview-equation-number", children: [
15241
+ return /* @__PURE__ */ jsxs12("span", { className: "butex-document-widget__preview-math-numbered", children: [
15242
+ /* @__PURE__ */ jsx13(MathIsland, { id: inline.id, tex: inline.tex, display: inline.display, output }),
15243
+ inline.numberLabel ? /* @__PURE__ */ jsxs12("span", { className: "butex-document-widget__preview-equation-number", children: [
14574
15244
  "(",
14575
15245
  inline.numberLabel,
14576
15246
  ")"
@@ -14601,51 +15271,51 @@ function PreviewBlock({
14601
15271
  if (!numberLabel && !hasCaption) {
14602
15272
  return null;
14603
15273
  }
14604
- return /* @__PURE__ */ jsxs11("figcaption", { dir: documentDirection, children: [
14605
- numberLabel ? /* @__PURE__ */ jsxs11("span", { className: "butex-document-widget__preview-float-number", children: [
15274
+ return /* @__PURE__ */ jsxs12("figcaption", { dir: documentDirection, children: [
15275
+ numberLabel ? /* @__PURE__ */ jsxs12("span", { className: "butex-document-widget__preview-float-number", children: [
14606
15276
  numberLabel,
14607
15277
  hasCaption ? floatCaptionSeparator : ""
14608
15278
  ] }) : null,
14609
- captionInlines ? /* @__PURE__ */ jsx12(PreviewInlines, { inlines: captionInlines, output }) : caption ?? ""
15279
+ captionInlines ? /* @__PURE__ */ jsx13(PreviewInlines, { inlines: captionInlines, output }) : caption ?? ""
14610
15280
  ] });
14611
15281
  }
14612
15282
  if (block.kind === "basmala" || block.kind === "closing") {
14613
- return /* @__PURE__ */ jsx12(
15283
+ return /* @__PURE__ */ jsx13(
14614
15284
  "p",
14615
15285
  {
14616
15286
  className: block.kind === "basmala" ? "butex-document-widget__preview-basmala" : "butex-document-widget__preview-closing",
14617
- children: /* @__PURE__ */ jsx12(MathIsland, { id: block.id, tex: block.tex, display: true, output })
15287
+ children: /* @__PURE__ */ jsx13(MathIsland, { id: block.id, tex: block.tex, display: true, output })
14618
15288
  }
14619
15289
  );
14620
15290
  }
14621
15291
  if (block.kind === "titleBlock") {
14622
- return /* @__PURE__ */ jsxs11("header", { className: "butex-document-widget__preview-title-block", children: [
14623
- block.title ? /* @__PURE__ */ jsx12("h1", { className: "butex-document-widget__preview-article-title", children: block.title }) : null,
14624
- block.authors ? /* @__PURE__ */ jsx12("p", { className: "butex-document-widget__preview-article-authors", children: block.authors.split("\n").map((line, index) => /* @__PURE__ */ jsxs11("span", { children: [
14625
- index > 0 ? /* @__PURE__ */ jsx12("br", {}) : null,
15292
+ return /* @__PURE__ */ jsxs12("header", { className: "butex-document-widget__preview-title-block", children: [
15293
+ block.title ? /* @__PURE__ */ jsx13("h1", { className: "butex-document-widget__preview-article-title", children: block.title }) : null,
15294
+ block.authors ? /* @__PURE__ */ jsx13("p", { className: "butex-document-widget__preview-article-authors", children: block.authors.split("\n").map((line, index) => /* @__PURE__ */ jsxs12("span", { children: [
15295
+ index > 0 ? /* @__PURE__ */ jsx13("br", {}) : null,
14626
15296
  line
14627
15297
  ] }, index)) }) : null,
14628
- block.date ? /* @__PURE__ */ jsx12("p", { className: "butex-document-widget__preview-article-date", children: block.date }) : null
15298
+ block.date ? /* @__PURE__ */ jsx13("p", { className: "butex-document-widget__preview-article-date", children: block.date }) : null
14629
15299
  ] });
14630
15300
  }
14631
15301
  if (block.kind === "abstract") {
14632
- return /* @__PURE__ */ jsxs11("section", { className: "butex-document-widget__preview-abstract", "aria-label": messages.articleAbstract, children: [
14633
- /* @__PURE__ */ jsx12("h2", { className: "butex-document-widget__preview-abstract-label", children: messages.articleAbstract }),
14634
- /* @__PURE__ */ jsx12("p", { children: block.text })
15302
+ return /* @__PURE__ */ jsxs12("section", { className: "butex-document-widget__preview-abstract", "aria-label": messages.articleAbstract, children: [
15303
+ /* @__PURE__ */ jsx13("h2", { className: "butex-document-widget__preview-abstract-label", children: messages.articleAbstract }),
15304
+ /* @__PURE__ */ jsx13("p", { children: block.text })
14635
15305
  ] });
14636
15306
  }
14637
15307
  if (block.kind === "heading") {
14638
15308
  const Tag = block.level === 1 ? "h1" : block.level === 2 ? "h2" : "h3";
14639
- return /* @__PURE__ */ jsx12(Tag, { "data-butex-block-source": source, children: /* @__PURE__ */ jsx12(PreviewInlines, { inlines: block.inlines, output }) });
15309
+ return /* @__PURE__ */ jsx13(Tag, { "data-butex-block-source": source, children: /* @__PURE__ */ jsx13(PreviewInlines, { inlines: block.inlines, output }) });
14640
15310
  }
14641
15311
  if (block.kind === "paragraph") {
14642
- return /* @__PURE__ */ jsx12("p", { "data-butex-block-source": source, className: block.centered ? "butex-document-widget__preview-paragraph--centered" : void 0, children: /* @__PURE__ */ jsx12(PreviewInlines, { inlines: block.inlines, output }) });
15312
+ return /* @__PURE__ */ jsx13("p", { "data-butex-block-source": source, className: block.centered ? "butex-document-widget__preview-paragraph--centered" : void 0, children: /* @__PURE__ */ jsx13(PreviewInlines, { inlines: block.inlines, output }) });
14643
15313
  }
14644
15314
  if (block.kind === "list") {
14645
15315
  const Tag = block.ordered ? "ol" : "ul";
14646
- return /* @__PURE__ */ jsx12(Tag, { "data-butex-block-source": source, children: block.items.map((item) => /* @__PURE__ */ jsxs11("li", { children: [
14647
- /* @__PURE__ */ jsx12(PreviewInlines, { inlines: item.inlines, output }),
14648
- item.blocks.map((child) => /* @__PURE__ */ jsx12(
15316
+ return /* @__PURE__ */ jsx13(Tag, { "data-butex-block-source": source, children: block.items.map((item) => /* @__PURE__ */ jsxs12("li", { children: [
15317
+ /* @__PURE__ */ jsx13(PreviewInlines, { inlines: item.inlines, output }),
15318
+ item.blocks.map((child) => /* @__PURE__ */ jsx13(
14649
15319
  PreviewBlock,
14650
15320
  {
14651
15321
  block: child,
@@ -14663,39 +15333,39 @@ function PreviewBlock({
14663
15333
  return null;
14664
15334
  }
14665
15335
  if (block.kind === "table") {
14666
- return /* @__PURE__ */ jsxs11("figure", { className: "butex-document-widget__preview-float", "data-butex-block-source": source, children: [
14667
- /* @__PURE__ */ jsx12("div", { className: "butex-document-widget__preview-table-scroll", children: /* @__PURE__ */ jsx12("table", { children: /* @__PURE__ */ jsx12("tbody", { children: block.rows.map((row, rowIndex) => /* @__PURE__ */ jsx12("tr", { children: row.map((cell, columnIndex) => /* @__PURE__ */ jsx12("td", { children: /* @__PURE__ */ jsx12(PreviewInlines, { inlines: cell, output }) }, columnIndex)) }, rowIndex)) }) }) }),
14668
- /* @__PURE__ */ jsx12(FloatCaption, { numberLabel: block.numberLabel, caption: block.caption, captionInlines: block.captionInlines })
15336
+ return /* @__PURE__ */ jsxs12("figure", { className: "butex-document-widget__preview-float", "data-butex-block-source": source, children: [
15337
+ /* @__PURE__ */ jsx13("div", { className: "butex-document-widget__preview-table-scroll", children: /* @__PURE__ */ jsx13("table", { children: /* @__PURE__ */ jsx13("tbody", { children: block.rows.map((row, rowIndex) => /* @__PURE__ */ jsx13("tr", { children: row.map((cell, columnIndex) => /* @__PURE__ */ jsx13("td", { children: /* @__PURE__ */ jsx13(PreviewInlines, { inlines: cell, output }) }, columnIndex)) }, rowIndex)) }) }) }),
15338
+ /* @__PURE__ */ jsx13(FloatCaption, { numberLabel: block.numberLabel, caption: block.caption, captionInlines: block.captionInlines })
14669
15339
  ] });
14670
15340
  }
14671
15341
  if (block.kind === "image") {
14672
15342
  const resolvedSrc = resolveImageUrl ? resolveImageUrl({ assetId: block.assetId, value: block.src }) : block.src;
14673
15343
  const src = resolvedSrc?.trim() ?? "";
14674
- return /* @__PURE__ */ jsxs11(
15344
+ return /* @__PURE__ */ jsxs12(
14675
15345
  "figure",
14676
15346
  {
14677
15347
  className: `butex-document-widget__preview-float${block.centered === false ? " butex-document-widget__preview-float--start" : ""}`,
14678
15348
  "data-butex-block-source": source,
14679
15349
  "data-butex-image-pending": src.length === 0 ? "true" : void 0,
14680
15350
  children: [
14681
- src.length > 0 ? /* @__PURE__ */ jsx12("img", { src, alt: block.caption ?? "" }) : null,
14682
- /* @__PURE__ */ jsx12(FloatCaption, { numberLabel: block.numberLabel, caption: block.caption, captionInlines: block.captionInlines })
15351
+ src.length > 0 ? /* @__PURE__ */ jsx13("img", { src, alt: block.caption ?? "" }) : null,
15352
+ /* @__PURE__ */ jsx13(FloatCaption, { numberLabel: block.numberLabel, caption: block.caption, captionInlines: block.captionInlines })
14683
15353
  ]
14684
15354
  }
14685
15355
  );
14686
15356
  }
14687
15357
  if (block.kind === "bibliography") {
14688
- return /* @__PURE__ */ jsx12("ol", { className: "butex-document-widget__preview-bibliography", "data-butex-block-source": source, children: block.items.map((item) => /* @__PURE__ */ jsxs11("li", { children: [
14689
- /* @__PURE__ */ jsxs11("span", { className: "butex-document-widget__preview-bib-number", children: [
15358
+ return /* @__PURE__ */ jsx13("ol", { className: "butex-document-widget__preview-bibliography", "data-butex-block-source": source, children: block.items.map((item) => /* @__PURE__ */ jsxs12("li", { children: [
15359
+ /* @__PURE__ */ jsxs12("span", { className: "butex-document-widget__preview-bib-number", children: [
14690
15360
  item.numberLabel,
14691
15361
  "."
14692
15362
  ] }),
14693
15363
  " ",
14694
- /* @__PURE__ */ jsxs11("span", { children: [
15364
+ /* @__PURE__ */ jsxs12("span", { children: [
14695
15365
  bibliographyEntryBody(item, item.fieldSeparator, { digitForm }),
14696
- item.url ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
15366
+ item.url ? /* @__PURE__ */ jsxs12(Fragment4, { children: [
14697
15367
  " ",
14698
- /* @__PURE__ */ jsx12("a", { href: absoluteHttpHref(item.url), target: "_blank", rel: "noreferrer", children: item.url })
15368
+ /* @__PURE__ */ jsx13("a", { href: absoluteHttpHref(item.url), target: "_blank", rel: "noreferrer", children: item.url })
14699
15369
  ] }) : null
14700
15370
  ] })
14701
15371
  ] }, item.id)) });
@@ -14713,8 +15383,8 @@ function DocumentPreview({
14713
15383
  const messages = documentMessages(uiLocale);
14714
15384
  const resolvedDigitForm = digitForm ?? (documentDirection === "rtl" ? "arabicIndic" : "western");
14715
15385
  const hasBody = blocks.some(isBodyPreviewBlock);
14716
- return /* @__PURE__ */ jsxs11("div", { className: "butex-document-widget__preview", dir: documentDirection, children: [
14717
- blocks.map((block) => /* @__PURE__ */ jsx12(
15386
+ return /* @__PURE__ */ jsxs12("div", { className: "butex-document-widget__preview", dir: documentDirection, children: [
15387
+ blocks.map((block) => /* @__PURE__ */ jsx13(
14718
15388
  PreviewBlock,
14719
15389
  {
14720
15390
  block,
@@ -14726,12 +15396,12 @@ function DocumentPreview({
14726
15396
  },
14727
15397
  block.id
14728
15398
  )),
14729
- !hasBody ? /* @__PURE__ */ jsx12("p", { className: "butex-document-widget__preview-empty-body", children: messages.emptyDocument }) : null
15399
+ !hasBody ? /* @__PURE__ */ jsx13("p", { className: "butex-document-widget__preview-empty-body", children: messages.emptyDocument }) : null
14730
15400
  ] });
14731
15401
  }
14732
15402
 
14733
15403
  // src/react-document/EquationDrawer.tsx
14734
- import { useEffect as useEffect11, useId as useId5, useRef as useRef11, useState as useState10 } from "react";
15404
+ import { useEffect as useEffect11, useId as useId5, useRef as useRef11, useState as useState11 } from "react";
14735
15405
 
14736
15406
  // src/react/ButexEditor.tsx
14737
15407
  import {
@@ -14741,7 +15411,7 @@ import {
14741
15411
  useId as useId4,
14742
15412
  useImperativeHandle,
14743
15413
  useRef as useRef10,
14744
- useState as useState9
15414
+ useState as useState10
14745
15415
  } from "react";
14746
15416
 
14747
15417
  // src/react/matrixPickerCss.ts
@@ -15136,95 +15806,6 @@ var WIDGET_CHROME_CSS = `
15136
15806
  margin-top: 8px;
15137
15807
  }
15138
15808
 
15139
- .butex-widget .butex-widget__command-sheet-backdrop {
15140
- align-items: flex-end;
15141
- background: rgba(15, 23, 42, 0.38);
15142
- inset: 0;
15143
- justify-content: center;
15144
- padding-bottom: var(--butex-safe-area-bottom, env(safe-area-inset-bottom, 0px));
15145
- padding-left: max(12px, var(--butex-safe-area-left, env(safe-area-inset-left, 0px)));
15146
- padding-right: max(12px, var(--butex-safe-area-right, env(safe-area-inset-right, 0px)));
15147
- padding-top: max(12px, var(--butex-safe-area-top, env(safe-area-inset-top, 0px)));
15148
- position: fixed;
15149
- z-index: var(--butex-z-popover);
15150
- }
15151
-
15152
- .butex-widget .butex-widget__command-sheet {
15153
- background: var(--butex-panel);
15154
- border: 1px solid var(--butex-border);
15155
- border-radius: 16px 16px 0 0;
15156
- box-shadow: 0 -18px 48px rgba(15, 23, 42, 0.22);
15157
- display: grid;
15158
- grid-template-rows: auto minmax(0, 1fr);
15159
- max-height: min(78vh, 720px);
15160
- max-height: min(720px, calc(100dvh - max(12px, var(--butex-safe-area-top, env(safe-area-inset-top, 0px))) - var(--butex-safe-area-bottom, env(safe-area-inset-bottom, 0px))));
15161
- max-width: 640px;
15162
- min-width: 0;
15163
- overflow: hidden;
15164
- width: 100%;
15165
- }
15166
-
15167
- .butex-widget .butex-widget__command-sheet-header {
15168
- align-items: center;
15169
- border-bottom: 1px solid var(--butex-border);
15170
- display: grid;
15171
- gap: 8px;
15172
- grid-template-columns: minmax(44px, auto) minmax(0, 1fr) minmax(44px, auto);
15173
- padding: 10px 12px;
15174
- text-align: center;
15175
- }
15176
-
15177
- .butex-widget .butex-widget__command-sheet-header strong {
15178
- overflow-wrap: anywhere;
15179
- }
15180
-
15181
- .butex-widget .butex-widget__command-sheet-body {
15182
- display: grid;
15183
- gap: 14px;
15184
- min-height: 0;
15185
- min-width: 0;
15186
- overflow-y: auto;
15187
- overscroll-behavior: contain;
15188
- padding: 12px;
15189
- }
15190
-
15191
- .butex-widget .butex-widget__sheet-section {
15192
- display: grid;
15193
- gap: 8px;
15194
- min-width: 0;
15195
- }
15196
-
15197
- .butex-widget .butex-widget__sheet-section h4 {
15198
- font-size: 13px;
15199
- margin: 0;
15200
- }
15201
-
15202
- .butex-widget .butex-widget__sheet-categories,
15203
- .butex-widget .butex-widget__sheet-command-grid,
15204
- .butex-widget .butex-widget__sheet-command-list,
15205
- .butex-widget .butex-widget__sheet-choice-row {
15206
- display: grid;
15207
- gap: 8px;
15208
- min-width: 0;
15209
- }
15210
-
15211
- .butex-widget .butex-widget__sheet-categories,
15212
- .butex-widget .butex-widget__sheet-command-grid {
15213
- grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
15214
- }
15215
-
15216
- .butex-widget .butex-widget__sheet-command-grid--three,
15217
- .butex-widget .butex-widget__sheet-choice-row {
15218
- grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
15219
- }
15220
-
15221
- .butex-widget .butex-widget__sheet-categories button,
15222
- .butex-widget .butex-widget__sheet-command-list button {
15223
- justify-content: flex-start;
15224
- overflow-wrap: anywhere;
15225
- text-align: start;
15226
- }
15227
-
15228
15809
  .butex-widget .butex-widget__command-sheet .operator-command-svg-label {
15229
15810
  background-color: currentColor;
15230
15811
  display: inline-block;
@@ -16129,19 +16710,6 @@ ${MATRIX_PICKER_CSS}
16129
16710
  grid-template-columns: repeat(4, minmax(44px, 1fr));
16130
16711
  }
16131
16712
 
16132
- .butex-widget:not([data-responsive-mode="desktop"]) .butex-widget__command-sheet-backdrop {
16133
- padding-bottom: var(--butex-safe-area-bottom, env(safe-area-inset-bottom, 0px));
16134
- padding-left: var(--butex-safe-area-left, env(safe-area-inset-left, 0px));
16135
- padding-right: var(--butex-safe-area-right, env(safe-area-inset-right, 0px));
16136
- padding-top: max(8px, var(--butex-safe-area-top, env(safe-area-inset-top, 0px)));
16137
- }
16138
-
16139
- .butex-widget:not([data-responsive-mode="desktop"]) .butex-widget__command-sheet {
16140
- border-bottom: 0;
16141
- max-height: calc(100dvh - max(8px, var(--butex-safe-area-top, env(safe-area-inset-top, 0px))) - var(--butex-safe-area-bottom, env(safe-area-inset-bottom, 0px)));
16142
- max-width: none;
16143
- }
16144
-
16145
16713
  .butex-widget:not([data-responsive-mode="desktop"]) .delimiter-command-menu,
16146
16714
  .butex-widget:not([data-responsive-mode="desktop"]) .matrix-command-menu,
16147
16715
  .butex-widget:not([data-responsive-mode="desktop"]) .character-font-menu,
@@ -16190,8 +16758,8 @@ function injectWidgetChromeCss(doc) {
16190
16758
  }
16191
16759
 
16192
16760
  // src/react/EquationMobileToolbar.tsx
16193
- import { useEffect as useEffect8, useId as useId3, useRef as useRef9, useState as useState8 } from "react";
16194
- import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
16761
+ import { useEffect as useEffect8, useId as useId3, useRef as useRef9, useState as useState9 } from "react";
16762
+ import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
16195
16763
  var ACCENT_COMMANDS2 = accentCommandsList();
16196
16764
  var FUNCTION_COMMANDS = atomicCommandsByCategory("function");
16197
16765
  var LIMITS_SERIES_COMMANDS = atomicCommandsByCategory("limits_series");
@@ -16270,13 +16838,13 @@ function functionLabel(command) {
16270
16838
  if (command.id !== "ln") {
16271
16839
  return command.arabicLabel;
16272
16840
  }
16273
- return /* @__PURE__ */ jsxs12("span", { className: "function-command-label-with-sub", "aria-hidden": "true", children: [
16274
- /* @__PURE__ */ jsx13("span", { className: "function-command-label-with-sub__base", children: command.arabicLabel }),
16275
- /* @__PURE__ */ jsx13("span", { className: "function-command-label-with-sub__sub", children: "\u0647\u0640" })
16841
+ return /* @__PURE__ */ jsxs13("span", { className: "function-command-label-with-sub", "aria-hidden": "true", children: [
16842
+ /* @__PURE__ */ jsx14("span", { className: "function-command-label-with-sub__base", children: command.arabicLabel }),
16843
+ /* @__PURE__ */ jsx14("span", { className: "function-command-label-with-sub__sub", children: "\u0647\u0640" })
16276
16844
  ] });
16277
16845
  }
16278
16846
  function operatorLabel(command) {
16279
- const label = command.svg_path ? /* @__PURE__ */ jsx13(
16847
+ const label = command.svg_path ? /* @__PURE__ */ jsx14(
16280
16848
  "span",
16281
16849
  {
16282
16850
  className: "operator-command-svg-label",
@@ -16287,7 +16855,7 @@ function operatorLabel(command) {
16287
16855
  }
16288
16856
  }
16289
16857
  ) : command.Label;
16290
- return /* @__PURE__ */ jsx13("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: label });
16858
+ return /* @__PURE__ */ jsx14("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: label });
16291
16859
  }
16292
16860
  function categoryTitle(view, messages) {
16293
16861
  if (view === "delimiters") return messages.insertDelimiters;
@@ -16308,12 +16876,12 @@ function EquationMobileToolbar({
16308
16876
  inputRef,
16309
16877
  getRuntime
16310
16878
  }) {
16311
- const [sheetView, setSheetView] = useState8("closed");
16312
- const [envMode, setEnvMode] = useState8("matrix");
16313
- const [matrixStyle, setMatrixStyle] = useState8("pmatrix");
16314
- const [matrixRows, setMatrixRows] = useState8(2);
16315
- const [matrixColumns, setMatrixColumns] = useState8(2);
16316
- const [alignmentColumn, setAlignmentColumn] = useState8(1);
16879
+ const [sheetView, setSheetView] = useState9("closed");
16880
+ const [envMode, setEnvMode] = useState9("matrix");
16881
+ const [matrixStyle, setMatrixStyle] = useState9("pmatrix");
16882
+ const [matrixRows, setMatrixRows] = useState9(2);
16883
+ const [matrixColumns, setMatrixColumns] = useState9(2);
16884
+ const [alignmentColumn, setAlignmentColumn] = useState9(1);
16317
16885
  const dialogRef = useRef9(null);
16318
16886
  const moreButtonRef = useRef9(null);
16319
16887
  const delimiterButtonRef = useRef9(null);
@@ -16382,413 +16950,321 @@ function EquationMobileToolbar({
16382
16950
  const directButtonMouseDown = (event) => event.preventDefault();
16383
16951
  const undoArrow = state.activeSide === "arabic" ? "\u21B7" : "\u21B6";
16384
16952
  const redoArrow = state.activeSide === "arabic" ? "\u21B6" : "\u21B7";
16385
- const renderFunctionGroup = (label, commands, limits = false, outline = false) => /* @__PURE__ */ jsxs12("section", { className: "butex-widget__sheet-section", children: [
16386
- /* @__PURE__ */ jsx13("h4", { children: label }),
16387
- /* @__PURE__ */ jsx13("div", { className: "butex-widget__sheet-command-grid", children: commands.map((command) => /* @__PURE__ */ jsx13(
16388
- "button",
16389
- {
16390
- className: `function-command-option${outline ? " function-command-option--outline" : ""}`,
16391
- type: "button",
16392
- title: atomicCommandTitle(command, uiLocale),
16393
- "aria-label": atomicCommandTitle(command, uiLocale),
16394
- onClick: () => runAndClose((runtime) => {
16395
- if (limits) runtime.insertLimitsSeriesTemplate(command.id);
16396
- else runtime.insertAtomicCommand(command.id);
16397
- }),
16398
- children: functionLabel(command)
16399
- },
16400
- command.id
16401
- )) })
16402
- ] }, label);
16403
- return /* @__PURE__ */ jsxs12(Fragment5, { children: [
16404
- /* @__PURE__ */ jsxs12("div", { className: "butex-widget__mobile-toolbar", role: "toolbar", "aria-label": messages.compactToolbar, children: [
16405
- /* @__PURE__ */ jsx13("button", { type: "button", disabled: !state.canUndo, title: messages.undo, "aria-label": messages.undo, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.performUndo(), children: undoArrow }),
16406
- /* @__PURE__ */ jsx13("button", { type: "button", disabled: !state.canRedo, title: messages.redo, "aria-label": messages.redo, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.performRedo(), children: redoArrow }),
16407
- /* @__PURE__ */ jsx13("button", { type: "button", title: messages.insertFraction, "aria-label": messages.insertFraction, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.insertFraction(), children: /* @__PURE__ */ jsxs12("span", { className: "toolbar-frac-icon", "aria-hidden": "true", children: [
16408
- /* @__PURE__ */ jsx13("span", { children: "\u0623" }),
16409
- /* @__PURE__ */ jsx13("span", { children: "\u0628" })
16953
+ const categoryIcons = {
16954
+ structures: "structure",
16955
+ functions: "functions",
16956
+ operators: "operators",
16957
+ matrices: "matrices",
16958
+ typography: "typography",
16959
+ spacing: "spacing",
16960
+ digits: "digits"
16961
+ };
16962
+ const renderFunctionGroup = (label, commands, limits = false, outline = false) => /* @__PURE__ */ jsx14(MobileSection, { title: label, icon: "functions", children: /* @__PURE__ */ jsx14(MobileGrid, { dense: true, className: "butex-widget__sheet-command-grid butex-mobile-command__math-glyphs", children: commands.map((command) => /* @__PURE__ */ jsx14(
16963
+ "button",
16964
+ {
16965
+ className: `function-command-option${outline ? " function-command-option--outline" : ""}`,
16966
+ type: "button",
16967
+ title: atomicCommandTitle(command, uiLocale),
16968
+ "aria-label": atomicCommandTitle(command, uiLocale),
16969
+ onClick: () => runAndClose((runtime) => {
16970
+ if (limits) runtime.insertLimitsSeriesTemplate(command.id);
16971
+ else runtime.insertAtomicCommand(command.id);
16972
+ }),
16973
+ children: functionLabel(command)
16974
+ },
16975
+ command.id
16976
+ )) }) });
16977
+ return /* @__PURE__ */ jsxs13(Fragment5, { children: [
16978
+ /* @__PURE__ */ jsxs13("div", { className: "butex-widget__mobile-toolbar", role: "toolbar", "aria-label": messages.compactToolbar, children: [
16979
+ /* @__PURE__ */ jsx14("button", { type: "button", disabled: !state.canUndo, title: messages.undo, "aria-label": messages.undo, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.performUndo(), children: undoArrow }),
16980
+ /* @__PURE__ */ jsx14("button", { type: "button", disabled: !state.canRedo, title: messages.redo, "aria-label": messages.redo, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.performRedo(), children: redoArrow }),
16981
+ /* @__PURE__ */ jsx14("button", { type: "button", title: messages.insertFraction, "aria-label": messages.insertFraction, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.insertFraction(), children: /* @__PURE__ */ jsxs13("span", { className: "toolbar-frac-icon", "aria-hidden": "true", children: [
16982
+ /* @__PURE__ */ jsx14("span", { children: "\u0623" }),
16983
+ /* @__PURE__ */ jsx14("span", { children: "\u0628" })
16410
16984
  ] }) }),
16411
- /* @__PURE__ */ jsx13("button", { type: "button", title: messages.addSuperscript, "aria-label": messages.addSuperscript, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.addSup(), children: /* @__PURE__ */ jsxs12("span", { className: "toolbar-script-icon toolbar-script-icon--sup", "aria-hidden": "true", children: [
16412
- /* @__PURE__ */ jsx13("span", { children: "\u0646" }),
16413
- /* @__PURE__ */ jsx13("span", { children: "\u0633" })
16985
+ /* @__PURE__ */ jsx14("button", { type: "button", title: messages.addSuperscript, "aria-label": messages.addSuperscript, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.addSup(), children: /* @__PURE__ */ jsxs13("span", { className: "toolbar-script-icon toolbar-script-icon--sup", "aria-hidden": "true", children: [
16986
+ /* @__PURE__ */ jsx14("span", { children: "\u0646" }),
16987
+ /* @__PURE__ */ jsx14("span", { children: "\u0633" })
16414
16988
  ] }) }),
16415
- /* @__PURE__ */ jsx13("button", { type: "button", title: messages.addSubscript, "aria-label": messages.addSubscript, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.addSub(), children: /* @__PURE__ */ jsxs12("span", { className: "toolbar-script-icon toolbar-script-icon--sub", "aria-hidden": "true", children: [
16416
- /* @__PURE__ */ jsx13("span", { children: "\u0646" }),
16417
- /* @__PURE__ */ jsx13("span", { children: "\u0633" })
16989
+ /* @__PURE__ */ jsx14("button", { type: "button", title: messages.addSubscript, "aria-label": messages.addSubscript, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.addSub(), children: /* @__PURE__ */ jsxs13("span", { className: "toolbar-script-icon toolbar-script-icon--sub", "aria-hidden": "true", children: [
16990
+ /* @__PURE__ */ jsx14("span", { children: "\u0646" }),
16991
+ /* @__PURE__ */ jsx14("span", { children: "\u0633" })
16418
16992
  ] }) }),
16419
- /* @__PURE__ */ jsx13("button", { ref: delimiterButtonRef, type: "button", title: messages.insertDelimiters, "aria-label": messages.insertDelimiters, "aria-haspopup": "dialog", "aria-expanded": sheetView === "delimiters", onClick: openDelimiters, children: "()" }),
16420
- /* @__PURE__ */ jsx13("button", { className: "butex-widget__mobile-danger", type: "button", title: messages.deleteSelectedStructure, "aria-label": messages.deleteSelectedStructure, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.deleteStructure(), children: "\xD7" }),
16421
- /* @__PURE__ */ jsx13("button", { ref: moreButtonRef, type: "button", title: messages.moreActions, "aria-label": messages.moreActions, "aria-haspopup": "dialog", "aria-expanded": sheetOpen && sheetView !== "delimiters", onClick: openMore, children: "\u22EF" })
16993
+ /* @__PURE__ */ jsx14("button", { ref: delimiterButtonRef, type: "button", title: messages.insertDelimiters, "aria-label": messages.insertDelimiters, "aria-haspopup": "dialog", "aria-expanded": sheetView === "delimiters", onClick: openDelimiters, children: "()" }),
16994
+ /* @__PURE__ */ jsx14("button", { className: "butex-widget__mobile-danger", type: "button", title: messages.deleteSelectedStructure, "aria-label": messages.deleteSelectedStructure, onMouseDown: directButtonMouseDown, onClick: () => getRuntime()?.deleteStructure(), children: "\xD7" }),
16995
+ /* @__PURE__ */ jsx14("button", { ref: moreButtonRef, type: "button", title: messages.moreActions, "aria-label": messages.moreActions, "aria-haspopup": "dialog", "aria-expanded": sheetOpen && sheetView !== "delimiters", onClick: openMore, children: "\u22EF" })
16422
16996
  ] }),
16423
- sheetOpen ? /* @__PURE__ */ jsx13(
16424
- "div",
16997
+ sheetOpen ? /* @__PURE__ */ jsxs13(
16998
+ MobileCommandSheet,
16425
16999
  {
16426
- className: "butex-widget__command-sheet-backdrop",
16427
- role: "presentation",
16428
- onClick: (event) => {
16429
- if (event.target === event.currentTarget) dismissSheet();
16430
- },
16431
- children: /* @__PURE__ */ jsxs12(
16432
- "div",
16433
- {
16434
- ref: dialogRef,
16435
- className: "butex-widget__command-sheet",
16436
- role: "dialog",
16437
- "aria-modal": "true",
16438
- "aria-labelledby": sheetTitleId,
16439
- tabIndex: -1,
16440
- children: [
16441
- /* @__PURE__ */ jsxs12("div", { className: "butex-widget__command-sheet-header", children: [
16442
- sheetView !== "root" && sheetView !== "delimiters" ? /* @__PURE__ */ jsx13("button", { ref: backButtonRef, type: "button", onClick: () => setSheetView("root"), children: messages.back }) : /* @__PURE__ */ jsx13("span", {}),
16443
- /* @__PURE__ */ jsx13("strong", { id: sheetTitleId, children: categoryTitle(sheetView, messages) }),
16444
- /* @__PURE__ */ jsx13("button", { type: "button", "data-dialog-initial-focus": true, "aria-label": messages.closeActions, onClick: dismissSheet, children: "\xD7" })
16445
- ] }),
16446
- /* @__PURE__ */ jsxs12("div", { className: "butex-widget__command-sheet-body", children: [
16447
- sheetView === "root" ? /* @__PURE__ */ jsxs12(Fragment5, { children: [
16448
- showSideSwitcher ? /* @__PURE__ */ jsxs12("section", { className: "butex-widget__sheet-section", children: [
16449
- /* @__PURE__ */ jsx13("h4", { children: messages.activeSide }),
16450
- /* @__PURE__ */ jsxs12("div", { className: "butex-widget__sheet-choice-row", children: [
16451
- /* @__PURE__ */ jsx13(
16452
- "button",
16453
- {
16454
- type: "button",
16455
- "aria-pressed": state.activeSide === "arabic",
16456
- onClick: (event) => {
16457
- if (state.activeSide !== "arabic") runAndKeepFocus(event.currentTarget, (runtime) => runtime.toggleSide());
16458
- },
16459
- children: messages.arabicSide
16460
- }
16461
- ),
16462
- /* @__PURE__ */ jsx13(
16463
- "button",
16464
- {
16465
- type: "button",
16466
- "aria-pressed": state.activeSide === "english",
16467
- onClick: (event) => {
16468
- if (state.activeSide !== "english") runAndKeepFocus(event.currentTarget, (runtime) => runtime.toggleSide());
16469
- },
16470
- children: messages.englishSide
16471
- }
16472
- )
16473
- ] })
16474
- ] }) : null,
16475
- /* @__PURE__ */ jsxs12("section", { className: "butex-widget__sheet-section", children: [
16476
- /* @__PURE__ */ jsx13("h4", { children: messages.clipboard }),
16477
- /* @__PURE__ */ jsxs12("div", { className: "butex-widget__sheet-choice-row", children: [
16478
- /* @__PURE__ */ jsx13("button", { type: "button", disabled: !state.hasSelection, onClick: () => runAndClose((runtime) => {
16479
- void runtime.performCopy();
16480
- }), children: messages.copy }),
16481
- /* @__PURE__ */ jsx13("button", { type: "button", disabled: !state.hasSelection, onClick: () => runAndClose((runtime) => {
16482
- void runtime.performCut();
16483
- }), children: messages.cut }),
16484
- /* @__PURE__ */ jsx13("button", { type: "button", onClick: () => runAndClose((runtime) => {
16485
- void runtime.performPaste();
16486
- }), children: messages.paste })
16487
- ] })
16488
- ] }),
16489
- /* @__PURE__ */ jsx13("nav", { className: "butex-widget__sheet-categories", "aria-label": messages.commandCategories, children: ["structures", "functions", "operators", "matrices", "typography", "spacing", "digits"].map((view) => /* @__PURE__ */ jsx13("button", { type: "button", onClick: () => setSheetView(view), children: categoryTitle(view, messages) }, view)) })
16490
- ] }) : null,
16491
- sheetView === "delimiters" ? /* @__PURE__ */ jsx13("div", { className: "butex-widget__sheet-command-grid butex-widget__sheet-command-grid--three", children: [
16492
- { kind: "paren", label: "()", title: messages.insertParentheses },
16493
- { kind: "bracket", label: "[]", title: messages.insertBrackets },
16494
- { kind: "brace", label: "{}", title: messages.insertBraces },
16495
- { kind: "vert", label: "| |", title: "| |" },
16496
- { kind: "Vert", label: "\u2016 \u2016", title: "\u2016 \u2016" }
16497
- ].map((option) => /* @__PURE__ */ jsx13("button", { type: "button", "aria-label": option.title, title: option.title, onClick: () => runAndClose((runtime) => runtime.insertDelimiterByKind(option.kind)), children: option.label }, option.kind)) }) : null,
16498
- sheetView === "structures" ? /* @__PURE__ */ jsxs12(Fragment5, { children: [
16499
- /* @__PURE__ */ jsxs12("div", { className: "butex-widget__sheet-command-grid", children: [
16500
- /* @__PURE__ */ jsx13("button", { type: "button", title: messages.insertRoot, "aria-label": messages.insertRoot, onClick: () => runAndClose((runtime) => runtime.insertSqrt()), children: /* @__PURE__ */ jsx13("span", { className: "toolbar-sqrt-icon", "aria-hidden": "true", children: "\u221A" }) }),
16501
- /* @__PURE__ */ jsx13("button", { type: "button", title: messages.insertOverset, "aria-label": messages.insertOverset, onClick: () => runAndClose((runtime) => runtime.insertOverset()), children: /* @__PURE__ */ jsxs12("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
16502
- /* @__PURE__ */ jsx13("span", { children: "\u2217" }),
16503
- /* @__PURE__ */ jsx13("span", { children: "\u25A1" })
16504
- ] }) }),
16505
- /* @__PURE__ */ jsx13("button", { type: "button", title: messages.insertUnderset, "aria-label": messages.insertUnderset, onClick: () => runAndClose((runtime) => runtime.insertUnderset()), children: /* @__PURE__ */ jsxs12("span", { className: "toolbar-accent-icon toolbar-accent-icon--under", "aria-hidden": "true", children: [
16506
- /* @__PURE__ */ jsx13("span", { children: "\u25A1" }),
16507
- /* @__PURE__ */ jsx13("span", { children: "\u2217" })
16508
- ] }) }),
16509
- /* @__PURE__ */ jsx13("button", { type: "button", title: messages.insertAccentPair, "aria-label": messages.insertAccentPair, onClick: () => runAndClose((runtime) => runtime.insertAccentPair()), children: /* @__PURE__ */ jsxs12("span", { className: "toolbar-accent-icon toolbar-accent-icon--pair", "aria-hidden": "true", children: [
16510
- /* @__PURE__ */ jsx13("span", { children: "\u2217" }),
16511
- /* @__PURE__ */ jsx13("span", { children: "\u25A1" }),
16512
- /* @__PURE__ */ jsx13("span", { children: "\u2217" })
16513
- ] }) }),
16514
- /* @__PURE__ */ jsx13("button", { type: "button", title: messages.removeSuperscript, "aria-label": messages.removeSuperscript, onClick: () => runAndClose((runtime) => runtime.removeSup()), children: /* @__PURE__ */ jsxs12("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sup", "aria-hidden": "true", children: [
16515
- /* @__PURE__ */ jsx13("span", { children: "\xD7" }),
16516
- /* @__PURE__ */ jsx13("span", { children: "\u0646" })
16517
- ] }) }),
16518
- /* @__PURE__ */ jsx13("button", { type: "button", title: messages.removeSubscript, "aria-label": messages.removeSubscript, onClick: () => runAndClose((runtime) => runtime.removeSub()), children: /* @__PURE__ */ jsxs12("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sub", "aria-hidden": "true", children: [
16519
- /* @__PURE__ */ jsx13("span", { children: "\xD7" }),
16520
- /* @__PURE__ */ jsx13("span", { children: "\u0646" })
16521
- ] }) })
16522
- ] }),
16523
- /* @__PURE__ */ jsxs12("section", { className: "butex-widget__sheet-section", children: [
16524
- /* @__PURE__ */ jsx13("h4", { children: messages.insertAccents }),
16525
- /* @__PURE__ */ jsx13("div", { className: "butex-widget__sheet-command-grid", children: ACCENT_COMMANDS2.map((command) => /* @__PURE__ */ jsx13("button", { className: "operator-command-option", type: "button", title: accentCommandTitle(command, uiLocale), "aria-label": accentCommandTitle(command, uiLocale), onClick: () => runAndClose((runtime) => runtime.insertAccent(command.id)), children: /* @__PURE__ */ jsx13("span", { className: "operator-command-label", "aria-hidden": "true", children: command.label }) }, command.id)) })
16526
- ] })
16527
- ] }) : null,
16528
- sheetView === "functions" ? /* @__PURE__ */ jsxs12(Fragment5, { children: [
16529
- renderFunctionGroup(messages.insertFunction, FUNCTION_COMMANDS),
16530
- renderFunctionGroup(messages.insertLimitsSeries, LIMITS_SERIES_COMMANDS, true),
16531
- renderFunctionGroup(messages.insertAdditionalFunctions, FUNCTION2_COMMANDS),
16532
- renderFunctionGroup(messages.insertDerivative, DERIVATIVE_COMMANDS),
16533
- /* @__PURE__ */ jsxs12("div", { className: "butex-widget__sheet-command-grid", children: [
16534
- /* @__PURE__ */ jsx13("button", { className: "function-command-option", type: "button", title: messages.insertFirstDerivative, "aria-label": messages.insertFirstDerivative, onClick: () => runAndClose((runtime) => runtime.insertFirstDerivative()), children: "\u0621/\u0633" }),
16535
- /* @__PURE__ */ jsx13("button", { className: "function-command-option", type: "button", title: messages.insertSecondDerivative, "aria-label": messages.insertSecondDerivative, onClick: () => runAndClose((runtime) => runtime.insertSecondDerivative()), children: "\u0621\xB2/\u0633\xB2" })
16536
- ] }),
16537
- renderFunctionGroup(messages.insertNumberSets, GROUP_COMMANDS, false, true)
16538
- ] }) : null,
16539
- sheetView === "operators" ? OPERATOR_GROUPS.map((commands, index) => /* @__PURE__ */ jsx13("section", { className: "butex-widget__sheet-section", children: /* @__PURE__ */ jsx13("div", { className: "butex-widget__sheet-command-grid", children: commands.map((command) => /* @__PURE__ */ jsx13("button", { className: "operator-command-option", type: "button", title: atomicOperatorCommandTitle(command, uiLocale), "aria-label": atomicOperatorCommandTitle(command, uiLocale), onClick: () => runAndClose((runtime) => runtime.insertAtomicOperatorCommand(command.id)), children: operatorLabel(command) }, command.id)) }) }, String(index))) : null,
16540
- sheetView === "matrices" ? /* @__PURE__ */ jsxs12("div", { className: "butex-widget__mobile-matrix-picker", children: [
16541
- /* @__PURE__ */ jsx13("div", { className: "butex-widget__sheet-choice-row", role: "group", "aria-label": messages.environmentType, children: [
16542
- { id: "matrix", label: messages.matrix },
16543
- { id: "array", label: messages.array },
16544
- { id: "aligned", label: messages.aligned },
16545
- { id: "cases", label: messages.piecewise }
16546
- ].map((option) => /* @__PURE__ */ jsx13(
16547
- "button",
16548
- {
16549
- type: "button",
16550
- "aria-pressed": envMode === option.id,
16551
- onClick: () => {
16552
- setEnvMode(option.id);
16553
- if (option.id === "aligned" || option.id === "cases") setMatrixColumns(2);
16554
- },
16555
- children: option.label
16556
- },
16557
- option.id
16558
- )) }),
16559
- envMode === "matrix" ? /* @__PURE__ */ jsx13("div", { className: "butex-widget__sheet-choice-row", role: "group", "aria-label": messages.matrixType, children: MATRIX_STYLES.map((style) => /* @__PURE__ */ jsx13("button", { type: "button", title: matrixStyleTitle(style.id, messages), "aria-label": matrixStyleTitle(style.id, messages), "aria-pressed": matrixStyle === style.id, onClick: () => setMatrixStyle(style.id), children: style.label }, style.id)) }) : null,
16560
- /* @__PURE__ */ jsxs12("section", { className: "butex-widget__sheet-section", children: [
16561
- /* @__PURE__ */ jsx13("h4", { children: messages.commonMatrixSizes }),
16562
- /* @__PURE__ */ jsx13("div", { className: "butex-widget__matrix-presets", children: (envMode === "aligned" || envMode === "cases" ? MATRIX_PRESETS.filter((preset) => preset.columns === 2) : MATRIX_PRESETS).map((preset) => /* @__PURE__ */ jsxs12(
16563
- "button",
16564
- {
16565
- type: "button",
16566
- "aria-pressed": matrixRows === preset.rows && matrixColumns === preset.columns,
16567
- onClick: () => {
16568
- setMatrixRows(preset.rows);
16569
- setMatrixColumns(envMode === "aligned" || envMode === "cases" ? 2 : preset.columns);
16570
- },
16571
- children: [
16572
- preset.rows,
16573
- "\xD7",
16574
- envMode === "aligned" || envMode === "cases" ? 2 : preset.columns
16575
- ]
16576
- },
16577
- `${String(preset.rows)}-${String(preset.columns)}`
16578
- )) })
16579
- ] }),
16580
- /* @__PURE__ */ jsxs12("div", { className: "butex-widget__matrix-stepper-row", children: [
16581
- /* @__PURE__ */ jsx13("span", { children: messages.rows }),
16582
- /* @__PURE__ */ jsxs12("div", { className: "butex-widget__matrix-stepper", children: [
16583
- /* @__PURE__ */ jsx13("button", { type: "button", disabled: matrixRows <= 1, "aria-label": messages.decreaseRows, onClick: () => setMatrixDimension("rows", matrixRows - 1), children: "\u2212" }),
16584
- /* @__PURE__ */ jsx13("output", { "aria-live": "polite", children: matrixRows }),
16585
- /* @__PURE__ */ jsx13("button", { type: "button", disabled: matrixRows >= 12, "aria-label": messages.increaseRows, onClick: () => setMatrixDimension("rows", matrixRows + 1), children: "+" })
16586
- ] })
16587
- ] }),
16588
- /* @__PURE__ */ jsxs12("div", { className: "butex-widget__matrix-stepper-row", children: [
16589
- /* @__PURE__ */ jsx13("span", { children: messages.columns }),
16590
- /* @__PURE__ */ jsxs12("div", { className: "butex-widget__matrix-stepper", children: [
16591
- /* @__PURE__ */ jsx13("button", { type: "button", disabled: matrixColumns <= 1 || envMode === "aligned" || envMode === "cases", "aria-label": messages.decreaseColumns, onClick: () => setMatrixDimension("columns", matrixColumns - 1), children: "\u2212" }),
16592
- /* @__PURE__ */ jsx13("output", { "aria-live": "polite", children: envMode === "aligned" || envMode === "cases" ? 2 : matrixColumns }),
16593
- /* @__PURE__ */ jsx13("button", { type: "button", disabled: matrixColumns >= 12 || envMode === "aligned" || envMode === "cases", "aria-label": messages.increaseColumns, onClick: () => setMatrixDimension("columns", matrixColumns + 1), children: "+" })
16594
- ] })
16595
- ] }),
16596
- /* @__PURE__ */ jsx13("p", { className: "butex-widget__matrix-size-summary", "aria-live": "polite", children: matrixSizeLabel(matrixRows, envMode === "aligned" || envMode === "cases" ? 2 : matrixColumns, messages) }),
16597
- /* @__PURE__ */ jsx13("button", { type: "button", className: "butex-widget__matrix-insert", onClick: insertEnvironment, children: messages.insert }),
16598
- /* @__PURE__ */ jsxs12("section", { className: "butex-widget__sheet-section", children: [
16599
- /* @__PURE__ */ jsx13("h4", { children: messages.editSelectedEnvironment }),
16600
- envMode === "matrix" ? /* @__PURE__ */ jsx13("button", { type: "button", onClick: () => getRuntime()?.setMatrixEnvStyle(matrixStyle), children: messages.applyStyle }) : null,
16601
- envMode === "array" ? /* @__PURE__ */ jsxs12("div", { className: "butex-widget__matrix-alignment", children: [
16602
- /* @__PURE__ */ jsxs12("label", { children: [
16603
- messages.column,
16604
- /* @__PURE__ */ jsx13("input", { type: "number", min: 1, max: 12, value: alignmentColumn, onChange: (event) => setAlignmentColumn(clampMatrixSize(Number(event.currentTarget.value) || 1)) })
16605
- ] }),
16606
- ARRAY_ALIGNMENTS.map((alignment) => /* @__PURE__ */ jsx13("button", { type: "button", title: alignmentTitle(alignment, messages), onClick: () => getRuntime()?.setArrayColumnAlignment(alignmentColumn - 1, alignment), children: alignmentLabel(alignment, messages) }, alignment))
16607
- ] }) : null,
16608
- /* @__PURE__ */ jsxs12("div", { className: "butex-widget__sheet-command-grid", children: [
16609
- /* @__PURE__ */ jsxs12("button", { type: "button", onClick: () => getRuntime()?.addMatrixRow(), children: [
16610
- "+",
16611
- messages.row
16612
- ] }),
16613
- /* @__PURE__ */ jsxs12("button", { type: "button", onClick: () => getRuntime()?.removeMatrixRow(), children: [
16614
- "\u2212",
16615
- messages.row
16616
- ] }),
16617
- /* @__PURE__ */ jsxs12("button", { type: "button", disabled: envMode === "cases", onClick: () => getRuntime()?.addMatrixColumn(), children: [
16618
- "+",
16619
- messages.column
16620
- ] }),
16621
- /* @__PURE__ */ jsxs12("button", { type: "button", disabled: envMode === "cases", onClick: () => getRuntime()?.removeMatrixColumn(), children: [
16622
- "\u2212",
16623
- messages.column
16624
- ] })
16625
- ] })
16626
- ] })
16627
- ] }) : null,
16628
- sheetView === "typography" ? /* @__PURE__ */ jsxs12(Fragment5, { children: [
16629
- /* @__PURE__ */ jsxs12("section", { className: "butex-widget__sheet-section", children: [
16630
- /* @__PURE__ */ jsx13("h4", { children: messages.chooseWritingFont }),
16631
- /* @__PURE__ */ jsxs12("div", { className: "butex-widget__sheet-choice-row", children: [
16632
- /* @__PURE__ */ jsx13(
16633
- "button",
16634
- {
16635
- type: "button",
16636
- className: "character-font-option--bold",
16637
- "aria-pressed": state.boldCharacterStyle,
16638
- title: boldCharacterStyleLabel(uiLocale),
16639
- onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentBoldCharacterStyle()),
16640
- children: boldCharacterStyleLabel(uiLocale)
16641
- }
16642
- ),
16643
- CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx13(
16644
- "button",
16645
- {
16646
- type: "button",
16647
- className: `character-font-option--${option.id}`,
16648
- "aria-pressed": !state.boldCharacterStyle && state.characterFont === option.id,
16649
- title: characterFontTitle(option.id, messages),
16650
- onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentCharacterFont(option.id)),
16651
- children: option.label
16652
- },
16653
- option.id
16654
- ))
16655
- ] })
16656
- ] }),
16657
- /* @__PURE__ */ jsx13(
16658
- "button",
16659
- {
16660
- className: "ligature-btn butex-widget__compact-ligature",
16661
- type: "button",
16662
- title: !state.splitLeafTyping ? messages.disableLetterMerging : messages.enableLetterMerging,
16663
- "aria-label": !state.splitLeafTyping ? messages.disableLetterMerging : messages.enableLetterMerging,
16664
- "aria-pressed": !state.splitLeafTyping,
16665
- onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.toggleSplitLeafTyping()),
16666
- children: !state.splitLeafTyping ? "\u0633\u0635\u0639" : "\u0633 \u0635 \u0639"
16667
- }
16668
- )
16669
- ] }) : null,
16670
- sheetView === "spacing" ? /* @__PURE__ */ jsx13("div", { className: "butex-widget__sheet-command-list", children: SPACING_COMMANDS.map((command) => /* @__PURE__ */ jsx13("button", { type: "button", title: atomicCommandTitle(command, uiLocale), "aria-label": atomicCommandTitle(command, uiLocale), onClick: () => runAndClose((runtime) => runtime.insertAtomicCommand(command.id)), children: /* @__PURE__ */ jsxs12(
16671
- "span",
17000
+ scope: "butex-widget",
17001
+ sourceRef: moreButtonRef,
17002
+ dialogRef,
17003
+ titleId: sheetTitleId,
17004
+ title: categoryTitle(sheetView, messages),
17005
+ closeLabel: messages.closeActions,
17006
+ onClose: dismissSheet,
17007
+ backRef: backButtonRef,
17008
+ backLabel: messages.back,
17009
+ onBack: sheetView !== "root" && sheetView !== "delimiters" ? () => setSheetView("root") : void 0,
17010
+ children: [
17011
+ sheetView === "root" ? /* @__PURE__ */ jsxs13(Fragment5, { children: [
17012
+ showSideSwitcher ? /* @__PURE__ */ jsx14(MobileSection, { title: messages.activeSide, icon: "typography", children: /* @__PURE__ */ jsxs13("div", { className: "butex-mobile-command__choice-row", children: [
17013
+ /* @__PURE__ */ jsx14(
17014
+ "button",
17015
+ {
17016
+ type: "button",
17017
+ className: "butex-mobile-command__choice",
17018
+ "aria-pressed": state.activeSide === "arabic",
17019
+ onClick: (event) => {
17020
+ if (state.activeSide !== "arabic") runAndKeepFocus(event.currentTarget, (runtime) => runtime.toggleSide());
17021
+ },
17022
+ children: messages.arabicSide
17023
+ }
17024
+ ),
17025
+ /* @__PURE__ */ jsx14(
17026
+ "button",
17027
+ {
17028
+ type: "button",
17029
+ className: "butex-mobile-command__choice",
17030
+ "aria-pressed": state.activeSide === "english",
17031
+ onClick: (event) => {
17032
+ if (state.activeSide !== "english") runAndKeepFocus(event.currentTarget, (runtime) => runtime.toggleSide());
17033
+ },
17034
+ children: messages.englishSide
17035
+ }
17036
+ )
17037
+ ] }) }) : null,
17038
+ /* @__PURE__ */ jsx14(MobileSection, { title: messages.clipboard, icon: "copy", children: /* @__PURE__ */ jsxs13(MobileGrid, { children: [
17039
+ /* @__PURE__ */ jsx14(MobileAction, { command: {
17040
+ id: "copy",
17041
+ label: messages.copy,
17042
+ icon: "copy",
17043
+ disabled: !state.hasSelection,
17044
+ onSelect: () => runAndClose((runtime) => {
17045
+ void runtime.performCopy();
17046
+ })
17047
+ } }),
17048
+ /* @__PURE__ */ jsx14(MobileAction, { command: {
17049
+ id: "cut",
17050
+ label: messages.cut,
17051
+ icon: "cut",
17052
+ disabled: !state.hasSelection,
17053
+ onSelect: () => runAndClose((runtime) => {
17054
+ void runtime.performCut();
17055
+ })
17056
+ } }),
17057
+ /* @__PURE__ */ jsx14(MobileAction, { command: {
17058
+ id: "paste",
17059
+ label: messages.paste,
17060
+ icon: "paste",
17061
+ onSelect: () => runAndClose((runtime) => {
17062
+ void runtime.performPaste();
17063
+ })
17064
+ } })
17065
+ ] }) }),
17066
+ /* @__PURE__ */ jsx14("nav", { "aria-label": messages.commandCategories, children: /* @__PURE__ */ jsx14(MobileGrid, { children: ["structures", "functions", "operators", "matrices", "typography", "spacing", "digits"].map((view) => /* @__PURE__ */ jsx14(
17067
+ MobileCategory,
17068
+ {
17069
+ label: categoryTitle(view, messages),
17070
+ icon: categoryIcons[view],
17071
+ onClick: () => setSheetView(view)
17072
+ },
17073
+ view
17074
+ )) }) })
17075
+ ] }) : null,
17076
+ sheetView === "delimiters" ? /* @__PURE__ */ jsx14("div", { className: "butex-widget__sheet-command-grid butex-widget__sheet-command-grid--three butex-mobile-command__math-glyphs", children: [
17077
+ { kind: "paren", label: "()", title: messages.insertParentheses },
17078
+ { kind: "bracket", label: "[]", title: messages.insertBrackets },
17079
+ { kind: "brace", label: "{}", title: messages.insertBraces },
17080
+ { kind: "vert", label: "| |", title: "| |" },
17081
+ { kind: "Vert", label: "\u2016 \u2016", title: "\u2016 \u2016" }
17082
+ ].map((option) => /* @__PURE__ */ jsx14("button", { type: "button", "aria-label": option.title, title: option.title, onClick: () => runAndClose((runtime) => runtime.insertDelimiterByKind(option.kind)), children: option.label }, option.kind)) }) : null,
17083
+ sheetView === "structures" ? /* @__PURE__ */ jsxs13(Fragment5, { children: [
17084
+ /* @__PURE__ */ jsxs13(MobileGrid, { children: [
17085
+ /* @__PURE__ */ jsx14(MobileAction, { command: { id: "sqrt", label: messages.insertRoot, icon: "math", onSelect: () => runAndClose((runtime) => runtime.insertSqrt()) } }),
17086
+ /* @__PURE__ */ jsx14(MobileAction, { command: { id: "over", label: messages.insertOverset, icon: "structure", onSelect: () => runAndClose((runtime) => runtime.insertOverset()) } }),
17087
+ /* @__PURE__ */ jsx14(MobileAction, { command: { id: "under", label: messages.insertUnderset, icon: "structure", onSelect: () => runAndClose((runtime) => runtime.insertUnderset()) } }),
17088
+ /* @__PURE__ */ jsx14(MobileAction, { command: { id: "pair", label: messages.insertAccentPair, icon: "structure", onSelect: () => runAndClose((runtime) => runtime.insertAccentPair()) } }),
17089
+ /* @__PURE__ */ jsx14(MobileAction, { command: { id: "removeSup", label: messages.removeSuperscript, icon: "trash", onSelect: () => runAndClose((runtime) => runtime.removeSup()) } }),
17090
+ /* @__PURE__ */ jsx14(MobileAction, { command: { id: "removeSub", label: messages.removeSubscript, icon: "trash", onSelect: () => runAndClose((runtime) => runtime.removeSub()) } })
17091
+ ] }),
17092
+ /* @__PURE__ */ jsxs13("section", { className: "butex-widget__sheet-section", children: [
17093
+ /* @__PURE__ */ jsx14("h4", { children: messages.insertAccents }),
17094
+ /* @__PURE__ */ jsx14("div", { className: "butex-widget__sheet-command-grid butex-mobile-command__math-glyphs", children: ACCENT_COMMANDS2.map((command) => /* @__PURE__ */ jsx14("button", { className: "operator-command-option", type: "button", title: accentCommandTitle(command, uiLocale), "aria-label": accentCommandTitle(command, uiLocale), onClick: () => runAndClose((runtime) => runtime.insertAccent(command.id)), children: /* @__PURE__ */ jsx14("span", { className: "operator-command-label", "aria-hidden": "true", children: command.label }) }, command.id)) })
17095
+ ] })
17096
+ ] }) : null,
17097
+ sheetView === "functions" ? /* @__PURE__ */ jsxs13(Fragment5, { children: [
17098
+ renderFunctionGroup(messages.insertFunction, FUNCTION_COMMANDS),
17099
+ renderFunctionGroup(messages.insertLimitsSeries, LIMITS_SERIES_COMMANDS, true),
17100
+ renderFunctionGroup(messages.insertAdditionalFunctions, FUNCTION2_COMMANDS),
17101
+ renderFunctionGroup(messages.insertDerivative, DERIVATIVE_COMMANDS),
17102
+ /* @__PURE__ */ jsxs13("div", { className: "butex-widget__sheet-command-grid butex-mobile-command__math-glyphs", children: [
17103
+ /* @__PURE__ */ jsx14("button", { className: "function-command-option", type: "button", title: messages.insertFirstDerivative, "aria-label": messages.insertFirstDerivative, onClick: () => runAndClose((runtime) => runtime.insertFirstDerivative()), children: "\u0621/\u0633" }),
17104
+ /* @__PURE__ */ jsx14("button", { className: "function-command-option", type: "button", title: messages.insertSecondDerivative, "aria-label": messages.insertSecondDerivative, onClick: () => runAndClose((runtime) => runtime.insertSecondDerivative()), children: "\u0621\xB2/\u0633\xB2" })
17105
+ ] }),
17106
+ renderFunctionGroup(messages.insertNumberSets, GROUP_COMMANDS, false, true)
17107
+ ] }) : null,
17108
+ sheetView === "operators" ? OPERATOR_GROUPS.map((commands, index) => /* @__PURE__ */ jsx14("section", { className: "butex-widget__sheet-section", children: /* @__PURE__ */ jsx14("div", { className: "butex-widget__sheet-command-grid butex-mobile-command__math-glyphs", children: commands.map((command) => /* @__PURE__ */ jsx14("button", { className: "operator-command-option", type: "button", title: atomicOperatorCommandTitle(command, uiLocale), "aria-label": atomicOperatorCommandTitle(command, uiLocale), onClick: () => runAndClose((runtime) => runtime.insertAtomicOperatorCommand(command.id)), children: operatorLabel(command) }, command.id)) }) }, String(index))) : null,
17109
+ sheetView === "matrices" ? /* @__PURE__ */ jsxs13("div", { className: "butex-widget__mobile-matrix-picker", children: [
17110
+ /* @__PURE__ */ jsx14("div", { className: "butex-widget__sheet-choice-row", role: "group", "aria-label": messages.environmentType, children: [
17111
+ { id: "matrix", label: messages.matrix },
17112
+ { id: "array", label: messages.array },
17113
+ { id: "aligned", label: messages.aligned },
17114
+ { id: "cases", label: messages.piecewise }
17115
+ ].map((option) => /* @__PURE__ */ jsx14(
17116
+ "button",
17117
+ {
17118
+ type: "button",
17119
+ "aria-pressed": envMode === option.id,
17120
+ onClick: () => {
17121
+ setEnvMode(option.id);
17122
+ if (option.id === "aligned" || option.id === "cases") setMatrixColumns(2);
17123
+ },
17124
+ children: option.label
17125
+ },
17126
+ option.id
17127
+ )) }),
17128
+ envMode === "matrix" ? /* @__PURE__ */ jsx14("div", { className: "butex-widget__sheet-choice-row", role: "group", "aria-label": messages.matrixType, children: MATRIX_STYLES.map((style) => /* @__PURE__ */ jsx14("button", { type: "button", title: matrixStyleTitle(style.id, messages), "aria-label": matrixStyleTitle(style.id, messages), "aria-pressed": matrixStyle === style.id, onClick: () => setMatrixStyle(style.id), children: style.label }, style.id)) }) : null,
17129
+ /* @__PURE__ */ jsxs13("section", { className: "butex-widget__sheet-section", children: [
17130
+ /* @__PURE__ */ jsx14("h4", { children: messages.commonMatrixSizes }),
17131
+ /* @__PURE__ */ jsx14("div", { className: "butex-widget__matrix-presets", children: (envMode === "aligned" || envMode === "cases" ? MATRIX_PRESETS.filter((preset) => preset.columns === 2) : MATRIX_PRESETS).map((preset) => /* @__PURE__ */ jsxs13(
17132
+ "button",
17133
+ {
17134
+ type: "button",
17135
+ "aria-pressed": matrixRows === preset.rows && matrixColumns === preset.columns,
17136
+ onClick: () => {
17137
+ setMatrixRows(preset.rows);
17138
+ setMatrixColumns(envMode === "aligned" || envMode === "cases" ? 2 : preset.columns);
17139
+ },
17140
+ children: [
17141
+ preset.rows,
17142
+ "\xD7",
17143
+ envMode === "aligned" || envMode === "cases" ? 2 : preset.columns
17144
+ ]
17145
+ },
17146
+ `${String(preset.rows)}-${String(preset.columns)}`
17147
+ )) })
17148
+ ] }),
17149
+ /* @__PURE__ */ jsxs13("div", { className: "butex-widget__matrix-stepper-row", children: [
17150
+ /* @__PURE__ */ jsx14("span", { children: messages.rows }),
17151
+ /* @__PURE__ */ jsxs13("div", { className: "butex-widget__matrix-stepper", children: [
17152
+ /* @__PURE__ */ jsx14("button", { type: "button", disabled: matrixRows <= 1, "aria-label": messages.decreaseRows, onClick: () => setMatrixDimension("rows", matrixRows - 1), children: "\u2212" }),
17153
+ /* @__PURE__ */ jsx14("output", { "aria-live": "polite", children: matrixRows }),
17154
+ /* @__PURE__ */ jsx14("button", { type: "button", disabled: matrixRows >= 12, "aria-label": messages.increaseRows, onClick: () => setMatrixDimension("rows", matrixRows + 1), children: "+" })
17155
+ ] })
17156
+ ] }),
17157
+ /* @__PURE__ */ jsxs13("div", { className: "butex-widget__matrix-stepper-row", children: [
17158
+ /* @__PURE__ */ jsx14("span", { children: messages.columns }),
17159
+ /* @__PURE__ */ jsxs13("div", { className: "butex-widget__matrix-stepper", children: [
17160
+ /* @__PURE__ */ jsx14("button", { type: "button", disabled: matrixColumns <= 1 || envMode === "aligned" || envMode === "cases", "aria-label": messages.decreaseColumns, onClick: () => setMatrixDimension("columns", matrixColumns - 1), children: "\u2212" }),
17161
+ /* @__PURE__ */ jsx14("output", { "aria-live": "polite", children: envMode === "aligned" || envMode === "cases" ? 2 : matrixColumns }),
17162
+ /* @__PURE__ */ jsx14("button", { type: "button", disabled: matrixColumns >= 12 || envMode === "aligned" || envMode === "cases", "aria-label": messages.increaseColumns, onClick: () => setMatrixDimension("columns", matrixColumns + 1), children: "+" })
17163
+ ] })
17164
+ ] }),
17165
+ /* @__PURE__ */ jsx14("p", { className: "butex-widget__matrix-size-summary", "aria-live": "polite", children: matrixSizeLabel(matrixRows, envMode === "aligned" || envMode === "cases" ? 2 : matrixColumns, messages) }),
17166
+ /* @__PURE__ */ jsx14("button", { type: "button", className: "butex-widget__matrix-insert", onClick: insertEnvironment, children: messages.insert }),
17167
+ /* @__PURE__ */ jsxs13("section", { className: "butex-widget__sheet-section", children: [
17168
+ /* @__PURE__ */ jsx14("h4", { children: messages.editSelectedEnvironment }),
17169
+ envMode === "matrix" ? /* @__PURE__ */ jsx14("button", { type: "button", onClick: () => getRuntime()?.setMatrixEnvStyle(matrixStyle), children: messages.applyStyle }) : null,
17170
+ envMode === "array" ? /* @__PURE__ */ jsxs13("div", { className: "butex-widget__matrix-alignment", children: [
17171
+ /* @__PURE__ */ jsxs13("label", { children: [
17172
+ messages.column,
17173
+ /* @__PURE__ */ jsx14("input", { type: "number", min: 1, max: 12, value: alignmentColumn, onChange: (event) => setAlignmentColumn(clampMatrixSize(Number(event.currentTarget.value) || 1)) })
17174
+ ] }),
17175
+ ARRAY_ALIGNMENTS.map((alignment) => /* @__PURE__ */ jsx14("button", { type: "button", title: alignmentTitle(alignment, messages), onClick: () => getRuntime()?.setArrayColumnAlignment(alignmentColumn - 1, alignment), children: alignmentLabel(alignment, messages) }, alignment))
17176
+ ] }) : null,
17177
+ /* @__PURE__ */ jsxs13("div", { className: "butex-widget__sheet-command-grid butex-mobile-command__math-glyphs", children: [
17178
+ /* @__PURE__ */ jsxs13("button", { type: "button", onClick: () => getRuntime()?.addMatrixRow(), children: [
17179
+ "+",
17180
+ messages.row
17181
+ ] }),
17182
+ /* @__PURE__ */ jsxs13("button", { type: "button", onClick: () => getRuntime()?.removeMatrixRow(), children: [
17183
+ "\u2212",
17184
+ messages.row
17185
+ ] }),
17186
+ /* @__PURE__ */ jsxs13("button", { type: "button", disabled: envMode === "cases", onClick: () => getRuntime()?.addMatrixColumn(), children: [
17187
+ "+",
17188
+ messages.column
17189
+ ] }),
17190
+ /* @__PURE__ */ jsxs13("button", { type: "button", disabled: envMode === "cases", onClick: () => getRuntime()?.removeMatrixColumn(), children: [
17191
+ "\u2212",
17192
+ messages.column
17193
+ ] })
17194
+ ] })
17195
+ ] })
17196
+ ] }) : null,
17197
+ sheetView === "typography" ? /* @__PURE__ */ jsxs13(Fragment5, { children: [
17198
+ /* @__PURE__ */ jsxs13("section", { className: "butex-widget__sheet-section", children: [
17199
+ /* @__PURE__ */ jsx14("h4", { children: messages.chooseWritingFont }),
17200
+ /* @__PURE__ */ jsxs13("div", { className: "butex-widget__sheet-choice-row", children: [
17201
+ /* @__PURE__ */ jsx14(
17202
+ "button",
16672
17203
  {
16673
- className: `spacing-command-glyph spacing-command-glyph--${command.spacing.direction} spacing-command-glyph--level-${String(command.spacing.level)}`,
16674
- "aria-hidden": "true",
16675
- children: [
16676
- command.spacing.direction === "negative" ? /* @__PURE__ */ jsx13("span", { className: "spacing-command-glyph__arrow", children: spacingArrow(command, state.activeSide) }) : null,
16677
- /* @__PURE__ */ jsx13("span", { className: "spacing-command-glyph__bar" }),
16678
- command.spacing.direction === "positive" ? /* @__PURE__ */ jsx13("span", { className: "spacing-command-glyph__arrow", children: spacingArrow(command, state.activeSide) }) : null
16679
- ]
17204
+ type: "button",
17205
+ className: "character-font-option--bold",
17206
+ "aria-pressed": state.boldCharacterStyle,
17207
+ title: boldCharacterStyleLabel(uiLocale),
17208
+ onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentBoldCharacterStyle()),
17209
+ children: boldCharacterStyleLabel(uiLocale)
16680
17210
  }
16681
- ) }, command.id)) }) : null,
16682
- sheetView === "digits" ? /* @__PURE__ */ jsx13("div", { className: "butex-widget__sheet-choice-row", children: [
16683
- { id: "western", label: "456" },
16684
- { id: "arabicIndic", label: "\u0664\u0665\u0666" },
16685
- { id: "persianIndic", label: "\u06F4\u06F5\u06F6" }
16686
- ].map((option) => /* @__PURE__ */ jsx13(
17211
+ ),
17212
+ CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx14(
16687
17213
  "button",
16688
17214
  {
16689
17215
  type: "button",
16690
- "aria-pressed": state.digitForm === option.id,
16691
- title: digitTitle(option.id, messages),
16692
- onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentDigitForm(option.id)),
17216
+ className: `character-font-option--${option.id}`,
17217
+ "aria-pressed": !state.boldCharacterStyle && state.characterFont === option.id,
17218
+ title: characterFontTitle(option.id, messages),
17219
+ onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentCharacterFont(option.id)),
16693
17220
  children: option.label
16694
17221
  },
16695
17222
  option.id
16696
- )) }) : null
17223
+ ))
16697
17224
  ] })
16698
- ]
16699
- }
16700
- )
17225
+ ] }),
17226
+ /* @__PURE__ */ jsx14(
17227
+ "button",
17228
+ {
17229
+ className: "ligature-btn butex-widget__compact-ligature",
17230
+ type: "button",
17231
+ title: !state.splitLeafTyping ? messages.disableLetterMerging : messages.enableLetterMerging,
17232
+ "aria-label": !state.splitLeafTyping ? messages.disableLetterMerging : messages.enableLetterMerging,
17233
+ "aria-pressed": !state.splitLeafTyping,
17234
+ onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.toggleSplitLeafTyping()),
17235
+ children: !state.splitLeafTyping ? "\u0633\u0635\u0639" : "\u0633 \u0635 \u0639"
17236
+ }
17237
+ )
17238
+ ] }) : null,
17239
+ sheetView === "spacing" ? /* @__PURE__ */ jsx14("div", { className: "butex-widget__sheet-command-list", children: SPACING_COMMANDS.map((command) => /* @__PURE__ */ jsx14("button", { type: "button", title: atomicCommandTitle(command, uiLocale), "aria-label": atomicCommandTitle(command, uiLocale), onClick: () => runAndClose((runtime) => runtime.insertAtomicCommand(command.id)), children: /* @__PURE__ */ jsxs13(
17240
+ "span",
17241
+ {
17242
+ className: `spacing-command-glyph spacing-command-glyph--${command.spacing.direction} spacing-command-glyph--level-${String(command.spacing.level)}`,
17243
+ "aria-hidden": "true",
17244
+ children: [
17245
+ command.spacing.direction === "negative" ? /* @__PURE__ */ jsx14("span", { className: "spacing-command-glyph__arrow", children: spacingArrow(command, state.activeSide) }) : null,
17246
+ /* @__PURE__ */ jsx14("span", { className: "spacing-command-glyph__bar" }),
17247
+ command.spacing.direction === "positive" ? /* @__PURE__ */ jsx14("span", { className: "spacing-command-glyph__arrow", children: spacingArrow(command, state.activeSide) }) : null
17248
+ ]
17249
+ }
17250
+ ) }, command.id)) }) : null,
17251
+ sheetView === "digits" ? /* @__PURE__ */ jsx14("div", { className: "butex-widget__sheet-choice-row", children: MOBILE_DIGIT_CHOICES.map((option) => /* @__PURE__ */ jsx14(
17252
+ "button",
17253
+ {
17254
+ type: "button",
17255
+ "aria-pressed": state.digitForm === option.id,
17256
+ title: digitTitle(option.id, messages),
17257
+ onClick: (event) => runAndKeepFocus(event.currentTarget, (runtime) => runtime.setCurrentDigitForm(option.id)),
17258
+ children: option.label
17259
+ },
17260
+ option.id
17261
+ )) }) : null
17262
+ ]
16701
17263
  }
16702
17264
  ) : null
16703
17265
  ] });
16704
17266
  }
16705
17267
 
16706
- // src/react/visibleViewport.ts
16707
- function positiveFinite(value, fallback) {
16708
- return Number.isFinite(value) && value > 0 ? value : fallback;
16709
- }
16710
- function finiteOffset(value) {
16711
- return Number.isFinite(value) ? value : 0;
16712
- }
16713
- function visibleViewportSnapshot(view) {
16714
- const fallbackWidth = positiveFinite(view.innerWidth, 1);
16715
- const fallbackHeight = positiveFinite(view.innerHeight, 1);
16716
- const visualViewport = view.visualViewport;
16717
- if (visualViewport && Number.isFinite(visualViewport.width) && visualViewport.width > 0 && Number.isFinite(visualViewport.height) && visualViewport.height > 0) {
16718
- return {
16719
- width: visualViewport.width,
16720
- height: visualViewport.height,
16721
- offsetLeft: finiteOffset(visualViewport.offsetLeft),
16722
- offsetTop: finiteOffset(visualViewport.offsetTop),
16723
- scale: positiveFinite(visualViewport.scale, 1),
16724
- source: "visual-viewport"
16725
- };
16726
- }
16727
- return {
16728
- width: fallbackWidth,
16729
- height: fallbackHeight,
16730
- offsetLeft: 0,
16731
- offsetTop: 0,
16732
- scale: 1,
16733
- source: "layout-viewport"
16734
- };
16735
- }
16736
- function reasonPriority(reason) {
16737
- if (reason === "orientation") return 3;
16738
- if (reason === "resize") return 2;
16739
- if (reason === "scroll") return 1;
16740
- return 0;
16741
- }
16742
- function observeVisibleViewport(view, onChange) {
16743
- let previous = visibleViewportSnapshot(view);
16744
- let frame = null;
16745
- let pendingReason = "scroll";
16746
- onChange({
16747
- snapshot: previous,
16748
- initial: true,
16749
- sizeChanged: false,
16750
- offsetChanged: false,
16751
- reason: "initial"
16752
- });
16753
- const emit = () => {
16754
- frame = null;
16755
- const next = visibleViewportSnapshot(view);
16756
- const sizeChanged = next.width !== previous.width || next.height !== previous.height || next.scale !== previous.scale || next.source !== previous.source;
16757
- const offsetChanged = next.offsetLeft !== previous.offsetLeft || next.offsetTop !== previous.offsetTop;
16758
- const reason = pendingReason;
16759
- pendingReason = "scroll";
16760
- previous = next;
16761
- onChange({ snapshot: next, initial: false, sizeChanged, offsetChanged, reason });
16762
- };
16763
- const schedule = (reason) => {
16764
- if (reasonPriority(reason) > reasonPriority(pendingReason)) {
16765
- pendingReason = reason;
16766
- }
16767
- if (frame !== null) {
16768
- return;
16769
- }
16770
- frame = view.requestAnimationFrame(emit);
16771
- };
16772
- const onResize = () => schedule("resize");
16773
- const onScroll = () => schedule("scroll");
16774
- const onOrientation = () => schedule("orientation");
16775
- const visualViewport = view.visualViewport;
16776
- visualViewport?.addEventListener("resize", onResize);
16777
- visualViewport?.addEventListener("scroll", onScroll);
16778
- view.addEventListener("resize", onResize);
16779
- view.addEventListener("orientationchange", onOrientation);
16780
- return () => {
16781
- visualViewport?.removeEventListener("resize", onResize);
16782
- visualViewport?.removeEventListener("scroll", onScroll);
16783
- view.removeEventListener("resize", onResize);
16784
- view.removeEventListener("orientationchange", onOrientation);
16785
- if (frame !== null) {
16786
- view.cancelAnimationFrame(frame);
16787
- frame = null;
16788
- }
16789
- };
16790
- }
16791
-
16792
17268
  // src/react/desktopPopover.ts
16793
17269
  import { useEffect as useEffect9 } from "react";
16794
17270
  var POPOVER_GAP = 5;
@@ -16929,7 +17405,7 @@ function useDesktopPopoverPlacement(rootRef, active, onClose) {
16929
17405
  }
16930
17406
 
16931
17407
  // src/react/ButexEditor.tsx
16932
- import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
17408
+ import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
16933
17409
  var DIGIT_FORM_OPTIONS = [
16934
17410
  { id: "western", label: "456" },
16935
17411
  { id: "arabicIndic", label: "\u0664\u0665\u0666" },
@@ -16966,7 +17442,7 @@ function matrixSizeLabel2(rows, columns, messages) {
16966
17442
  function clampMatrixSize2(value) {
16967
17443
  return Math.max(1, Math.min(12, Math.trunc(value)));
16968
17444
  }
16969
- function digitFormLabel3(digitForm) {
17445
+ function digitFormLabel2(digitForm) {
16970
17446
  return DIGIT_FORM_OPTIONS.find((option) => option.id === digitForm)?.label ?? "456";
16971
17447
  }
16972
17448
  function characterFontOption(fontId) {
@@ -17008,16 +17484,16 @@ function renderArabicCommandLabel(command) {
17008
17484
  if (command.id !== "ln") {
17009
17485
  return command.arabicLabel;
17010
17486
  }
17011
- return /* @__PURE__ */ jsxs13("span", { className: "function-command-label-with-sub", "aria-hidden": "true", children: [
17012
- /* @__PURE__ */ jsx14("span", { className: "function-command-label-with-sub__base", children: command.arabicLabel }),
17013
- /* @__PURE__ */ jsx14("span", { className: "function-command-label-with-sub__sub", children: "\u0647\u0640" })
17487
+ return /* @__PURE__ */ jsxs14("span", { className: "function-command-label-with-sub", "aria-hidden": "true", children: [
17488
+ /* @__PURE__ */ jsx15("span", { className: "function-command-label-with-sub__base", children: command.arabicLabel }),
17489
+ /* @__PURE__ */ jsx15("span", { className: "function-command-label-with-sub__sub", children: "\u0647\u0640" })
17014
17490
  ] });
17015
17491
  }
17016
17492
  function renderOperatorCommandLabel(command) {
17017
17493
  if (!command.svg_path) {
17018
17494
  return command.Label;
17019
17495
  }
17020
- return /* @__PURE__ */ jsx14(
17496
+ return /* @__PURE__ */ jsx15(
17021
17497
  "span",
17022
17498
  {
17023
17499
  className: "operator-command-svg-label",
@@ -17033,7 +17509,7 @@ function renderOperatorMenuButtonLabel(command, fallback) {
17033
17509
  if (!command) {
17034
17510
  return fallback;
17035
17511
  }
17036
- return /* @__PURE__ */ jsx14("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) });
17512
+ return /* @__PURE__ */ jsx15("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) });
17037
17513
  }
17038
17514
  function passiveTreeText(session, messages) {
17039
17515
  const passive = session.activeSide === "arabic" ? session.englishTree : session.arabicTree;
@@ -17071,29 +17547,29 @@ var ButexEditor = forwardRef(
17071
17547
  const onSessionChangeRef = useRef10(onSessionChange);
17072
17548
  onSessionChangeRef.current = onSessionChange;
17073
17549
  const debugBodyHiddenRef = useRef10(false);
17074
- const [debugBodyHidden, setDebugBodyHidden] = useState9(false);
17550
+ const [debugBodyHidden, setDebugBodyHidden] = useState10(false);
17075
17551
  debugBodyHiddenRef.current = debugBodyHidden;
17076
- const [debugImportOpen, setDebugImportOpen] = useState9(false);
17077
- const [debugImportText, setDebugImportText] = useState9("");
17078
- const [debugImportError, setDebugImportError] = useState9("");
17079
- const [openDesktopMenu, setOpenDesktopMenu] = useState9(null);
17080
- const [selectedDigitForm2, setSelectedDigitForm] = useState9("western");
17081
- const [selectedCharacterFont, setSelectedCharacterFont] = useState9("default");
17082
- const [boldCharacterStyle, setBoldCharacterStyle] = useState9(initialSession?.currentCharacterWrapper === "\\boldarabic");
17083
- const [activeEditorSide, setActiveEditorSide] = useState9("arabic");
17084
- const [compactPreviewOpen, setCompactPreviewOpen] = useState9(false);
17085
- const [compactControlState, setCompactControlState] = useState9({
17552
+ const [debugImportOpen, setDebugImportOpen] = useState10(false);
17553
+ const [debugImportText, setDebugImportText] = useState10("");
17554
+ const [debugImportError, setDebugImportError] = useState10("");
17555
+ const [openDesktopMenu, setOpenDesktopMenu] = useState10(null);
17556
+ const [selectedDigitForm2, setSelectedDigitForm] = useState10("western");
17557
+ const [selectedCharacterFont, setSelectedCharacterFont] = useState10("default");
17558
+ const [boldCharacterStyle, setBoldCharacterStyle] = useState10(initialSession?.currentCharacterWrapper === "\\boldarabic");
17559
+ const [activeEditorSide, setActiveEditorSide] = useState10("arabic");
17560
+ const [compactPreviewOpen, setCompactPreviewOpen] = useState10(false);
17561
+ const [compactControlState, setCompactControlState] = useState10({
17086
17562
  canUndo: false,
17087
17563
  canRedo: false,
17088
17564
  hasSelection: false,
17089
17565
  splitLeafTyping: initialSession?.splitLeafTyping ?? true
17090
17566
  });
17091
- const [envPaletteMode, setEnvPaletteMode] = useState9("matrix");
17092
- const [matrixStyle, setMatrixStyle] = useState9("pmatrix");
17093
- const [matrixRows, setMatrixRows] = useState9(2);
17094
- const [matrixColumns, setMatrixColumns] = useState9(2);
17095
- const [matrixHover, setMatrixHover] = useState9(null);
17096
- const [arrayAlignmentColumn, setArrayAlignmentColumn] = useState9(1);
17567
+ const [envPaletteMode, setEnvPaletteMode] = useState10("matrix");
17568
+ const [matrixStyle, setMatrixStyle] = useState10("pmatrix");
17569
+ const [matrixRows, setMatrixRows] = useState10(2);
17570
+ const [matrixColumns, setMatrixColumns] = useState10(2);
17571
+ const [matrixHover, setMatrixHover] = useState10(null);
17572
+ const [arrayAlignmentColumn, setArrayAlignmentColumn] = useState10(1);
17097
17573
  const closeDesktopMenu = useCallback(() => setOpenDesktopMenu(null), []);
17098
17574
  useDesktopPopoverPlacement(wrapperRef, openDesktopMenu !== null, closeDesktopMenu);
17099
17575
  function desktopMenuOpen(menu) {
@@ -17362,7 +17838,7 @@ ${arabic || currentMessages.empty}`;
17362
17838
  boldCharacterStyle,
17363
17839
  digitForm: selectedDigitForm2
17364
17840
  };
17365
- return /* @__PURE__ */ jsx14(
17841
+ return /* @__PURE__ */ jsx15(
17366
17842
  "div",
17367
17843
  {
17368
17844
  ref: wrapperRef,
@@ -17371,9 +17847,9 @@ ${arabic || currentMessages.empty}`;
17371
17847
  "data-responsive-mode": responsiveMode,
17372
17848
  dir: uiLocaleDirection(uiLocale),
17373
17849
  lang: uiLocale,
17374
- children: /* @__PURE__ */ jsxs13("div", { className: "butex-widget-layout", children: [
17375
- /* @__PURE__ */ jsxs13("section", { className: "panel panel-editor", children: [
17376
- /* @__PURE__ */ jsx14(
17850
+ children: /* @__PURE__ */ jsxs14("div", { className: "butex-widget-layout", children: [
17851
+ /* @__PURE__ */ jsxs14("section", { className: "panel panel-editor", children: [
17852
+ /* @__PURE__ */ jsx15(
17377
17853
  EquationMobileToolbar,
17378
17854
  {
17379
17855
  uiLocale,
@@ -17384,15 +17860,15 @@ ${arabic || currentMessages.empty}`;
17384
17860
  getRuntime: () => runtimeRef.current
17385
17861
  }
17386
17862
  ),
17387
- /* @__PURE__ */ jsxs13("div", { className: "toolbar butex-widget__desktop-toolbar", children: [
17388
- /* @__PURE__ */ jsxs13("div", { className: "toolbar-group toolbar-history", role: "group", "aria-label": messages.undoRedo, children: [
17389
- /* @__PURE__ */ jsx14("button", { ref: undoBtnRef, id: "btn-undo", type: "button", className: "icon-btn", title: messages.undo, "aria-label": messages.undo, children: "\u21B7" }),
17390
- /* @__PURE__ */ jsx14("button", { ref: redoBtnRef, id: "btn-redo", type: "button", className: "icon-btn", title: messages.redo, "aria-label": messages.redo, children: "\u21B6" })
17863
+ /* @__PURE__ */ jsxs14("div", { className: "toolbar butex-widget__desktop-toolbar", children: [
17864
+ /* @__PURE__ */ jsxs14("div", { className: "toolbar-group toolbar-history", role: "group", "aria-label": messages.undoRedo, children: [
17865
+ /* @__PURE__ */ jsx15("button", { ref: undoBtnRef, id: "btn-undo", type: "button", className: "icon-btn", title: messages.undo, "aria-label": messages.undo, children: "\u21B7" }),
17866
+ /* @__PURE__ */ jsx15("button", { ref: redoBtnRef, id: "btn-redo", type: "button", className: "icon-btn", title: messages.redo, "aria-label": messages.redo, children: "\u21B6" })
17391
17867
  ] }),
17392
- /* @__PURE__ */ jsxs13("div", { className: "toolbar-group toolbar-clipboard", role: "group", "aria-label": messages.clipboard, children: [
17393
- /* @__PURE__ */ jsx14("button", { ref: copyBtnRef, id: "btn-copy", type: "button", className: "icon-btn", title: messages.copy, "aria-label": messages.copy, disabled: true, children: "\u29C9" }),
17394
- /* @__PURE__ */ jsx14("button", { ref: cutBtnRef, id: "btn-cut", type: "button", className: "icon-btn", title: messages.cut, "aria-label": messages.cut, disabled: true, children: "\u2702" }),
17395
- /* @__PURE__ */ jsx14(
17868
+ /* @__PURE__ */ jsxs14("div", { className: "toolbar-group toolbar-clipboard", role: "group", "aria-label": messages.clipboard, children: [
17869
+ /* @__PURE__ */ jsx15("button", { ref: copyBtnRef, id: "btn-copy", type: "button", className: "icon-btn", title: messages.copy, "aria-label": messages.copy, disabled: true, children: "\u29C9" }),
17870
+ /* @__PURE__ */ jsx15("button", { ref: cutBtnRef, id: "btn-cut", type: "button", className: "icon-btn", title: messages.cut, "aria-label": messages.cut, disabled: true, children: "\u2702" }),
17871
+ /* @__PURE__ */ jsx15(
17396
17872
  "button",
17397
17873
  {
17398
17874
  id: "btn-paste",
@@ -17409,9 +17885,9 @@ ${arabic || currentMessages.empty}`;
17409
17885
  }
17410
17886
  )
17411
17887
  ] }),
17412
- showSideSwitcher ? /* @__PURE__ */ jsx14("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.editorSettings, children: /* @__PURE__ */ jsx14("button", { className: "icon-btn accent", type: "button", title: messages.toggleSide, "aria-label": messages.toggleSide, onClick: () => runtimeRef.current?.toggleSide(), children: "\u21C4" }) }) : null,
17413
- /* @__PURE__ */ jsxs13("div", { className: "toolbar-group toolbar-structures", role: "group", "aria-label": messages.structures, children: [
17414
- /* @__PURE__ */ jsxs13(
17888
+ showSideSwitcher ? /* @__PURE__ */ jsx15("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.editorSettings, children: /* @__PURE__ */ jsx15("button", { className: "icon-btn accent", type: "button", title: messages.toggleSide, "aria-label": messages.toggleSide, onClick: () => runtimeRef.current?.toggleSide(), children: "\u21C4" }) }) : null,
17889
+ /* @__PURE__ */ jsxs14("div", { className: "toolbar-group toolbar-structures", role: "group", "aria-label": messages.structures, children: [
17890
+ /* @__PURE__ */ jsxs14(
17415
17891
  "div",
17416
17892
  {
17417
17893
  className: "delimiter-command-menu",
@@ -17422,7 +17898,7 @@ ${arabic || currentMessages.empty}`;
17422
17898
  }
17423
17899
  },
17424
17900
  children: [
17425
- /* @__PURE__ */ jsx14(
17901
+ /* @__PURE__ */ jsx15(
17426
17902
  "button",
17427
17903
  {
17428
17904
  className: "icon-btn delimiter-command-btn",
@@ -17435,8 +17911,8 @@ ${arabic || currentMessages.empty}`;
17435
17911
  children: "()"
17436
17912
  }
17437
17913
  ),
17438
- /* @__PURE__ */ jsxs13("div", { className: "delimiter-command-options", role: "menu", "aria-label": messages.insertDelimiters, hidden: !delimiterMenuOpen, children: [
17439
- /* @__PURE__ */ jsx14(
17914
+ /* @__PURE__ */ jsxs14("div", { className: "delimiter-command-options", role: "menu", "aria-label": messages.insertDelimiters, hidden: !delimiterMenuOpen, children: [
17915
+ /* @__PURE__ */ jsx15(
17440
17916
  "button",
17441
17917
  {
17442
17918
  className: "delimiter-command-option",
@@ -17454,7 +17930,7 @@ ${arabic || currentMessages.empty}`;
17454
17930
  children: "()"
17455
17931
  }
17456
17932
  ),
17457
- /* @__PURE__ */ jsx14(
17933
+ /* @__PURE__ */ jsx15(
17458
17934
  "button",
17459
17935
  {
17460
17936
  className: "delimiter-command-option",
@@ -17472,7 +17948,7 @@ ${arabic || currentMessages.empty}`;
17472
17948
  children: "[]"
17473
17949
  }
17474
17950
  ),
17475
- /* @__PURE__ */ jsx14(
17951
+ /* @__PURE__ */ jsx15(
17476
17952
  "button",
17477
17953
  {
17478
17954
  className: "delimiter-command-option",
@@ -17490,7 +17966,7 @@ ${arabic || currentMessages.empty}`;
17490
17966
  children: "{}"
17491
17967
  }
17492
17968
  ),
17493
- /* @__PURE__ */ jsx14(
17969
+ /* @__PURE__ */ jsx15(
17494
17970
  "button",
17495
17971
  {
17496
17972
  className: "delimiter-command-option",
@@ -17508,7 +17984,7 @@ ${arabic || currentMessages.empty}`;
17508
17984
  children: "| |"
17509
17985
  }
17510
17986
  ),
17511
- /* @__PURE__ */ jsx14(
17987
+ /* @__PURE__ */ jsx15(
17512
17988
  "button",
17513
17989
  {
17514
17990
  className: "delimiter-command-option",
@@ -17530,40 +18006,40 @@ ${arabic || currentMessages.empty}`;
17530
18006
  ]
17531
18007
  }
17532
18008
  ),
17533
- /* @__PURE__ */ jsx14("button", { id: "insert-frac", className: "icon-btn frac-icon-btn", type: "button", title: messages.insertFraction, "aria-label": messages.insertFraction, onClick: () => {
18009
+ /* @__PURE__ */ jsx15("button", { id: "insert-frac", className: "icon-btn frac-icon-btn", type: "button", title: messages.insertFraction, "aria-label": messages.insertFraction, onClick: () => {
17534
18010
  runtimeRef.current?.insertFraction();
17535
18011
  focusSurface();
17536
- }, children: /* @__PURE__ */ jsxs13("span", { className: "toolbar-frac-icon", "aria-hidden": "true", children: [
17537
- /* @__PURE__ */ jsx14("span", { children: "\u0623" }),
17538
- /* @__PURE__ */ jsx14("span", { children: "\u0628" })
18012
+ }, children: /* @__PURE__ */ jsxs14("span", { className: "toolbar-frac-icon", "aria-hidden": "true", children: [
18013
+ /* @__PURE__ */ jsx15("span", { children: "\u0623" }),
18014
+ /* @__PURE__ */ jsx15("span", { children: "\u0628" })
17539
18015
  ] }) }),
17540
- /* @__PURE__ */ jsx14("button", { id: "insert-sqrt", className: "icon-btn", type: "button", title: messages.insertRoot, "aria-label": messages.insertRoot, onClick: () => {
18016
+ /* @__PURE__ */ jsx15("button", { id: "insert-sqrt", className: "icon-btn", type: "button", title: messages.insertRoot, "aria-label": messages.insertRoot, onClick: () => {
17541
18017
  runtimeRef.current?.insertSqrt();
17542
18018
  focusSurface();
17543
- }, children: /* @__PURE__ */ jsx14("span", { className: "toolbar-sqrt-icon", "aria-hidden": "true", children: "\u221A" }) }),
17544
- /* @__PURE__ */ jsx14("button", { id: "insert-overset", className: "icon-btn", type: "button", title: messages.insertOverset, "aria-label": messages.insertOverset, onClick: () => {
18019
+ }, children: /* @__PURE__ */ jsx15("span", { className: "toolbar-sqrt-icon", "aria-hidden": "true", children: "\u221A" }) }),
18020
+ /* @__PURE__ */ jsx15("button", { id: "insert-overset", className: "icon-btn", type: "button", title: messages.insertOverset, "aria-label": messages.insertOverset, onClick: () => {
17545
18021
  runtimeRef.current?.insertOverset();
17546
18022
  focusSurface();
17547
- }, children: /* @__PURE__ */ jsxs13("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
17548
- /* @__PURE__ */ jsx14("span", { children: "\u2217" }),
17549
- /* @__PURE__ */ jsx14("span", { children: "\u25A1" })
18023
+ }, children: /* @__PURE__ */ jsxs14("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
18024
+ /* @__PURE__ */ jsx15("span", { children: "\u2217" }),
18025
+ /* @__PURE__ */ jsx15("span", { children: "\u25A1" })
17550
18026
  ] }) }),
17551
- /* @__PURE__ */ jsx14("button", { id: "insert-underset", className: "icon-btn", type: "button", title: messages.insertUnderset, "aria-label": messages.insertUnderset, onClick: () => {
18027
+ /* @__PURE__ */ jsx15("button", { id: "insert-underset", className: "icon-btn", type: "button", title: messages.insertUnderset, "aria-label": messages.insertUnderset, onClick: () => {
17552
18028
  runtimeRef.current?.insertUnderset();
17553
18029
  focusSurface();
17554
- }, children: /* @__PURE__ */ jsxs13("span", { className: "toolbar-accent-icon toolbar-accent-icon--under", "aria-hidden": "true", children: [
17555
- /* @__PURE__ */ jsx14("span", { children: "\u25A1" }),
17556
- /* @__PURE__ */ jsx14("span", { children: "\u2217" })
18030
+ }, children: /* @__PURE__ */ jsxs14("span", { className: "toolbar-accent-icon toolbar-accent-icon--under", "aria-hidden": "true", children: [
18031
+ /* @__PURE__ */ jsx15("span", { children: "\u25A1" }),
18032
+ /* @__PURE__ */ jsx15("span", { children: "\u2217" })
17557
18033
  ] }) }),
17558
- /* @__PURE__ */ jsx14("button", { id: "insert-accent-pair", className: "icon-btn", type: "button", title: messages.insertAccentPair, "aria-label": messages.insertAccentPair, onClick: () => {
18034
+ /* @__PURE__ */ jsx15("button", { id: "insert-accent-pair", className: "icon-btn", type: "button", title: messages.insertAccentPair, "aria-label": messages.insertAccentPair, onClick: () => {
17559
18035
  runtimeRef.current?.insertAccentPair();
17560
18036
  focusSurface();
17561
- }, children: /* @__PURE__ */ jsxs13("span", { className: "toolbar-accent-icon toolbar-accent-icon--pair", "aria-hidden": "true", children: [
17562
- /* @__PURE__ */ jsx14("span", { children: "\u2217" }),
17563
- /* @__PURE__ */ jsx14("span", { children: "\u25A1" }),
17564
- /* @__PURE__ */ jsx14("span", { children: "\u2217" })
18037
+ }, children: /* @__PURE__ */ jsxs14("span", { className: "toolbar-accent-icon toolbar-accent-icon--pair", "aria-hidden": "true", children: [
18038
+ /* @__PURE__ */ jsx15("span", { children: "\u2217" }),
18039
+ /* @__PURE__ */ jsx15("span", { children: "\u25A1" }),
18040
+ /* @__PURE__ */ jsx15("span", { children: "\u2217" })
17565
18041
  ] }) }),
17566
- /* @__PURE__ */ jsxs13(
18042
+ /* @__PURE__ */ jsxs14(
17567
18043
  "div",
17568
18044
  {
17569
18045
  className: "function-command-menu operator-command-menu",
@@ -17574,7 +18050,7 @@ ${arabic || currentMessages.empty}`;
17574
18050
  }
17575
18051
  },
17576
18052
  children: [
17577
- /* @__PURE__ */ jsx14(
18053
+ /* @__PURE__ */ jsx15(
17578
18054
  "button",
17579
18055
  {
17580
18056
  id: "insert-accents",
@@ -17585,13 +18061,13 @@ ${arabic || currentMessages.empty}`;
17585
18061
  "aria-haspopup": "menu",
17586
18062
  "aria-expanded": accentMenuOpen,
17587
18063
  onClick: () => setAccentMenuOpen((open) => !open),
17588
- children: /* @__PURE__ */ jsxs13("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
17589
- /* @__PURE__ */ jsx14("span", { children: "\u02C6" }),
17590
- /* @__PURE__ */ jsx14("span", { children: "\u25A1" })
18064
+ children: /* @__PURE__ */ jsxs14("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
18065
+ /* @__PURE__ */ jsx15("span", { children: "\u02C6" }),
18066
+ /* @__PURE__ */ jsx15("span", { children: "\u25A1" })
17591
18067
  ] })
17592
18068
  }
17593
18069
  ),
17594
- /* @__PURE__ */ jsx14("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertAccents, hidden: !accentMenuOpen, children: ACCENT_COMMANDS_LIST.map((command) => /* @__PURE__ */ jsx14(
18070
+ /* @__PURE__ */ jsx15("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertAccents, hidden: !accentMenuOpen, children: ACCENT_COMMANDS_LIST.map((command) => /* @__PURE__ */ jsx15(
17595
18071
  "button",
17596
18072
  {
17597
18073
  className: "function-command-option operator-command-option",
@@ -17605,7 +18081,7 @@ ${arabic || currentMessages.empty}`;
17605
18081
  setAccentMenuOpen(false);
17606
18082
  focusSurface();
17607
18083
  },
17608
- children: /* @__PURE__ */ jsx14("span", { className: "operator-command-label", children: command.label })
18084
+ children: /* @__PURE__ */ jsx15("span", { className: "operator-command-label", children: command.label })
17609
18085
  },
17610
18086
  command.id
17611
18087
  )) })
@@ -17613,7 +18089,7 @@ ${arabic || currentMessages.empty}`;
17613
18089
  }
17614
18090
  )
17615
18091
  ] }),
17616
- /* @__PURE__ */ jsx14("div", { className: "toolbar-group toolbar-environments", role: "group", "aria-label": messages.environments, children: /* @__PURE__ */ jsxs13(
18092
+ /* @__PURE__ */ jsx15("div", { className: "toolbar-group toolbar-environments", role: "group", "aria-label": messages.environments, children: /* @__PURE__ */ jsxs14(
17617
18093
  "div",
17618
18094
  {
17619
18095
  className: "matrix-command-menu",
@@ -17624,7 +18100,7 @@ ${arabic || currentMessages.empty}`;
17624
18100
  }
17625
18101
  },
17626
18102
  children: [
17627
- /* @__PURE__ */ jsx14(
18103
+ /* @__PURE__ */ jsx15(
17628
18104
  "button",
17629
18105
  {
17630
18106
  className: "icon-btn matrix-command-btn",
@@ -17634,21 +18110,21 @@ ${arabic || currentMessages.empty}`;
17634
18110
  "aria-haspopup": "dialog",
17635
18111
  "aria-expanded": matrixMenuOpen,
17636
18112
  onClick: () => setMatrixMenuOpen((open) => !open),
17637
- children: /* @__PURE__ */ jsxs13("span", { className: "toolbar-matrix-icon", "aria-hidden": "true", children: [
17638
- /* @__PURE__ */ jsx14("span", {}),
17639
- /* @__PURE__ */ jsx14("span", {}),
17640
- /* @__PURE__ */ jsx14("span", {}),
17641
- /* @__PURE__ */ jsx14("span", {})
18113
+ children: /* @__PURE__ */ jsxs14("span", { className: "toolbar-matrix-icon", "aria-hidden": "true", children: [
18114
+ /* @__PURE__ */ jsx15("span", {}),
18115
+ /* @__PURE__ */ jsx15("span", {}),
18116
+ /* @__PURE__ */ jsx15("span", {}),
18117
+ /* @__PURE__ */ jsx15("span", {})
17642
18118
  ] })
17643
18119
  }
17644
18120
  ),
17645
- /* @__PURE__ */ jsxs13("div", { className: "matrix-command-popover", role: "dialog", "aria-label": messages.insertEnvironment, hidden: !matrixMenuOpen, children: [
17646
- /* @__PURE__ */ jsx14("div", { className: "matrix-style-options", role: "listbox", "aria-label": messages.environmentType, children: [
18121
+ /* @__PURE__ */ jsxs14("div", { className: "matrix-command-popover", role: "dialog", "aria-label": messages.insertEnvironment, hidden: !matrixMenuOpen, children: [
18122
+ /* @__PURE__ */ jsx15("div", { className: "matrix-style-options", role: "listbox", "aria-label": messages.environmentType, children: [
17647
18123
  { id: "matrix", label: messages.matrix },
17648
18124
  { id: "array", label: messages.array },
17649
18125
  { id: "aligned", label: messages.aligned },
17650
18126
  { id: "cases", label: messages.piecewise }
17651
- ].map((option) => /* @__PURE__ */ jsx14(
18127
+ ].map((option) => /* @__PURE__ */ jsx15(
17652
18128
  "button",
17653
18129
  {
17654
18130
  type: "button",
@@ -17666,7 +18142,7 @@ ${arabic || currentMessages.empty}`;
17666
18142
  },
17667
18143
  option.id
17668
18144
  )) }),
17669
- envPaletteMode === "matrix" ? /* @__PURE__ */ jsx14("div", { className: "matrix-style-options", role: "listbox", "aria-label": messages.matrixType, children: MATRIX_STYLES2.map((style) => /* @__PURE__ */ jsx14(
18145
+ envPaletteMode === "matrix" ? /* @__PURE__ */ jsx15("div", { className: "matrix-style-options", role: "listbox", "aria-label": messages.matrixType, children: MATRIX_STYLES2.map((style) => /* @__PURE__ */ jsx15(
17670
18146
  "button",
17671
18147
  {
17672
18148
  type: "button",
@@ -17682,15 +18158,15 @@ ${arabic || currentMessages.empty}`;
17682
18158
  },
17683
18159
  style.id
17684
18160
  )) }) : null,
17685
- /* @__PURE__ */ jsx14("div", { className: "matrix-size-readout", children: matrixHover ? matrixSizeLabel2(matrixHover.rows, matrixHover.columns, messages) : matrixSizeLabel2(matrixRows, matrixColumns, messages) }),
17686
- envPaletteMode !== "cases" ? /* @__PURE__ */ jsx14("div", { className: "matrix-grid-picker", "aria-label": messages.chooseEnvironmentSize, children: Array.from(
18161
+ /* @__PURE__ */ jsx15("div", { className: "matrix-size-readout", children: matrixHover ? matrixSizeLabel2(matrixHover.rows, matrixHover.columns, messages) : matrixSizeLabel2(matrixRows, matrixColumns, messages) }),
18162
+ envPaletteMode !== "cases" ? /* @__PURE__ */ jsx15("div", { className: "matrix-grid-picker", "aria-label": messages.chooseEnvironmentSize, children: Array.from(
17687
18163
  { length: 8 },
17688
18164
  (_, rowIndex) => Array.from({ length: 8 }, (_2, columnIndex) => {
17689
18165
  const rows = rowIndex + 1;
17690
18166
  const columns = columnIndex + 1;
17691
18167
  const activeRows = matrixHover?.rows ?? matrixRows;
17692
18168
  const activeColumns = matrixHover?.columns ?? matrixColumns;
17693
- return /* @__PURE__ */ jsx14(
18169
+ return /* @__PURE__ */ jsx15(
17694
18170
  "button",
17695
18171
  {
17696
18172
  type: "button",
@@ -17712,10 +18188,10 @@ ${arabic || currentMessages.empty}`;
17712
18188
  );
17713
18189
  })
17714
18190
  ) }) : null,
17715
- /* @__PURE__ */ jsxs13("div", { className: "matrix-custom-size", children: [
17716
- /* @__PURE__ */ jsxs13("label", { children: [
18191
+ /* @__PURE__ */ jsxs14("div", { className: "matrix-custom-size", children: [
18192
+ /* @__PURE__ */ jsxs14("label", { children: [
17717
18193
  messages.row,
17718
- /* @__PURE__ */ jsx14(
18194
+ /* @__PURE__ */ jsx15(
17719
18195
  "input",
17720
18196
  {
17721
18197
  type: "number",
@@ -17726,9 +18202,9 @@ ${arabic || currentMessages.empty}`;
17726
18202
  }
17727
18203
  )
17728
18204
  ] }),
17729
- /* @__PURE__ */ jsxs13("label", { children: [
18205
+ /* @__PURE__ */ jsxs14("label", { children: [
17730
18206
  messages.column,
17731
- /* @__PURE__ */ jsx14(
18207
+ /* @__PURE__ */ jsx15(
17732
18208
  "input",
17733
18209
  {
17734
18210
  type: "number",
@@ -17740,7 +18216,7 @@ ${arabic || currentMessages.empty}`;
17740
18216
  }
17741
18217
  )
17742
18218
  ] }),
17743
- /* @__PURE__ */ jsx14(
18219
+ /* @__PURE__ */ jsx15(
17744
18220
  "button",
17745
18221
  {
17746
18222
  type: "button",
@@ -17758,12 +18234,12 @@ ${arabic || currentMessages.empty}`;
17758
18234
  }
17759
18235
  )
17760
18236
  ] }),
17761
- /* @__PURE__ */ jsxs13("div", { className: "matrix-edit-actions", "aria-label": messages.editSelectedEnvironment, children: [
17762
- envPaletteMode === "matrix" ? /* @__PURE__ */ jsx14("button", { type: "button", title: messages.applySelectedMatrixStyle, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.setMatrixEnvStyle(matrixStyle), children: messages.applyStyle }) : null,
17763
- envPaletteMode === "array" ? /* @__PURE__ */ jsxs13(Fragment6, { children: [
17764
- /* @__PURE__ */ jsxs13("label", { children: [
18237
+ /* @__PURE__ */ jsxs14("div", { className: "matrix-edit-actions", "aria-label": messages.editSelectedEnvironment, children: [
18238
+ envPaletteMode === "matrix" ? /* @__PURE__ */ jsx15("button", { type: "button", title: messages.applySelectedMatrixStyle, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.setMatrixEnvStyle(matrixStyle), children: messages.applyStyle }) : null,
18239
+ envPaletteMode === "array" ? /* @__PURE__ */ jsxs14(Fragment6, { children: [
18240
+ /* @__PURE__ */ jsxs14("label", { children: [
17765
18241
  messages.column,
17766
- /* @__PURE__ */ jsx14(
18242
+ /* @__PURE__ */ jsx15(
17767
18243
  "input",
17768
18244
  {
17769
18245
  type: "number",
@@ -17774,7 +18250,7 @@ ${arabic || currentMessages.empty}`;
17774
18250
  }
17775
18251
  )
17776
18252
  ] }),
17777
- ARRAY_ALIGNMENTS2.map((alignment) => /* @__PURE__ */ jsx14(
18253
+ ARRAY_ALIGNMENTS2.map((alignment) => /* @__PURE__ */ jsx15(
17778
18254
  "button",
17779
18255
  {
17780
18256
  type: "button",
@@ -17786,19 +18262,19 @@ ${arabic || currentMessages.empty}`;
17786
18262
  alignment.id
17787
18263
  ))
17788
18264
  ] }) : null,
17789
- /* @__PURE__ */ jsxs13("button", { type: "button", title: messages.addRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixRow(), children: [
18265
+ /* @__PURE__ */ jsxs14("button", { type: "button", title: messages.addRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixRow(), children: [
17790
18266
  "+",
17791
18267
  messages.row
17792
18268
  ] }),
17793
- /* @__PURE__ */ jsxs13("button", { type: "button", title: messages.removeRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixRow(), children: [
18269
+ /* @__PURE__ */ jsxs14("button", { type: "button", title: messages.removeRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixRow(), children: [
17794
18270
  "-",
17795
18271
  messages.row
17796
18272
  ] }),
17797
- /* @__PURE__ */ jsxs13("button", { type: "button", title: messages.addColumn, disabled: envPaletteMode === "cases", onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixColumn(), children: [
18273
+ /* @__PURE__ */ jsxs14("button", { type: "button", title: messages.addColumn, disabled: envPaletteMode === "cases", onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixColumn(), children: [
17798
18274
  "+",
17799
18275
  messages.column
17800
18276
  ] }),
17801
- /* @__PURE__ */ jsxs13("button", { type: "button", title: messages.removeColumn, disabled: envPaletteMode === "cases", onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixColumn(), children: [
18277
+ /* @__PURE__ */ jsxs14("button", { type: "button", title: messages.removeColumn, disabled: envPaletteMode === "cases", onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixColumn(), children: [
17802
18278
  "-",
17803
18279
  messages.column
17804
18280
  ] })
@@ -17807,7 +18283,7 @@ ${arabic || currentMessages.empty}`;
17807
18283
  ]
17808
18284
  }
17809
18285
  ) }),
17810
- /* @__PURE__ */ jsx14("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.spaces, children: /* @__PURE__ */ jsxs13(
18286
+ /* @__PURE__ */ jsx15("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.spaces, children: /* @__PURE__ */ jsxs14(
17811
18287
  "div",
17812
18288
  {
17813
18289
  className: `spacing-command-menu spacing-command-menu--${activeEditorSide}`,
@@ -17818,7 +18294,7 @@ ${arabic || currentMessages.empty}`;
17818
18294
  }
17819
18295
  },
17820
18296
  children: [
17821
- /* @__PURE__ */ jsx14(
18297
+ /* @__PURE__ */ jsx15(
17822
18298
  "button",
17823
18299
  {
17824
18300
  className: "icon-btn spacing-command-btn",
@@ -17828,13 +18304,13 @@ ${arabic || currentMessages.empty}`;
17828
18304
  "aria-haspopup": "menu",
17829
18305
  "aria-expanded": spacingMenuOpen,
17830
18306
  onClick: () => setSpacingMenuOpen((open) => !open),
17831
- children: /* @__PURE__ */ jsxs13("span", { className: "spacing-command-glyph spacing-command-glyph--positive spacing-command-glyph--level-2", "aria-hidden": "true", children: [
17832
- /* @__PURE__ */ jsx14("span", { className: "spacing-command-glyph__bar" }),
17833
- /* @__PURE__ */ jsx14("span", { className: "spacing-command-glyph__arrow", children: activeEditorSide === "arabic" ? "\u2190" : "\u2192" })
18307
+ children: /* @__PURE__ */ jsxs14("span", { className: "spacing-command-glyph spacing-command-glyph--positive spacing-command-glyph--level-2", "aria-hidden": "true", children: [
18308
+ /* @__PURE__ */ jsx15("span", { className: "spacing-command-glyph__bar" }),
18309
+ /* @__PURE__ */ jsx15("span", { className: "spacing-command-glyph__arrow", children: activeEditorSide === "arabic" ? "\u2190" : "\u2192" })
17834
18310
  ] })
17835
18311
  }
17836
18312
  ),
17837
- /* @__PURE__ */ jsx14("div", { className: "spacing-command-options", role: "menu", "aria-label": messages.insertSpace, hidden: !spacingMenuOpen, children: SPACING_COMMANDS2.map((command) => /* @__PURE__ */ jsxs13(
18313
+ /* @__PURE__ */ jsx15("div", { className: "spacing-command-options", role: "menu", "aria-label": messages.insertSpace, hidden: !spacingMenuOpen, children: SPACING_COMMANDS2.map((command) => /* @__PURE__ */ jsxs14(
17838
18314
  "button",
17839
18315
  {
17840
18316
  type: "button",
@@ -17848,12 +18324,12 @@ ${arabic || currentMessages.empty}`;
17848
18324
  focusSurface();
17849
18325
  },
17850
18326
  children: [
17851
- /* @__PURE__ */ jsxs13("span", { className: `spacing-command-glyph spacing-command-glyph--${command.spacing.direction} spacing-command-glyph--level-${String(command.spacing.level)}`, "aria-hidden": "true", children: [
17852
- command.spacing.direction === "negative" ? /* @__PURE__ */ jsx14("span", { className: "spacing-command-glyph__arrow", children: spacingArrow2(command, activeEditorSide) }) : null,
17853
- /* @__PURE__ */ jsx14("span", { className: "spacing-command-glyph__bar" }),
17854
- command.spacing.direction === "positive" ? /* @__PURE__ */ jsx14("span", { className: "spacing-command-glyph__arrow", children: spacingArrow2(command, activeEditorSide) }) : null
18327
+ /* @__PURE__ */ jsxs14("span", { className: `spacing-command-glyph spacing-command-glyph--${command.spacing.direction} spacing-command-glyph--level-${String(command.spacing.level)}`, "aria-hidden": "true", children: [
18328
+ command.spacing.direction === "negative" ? /* @__PURE__ */ jsx15("span", { className: "spacing-command-glyph__arrow", children: spacingArrow2(command, activeEditorSide) }) : null,
18329
+ /* @__PURE__ */ jsx15("span", { className: "spacing-command-glyph__bar" }),
18330
+ command.spacing.direction === "positive" ? /* @__PURE__ */ jsx15("span", { className: "spacing-command-glyph__arrow", children: spacingArrow2(command, activeEditorSide) }) : null
17855
18331
  ] }),
17856
- /* @__PURE__ */ jsx14("span", { className: "spacing-command-option__name", children: atomicCommandTitle(command, uiLocale) })
18332
+ /* @__PURE__ */ jsx15("span", { className: "spacing-command-option__name", children: atomicCommandTitle(command, uiLocale) })
17857
18333
  ]
17858
18334
  },
17859
18335
  command.id
@@ -17861,8 +18337,8 @@ ${arabic || currentMessages.empty}`;
17861
18337
  ]
17862
18338
  }
17863
18339
  ) }),
17864
- /* @__PURE__ */ jsxs13("div", { className: "toolbar-group toolbar-functions", role: "group", "aria-label": messages.functions, children: [
17865
- /* @__PURE__ */ jsxs13(
18340
+ /* @__PURE__ */ jsxs14("div", { className: "toolbar-group toolbar-functions", role: "group", "aria-label": messages.functions, children: [
18341
+ /* @__PURE__ */ jsxs14(
17866
18342
  "div",
17867
18343
  {
17868
18344
  className: "function-command-menu",
@@ -17873,7 +18349,7 @@ ${arabic || currentMessages.empty}`;
17873
18349
  }
17874
18350
  },
17875
18351
  children: [
17876
- /* @__PURE__ */ jsx14(
18352
+ /* @__PURE__ */ jsx15(
17877
18353
  "button",
17878
18354
  {
17879
18355
  className: "icon-btn function-command-btn",
@@ -17886,7 +18362,7 @@ ${arabic || currentMessages.empty}`;
17886
18362
  children: FUNCTION_COMMANDS2[0]?.arabicLabel ?? "\u062F"
17887
18363
  }
17888
18364
  ),
17889
- /* @__PURE__ */ jsx14("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertFunction, hidden: !functionMenuOpen, children: FUNCTION_COMMANDS2.map((command) => /* @__PURE__ */ jsx14(
18365
+ /* @__PURE__ */ jsx15("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertFunction, hidden: !functionMenuOpen, children: FUNCTION_COMMANDS2.map((command) => /* @__PURE__ */ jsx15(
17890
18366
  "button",
17891
18367
  {
17892
18368
  className: "function-command-option",
@@ -17907,7 +18383,7 @@ ${arabic || currentMessages.empty}`;
17907
18383
  ]
17908
18384
  }
17909
18385
  ),
17910
- /* @__PURE__ */ jsxs13(
18386
+ /* @__PURE__ */ jsxs14(
17911
18387
  "div",
17912
18388
  {
17913
18389
  className: "function-command-menu function-command-menu--limits-series",
@@ -17918,7 +18394,7 @@ ${arabic || currentMessages.empty}`;
17918
18394
  }
17919
18395
  },
17920
18396
  children: [
17921
- /* @__PURE__ */ jsx14(
18397
+ /* @__PURE__ */ jsx15(
17922
18398
  "button",
17923
18399
  {
17924
18400
  className: "icon-btn function-command-btn",
@@ -17931,7 +18407,7 @@ ${arabic || currentMessages.empty}`;
17931
18407
  children: LIMITS_SERIES_COMMANDS2[0]?.arabicLabel ?? "\u062D\u062F"
17932
18408
  }
17933
18409
  ),
17934
- /* @__PURE__ */ jsx14("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertLimitsSeries, hidden: !limitsSeriesMenuOpen, children: LIMITS_SERIES_COMMANDS2.map((command) => /* @__PURE__ */ jsx14(
18410
+ /* @__PURE__ */ jsx15("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertLimitsSeries, hidden: !limitsSeriesMenuOpen, children: LIMITS_SERIES_COMMANDS2.map((command) => /* @__PURE__ */ jsx15(
17935
18411
  "button",
17936
18412
  {
17937
18413
  className: "function-command-option",
@@ -17952,7 +18428,7 @@ ${arabic || currentMessages.empty}`;
17952
18428
  ]
17953
18429
  }
17954
18430
  ),
17955
- /* @__PURE__ */ jsxs13(
18431
+ /* @__PURE__ */ jsxs14(
17956
18432
  "div",
17957
18433
  {
17958
18434
  className: "function-command-menu function-command-menu--function2",
@@ -17963,7 +18439,7 @@ ${arabic || currentMessages.empty}`;
17963
18439
  }
17964
18440
  },
17965
18441
  children: [
17966
- /* @__PURE__ */ jsx14(
18442
+ /* @__PURE__ */ jsx15(
17967
18443
  "button",
17968
18444
  {
17969
18445
  className: "icon-btn function-command-btn",
@@ -17976,7 +18452,7 @@ ${arabic || currentMessages.empty}`;
17976
18452
  children: FUNCTION2_COMMANDS2[0]?.arabicLabel ?? "\u062F"
17977
18453
  }
17978
18454
  ),
17979
- /* @__PURE__ */ jsx14("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertAdditionalFunctions, hidden: !function2MenuOpen, children: FUNCTION2_COMMANDS2.map((command) => /* @__PURE__ */ jsx14(
18455
+ /* @__PURE__ */ jsx15("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertAdditionalFunctions, hidden: !function2MenuOpen, children: FUNCTION2_COMMANDS2.map((command) => /* @__PURE__ */ jsx15(
17980
18456
  "button",
17981
18457
  {
17982
18458
  className: "function-command-option",
@@ -17997,7 +18473,7 @@ ${arabic || currentMessages.empty}`;
17997
18473
  ]
17998
18474
  }
17999
18475
  ),
18000
- /* @__PURE__ */ jsxs13(
18476
+ /* @__PURE__ */ jsxs14(
18001
18477
  "div",
18002
18478
  {
18003
18479
  className: "function-command-menu function-command-menu--derivative",
@@ -18008,7 +18484,7 @@ ${arabic || currentMessages.empty}`;
18008
18484
  }
18009
18485
  },
18010
18486
  children: [
18011
- /* @__PURE__ */ jsx14(
18487
+ /* @__PURE__ */ jsx15(
18012
18488
  "button",
18013
18489
  {
18014
18490
  className: "icon-btn function-command-btn",
@@ -18021,8 +18497,8 @@ ${arabic || currentMessages.empty}`;
18021
18497
  children: DERIVATIVE_COMMANDS2[0]?.arabicLabel ?? "\u0621"
18022
18498
  }
18023
18499
  ),
18024
- /* @__PURE__ */ jsxs13("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertDerivative, hidden: !derivativeMenuOpen, children: [
18025
- DERIVATIVE_COMMANDS2.map((command) => /* @__PURE__ */ jsx14(
18500
+ /* @__PURE__ */ jsxs14("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertDerivative, hidden: !derivativeMenuOpen, children: [
18501
+ DERIVATIVE_COMMANDS2.map((command) => /* @__PURE__ */ jsx15(
18026
18502
  "button",
18027
18503
  {
18028
18504
  className: "function-command-option",
@@ -18040,7 +18516,7 @@ ${arabic || currentMessages.empty}`;
18040
18516
  },
18041
18517
  command.id
18042
18518
  )),
18043
- /* @__PURE__ */ jsx14(
18519
+ /* @__PURE__ */ jsx15(
18044
18520
  "button",
18045
18521
  {
18046
18522
  className: "function-command-option",
@@ -18057,7 +18533,7 @@ ${arabic || currentMessages.empty}`;
18057
18533
  children: "\u0621/\u0633"
18058
18534
  }
18059
18535
  ),
18060
- /* @__PURE__ */ jsx14(
18536
+ /* @__PURE__ */ jsx15(
18061
18537
  "button",
18062
18538
  {
18063
18539
  className: "function-command-option",
@@ -18078,7 +18554,7 @@ ${arabic || currentMessages.empty}`;
18078
18554
  ]
18079
18555
  }
18080
18556
  ),
18081
- /* @__PURE__ */ jsxs13(
18557
+ /* @__PURE__ */ jsxs14(
18082
18558
  "div",
18083
18559
  {
18084
18560
  className: "function-command-menu function-command-menu--groups",
@@ -18089,7 +18565,7 @@ ${arabic || currentMessages.empty}`;
18089
18565
  }
18090
18566
  },
18091
18567
  children: [
18092
- /* @__PURE__ */ jsx14(
18568
+ /* @__PURE__ */ jsx15(
18093
18569
  "button",
18094
18570
  {
18095
18571
  className: "icon-btn function-command-btn",
@@ -18102,7 +18578,7 @@ ${arabic || currentMessages.empty}`;
18102
18578
  children: GROUP_COMMANDS2[0]?.arabicLabel ?? "\u0645"
18103
18579
  }
18104
18580
  ),
18105
- /* @__PURE__ */ jsx14("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertNumberSets, hidden: !groupMenuOpen, children: GROUP_COMMANDS2.map((command) => /* @__PURE__ */ jsx14(
18581
+ /* @__PURE__ */ jsx15("div", { className: "function-command-options", role: "menu", "aria-label": messages.insertNumberSets, hidden: !groupMenuOpen, children: GROUP_COMMANDS2.map((command) => /* @__PURE__ */ jsx15(
18106
18582
  "button",
18107
18583
  {
18108
18584
  className: "function-command-option",
@@ -18124,8 +18600,8 @@ ${arabic || currentMessages.empty}`;
18124
18600
  }
18125
18601
  )
18126
18602
  ] }),
18127
- /* @__PURE__ */ jsxs13("div", { className: "toolbar-group toolbar-operators", role: "group", "aria-label": messages.operations, children: [
18128
- /* @__PURE__ */ jsxs13(
18603
+ /* @__PURE__ */ jsxs14("div", { className: "toolbar-group toolbar-operators", role: "group", "aria-label": messages.operations, children: [
18604
+ /* @__PURE__ */ jsxs14(
18129
18605
  "div",
18130
18606
  {
18131
18607
  className: "function-command-menu operator-command-menu",
@@ -18136,7 +18612,7 @@ ${arabic || currentMessages.empty}`;
18136
18612
  }
18137
18613
  },
18138
18614
  children: [
18139
- /* @__PURE__ */ jsx14(
18615
+ /* @__PURE__ */ jsx15(
18140
18616
  "button",
18141
18617
  {
18142
18618
  className: "icon-btn function-command-btn operator-command-btn",
@@ -18149,7 +18625,7 @@ ${arabic || currentMessages.empty}`;
18149
18625
  children: renderOperatorMenuButtonLabel(OPERATOR_COMMANDS[0], "\u2217")
18150
18626
  }
18151
18627
  ),
18152
- /* @__PURE__ */ jsx14("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertOperation, hidden: !operatorMenuOpen, children: OPERATOR_COMMANDS.map((command) => /* @__PURE__ */ jsx14(
18628
+ /* @__PURE__ */ jsx15("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertOperation, hidden: !operatorMenuOpen, children: OPERATOR_COMMANDS.map((command) => /* @__PURE__ */ jsx15(
18153
18629
  "button",
18154
18630
  {
18155
18631
  className: "function-command-option operator-command-option",
@@ -18163,14 +18639,14 @@ ${arabic || currentMessages.empty}`;
18163
18639
  setOperatorMenuOpen(false);
18164
18640
  focusSurface();
18165
18641
  },
18166
- children: /* @__PURE__ */ jsx14("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
18642
+ children: /* @__PURE__ */ jsx15("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
18167
18643
  },
18168
18644
  command.id
18169
18645
  )) })
18170
18646
  ]
18171
18647
  }
18172
18648
  ),
18173
- /* @__PURE__ */ jsxs13(
18649
+ /* @__PURE__ */ jsxs14(
18174
18650
  "div",
18175
18651
  {
18176
18652
  className: "function-command-menu operator-command-menu",
@@ -18181,7 +18657,7 @@ ${arabic || currentMessages.empty}`;
18181
18657
  }
18182
18658
  },
18183
18659
  children: [
18184
- /* @__PURE__ */ jsx14(
18660
+ /* @__PURE__ */ jsx15(
18185
18661
  "button",
18186
18662
  {
18187
18663
  className: "icon-btn function-command-btn operator-command-btn",
@@ -18194,7 +18670,7 @@ ${arabic || currentMessages.empty}`;
18194
18670
  children: "\u2229"
18195
18671
  }
18196
18672
  ),
18197
- /* @__PURE__ */ jsx14("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertRelationsSets, hidden: !operator2MenuOpen, children: OPERATOR2_COMMANDS.map((command) => /* @__PURE__ */ jsx14(
18673
+ /* @__PURE__ */ jsx15("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertRelationsSets, hidden: !operator2MenuOpen, children: OPERATOR2_COMMANDS.map((command) => /* @__PURE__ */ jsx15(
18198
18674
  "button",
18199
18675
  {
18200
18676
  className: "function-command-option operator-command-option",
@@ -18208,14 +18684,14 @@ ${arabic || currentMessages.empty}`;
18208
18684
  setOperator2MenuOpen(false);
18209
18685
  focusSurface();
18210
18686
  },
18211
- children: /* @__PURE__ */ jsx14("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
18687
+ children: /* @__PURE__ */ jsx15("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
18212
18688
  },
18213
18689
  command.id
18214
18690
  )) })
18215
18691
  ]
18216
18692
  }
18217
18693
  ),
18218
- /* @__PURE__ */ jsxs13(
18694
+ /* @__PURE__ */ jsxs14(
18219
18695
  "div",
18220
18696
  {
18221
18697
  className: "function-command-menu operator-command-menu",
@@ -18226,7 +18702,7 @@ ${arabic || currentMessages.empty}`;
18226
18702
  }
18227
18703
  },
18228
18704
  children: [
18229
- /* @__PURE__ */ jsx14(
18705
+ /* @__PURE__ */ jsx15(
18230
18706
  "button",
18231
18707
  {
18232
18708
  className: "icon-btn function-command-btn operator-command-btn",
@@ -18239,7 +18715,7 @@ ${arabic || currentMessages.empty}`;
18239
18715
  children: renderOperatorMenuButtonLabel(OPERATOR3_COMMANDS[0], "\u21D2")
18240
18716
  }
18241
18717
  ),
18242
- /* @__PURE__ */ jsx14("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertArrows, hidden: !operator3MenuOpen, children: OPERATOR3_COMMANDS.map((command) => /* @__PURE__ */ jsx14(
18718
+ /* @__PURE__ */ jsx15("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertArrows, hidden: !operator3MenuOpen, children: OPERATOR3_COMMANDS.map((command) => /* @__PURE__ */ jsx15(
18243
18719
  "button",
18244
18720
  {
18245
18721
  className: "function-command-option operator-command-option",
@@ -18253,14 +18729,14 @@ ${arabic || currentMessages.empty}`;
18253
18729
  setOperator3MenuOpen(false);
18254
18730
  focusSurface();
18255
18731
  },
18256
- children: /* @__PURE__ */ jsx14("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
18732
+ children: /* @__PURE__ */ jsx15("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
18257
18733
  },
18258
18734
  command.id
18259
18735
  )) })
18260
18736
  ]
18261
18737
  }
18262
18738
  ),
18263
- /* @__PURE__ */ jsxs13(
18739
+ /* @__PURE__ */ jsxs14(
18264
18740
  "div",
18265
18741
  {
18266
18742
  className: "function-command-menu operator-command-menu",
@@ -18271,7 +18747,7 @@ ${arabic || currentMessages.empty}`;
18271
18747
  }
18272
18748
  },
18273
18749
  children: [
18274
- /* @__PURE__ */ jsx14(
18750
+ /* @__PURE__ */ jsx15(
18275
18751
  "button",
18276
18752
  {
18277
18753
  className: "icon-btn function-command-btn operator-command-btn",
@@ -18284,7 +18760,7 @@ ${arabic || currentMessages.empty}`;
18284
18760
  children: renderOperatorMenuButtonLabel(DOT_COMMANDS[0], "\u2026")
18285
18761
  }
18286
18762
  ),
18287
- /* @__PURE__ */ jsx14("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertDots, hidden: !dotMenuOpen, children: DOT_COMMANDS.map((command) => /* @__PURE__ */ jsx14(
18763
+ /* @__PURE__ */ jsx15("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertDots, hidden: !dotMenuOpen, children: DOT_COMMANDS.map((command) => /* @__PURE__ */ jsx15(
18288
18764
  "button",
18289
18765
  {
18290
18766
  className: "function-command-option operator-command-option",
@@ -18298,14 +18774,14 @@ ${arabic || currentMessages.empty}`;
18298
18774
  setDotMenuOpen(false);
18299
18775
  focusSurface();
18300
18776
  },
18301
- children: /* @__PURE__ */ jsx14("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
18777
+ children: /* @__PURE__ */ jsx15("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
18302
18778
  },
18303
18779
  command.id
18304
18780
  )) })
18305
18781
  ]
18306
18782
  }
18307
18783
  ),
18308
- /* @__PURE__ */ jsxs13(
18784
+ /* @__PURE__ */ jsxs14(
18309
18785
  "div",
18310
18786
  {
18311
18787
  className: "function-command-menu operator-command-menu",
@@ -18316,7 +18792,7 @@ ${arabic || currentMessages.empty}`;
18316
18792
  }
18317
18793
  },
18318
18794
  children: [
18319
- /* @__PURE__ */ jsx14(
18795
+ /* @__PURE__ */ jsx15(
18320
18796
  "button",
18321
18797
  {
18322
18798
  className: "icon-btn function-command-btn operator-command-btn",
@@ -18329,7 +18805,7 @@ ${arabic || currentMessages.empty}`;
18329
18805
  children: renderOperatorMenuButtonLabel(INTEGRAL_COMMANDS[0], "\u222B")
18330
18806
  }
18331
18807
  ),
18332
- /* @__PURE__ */ jsx14("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertIntegrals, hidden: !integralMenuOpen, children: INTEGRAL_COMMANDS.map((command) => /* @__PURE__ */ jsx14(
18808
+ /* @__PURE__ */ jsx15("div", { className: "function-command-options operator-command-options", role: "menu", "aria-label": messages.insertIntegrals, hidden: !integralMenuOpen, children: INTEGRAL_COMMANDS.map((command) => /* @__PURE__ */ jsx15(
18333
18809
  "button",
18334
18810
  {
18335
18811
  className: "function-command-option operator-command-option",
@@ -18343,7 +18819,7 @@ ${arabic || currentMessages.empty}`;
18343
18819
  setIntegralMenuOpen(false);
18344
18820
  focusSurface();
18345
18821
  },
18346
- children: /* @__PURE__ */ jsx14("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
18822
+ children: /* @__PURE__ */ jsx15("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) })
18347
18823
  },
18348
18824
  command.id
18349
18825
  )) })
@@ -18351,28 +18827,28 @@ ${arabic || currentMessages.empty}`;
18351
18827
  }
18352
18828
  )
18353
18829
  ] }),
18354
- /* @__PURE__ */ jsxs13("div", { className: "toolbar-group toolbar-scripts", role: "group", "aria-label": messages.scripts, children: [
18355
- /* @__PURE__ */ jsx14("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSuperscript, "aria-label": messages.addSuperscript, onClick: () => runtimeRef.current?.addSup(), children: /* @__PURE__ */ jsxs13("span", { className: "toolbar-script-icon toolbar-script-icon--sup", "aria-hidden": "true", children: [
18356
- /* @__PURE__ */ jsx14("span", { children: "\u0646" }),
18357
- /* @__PURE__ */ jsx14("span", { children: "\u0633" })
18830
+ /* @__PURE__ */ jsxs14("div", { className: "toolbar-group toolbar-scripts", role: "group", "aria-label": messages.scripts, children: [
18831
+ /* @__PURE__ */ jsx15("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSuperscript, "aria-label": messages.addSuperscript, onClick: () => runtimeRef.current?.addSup(), children: /* @__PURE__ */ jsxs14("span", { className: "toolbar-script-icon toolbar-script-icon--sup", "aria-hidden": "true", children: [
18832
+ /* @__PURE__ */ jsx15("span", { children: "\u0646" }),
18833
+ /* @__PURE__ */ jsx15("span", { children: "\u0633" })
18358
18834
  ] }) }),
18359
- /* @__PURE__ */ jsx14("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSubscript, "aria-label": messages.addSubscript, onClick: () => runtimeRef.current?.addSub(), children: /* @__PURE__ */ jsxs13("span", { className: "toolbar-script-icon toolbar-script-icon--sub", "aria-hidden": "true", children: [
18360
- /* @__PURE__ */ jsx14("span", { children: "\u0646" }),
18361
- /* @__PURE__ */ jsx14("span", { children: "\u0633" })
18835
+ /* @__PURE__ */ jsx15("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSubscript, "aria-label": messages.addSubscript, onClick: () => runtimeRef.current?.addSub(), children: /* @__PURE__ */ jsxs14("span", { className: "toolbar-script-icon toolbar-script-icon--sub", "aria-hidden": "true", children: [
18836
+ /* @__PURE__ */ jsx15("span", { children: "\u0646" }),
18837
+ /* @__PURE__ */ jsx15("span", { children: "\u0633" })
18362
18838
  ] }) }),
18363
- /* @__PURE__ */ jsx14("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__ */ jsxs13("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sup", "aria-hidden": "true", children: [
18364
- /* @__PURE__ */ jsx14("span", { children: "\u0646" }),
18365
- /* @__PURE__ */ jsx14("span", { children: "\xD7" })
18839
+ /* @__PURE__ */ jsx15("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__ */ jsxs14("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sup", "aria-hidden": "true", children: [
18840
+ /* @__PURE__ */ jsx15("span", { children: "\u0646" }),
18841
+ /* @__PURE__ */ jsx15("span", { children: "\xD7" })
18366
18842
  ] }) }),
18367
- /* @__PURE__ */ jsx14("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__ */ jsxs13("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sub", "aria-hidden": "true", children: [
18368
- /* @__PURE__ */ jsx14("span", { children: "\u0646" }),
18369
- /* @__PURE__ */ jsx14("span", { children: "\xD7" })
18843
+ /* @__PURE__ */ jsx15("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__ */ jsxs14("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sub", "aria-hidden": "true", children: [
18844
+ /* @__PURE__ */ jsx15("span", { children: "\u0646" }),
18845
+ /* @__PURE__ */ jsx15("span", { children: "\xD7" })
18370
18846
  ] }) })
18371
18847
  ] }),
18372
- /* @__PURE__ */ jsxs13("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.inputStyles, children: [
18373
- /* @__PURE__ */ jsx14("button", { className: "icon-btn delete-node-btn", type: "button", title: messages.deleteSelectedStructure, "aria-label": messages.deleteSelectedStructure, onClick: () => runtimeRef.current?.deleteStructure(), children: "\xD7" }),
18374
- /* @__PURE__ */ jsx14("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" }),
18375
- /* @__PURE__ */ jsxs13(
18848
+ /* @__PURE__ */ jsxs14("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.inputStyles, children: [
18849
+ /* @__PURE__ */ jsx15("button", { className: "icon-btn delete-node-btn", type: "button", title: messages.deleteSelectedStructure, "aria-label": messages.deleteSelectedStructure, onClick: () => runtimeRef.current?.deleteStructure(), children: "\xD7" }),
18850
+ /* @__PURE__ */ jsx15("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" }),
18851
+ /* @__PURE__ */ jsxs14(
18376
18852
  "div",
18377
18853
  {
18378
18854
  className: "character-font-menu",
@@ -18383,7 +18859,7 @@ ${arabic || currentMessages.empty}`;
18383
18859
  }
18384
18860
  },
18385
18861
  children: [
18386
- /* @__PURE__ */ jsx14(
18862
+ /* @__PURE__ */ jsx15(
18387
18863
  "button",
18388
18864
  {
18389
18865
  ref: characterFontBtnRef,
@@ -18398,8 +18874,8 @@ ${arabic || currentMessages.empty}`;
18398
18874
  children: boldCharacterStyle ? boldCharacterStyleLabel2(uiLocale) : characterFontOption(selectedCharacterFont).label
18399
18875
  }
18400
18876
  ),
18401
- /* @__PURE__ */ jsxs13("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: [
18402
- /* @__PURE__ */ jsx14(
18877
+ /* @__PURE__ */ jsxs14("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: [
18878
+ /* @__PURE__ */ jsx15(
18403
18879
  "button",
18404
18880
  {
18405
18881
  type: "button",
@@ -18416,7 +18892,7 @@ ${arabic || currentMessages.empty}`;
18416
18892
  children: boldCharacterStyleLabel2(uiLocale)
18417
18893
  }
18418
18894
  ),
18419
- CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx14(
18895
+ CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ jsx15(
18420
18896
  "button",
18421
18897
  {
18422
18898
  type: "button",
@@ -18439,7 +18915,7 @@ ${arabic || currentMessages.empty}`;
18439
18915
  ]
18440
18916
  }
18441
18917
  ),
18442
- /* @__PURE__ */ jsxs13(
18918
+ /* @__PURE__ */ jsxs14(
18443
18919
  "div",
18444
18920
  {
18445
18921
  className: "digit-form-menu",
@@ -18450,7 +18926,7 @@ ${arabic || currentMessages.empty}`;
18450
18926
  }
18451
18927
  },
18452
18928
  children: [
18453
- /* @__PURE__ */ jsx14(
18929
+ /* @__PURE__ */ jsx15(
18454
18930
  "button",
18455
18931
  {
18456
18932
  ref: digitFormBtnRef,
@@ -18462,10 +18938,10 @@ ${arabic || currentMessages.empty}`;
18462
18938
  "aria-haspopup": "listbox",
18463
18939
  "aria-expanded": digitMenuOpen,
18464
18940
  onClick: () => setDigitMenuOpen((open) => !open),
18465
- children: digitFormLabel3(selectedDigitForm2)
18941
+ children: digitFormLabel2(selectedDigitForm2)
18466
18942
  }
18467
18943
  ),
18468
- /* @__PURE__ */ jsx14("div", { className: "digit-form-options", role: "listbox", "aria-label": messages.chooseDigitForm, hidden: !digitMenuOpen, children: DIGIT_FORM_OPTIONS.map((option) => /* @__PURE__ */ jsx14(
18944
+ /* @__PURE__ */ jsx15("div", { className: "digit-form-options", role: "listbox", "aria-label": messages.chooseDigitForm, hidden: !digitMenuOpen, children: DIGIT_FORM_OPTIONS.map((option) => /* @__PURE__ */ jsx15(
18469
18945
  "button",
18470
18946
  {
18471
18947
  type: "button",
@@ -18489,7 +18965,7 @@ ${arabic || currentMessages.empty}`;
18489
18965
  )
18490
18966
  ] })
18491
18967
  ] }),
18492
- /* @__PURE__ */ jsx14(
18968
+ /* @__PURE__ */ jsx15(
18493
18969
  "div",
18494
18970
  {
18495
18971
  ref: surfaceRef,
@@ -18499,7 +18975,7 @@ ${arabic || currentMessages.empty}`;
18499
18975
  "aria-label": messages.equationEditor
18500
18976
  }
18501
18977
  ),
18502
- /* @__PURE__ */ jsx14(
18978
+ /* @__PURE__ */ jsx15(
18503
18979
  "textarea",
18504
18980
  {
18505
18981
  ref: inputRef,
@@ -18513,8 +18989,8 @@ ${arabic || currentMessages.empty}`;
18513
18989
  tabIndex: -1
18514
18990
  }
18515
18991
  ),
18516
- /* @__PURE__ */ jsx14("div", { ref: renderErrorRef, className: "error", hidden: true }),
18517
- /* @__PURE__ */ jsx14(
18992
+ /* @__PURE__ */ jsx15("div", { ref: renderErrorRef, className: "error", hidden: true }),
18993
+ /* @__PURE__ */ jsx15(
18518
18994
  "button",
18519
18995
  {
18520
18996
  type: "button",
@@ -18526,18 +19002,18 @@ ${arabic || currentMessages.empty}`;
18526
19002
  }
18527
19003
  )
18528
19004
  ] }),
18529
- /* @__PURE__ */ jsx14("section", { id: previewPanelId, className: "panel panel-preview", "aria-label": messages.renderPreview, children: /* @__PURE__ */ jsx14("div", { ref: mathOutputRef, className: "preview-box" }) }),
18530
- debugEnabled ? /* @__PURE__ */ jsxs13("section", { className: "panel", children: [
18531
- /* @__PURE__ */ jsxs13("div", { className: "dev-strip", children: [
18532
- /* @__PURE__ */ jsx14("span", { className: "dev-badge", children: messages.development }),
18533
- /* @__PURE__ */ jsx14("div", { ref: latexLinesRef, className: "ascii" }),
18534
- /* @__PURE__ */ jsx14("div", { ref: passivePreviewRef, className: "passive-preview-text" })
19005
+ /* @__PURE__ */ jsx15("section", { id: previewPanelId, className: "panel panel-preview", "aria-label": messages.renderPreview, children: /* @__PURE__ */ jsx15("div", { ref: mathOutputRef, className: "preview-box" }) }),
19006
+ debugEnabled ? /* @__PURE__ */ jsxs14("section", { className: "panel", children: [
19007
+ /* @__PURE__ */ jsxs14("div", { className: "dev-strip", children: [
19008
+ /* @__PURE__ */ jsx15("span", { className: "dev-badge", children: messages.development }),
19009
+ /* @__PURE__ */ jsx15("div", { ref: latexLinesRef, className: "ascii" }),
19010
+ /* @__PURE__ */ jsx15("div", { ref: passivePreviewRef, className: "passive-preview-text" })
18535
19011
  ] }),
18536
- /* @__PURE__ */ jsxs13("div", { style: { marginTop: 12 }, children: [
18537
- /* @__PURE__ */ jsxs13("div", { className: "debug-head", children: [
18538
- /* @__PURE__ */ jsx14("button", { type: "button", onClick: () => void copyDebugText(currentMathObjectJsonText()), children: "Copy MathObject JSON" }),
18539
- /* @__PURE__ */ jsx14("button", { type: "button", "aria-expanded": debugImportOpen, onClick: openDebugMathObjectImport, children: "Import MathObject JSON" }),
18540
- /* @__PURE__ */ jsx14(
19012
+ /* @__PURE__ */ jsxs14("div", { style: { marginTop: 12 }, children: [
19013
+ /* @__PURE__ */ jsxs14("div", { className: "debug-head", children: [
19014
+ /* @__PURE__ */ jsx15("button", { type: "button", onClick: () => void copyDebugText(currentMathObjectJsonText()), children: "Copy MathObject JSON" }),
19015
+ /* @__PURE__ */ jsx15("button", { type: "button", "aria-expanded": debugImportOpen, onClick: openDebugMathObjectImport, children: "Import MathObject JSON" }),
19016
+ /* @__PURE__ */ jsx15(
18541
19017
  "button",
18542
19018
  {
18543
19019
  type: "button",
@@ -18557,7 +19033,7 @@ ${arabic || currentMessages.empty}`;
18557
19033
  children: debugBodyHidden ? messages.showDebugLog : messages.hideDebugLog
18558
19034
  }
18559
19035
  ),
18560
- /* @__PURE__ */ jsx14(
19036
+ /* @__PURE__ */ jsx15(
18561
19037
  "button",
18562
19038
  {
18563
19039
  type: "button",
@@ -18572,8 +19048,8 @@ ${arabic || currentMessages.empty}`;
18572
19048
  }
18573
19049
  )
18574
19050
  ] }),
18575
- debugImportOpen ? /* @__PURE__ */ jsxs13("div", { className: "debug-json-import", children: [
18576
- /* @__PURE__ */ jsx14(
19051
+ debugImportOpen ? /* @__PURE__ */ jsxs14("div", { className: "debug-json-import", children: [
19052
+ /* @__PURE__ */ jsx15(
18577
19053
  "textarea",
18578
19054
  {
18579
19055
  value: debugImportText,
@@ -18585,9 +19061,9 @@ ${arabic || currentMessages.empty}`;
18585
19061
  }
18586
19062
  }
18587
19063
  ),
18588
- /* @__PURE__ */ jsxs13("div", { className: "debug-head", children: [
18589
- /* @__PURE__ */ jsx14("button", { type: "button", onClick: applyDebugMathObjectImport, children: "Apply" }),
18590
- /* @__PURE__ */ jsx14(
19064
+ /* @__PURE__ */ jsxs14("div", { className: "debug-head", children: [
19065
+ /* @__PURE__ */ jsx15("button", { type: "button", onClick: applyDebugMathObjectImport, children: "Apply" }),
19066
+ /* @__PURE__ */ jsx15(
18591
19067
  "button",
18592
19068
  {
18593
19069
  type: "button",
@@ -18599,9 +19075,9 @@ ${arabic || currentMessages.empty}`;
18599
19075
  }
18600
19076
  )
18601
19077
  ] }),
18602
- debugImportError ? /* @__PURE__ */ jsx14("p", { className: "debug-json-error", children: debugImportError }) : null
19078
+ debugImportError ? /* @__PURE__ */ jsx15("p", { className: "debug-json-error", children: debugImportError }) : null
18603
19079
  ] }) : null,
18604
- /* @__PURE__ */ jsx14("div", { ref: debugLogRef, className: "debug-log" })
19080
+ /* @__PURE__ */ jsx15("div", { ref: debugLogRef, className: "debug-log" })
18605
19081
  ] })
18606
19082
  ] }) : null
18607
19083
  ] })
@@ -18612,7 +19088,7 @@ ${arabic || currentMessages.empty}`;
18612
19088
  ButexEditor.displayName = "ButexEditor";
18613
19089
 
18614
19090
  // src/react-document/EquationDrawer.tsx
18615
- import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
19091
+ import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
18616
19092
  function keyErrorMessage2(error, messages) {
18617
19093
  if (error === "empty") {
18618
19094
  return messages.keyEmpty;
@@ -18629,6 +19105,7 @@ function standardCommandWarning(uiLocale) {
18629
19105
  return uiLocale === "en" ? "This equation contains standard non-Arabic math commands. Review them and replace them with the Arabic-oriented equivalent where appropriate." : "\u062A\u062D\u062A\u0648\u064A \u0647\u0630\u0647 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629 \u0639\u0644\u0649 \u0631\u0645\u0648\u0632 \u0623\u0648 \u0623\u0648\u0627\u0645\u0631 \u0631\u064A\u0627\u0636\u064A\u0629 \u0642\u064A\u0627\u0633\u064A\u0629 \u063A\u064A\u0631 \u0645\u0639\u0631\u0651\u0628\u0629. \u064A\u064F\u0631\u062C\u0649 \u0645\u0631\u0627\u062C\u0639\u062A\u0647\u0627 \u0648\u0627\u0633\u062A\u0628\u062F\u0627\u0644\u0647\u0627 \u0628\u0627\u0644\u0645\u0642\u0627\u0628\u0644 \u0627\u0644\u0639\u0631\u0628\u064A \u0639\u0646\u062F \u0627\u0644\u062D\u0627\u062C\u0629.";
18630
19106
  }
18631
19107
  function EquationDrawer({
19108
+ sourceRef,
18632
19109
  debug = false,
18633
19110
  session,
18634
19111
  reason,
@@ -18653,11 +19130,10 @@ function EquationDrawer({
18653
19130
  }) {
18654
19131
  const messages = documentMessages(uiLocale);
18655
19132
  const latestSession = useRef11(session);
18656
- const modalRef = useRef11(null);
18657
19133
  const dialogRef = useRef11(null);
18658
19134
  const titleId = useId5();
18659
- const [labelOverride, setLabelOverride] = useState10(null);
18660
- const [hasStandardCommandWarning, setHasStandardCommandWarning] = useState10(
19135
+ const [labelOverride, setLabelOverride] = useState11(null);
19136
+ const [hasStandardCommandWarning, setHasStandardCommandWarning] = useState11(
18661
19137
  () => sessionHasStandardCommands(session)
18662
19138
  );
18663
19139
  const displayedLabel = labelOverride ?? label;
@@ -18674,26 +19150,8 @@ function EquationDrawer({
18674
19150
  setHasStandardCommandWarning(sessionHasStandardCommands(session));
18675
19151
  }, [session]);
18676
19152
  useDialogFocus({ open: true, dialogRef, onClose });
18677
- useEffect11(() => observeVisibleViewport(window, ({ snapshot }) => {
18678
- const modal = modalRef.current;
18679
- if (!modal) {
18680
- return;
18681
- }
18682
- if (snapshot.source !== "visual-viewport") {
18683
- delete modal.dataset.visibleViewport;
18684
- for (const name of ["top", "left", "width", "height"]) {
18685
- modal.style.removeProperty(`--butex-document-visible-viewport-${name}`);
18686
- }
18687
- return;
18688
- }
18689
- modal.dataset.visibleViewport = "true";
18690
- modal.style.setProperty("--butex-document-visible-viewport-top", `${String(snapshot.offsetTop)}px`);
18691
- modal.style.setProperty("--butex-document-visible-viewport-left", `${String(snapshot.offsetLeft)}px`);
18692
- modal.style.setProperty("--butex-document-visible-viewport-width", `${String(snapshot.width)}px`);
18693
- modal.style.setProperty("--butex-document-visible-viewport-height", `${String(snapshot.height)}px`);
18694
- }), []);
18695
- return /* @__PURE__ */ jsxs14("div", { ref: modalRef, className: "butex-document-widget__equation-modal", role: "presentation", children: [
18696
- /* @__PURE__ */ jsx15(
19153
+ return /* @__PURE__ */ jsx16(ViewportModalPortal, { sourceRef, scopeClassName: "butex-document-widget", children: /* @__PURE__ */ jsxs15("div", { className: "butex-document-widget__equation-modal", style: { position: "absolute" }, role: "presentation", children: [
19154
+ /* @__PURE__ */ jsx16(
18697
19155
  "button",
18698
19156
  {
18699
19157
  type: "button",
@@ -18702,7 +19160,7 @@ function EquationDrawer({
18702
19160
  onClick: onClose
18703
19161
  }
18704
19162
  ),
18705
- /* @__PURE__ */ jsxs14(
19163
+ /* @__PURE__ */ jsxs15(
18706
19164
  "div",
18707
19165
  {
18708
19166
  ref: dialogRef,
@@ -18714,28 +19172,28 @@ function EquationDrawer({
18714
19172
  lang: uiLocale,
18715
19173
  tabIndex: -1,
18716
19174
  children: [
18717
- /* @__PURE__ */ jsxs14("div", { className: "butex-document-widget__row butex-document-widget__equation-modal-header", children: [
18718
- /* @__PURE__ */ jsx15("strong", { id: titleId, children: messages.equationEditorTitle }),
18719
- /* @__PURE__ */ jsx15("button", { type: "button", "data-dialog-initial-focus": true, onClick: onClose, children: messages.close })
19175
+ /* @__PURE__ */ jsxs15("div", { className: "butex-document-widget__row butex-document-widget__equation-modal-header", children: [
19176
+ /* @__PURE__ */ jsx16("strong", { id: titleId, children: messages.equationEditorTitle }),
19177
+ /* @__PURE__ */ jsx16("button", { type: "button", "data-dialog-initial-focus": true, onClick: onClose, children: messages.close })
18720
19178
  ] }),
18721
- /* @__PURE__ */ jsxs14("div", { className: "butex-document-widget__equation-modal-body", children: [
18722
- /* @__PURE__ */ jsxs14("div", { className: "butex-document-widget__row", role: "group", "aria-label": messages.equationType, children: [
18723
- /* @__PURE__ */ jsxs14("button", { type: "button", "aria-pressed": mathMode === "inline", onClick: () => onMathModeChange("inline"), children: [
19179
+ /* @__PURE__ */ jsxs15("div", { className: "butex-document-widget__equation-modal-body", children: [
19180
+ /* @__PURE__ */ jsxs15("div", { className: "butex-document-widget__row", role: "group", "aria-label": messages.equationType, children: [
19181
+ /* @__PURE__ */ jsxs15("button", { type: "button", "aria-pressed": mathMode === "inline", onClick: () => onMathModeChange("inline"), children: [
18724
19182
  messages.inline,
18725
19183
  " ($)"
18726
19184
  ] }),
18727
- /* @__PURE__ */ jsxs14("button", { type: "button", "aria-pressed": mathMode === "display", onClick: () => onMathModeChange("display"), children: [
19185
+ /* @__PURE__ */ jsxs15("button", { type: "button", "aria-pressed": mathMode === "display", onClick: () => onMathModeChange("display"), children: [
18728
19186
  messages.displayed,
18729
19187
  " (\\\\[)"
18730
19188
  ] })
18731
19189
  ] }),
18732
- mathMode === "display" ? /* @__PURE__ */ jsxs14("div", { className: "butex-document-widget__float-meta", children: [
18733
- /* @__PURE__ */ jsxs14("label", { className: "butex-document-widget__float-meta-toggle", children: [
18734
- /* @__PURE__ */ jsx15("input", { type: "checkbox", checked: numbered, onChange: (event) => onNumberedChange?.(event.currentTarget.checked) }),
18735
- /* @__PURE__ */ jsx15("span", { children: uiLocale === "ar" ? "\u062A\u0631\u0642\u064A\u0645 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629" : "Number equation" })
19190
+ mathMode === "display" ? /* @__PURE__ */ jsxs15("div", { className: "butex-document-widget__float-meta", children: [
19191
+ /* @__PURE__ */ jsxs15("label", { className: "butex-document-widget__float-meta-toggle", children: [
19192
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: numbered, onChange: (event) => onNumberedChange?.(event.currentTarget.checked) }),
19193
+ /* @__PURE__ */ jsx16("span", { children: uiLocale === "ar" ? "\u062A\u0631\u0642\u064A\u0645 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629" : "Number equation" })
18736
19194
  ] }),
18737
- /* @__PURE__ */ jsxs14("label", { className: "butex-document-widget__float-meta-toggle", children: [
18738
- /* @__PURE__ */ jsx15(
19195
+ /* @__PURE__ */ jsxs15("label", { className: "butex-document-widget__float-meta-toggle", children: [
19196
+ /* @__PURE__ */ jsx16(
18739
19197
  "input",
18740
19198
  {
18741
19199
  type: "checkbox",
@@ -18743,11 +19201,11 @@ function EquationDrawer({
18743
19201
  onChange: (event) => onLabelEnabledChange?.(event.currentTarget.checked)
18744
19202
  }
18745
19203
  ),
18746
- /* @__PURE__ */ jsx15("span", { children: messages.labelToggle })
19204
+ /* @__PURE__ */ jsx16("span", { children: messages.labelToggle })
18747
19205
  ] }),
18748
- labelEnabled ? /* @__PURE__ */ jsxs14("label", { className: "butex-document-widget__refs-field", children: [
18749
- /* @__PURE__ */ jsx15("span", { children: messages.floatLabel }),
18750
- /* @__PURE__ */ jsx15(
19206
+ labelEnabled ? /* @__PURE__ */ jsxs15("label", { className: "butex-document-widget__refs-field", children: [
19207
+ /* @__PURE__ */ jsx16("span", { children: messages.floatLabel }),
19208
+ /* @__PURE__ */ jsx16(
18751
19209
  "input",
18752
19210
  {
18753
19211
  value: displayedLabel,
@@ -18770,12 +19228,12 @@ function EquationDrawer({
18770
19228
  }
18771
19229
  }
18772
19230
  ),
18773
- labelError !== null ? /* @__PURE__ */ jsx15("p", { className: "butex-document-widget__field-error", children: labelError === "invalid" ? messages.keyRulesHint : keyErrorMessage2(labelError, messages) }) : null
19231
+ labelError !== null ? /* @__PURE__ */ jsx16("p", { className: "butex-document-widget__field-error", children: labelError === "invalid" ? messages.keyRulesHint : keyErrorMessage2(labelError, messages) }) : null
18774
19232
  ] }) : null
18775
19233
  ] }) : null,
18776
- reason ? /* @__PURE__ */ jsx15("p", { className: "butex-document-widget__error", children: uiLocale === "en" ? messages.equationUnavailable : reason }) : null,
18777
- hasStandardCommandWarning && !reason ? /* @__PURE__ */ jsx15("p", { className: "butex-document-widget__standard-command-warning", role: "status", children: standardCommandWarning(uiLocale) }) : null,
18778
- /* @__PURE__ */ jsx15(
19234
+ reason ? /* @__PURE__ */ jsx16("p", { className: "butex-document-widget__error", children: uiLocale === "en" ? messages.equationUnavailable : reason }) : null,
19235
+ hasStandardCommandWarning && !reason ? /* @__PURE__ */ jsx16("p", { className: "butex-document-widget__standard-command-warning", role: "status", children: standardCommandWarning(uiLocale) }) : null,
19236
+ /* @__PURE__ */ jsx16(
18779
19237
  ButexEditor,
18780
19238
  {
18781
19239
  debug,
@@ -18791,9 +19249,9 @@ function EquationDrawer({
18791
19249
  }
18792
19250
  )
18793
19251
  ] }),
18794
- /* @__PURE__ */ jsxs14("div", { className: "butex-document-widget__row butex-document-widget__equation-modal-actions", children: [
18795
- canDelete && onDelete ? /* @__PURE__ */ jsx15("button", { type: "button", className: "butex-document-widget__button--danger", onClick: onDelete, children: messages.deleteEquation }) : null,
18796
- /* @__PURE__ */ jsx15(
19252
+ /* @__PURE__ */ jsxs15("div", { className: "butex-document-widget__row butex-document-widget__equation-modal-actions", children: [
19253
+ canDelete && onDelete ? /* @__PURE__ */ jsx16("button", { type: "button", className: "butex-document-widget__button--danger", onClick: onDelete, children: messages.deleteEquation }) : null,
19254
+ /* @__PURE__ */ jsx16(
18797
19255
  "button",
18798
19256
  {
18799
19257
  type: "button",
@@ -18806,12 +19264,12 @@ function EquationDrawer({
18806
19264
  ]
18807
19265
  }
18808
19266
  )
18809
- ] });
19267
+ ] }) });
18810
19268
  }
18811
19269
 
18812
19270
  // src/react-document/LabelsPanel.tsx
18813
- import { useRef as useRef12, useState as useState11 } from "react";
18814
- import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
19271
+ import { useRef as useRef12, useState as useState12 } from "react";
19272
+ import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
18815
19273
  function keyErrorMessage3(error, messages) {
18816
19274
  if (error === "empty") {
18817
19275
  return messages.keyEmpty;
@@ -18837,13 +19295,13 @@ function LabelsPanel({
18837
19295
  }) {
18838
19296
  const messages = documentMessages(uiLocale);
18839
19297
  const documentDirection = uiLocale === "ar" ? "rtl" : "ltr";
18840
- const [keyOverrides, setKeyOverrides] = useState11({});
19298
+ const [keyOverrides, setKeyOverrides] = useState12({});
18841
19299
  const dialogRef = useRef12(null);
18842
19300
  useDialogFocus({ open, dialogRef, triggerRef: returnFocusRef, onClose });
18843
19301
  if (!open) {
18844
19302
  return null;
18845
19303
  }
18846
- return /* @__PURE__ */ jsx16("div", { className: "butex-document-widget__refs-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs15(
19304
+ return /* @__PURE__ */ jsx17("div", { className: "butex-document-widget__refs-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs16(
18847
19305
  "div",
18848
19306
  {
18849
19307
  ref: dialogRef,
@@ -18854,13 +19312,13 @@ function LabelsPanel({
18854
19312
  tabIndex: -1,
18855
19313
  onClick: (event) => event.stopPropagation(),
18856
19314
  children: [
18857
- /* @__PURE__ */ jsxs15("header", { className: "butex-document-widget__refs-header", children: [
18858
- /* @__PURE__ */ jsx16("strong", { children: messages.labelsTitle }),
18859
- /* @__PURE__ */ jsx16("button", { type: "button", "data-dialog-initial-focus": true, className: "butex-document-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
19315
+ /* @__PURE__ */ jsxs16("header", { className: "butex-document-widget__refs-header", children: [
19316
+ /* @__PURE__ */ jsx17("strong", { children: messages.labelsTitle }),
19317
+ /* @__PURE__ */ jsx17("button", { type: "button", "data-dialog-initial-focus": true, className: "butex-document-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
18860
19318
  ] }),
18861
- /* @__PURE__ */ jsxs15("div", { className: "butex-document-widget__dialog-body", children: [
18862
- /* @__PURE__ */ jsx16("p", { className: "butex-document-widget__labels-help", children: messages.labelsHelp }),
18863
- labels.length === 0 ? /* @__PURE__ */ jsx16("p", { className: "butex-document-widget__cite-picker-empty", children: messages.noLabelsYet }) : /* @__PURE__ */ jsx16("ul", { className: "butex-document-widget__refs-list", children: labels.map((entry) => {
19319
+ /* @__PURE__ */ jsxs16("div", { className: "butex-document-widget__dialog-body", children: [
19320
+ /* @__PURE__ */ jsx17("p", { className: "butex-document-widget__labels-help", children: messages.labelsHelp }),
19321
+ labels.length === 0 ? /* @__PURE__ */ jsx17("p", { className: "butex-document-widget__cite-picker-empty", children: messages.noLabelsYet }) : /* @__PURE__ */ jsx17("ul", { className: "butex-document-widget__refs-list", children: labels.map((entry) => {
18864
19322
  const title = formatFloatCaptionTitle(entry.kind, entry.number, {
18865
19323
  uiLocale,
18866
19324
  digitForm,
@@ -18874,12 +19332,12 @@ function LabelsPanel({
18874
19332
  labels,
18875
19333
  excludeOwnerId: entry.ownerId
18876
19334
  });
18877
- return /* @__PURE__ */ jsxs15("li", { className: "butex-document-widget__refs-item", children: [
18878
- /* @__PURE__ */ jsxs15("div", { className: "butex-document-widget__refs-item-head", children: [
18879
- /* @__PURE__ */ jsx16("strong", { children: title }),
18880
- /* @__PURE__ */ jsx16("span", { className: "butex-document-widget__refs-item-key", children: entry.key })
19335
+ return /* @__PURE__ */ jsxs16("li", { className: "butex-document-widget__refs-item", children: [
19336
+ /* @__PURE__ */ jsxs16("div", { className: "butex-document-widget__refs-item-head", children: [
19337
+ /* @__PURE__ */ jsx17("strong", { children: title }),
19338
+ /* @__PURE__ */ jsx17("span", { className: "butex-document-widget__refs-item-key", children: entry.key })
18881
19339
  ] }),
18882
- /* @__PURE__ */ jsx16(
19340
+ /* @__PURE__ */ jsx17(
18883
19341
  "div",
18884
19342
  {
18885
19343
  className: "butex-document-widget__modal-preview",
@@ -18888,10 +19346,10 @@ function LabelsPanel({
18888
19346
  children: captionPreview2
18889
19347
  }
18890
19348
  ),
18891
- /* @__PURE__ */ jsxs15("div", { className: "butex-document-widget__refs-grid", children: [
18892
- /* @__PURE__ */ jsxs15("label", { className: "butex-document-widget__refs-field", children: [
18893
- /* @__PURE__ */ jsx16("span", { children: messages.floatLabel }),
18894
- /* @__PURE__ */ jsx16(
19349
+ /* @__PURE__ */ jsxs16("div", { className: "butex-document-widget__refs-grid", children: [
19350
+ /* @__PURE__ */ jsxs16("label", { className: "butex-document-widget__refs-field", children: [
19351
+ /* @__PURE__ */ jsx17("span", { children: messages.floatLabel }),
19352
+ /* @__PURE__ */ jsx17(
18895
19353
  "input",
18896
19354
  {
18897
19355
  value: displayedKey,
@@ -18921,11 +19379,11 @@ function LabelsPanel({
18921
19379
  }
18922
19380
  }
18923
19381
  ),
18924
- entryKeyError !== null ? /* @__PURE__ */ jsx16("p", { className: "butex-document-widget__field-error", children: entryKeyError === "invalid" ? messages.keyRulesHint : keyErrorMessage3(entryKeyError, messages) }) : null
19382
+ entryKeyError !== null ? /* @__PURE__ */ jsx17("p", { className: "butex-document-widget__field-error", children: entryKeyError === "invalid" ? messages.keyRulesHint : keyErrorMessage3(entryKeyError, messages) }) : null
18925
19383
  ] }),
18926
- entry.kind === "fig" || entry.kind === "tab" ? /* @__PURE__ */ jsxs15("label", { className: "butex-document-widget__refs-field", children: [
18927
- /* @__PURE__ */ jsx16("span", { children: messages.floatCaption }),
18928
- /* @__PURE__ */ jsx16(
19384
+ entry.kind === "fig" || entry.kind === "tab" ? /* @__PURE__ */ jsxs16("label", { className: "butex-document-widget__refs-field", children: [
19385
+ /* @__PURE__ */ jsx17("span", { children: messages.floatCaption }),
19386
+ /* @__PURE__ */ jsx17(
18929
19387
  "input",
18930
19388
  {
18931
19389
  value: entry.caption,
@@ -18949,8 +19407,8 @@ function LabelsPanel({
18949
19407
  }
18950
19408
 
18951
19409
  // src/react-document/ReferencesPanel.tsx
18952
- import { useMemo, useRef as useRef13, useState as useState12 } from "react";
18953
- import { Fragment as Fragment7, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
19410
+ import { useMemo, useRef as useRef13, useState as useState13 } from "react";
19411
+ import { Fragment as Fragment7, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
18954
19412
  var EMPTY_DRAFT = {
18955
19413
  key: "",
18956
19414
  authors: "",
@@ -18985,10 +19443,10 @@ function FieldSeparatorToggle({
18985
19443
  messages,
18986
19444
  onChange
18987
19445
  }) {
18988
- return /* @__PURE__ */ jsxs16("div", { className: "butex-document-widget__refs-field butex-document-widget__refs-separator", children: [
18989
- /* @__PURE__ */ jsx17("span", { children: messages.referenceFieldSeparator }),
18990
- /* @__PURE__ */ jsxs16("div", { className: "butex-document-widget__refs-separator-toggle", role: "group", "aria-label": messages.referenceFieldSeparator, children: [
18991
- /* @__PURE__ */ jsx17(
19446
+ return /* @__PURE__ */ jsxs17("div", { className: "butex-document-widget__refs-field butex-document-widget__refs-separator", children: [
19447
+ /* @__PURE__ */ jsx18("span", { children: messages.referenceFieldSeparator }),
19448
+ /* @__PURE__ */ jsxs17("div", { className: "butex-document-widget__refs-separator-toggle", role: "group", "aria-label": messages.referenceFieldSeparator, children: [
19449
+ /* @__PURE__ */ jsx18(
18992
19450
  "button",
18993
19451
  {
18994
19452
  type: "button",
@@ -19000,7 +19458,7 @@ function FieldSeparatorToggle({
19000
19458
  children: "\u060C"
19001
19459
  }
19002
19460
  ),
19003
- /* @__PURE__ */ jsx17(
19461
+ /* @__PURE__ */ jsx18(
19004
19462
  "button",
19005
19463
  {
19006
19464
  type: "button",
@@ -19028,22 +19486,22 @@ function ReferencePreview({
19028
19486
  digitForm
19029
19487
  }) {
19030
19488
  const body = bibliographyEntryBody({ authors, title, venue, year, fieldSeparator }, fieldSeparator, { digitForm });
19031
- return /* @__PURE__ */ jsxs16(
19489
+ return /* @__PURE__ */ jsxs17(
19032
19490
  "div",
19033
19491
  {
19034
19492
  className: "butex-document-widget__modal-preview",
19035
19493
  dir: uiLocaleDirection(uiLocale),
19036
19494
  "aria-label": messages.referencePreview,
19037
19495
  children: [
19038
- numberLabel ? /* @__PURE__ */ jsxs16("span", { className: "butex-document-widget__modal-preview-number", children: [
19496
+ numberLabel ? /* @__PURE__ */ jsxs17("span", { className: "butex-document-widget__modal-preview-number", children: [
19039
19497
  "[",
19040
19498
  numberLabel,
19041
19499
  "] "
19042
19500
  ] }) : null,
19043
- body.length > 0 ? body : /* @__PURE__ */ jsx17("span", { className: "butex-document-widget__cite-picker-empty", children: "\u2026" }),
19044
- url.trim().length > 0 ? /* @__PURE__ */ jsxs16(Fragment7, { children: [
19501
+ body.length > 0 ? body : /* @__PURE__ */ jsx18("span", { className: "butex-document-widget__cite-picker-empty", children: "\u2026" }),
19502
+ url.trim().length > 0 ? /* @__PURE__ */ jsxs17(Fragment7, { children: [
19045
19503
  " ",
19046
- /* @__PURE__ */ jsx17("span", { className: "butex-document-widget__modal-preview-url", children: url.trim() })
19504
+ /* @__PURE__ */ jsx18("span", { className: "butex-document-widget__modal-preview-url", children: url.trim() })
19047
19505
  ] }) : null
19048
19506
  ]
19049
19507
  }
@@ -19063,9 +19521,9 @@ function ReferencesPanel({
19063
19521
  onMove
19064
19522
  }) {
19065
19523
  const messages = documentMessages(uiLocale);
19066
- const [draft, setDraft] = useState12(EMPTY_DRAFT);
19067
- const [draftKeyTouched, setDraftKeyTouched] = useState12(false);
19068
- const [keyOverrides, setKeyOverrides] = useState12({});
19524
+ const [draft, setDraft] = useState13(EMPTY_DRAFT);
19525
+ const [draftKeyTouched, setDraftKeyTouched] = useState13(false);
19526
+ const [keyOverrides, setKeyOverrides] = useState13({});
19069
19527
  const dialogRef = useRef13(null);
19070
19528
  const draftSeparator = draft.field_separator === "," ? "," : DEFAULT_REFERENCE_FIELD_SEPARATOR;
19071
19529
  const documentDirection = uiLocale === "ar" ? "rtl" : "ltr";
@@ -19080,7 +19538,7 @@ function ReferencesPanel({
19080
19538
  if (!open) {
19081
19539
  return null;
19082
19540
  }
19083
- return /* @__PURE__ */ jsx17("div", { className: "butex-document-widget__refs-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs16(
19541
+ return /* @__PURE__ */ jsx18("div", { className: "butex-document-widget__refs-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs17(
19084
19542
  "div",
19085
19543
  {
19086
19544
  ref: dialogRef,
@@ -19091,17 +19549,17 @@ function ReferencesPanel({
19091
19549
  tabIndex: -1,
19092
19550
  onClick: (event) => event.stopPropagation(),
19093
19551
  children: [
19094
- /* @__PURE__ */ jsxs16("header", { className: "butex-document-widget__refs-header", children: [
19095
- /* @__PURE__ */ jsx17("strong", { children: messages.referencesTitle }),
19096
- /* @__PURE__ */ jsx17("button", { type: "button", "data-dialog-initial-focus": true, className: "butex-document-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
19552
+ /* @__PURE__ */ jsxs17("header", { className: "butex-document-widget__refs-header", children: [
19553
+ /* @__PURE__ */ jsx18("strong", { children: messages.referencesTitle }),
19554
+ /* @__PURE__ */ jsx18("button", { type: "button", "data-dialog-initial-focus": true, className: "butex-document-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
19097
19555
  ] }),
19098
- /* @__PURE__ */ jsxs16("div", { className: "butex-document-widget__dialog-body", children: [
19099
- /* @__PURE__ */ jsxs16("div", { className: "butex-document-widget__refs-add", children: [
19100
- /* @__PURE__ */ jsx17("h3", { children: messages.addReference }),
19101
- /* @__PURE__ */ jsxs16("div", { className: "butex-document-widget__refs-grid", children: [
19102
- REFERENCE_FIELDS.map(([field, messageKey]) => /* @__PURE__ */ jsxs16("label", { className: "butex-document-widget__refs-field", children: [
19103
- /* @__PURE__ */ jsx17("span", { children: messages[messageKey] }),
19104
- /* @__PURE__ */ jsx17(
19556
+ /* @__PURE__ */ jsxs17("div", { className: "butex-document-widget__dialog-body", children: [
19557
+ /* @__PURE__ */ jsxs17("div", { className: "butex-document-widget__refs-add", children: [
19558
+ /* @__PURE__ */ jsx18("h3", { children: messages.addReference }),
19559
+ /* @__PURE__ */ jsxs17("div", { className: "butex-document-widget__refs-grid", children: [
19560
+ REFERENCE_FIELDS.map(([field, messageKey]) => /* @__PURE__ */ jsxs17("label", { className: "butex-document-widget__refs-field", children: [
19561
+ /* @__PURE__ */ jsx18("span", { children: messages[messageKey] }),
19562
+ /* @__PURE__ */ jsx18(
19105
19563
  "input",
19106
19564
  {
19107
19565
  value: draft[field] ?? "",
@@ -19115,9 +19573,9 @@ function ReferencesPanel({
19115
19573
  }
19116
19574
  }
19117
19575
  ),
19118
- field === "key" && draftKeyTouched && draftKeyError !== null ? /* @__PURE__ */ jsx17("p", { className: "butex-document-widget__field-error", children: draftKeyError === "invalid" ? messages.keyRulesHint : keyErrorMessage4(draftKeyError, messages) }) : null
19576
+ field === "key" && draftKeyTouched && draftKeyError !== null ? /* @__PURE__ */ jsx18("p", { className: "butex-document-widget__field-error", children: draftKeyError === "invalid" ? messages.keyRulesHint : keyErrorMessage4(draftKeyError, messages) }) : null
19119
19577
  ] }, field)),
19120
- /* @__PURE__ */ jsx17(
19578
+ /* @__PURE__ */ jsx18(
19121
19579
  FieldSeparatorToggle,
19122
19580
  {
19123
19581
  value: draftSeparator,
@@ -19126,7 +19584,7 @@ function ReferencesPanel({
19126
19584
  }
19127
19585
  )
19128
19586
  ] }),
19129
- /* @__PURE__ */ jsx17(
19587
+ /* @__PURE__ */ jsx18(
19130
19588
  ReferencePreview,
19131
19589
  {
19132
19590
  authors: draft.authors ?? "",
@@ -19140,7 +19598,7 @@ function ReferencesPanel({
19140
19598
  digitForm
19141
19599
  }
19142
19600
  ),
19143
- /* @__PURE__ */ jsx17(
19601
+ /* @__PURE__ */ jsx18(
19144
19602
  "button",
19145
19603
  {
19146
19604
  type: "button",
@@ -19155,7 +19613,7 @@ function ReferencesPanel({
19155
19613
  }
19156
19614
  )
19157
19615
  ] }),
19158
- /* @__PURE__ */ jsx17("ul", { className: "butex-document-widget__refs-list", children: references.map((reference, index) => {
19616
+ /* @__PURE__ */ jsx18("ul", { className: "butex-document-widget__refs-list", children: references.map((reference, index) => {
19159
19617
  const displayedKey = keyOverrides[reference.id] ?? reference.key;
19160
19618
  const entryKeyError = documentKeyError(displayedKey, {
19161
19619
  references,
@@ -19163,17 +19621,17 @@ function ReferencesPanel({
19163
19621
  excludeReferenceId: reference.id
19164
19622
  });
19165
19623
  const numberLabel = formatBibliographyNumber(index + 1, { documentDirection, digitForm });
19166
- return /* @__PURE__ */ jsxs16("li", { className: "butex-document-widget__refs-item", children: [
19167
- /* @__PURE__ */ jsxs16("div", { className: "butex-document-widget__refs-item-head", children: [
19168
- /* @__PURE__ */ jsxs16("strong", { children: [
19624
+ return /* @__PURE__ */ jsxs17("li", { className: "butex-document-widget__refs-item", children: [
19625
+ /* @__PURE__ */ jsxs17("div", { className: "butex-document-widget__refs-item-head", children: [
19626
+ /* @__PURE__ */ jsxs17("strong", { children: [
19169
19627
  "[",
19170
19628
  numberLabel,
19171
19629
  "] ",
19172
19630
  reference.key
19173
19631
  ] }),
19174
- /* @__PURE__ */ jsxs16("div", { className: "butex-document-widget__refs-item-actions", children: [
19175
- /* @__PURE__ */ jsx17("button", { type: "button", title: messages.moveUp, "aria-label": messages.moveUp, disabled: index === 0, onClick: () => onMove(reference.id, -1), children: "\u2191" }),
19176
- /* @__PURE__ */ jsx17(
19632
+ /* @__PURE__ */ jsxs17("div", { className: "butex-document-widget__refs-item-actions", children: [
19633
+ /* @__PURE__ */ jsx18("button", { type: "button", title: messages.moveUp, "aria-label": messages.moveUp, disabled: index === 0, onClick: () => onMove(reference.id, -1), children: "\u2191" }),
19634
+ /* @__PURE__ */ jsx18(
19177
19635
  "button",
19178
19636
  {
19179
19637
  type: "button",
@@ -19184,10 +19642,10 @@ function ReferencesPanel({
19184
19642
  children: "\u2193"
19185
19643
  }
19186
19644
  ),
19187
- /* @__PURE__ */ jsx17("button", { type: "button", title: messages.deleteReference, "aria-label": messages.deleteReference, onClick: () => onRemove(reference.id), children: "\xD7" })
19645
+ /* @__PURE__ */ jsx18("button", { type: "button", title: messages.deleteReference, "aria-label": messages.deleteReference, onClick: () => onRemove(reference.id), children: "\xD7" })
19188
19646
  ] })
19189
19647
  ] }),
19190
- /* @__PURE__ */ jsx17(
19648
+ /* @__PURE__ */ jsx18(
19191
19649
  ReferencePreview,
19192
19650
  {
19193
19651
  authors: reference.authors,
@@ -19202,10 +19660,10 @@ function ReferencesPanel({
19202
19660
  digitForm
19203
19661
  }
19204
19662
  ),
19205
- /* @__PURE__ */ jsxs16("div", { className: "butex-document-widget__refs-grid", children: [
19206
- REFERENCE_FIELDS.map(([field, messageKey]) => /* @__PURE__ */ jsxs16("label", { className: "butex-document-widget__refs-field", children: [
19207
- /* @__PURE__ */ jsx17("span", { children: messages[messageKey] }),
19208
- /* @__PURE__ */ jsx17(
19663
+ /* @__PURE__ */ jsxs17("div", { className: "butex-document-widget__refs-grid", children: [
19664
+ REFERENCE_FIELDS.map(([field, messageKey]) => /* @__PURE__ */ jsxs17("label", { className: "butex-document-widget__refs-field", children: [
19665
+ /* @__PURE__ */ jsx18("span", { children: messages[messageKey] }),
19666
+ /* @__PURE__ */ jsx18(
19209
19667
  "input",
19210
19668
  {
19211
19669
  value: field === "key" ? displayedKey : reference[field],
@@ -19233,9 +19691,9 @@ function ReferencesPanel({
19233
19691
  }
19234
19692
  }
19235
19693
  ),
19236
- field === "key" && entryKeyError !== null ? /* @__PURE__ */ jsx17("p", { className: "butex-document-widget__field-error", children: entryKeyError === "invalid" ? messages.keyRulesHint : keyErrorMessage4(entryKeyError, messages) }) : null
19694
+ field === "key" && entryKeyError !== null ? /* @__PURE__ */ jsx18("p", { className: "butex-document-widget__field-error", children: entryKeyError === "invalid" ? messages.keyRulesHint : keyErrorMessage4(entryKeyError, messages) }) : null
19237
19695
  ] }, field)),
19238
- /* @__PURE__ */ jsx17(
19696
+ /* @__PURE__ */ jsx18(
19239
19697
  FieldSeparatorToggle,
19240
19698
  {
19241
19699
  value: reference.fieldSeparator,
@@ -19253,8 +19711,8 @@ function ReferencesPanel({
19253
19711
  }
19254
19712
 
19255
19713
  // src/react-document/RefPickerPopover.tsx
19256
- import { useEffect as useEffect12, useRef as useRef14, useState as useState13 } from "react";
19257
- import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
19714
+ import { useEffect as useEffect12, useRef as useRef14, useState as useState14 } from "react";
19715
+ import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
19258
19716
  function RefPickerPopover({
19259
19717
  open,
19260
19718
  targets,
@@ -19269,8 +19727,8 @@ function RefPickerPopover({
19269
19727
  }) {
19270
19728
  const messages = documentMessages(uiLocale);
19271
19729
  const documentDirection = uiLocale === "ar" ? "rtl" : "ltr";
19272
- const [selected, setSelected] = useState13(initialKeys);
19273
- const [refCommand, setRefCommand] = useState13(initialRefCommand);
19730
+ const [selected, setSelected] = useState14(initialKeys);
19731
+ const [refCommand, setRefCommand] = useState14(initialRefCommand);
19274
19732
  const dialogRef = useRef14(null);
19275
19733
  useDialogFocus({ open, dialogRef, onClose });
19276
19734
  useEffect12(() => {
@@ -19286,7 +19744,7 @@ function RefPickerPopover({
19286
19744
  setSelected([key]);
19287
19745
  setRefCommand(kind === "eq" ? "eqref" : "ref");
19288
19746
  }
19289
- return /* @__PURE__ */ jsx18("div", { className: "butex-document-widget__cite-picker-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs17(
19747
+ return /* @__PURE__ */ jsx19("div", { className: "butex-document-widget__cite-picker-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs18(
19290
19748
  "div",
19291
19749
  {
19292
19750
  ref: dialogRef,
@@ -19297,30 +19755,30 @@ function RefPickerPopover({
19297
19755
  tabIndex: -1,
19298
19756
  onClick: (event) => event.stopPropagation(),
19299
19757
  children: [
19300
- /* @__PURE__ */ jsxs17("header", { className: "butex-document-widget__cite-picker-header", children: [
19301
- /* @__PURE__ */ jsx18("strong", { children: messages.refPickerTitle }),
19302
- /* @__PURE__ */ jsx18("button", { type: "button", "data-dialog-initial-focus": true, className: "butex-document-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
19758
+ /* @__PURE__ */ jsxs18("header", { className: "butex-document-widget__cite-picker-header", children: [
19759
+ /* @__PURE__ */ jsx19("strong", { children: messages.refPickerTitle }),
19760
+ /* @__PURE__ */ jsx19("button", { type: "button", "data-dialog-initial-focus": true, className: "butex-document-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
19303
19761
  ] }),
19304
- /* @__PURE__ */ jsx18("div", { className: "butex-document-widget__dialog-body", children: targets.length === 0 ? /* @__PURE__ */ jsx18("p", { className: "butex-document-widget__cite-picker-empty", children: messages.noLabelsYet }) : /* @__PURE__ */ jsx18("ul", { className: "butex-document-widget__cite-picker-list", children: targets.filter((entry) => entry.number !== null || Boolean(entry.displayLabel) || entry.kind === "eq").map((entry) => {
19762
+ /* @__PURE__ */ jsx19("div", { className: "butex-document-widget__dialog-body", children: targets.length === 0 ? /* @__PURE__ */ jsx19("p", { className: "butex-document-widget__cite-picker-empty", children: messages.noLabelsYet }) : /* @__PURE__ */ jsx19("ul", { className: "butex-document-widget__cite-picker-list", children: targets.filter((entry) => entry.number !== null || Boolean(entry.displayLabel) || entry.kind === "eq").map((entry) => {
19305
19763
  const checked = selected.includes(entry.key) || Boolean(entry.manualKey && selected.includes(entry.manualKey));
19306
19764
  const title = entry.displayLabel ?? (entry.number === null ? uiLocale === "ar" ? "\u0645\u0639\u0627\u062F\u0644\u0629 \u063A\u064A\u0631 \u0645\u0631\u0642\u0645\u0629" : "Unnumbered equation" : formatFloatCaptionTitle(entry.kind, entry.number, {
19307
19765
  uiLocale,
19308
19766
  digitForm,
19309
19767
  documentDirection
19310
19768
  }));
19311
- return /* @__PURE__ */ jsx18("li", { children: /* @__PURE__ */ jsxs17("label", { className: "butex-document-widget__cite-picker-item", children: [
19312
- /* @__PURE__ */ jsx18("input", { type: "radio", name: "butex-ref-key", checked, disabled: entry.number === null && !entry.displayLabel, onChange: () => selectKey(entry.key, entry.kind) }),
19313
- /* @__PURE__ */ jsxs17("span", { children: [
19314
- /* @__PURE__ */ jsx18("strong", { children: entry.kind === "eq" && entry.number !== null ? title.replace(/(\d+|[٠-٩]+)$/, "($1)") : title }),
19315
- entry.caption ? /* @__PURE__ */ jsx18("span", { className: "butex-document-widget__cite-picker-meta", children: entry.caption }) : null,
19316
- entry.kind === "eq" && entry.number === null && onNumberEquation ? /* @__PURE__ */ jsx18("button", { type: "button", onClick: () => onNumberEquation(entry.ownerId), children: uiLocale === "ar" ? "\u0631\u0642\u0651\u0645 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629 \u0623\u0648\u0644\u0627\u064B" : "Number equation first" }) : null
19769
+ return /* @__PURE__ */ jsx19("li", { children: /* @__PURE__ */ jsxs18("label", { className: "butex-document-widget__cite-picker-item", children: [
19770
+ /* @__PURE__ */ jsx19("input", { type: "radio", name: "butex-ref-key", checked, disabled: entry.number === null && !entry.displayLabel, onChange: () => selectKey(entry.key, entry.kind) }),
19771
+ /* @__PURE__ */ jsxs18("span", { children: [
19772
+ /* @__PURE__ */ jsx19("strong", { children: entry.kind === "eq" && entry.number !== null ? title.replace(/(\d+|[٠-٩]+)$/, "($1)") : title }),
19773
+ entry.caption ? /* @__PURE__ */ jsx19("span", { className: "butex-document-widget__cite-picker-meta", children: entry.caption }) : null,
19774
+ entry.kind === "eq" && entry.number === null && onNumberEquation ? /* @__PURE__ */ jsx19("button", { type: "button", onClick: () => onNumberEquation(entry.ownerId), children: uiLocale === "ar" ? "\u0631\u0642\u0651\u0645 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629 \u0623\u0648\u0644\u0627\u064B" : "Number equation first" }) : null
19317
19775
  ] })
19318
19776
  ] }) }, `${entry.kind}:${entry.ownerId}`);
19319
19777
  }) }) }),
19320
- /* @__PURE__ */ jsxs17("footer", { className: "butex-document-widget__cite-picker-footer", children: [
19321
- onManageLabels ? /* @__PURE__ */ jsx18("button", { type: "button", onClick: onManageLabels, children: messages.manageLabels }) : null,
19322
- /* @__PURE__ */ jsx18("button", { type: "button", onClick: onClose, children: messages.close }),
19323
- /* @__PURE__ */ jsx18(
19778
+ /* @__PURE__ */ jsxs18("footer", { className: "butex-document-widget__cite-picker-footer", children: [
19779
+ onManageLabels ? /* @__PURE__ */ jsx19("button", { type: "button", onClick: onManageLabels, children: messages.manageLabels }) : null,
19780
+ /* @__PURE__ */ jsx19("button", { type: "button", onClick: onClose, children: messages.close }),
19781
+ /* @__PURE__ */ jsx19(
19324
19782
  "button",
19325
19783
  {
19326
19784
  type: "button",
@@ -19577,91 +20035,6 @@ var DOCUMENT_WIDGET_CSS = `
19577
20035
  scrollbar-width: thin;
19578
20036
  }
19579
20037
 
19580
- .butex-document-widget__command-sheet-backdrop {
19581
- align-items: flex-end;
19582
- background: color-mix(in srgb, #000 35%, transparent);
19583
- display: flex;
19584
- inset: 0;
19585
- justify-content: center;
19586
- padding-bottom: var(--butex-safe-area-bottom);
19587
- padding-left: max(12px, var(--butex-safe-area-left));
19588
- padding-right: max(12px, var(--butex-safe-area-right));
19589
- padding-top: max(12px, var(--butex-safe-area-top));
19590
- position: fixed;
19591
- z-index: var(--butex-document-z-popover);
19592
- }
19593
-
19594
- .butex-document-widget__command-sheet {
19595
- background: var(--butex-document-panel);
19596
- border: 1px solid var(--butex-document-border);
19597
- border-radius: 16px 16px 0 0;
19598
- box-shadow: 0 -16px 40px color-mix(in srgb, #000 22%, transparent);
19599
- display: grid;
19600
- grid-template-rows: auto minmax(0, 1fr);
19601
- max-height: min(78vh, 720px);
19602
- max-height: min(720px, calc(100dvh - max(12px, var(--butex-safe-area-top)) - var(--butex-safe-area-bottom)));
19603
- max-width: 640px;
19604
- min-width: 0;
19605
- overflow: hidden;
19606
- width: 100%;
19607
- }
19608
-
19609
- .butex-document-widget__command-sheet-header {
19610
- align-items: center;
19611
- border-block-end: 1px solid var(--butex-document-border);
19612
- display: flex;
19613
- gap: 8px;
19614
- justify-content: space-between;
19615
- min-width: 0;
19616
- padding: 10px 12px;
19617
- }
19618
-
19619
- .butex-document-widget__command-sheet-body {
19620
- display: grid;
19621
- gap: 12px;
19622
- min-height: 0;
19623
- min-width: 0;
19624
- overflow-y: auto;
19625
- overscroll-behavior: contain;
19626
- padding: 12px;
19627
- }
19628
-
19629
- .butex-document-widget__command-group {
19630
- border: 1px solid var(--butex-document-border);
19631
- border-radius: 10px;
19632
- display: grid;
19633
- gap: 8px;
19634
- min-width: 0;
19635
- padding: 10px;
19636
- }
19637
-
19638
- .butex-document-widget__command-group h3 {
19639
- font-size: 0.88rem;
19640
- margin: 0;
19641
- }
19642
-
19643
- .butex-document-widget__command-grid {
19644
- display: grid;
19645
- gap: 6px;
19646
- grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
19647
- min-width: 0;
19648
- }
19649
-
19650
- .butex-document-widget__command-grid button {
19651
- min-height: 44px;
19652
- overflow-wrap: anywhere;
19653
- text-align: start;
19654
- }
19655
-
19656
- .butex-document-widget__command-grid--digits button {
19657
- text-align: center;
19658
- }
19659
-
19660
- .butex-document-widget__command-grid [aria-selected="true"] {
19661
- background: var(--butex-document-accent-bg);
19662
- border-color: var(--butex-document-accent);
19663
- }
19664
-
19665
20038
  .butex-document-widget__command-subtitle {
19666
20039
  color: var(--butex-document-muted);
19667
20040
  font-size: 0.82rem;
@@ -20552,15 +20925,6 @@ var DOCUMENT_WIDGET_CSS = `
20552
20925
  z-index: var(--butex-document-z-equation);
20553
20926
  }
20554
20927
 
20555
- .butex-document-widget__equation-modal[data-visible-viewport="true"] {
20556
- bottom: auto;
20557
- height: var(--butex-document-visible-viewport-height);
20558
- left: var(--butex-document-visible-viewport-left);
20559
- right: auto;
20560
- top: var(--butex-document-visible-viewport-top);
20561
- width: var(--butex-document-visible-viewport-width);
20562
- }
20563
-
20564
20928
  .butex-document-widget__equation-modal-backdrop {
20565
20929
  background: color-mix(in srgb, var(--butex-document-fg) 34%, transparent);
20566
20930
  border: 0;
@@ -21503,7 +21867,7 @@ var DOCUMENT_WIDGET_CSS = `
21503
21867
  width: 100%;
21504
21868
  }
21505
21869
 
21506
- .butex-document-widget__equation-modal[data-visible-viewport="true"] .butex-document-widget__equation-modal-panel {
21870
+ .butex-mobile-command-portal .butex-document-widget__equation-modal-panel {
21507
21871
  height: 100%;
21508
21872
  max-height: 100%;
21509
21873
  }
@@ -21541,21 +21905,6 @@ var DOCUMENT_WIDGET_CSS = `
21541
21905
  min-height: 44px;
21542
21906
  }
21543
21907
 
21544
- .butex-document-widget__command-sheet-backdrop {
21545
- padding-bottom: var(--butex-safe-area-bottom);
21546
- padding-left: var(--butex-safe-area-left);
21547
- padding-right: var(--butex-safe-area-right);
21548
- padding-top: max(8px, var(--butex-safe-area-top));
21549
- }
21550
-
21551
- .butex-document-widget__command-sheet {
21552
- border-block-end: 0;
21553
- border-radius: 16px 16px 0 0;
21554
- max-height: calc(100vh - 8px);
21555
- max-height: calc(100dvh - max(8px, var(--butex-safe-area-top)) - var(--butex-safe-area-bottom));
21556
- max-width: none;
21557
- }
21558
-
21559
21908
  .butex-document-widget__article-meta-date,
21560
21909
  .butex-document-widget__refs-grid {
21561
21910
  grid-template-columns: minmax(0, 1fr);
@@ -21639,6 +21988,11 @@ var DOCUMENT_WIDGET_CSS = `
21639
21988
  padding-top: max(8px, var(--butex-safe-area-top));
21640
21989
  }
21641
21990
 
21991
+ .butex-mobile-command-portal .butex-document-widget__equation-modal-panel {
21992
+ height: 100%;
21993
+ max-height: 100%;
21994
+ }
21995
+
21642
21996
  .butex-document-widget__cite-picker,
21643
21997
  .butex-document-widget__refs-panel {
21644
21998
  border-block-end: 0;
@@ -21679,7 +22033,7 @@ function injectBuTeXDocumentStyles(doc) {
21679
22033
  }
21680
22034
 
21681
22035
  // src/react-document/ButexDocumentEditor.tsx
21682
- import { Fragment as Fragment8, jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
22036
+ import { Fragment as Fragment8, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
21683
22037
  function mathDelimiters(mode) {
21684
22038
  return mode === "inline" ? { opening: "$", closing: "$" } : { opening: "\\[", closing: "\\]" };
21685
22039
  }
@@ -21984,25 +22338,25 @@ var ButexDocumentEditor = forwardRef2(
21984
22338
  () => resolveInitialDocument(initialDocument, uiLocale, documentMeta),
21985
22339
  [initialDocument, documentMeta, uiLocale]
21986
22340
  );
21987
- const [documentNode, setDocumentNode] = useState14(initialState.document);
21988
- const [error, setError] = useState14(initialState.error);
21989
- const [editorOpen, setEditorOpen] = useState14(true);
21990
- const [previewOpen, setPreviewOpen] = useState14(true);
21991
- const [mobileView, setMobileView] = useState14("editor");
21992
- const [mobileViewAnnouncement, setMobileViewAnnouncement] = useState14("");
21993
- const [selectedMath, setSelectedMath] = useState14(null);
21994
- const [citePicker, setCitePicker] = useState14(null);
21995
- const [referencesOpen, setReferencesOpen] = useState14(false);
21996
- const [labelsOpen, setLabelsOpen] = useState14(false);
21997
- const [refPicker, setRefPicker] = useState14(null);
21998
- const [digitFormState, setDigitFormState] = useState14(null);
21999
- const [debugImportOpen, setDebugImportOpen] = useState14(false);
22000
- const [debugImportText, setDebugImportText] = useState14("");
22001
- const [debugImportError, setDebugImportError] = useState14("");
22002
- const [editorFocus, setEditorFocus] = useState14(createEmptyDocumentEditorFocus());
22003
- const [collapsedBlockIds, setCollapsedBlockIds] = useState14(() => /* @__PURE__ */ new Set());
22004
- const [blockSelectionState, setBlockSelectionState] = useState14(emptyBlockSelection);
22005
- const [historyTick, setHistoryTick] = useState14(0);
22341
+ const [documentNode, setDocumentNode] = useState15(initialState.document);
22342
+ const [error, setError] = useState15(initialState.error);
22343
+ const [editorOpen, setEditorOpen] = useState15(true);
22344
+ const [previewOpen, setPreviewOpen] = useState15(true);
22345
+ const [mobileView, setMobileView] = useState15("editor");
22346
+ const [mobileViewAnnouncement, setMobileViewAnnouncement] = useState15("");
22347
+ const [selectedMath, setSelectedMath] = useState15(null);
22348
+ const [citePicker, setCitePicker] = useState15(null);
22349
+ const [referencesOpen, setReferencesOpen] = useState15(false);
22350
+ const [labelsOpen, setLabelsOpen] = useState15(false);
22351
+ const [refPicker, setRefPicker] = useState15(null);
22352
+ const [digitFormState, setDigitFormState] = useState15(null);
22353
+ const [debugImportOpen, setDebugImportOpen] = useState15(false);
22354
+ const [debugImportText, setDebugImportText] = useState15("");
22355
+ const [debugImportError, setDebugImportError] = useState15("");
22356
+ const [editorFocus, setEditorFocus] = useState15(createEmptyDocumentEditorFocus());
22357
+ const [collapsedBlockIds, setCollapsedBlockIds] = useState15(() => /* @__PURE__ */ new Set());
22358
+ const [blockSelectionState, setBlockSelectionState] = useState15(emptyBlockSelection);
22359
+ const [historyTick, setHistoryTick] = useState15(0);
22006
22360
  const digitForm = digitFormProp ?? digitFormState ?? (documentDirection === "rtl" ? "arabicIndic" : "western");
22007
22361
  function equationSessionWithDocumentDigits(session) {
22008
22362
  return setCurrentDigitForm(session, digitForm);
@@ -22751,7 +23105,7 @@ var ButexDocumentEditor = forwardRef2(
22751
23105
  }
22752
23106
  const showEditorPanel = !previewOnly && editorOpen;
22753
23107
  const showPreviewPanel = previewOnly || previewOpen;
22754
- return /* @__PURE__ */ jsx19(
23108
+ return /* @__PURE__ */ jsx20(
22755
23109
  "div",
22756
23110
  {
22757
23111
  ref: widgetRef,
@@ -22760,9 +23114,9 @@ var ButexDocumentEditor = forwardRef2(
22760
23114
  "data-responsive-mode": responsiveMode,
22761
23115
  dir: uiLocaleDirection(uiLocale),
22762
23116
  lang: uiLocale,
22763
- children: /* @__PURE__ */ jsxs18("div", { className: "butex-document-widget__shell", children: [
22764
- !previewOnly ? /* @__PURE__ */ jsxs18("div", { className: "butex-document-widget__toolbar", children: [
22765
- /* @__PURE__ */ jsx19(
23117
+ children: /* @__PURE__ */ jsxs19("div", { className: "butex-document-widget__shell", children: [
23118
+ !previewOnly ? /* @__PURE__ */ jsxs19("div", { className: "butex-document-widget__toolbar", children: [
23119
+ /* @__PURE__ */ jsx20(
22766
23120
  DocumentInsertToolbar,
22767
23121
  {
22768
23122
  mode,
@@ -22801,7 +23155,7 @@ var ButexDocumentEditor = forwardRef2(
22801
23155
  onDigitFormChange: changeDigitForm
22802
23156
  }
22803
23157
  ),
22804
- /* @__PURE__ */ jsx19(
23158
+ /* @__PURE__ */ jsx20(
22805
23159
  DocumentMobileToolbar,
22806
23160
  {
22807
23161
  mode,
@@ -22844,7 +23198,7 @@ var ButexDocumentEditor = forwardRef2(
22844
23198
  onOpenAll: openAllBlocks
22845
23199
  }
22846
23200
  ),
22847
- /* @__PURE__ */ jsx19(
23201
+ /* @__PURE__ */ jsx20(
22848
23202
  "span",
22849
23203
  {
22850
23204
  className: "butex-document-widget__sr-only",
@@ -22854,29 +23208,29 @@ var ButexDocumentEditor = forwardRef2(
22854
23208
  children: mobileViewAnnouncement
22855
23209
  }
22856
23210
  ),
22857
- /* @__PURE__ */ jsxs18("div", { className: "butex-document-widget__toolbar-group butex-document-widget__desktop-toolbar-control", role: "group", "aria-label": messages.panels, children: [
22858
- /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": editorOpen, onClick: toggleEditorPanel, children: editorOpen ? messages.hideEditor : messages.editor }),
22859
- /* @__PURE__ */ jsx19("button", { type: "button", "aria-pressed": previewOpen, onClick: togglePreviewPanel, children: previewOpen ? messages.hidePreview : messages.preview })
23211
+ /* @__PURE__ */ jsxs19("div", { className: "butex-document-widget__toolbar-group butex-document-widget__desktop-toolbar-control", role: "group", "aria-label": messages.panels, children: [
23212
+ /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": editorOpen, onClick: toggleEditorPanel, children: editorOpen ? messages.hideEditor : messages.editor }),
23213
+ /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": previewOpen, onClick: togglePreviewPanel, children: previewOpen ? messages.hidePreview : messages.preview })
22860
23214
  ] }),
22861
- /* @__PURE__ */ jsxs18("div", { className: "butex-document-widget__toolbar-group butex-document-widget__desktop-toolbar-control", role: "group", "aria-label": messages.collapseBlocks, children: [
22862
- /* @__PURE__ */ jsx19("button", { type: "button", onClick: collapseAllBlocks, children: messages.collapseAll }),
22863
- /* @__PURE__ */ jsx19("button", { type: "button", onClick: openAllBlocks, children: messages.openAll })
23215
+ /* @__PURE__ */ jsxs19("div", { className: "butex-document-widget__toolbar-group butex-document-widget__desktop-toolbar-control", role: "group", "aria-label": messages.collapseBlocks, children: [
23216
+ /* @__PURE__ */ jsx20("button", { type: "button", onClick: collapseAllBlocks, children: messages.collapseAll }),
23217
+ /* @__PURE__ */ jsx20("button", { type: "button", onClick: openAllBlocks, children: messages.openAll })
22864
23218
  ] })
22865
23219
  ] }) : null,
22866
- error ? /* @__PURE__ */ jsx19("p", { className: "butex-document-widget__error", children: error }) : null,
22867
- /* @__PURE__ */ jsxs18(
23220
+ error ? /* @__PURE__ */ jsx20("p", { className: "butex-document-widget__error", children: error }) : null,
23221
+ /* @__PURE__ */ jsxs19(
22868
23222
  "div",
22869
23223
  {
22870
23224
  className: `butex-document-widget__layout butex-document-widget__layout--editor-${showEditorPanel ? "open" : "closed"} butex-document-widget__layout--preview-${showPreviewPanel ? "open" : "closed"}`,
22871
23225
  children: [
22872
- !previewOnly ? /* @__PURE__ */ jsx19(
23226
+ !previewOnly ? /* @__PURE__ */ jsx20(
22873
23227
  "section",
22874
23228
  {
22875
23229
  className: "butex-document-widget__panel butex-document-widget__editor-panel",
22876
23230
  "aria-label": messages.documentEditor,
22877
23231
  "aria-hidden": !showEditorPanel,
22878
- children: /* @__PURE__ */ jsxs18("div", { className: "butex-document-widget__blocks", children: [
22879
- mode === "article" ? /* @__PURE__ */ jsx19(
23232
+ children: /* @__PURE__ */ jsxs19("div", { className: "butex-document-widget__blocks", children: [
23233
+ mode === "article" ? /* @__PURE__ */ jsx20(
22880
23234
  ArticleMetaPanel,
22881
23235
  {
22882
23236
  meta: documentNode.meta ?? emptyDocumentMeta(),
@@ -22889,8 +23243,8 @@ var ButexDocumentEditor = forwardRef2(
22889
23243
  }
22890
23244
  }
22891
23245
  ) : null,
22892
- mode === "book-content" && documentNode.blocks.some((block) => block.kind === "bibliography") ? /* @__PURE__ */ jsx19("p", { role: "alert", className: "butex-document-widget__error", children: uiLocale === "ar" ? "\u062A\u0633\u062A\u062E\u062F\u0645 \u0641\u0635\u0648\u0644 \u0627\u0644\u0643\u062A\u0627\u0628 \u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0627\u062C\u0639 \u0645\u0634\u062A\u0631\u0643\u0629\u061B \u0623\u0632\u0644 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0645\u0631\u0627\u062C\u0639 \u0627\u0644\u0645\u062D\u0644\u064A\u0629 \u0645\u0646 \u0627\u0644\u0641\u0635\u0644." : "Book chapters use the shared bibliography. Remove the local bibliography block." }) : null,
22893
- documentNode.blocks.map((block, blockIndex) => /* @__PURE__ */ jsx19(
23246
+ mode === "book-content" && documentNode.blocks.some((block) => block.kind === "bibliography") ? /* @__PURE__ */ jsx20("p", { role: "alert", className: "butex-document-widget__error", children: uiLocale === "ar" ? "\u062A\u0633\u062A\u062E\u062F\u0645 \u0641\u0635\u0648\u0644 \u0627\u0644\u0643\u062A\u0627\u0628 \u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0627\u062C\u0639 \u0645\u0634\u062A\u0631\u0643\u0629\u061B \u0623\u0632\u0644 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0645\u0631\u0627\u062C\u0639 \u0627\u0644\u0645\u062D\u0644\u064A\u0629 \u0645\u0646 \u0627\u0644\u0641\u0635\u0644." : "Book chapters use the shared bibliography. Remove the local bibliography block." }) : null,
23247
+ documentNode.blocks.map((block, blockIndex) => /* @__PURE__ */ jsx20(
22894
23248
  BlockEditor,
22895
23249
  {
22896
23250
  block,
@@ -22965,13 +23319,13 @@ var ButexDocumentEditor = forwardRef2(
22965
23319
  ] })
22966
23320
  }
22967
23321
  ) : null,
22968
- /* @__PURE__ */ jsx19(
23322
+ /* @__PURE__ */ jsx20(
22969
23323
  "section",
22970
23324
  {
22971
23325
  className: "butex-document-widget__panel butex-document-widget__preview-panel",
22972
23326
  "aria-label": messages.documentPreview,
22973
23327
  "aria-hidden": !showPreviewPanel,
22974
- children: /* @__PURE__ */ jsx19(
23328
+ children: /* @__PURE__ */ jsx20(
22975
23329
  DocumentPreview,
22976
23330
  {
22977
23331
  blocks: preview.blocks,
@@ -22987,18 +23341,18 @@ var ButexDocumentEditor = forwardRef2(
22987
23341
  ]
22988
23342
  }
22989
23343
  ),
22990
- debugEnabled ? /* @__PURE__ */ jsxs18("div", { className: "butex-document-widget__dev", children: [
22991
- debugEnabled && documentNode.diagnostics.length > 0 ? /* @__PURE__ */ jsxs18(Fragment8, { children: [
22992
- /* @__PURE__ */ jsx19("strong", { children: messages.importWarnings }),
22993
- documentNode.diagnostics.map((diagnostic) => /* @__PURE__ */ jsx19("p", { className: "butex-document-widget__dev-diagnostic", children: formatDocumentDiagnostic(diagnostic, messages) }, `${diagnostic.path}-${diagnostic.message}`))
23344
+ debugEnabled ? /* @__PURE__ */ jsxs19("div", { className: "butex-document-widget__dev", children: [
23345
+ debugEnabled && documentNode.diagnostics.length > 0 ? /* @__PURE__ */ jsxs19(Fragment8, { children: [
23346
+ /* @__PURE__ */ jsx20("strong", { children: messages.importWarnings }),
23347
+ documentNode.diagnostics.map((diagnostic) => /* @__PURE__ */ jsx20("p", { className: "butex-document-widget__dev-diagnostic", children: formatDocumentDiagnostic(diagnostic, messages) }, `${diagnostic.path}-${diagnostic.message}`))
22994
23348
  ] }) : null,
22995
- /* @__PURE__ */ jsxs18("div", { className: "butex-document-widget__dev-actions", children: [
22996
- /* @__PURE__ */ jsx19("button", { type: "button", onClick: () => void copyDebugText(JSON.stringify(documentJson, null, 2)), children: "Copy JSON" }),
22997
- /* @__PURE__ */ jsx19("button", { type: "button", onClick: () => void copyDebugText(latex), children: "Copy TeX" }),
22998
- /* @__PURE__ */ jsx19("button", { type: "button", "aria-expanded": debugImportOpen, onClick: openDebugJsonImport, children: "Import JSON" })
23349
+ /* @__PURE__ */ jsxs19("div", { className: "butex-document-widget__dev-actions", children: [
23350
+ /* @__PURE__ */ jsx20("button", { type: "button", onClick: () => void copyDebugText(JSON.stringify(documentJson, null, 2)), children: "Copy JSON" }),
23351
+ /* @__PURE__ */ jsx20("button", { type: "button", onClick: () => void copyDebugText(latex), children: "Copy TeX" }),
23352
+ /* @__PURE__ */ jsx20("button", { type: "button", "aria-expanded": debugImportOpen, onClick: openDebugJsonImport, children: "Import JSON" })
22999
23353
  ] }),
23000
- debugImportOpen ? /* @__PURE__ */ jsxs18("div", { className: "butex-document-widget__dev-import", children: [
23001
- /* @__PURE__ */ jsx19(
23354
+ debugImportOpen ? /* @__PURE__ */ jsxs19("div", { className: "butex-document-widget__dev-import", children: [
23355
+ /* @__PURE__ */ jsx20(
23002
23356
  "textarea",
23003
23357
  {
23004
23358
  value: debugImportText,
@@ -23010,9 +23364,9 @@ var ButexDocumentEditor = forwardRef2(
23010
23364
  }
23011
23365
  }
23012
23366
  ),
23013
- /* @__PURE__ */ jsxs18("div", { className: "butex-document-widget__dev-actions", children: [
23014
- /* @__PURE__ */ jsx19("button", { type: "button", onClick: applyDebugJsonImport, children: "Apply" }),
23015
- /* @__PURE__ */ jsx19(
23367
+ /* @__PURE__ */ jsxs19("div", { className: "butex-document-widget__dev-actions", children: [
23368
+ /* @__PURE__ */ jsx20("button", { type: "button", onClick: applyDebugJsonImport, children: "Apply" }),
23369
+ /* @__PURE__ */ jsx20(
23016
23370
  "button",
23017
23371
  {
23018
23372
  type: "button",
@@ -23024,18 +23378,19 @@ var ButexDocumentEditor = forwardRef2(
23024
23378
  }
23025
23379
  )
23026
23380
  ] }),
23027
- debugImportError ? /* @__PURE__ */ jsx19("p", { className: "butex-document-widget__dev-error", children: debugImportError }) : null
23381
+ debugImportError ? /* @__PURE__ */ jsx20("p", { className: "butex-document-widget__dev-error", children: debugImportError }) : null
23028
23382
  ] }) : null,
23029
- /* @__PURE__ */ jsx19("strong", { children: "LaTeX" }),
23030
- /* @__PURE__ */ jsx19("pre", { children: latex }),
23031
- /* @__PURE__ */ jsx19("strong", { children: "JSON" }),
23032
- /* @__PURE__ */ jsx19("pre", { children: JSON.stringify(documentJson, null, 2) }),
23033
- /* @__PURE__ */ jsx19("strong", { children: "AST" }),
23034
- /* @__PURE__ */ jsx19("pre", { children: JSON.stringify(documentNode, null, 2) })
23383
+ /* @__PURE__ */ jsx20("strong", { children: "LaTeX" }),
23384
+ /* @__PURE__ */ jsx20("pre", { children: latex }),
23385
+ /* @__PURE__ */ jsx20("strong", { children: "JSON" }),
23386
+ /* @__PURE__ */ jsx20("pre", { children: JSON.stringify(documentJson, null, 2) }),
23387
+ /* @__PURE__ */ jsx20("strong", { children: "AST" }),
23388
+ /* @__PURE__ */ jsx20("pre", { children: JSON.stringify(documentNode, null, 2) })
23035
23389
  ] }) : null,
23036
- !previewOnly && selectedMath ? /* @__PURE__ */ jsx19(
23390
+ !previewOnly && selectedMath ? /* @__PURE__ */ jsx20(
23037
23391
  EquationDrawer,
23038
23392
  {
23393
+ sourceRef: widgetRef,
23039
23394
  debug: debugEnabled,
23040
23395
  session: selectedMath.session,
23041
23396
  reason: selectedMath.reason,
@@ -23059,7 +23414,7 @@ var ButexDocumentEditor = forwardRef2(
23059
23414
  onDelete: deleteSelectedEquation
23060
23415
  }
23061
23416
  ) : null,
23062
- !previewOnly ? /* @__PURE__ */ jsx19(
23417
+ !previewOnly ? /* @__PURE__ */ jsx20(
23063
23418
  CitePickerPopover,
23064
23419
  {
23065
23420
  open: citePicker !== null,
@@ -23075,7 +23430,7 @@ var ButexDocumentEditor = forwardRef2(
23075
23430
  } : void 0
23076
23431
  }
23077
23432
  ) : null,
23078
- !previewOnly ? /* @__PURE__ */ jsx19(
23433
+ !previewOnly ? /* @__PURE__ */ jsx20(
23079
23434
  RefPickerPopover,
23080
23435
  {
23081
23436
  open: refPicker !== null,
@@ -23095,7 +23450,7 @@ var ButexDocumentEditor = forwardRef2(
23095
23450
  }
23096
23451
  }
23097
23452
  ) : null,
23098
- !previewOnly && mode === "article" ? /* @__PURE__ */ jsx19(
23453
+ !previewOnly && mode === "article" ? /* @__PURE__ */ jsx20(
23099
23454
  ReferencesPanel,
23100
23455
  {
23101
23456
  open: referencesOpen,
@@ -23111,7 +23466,7 @@ var ButexDocumentEditor = forwardRef2(
23111
23466
  onMove: (referenceId, direction) => applyDocument(moveDocumentReference(documentRef.current, referenceId, direction), "immediate")
23112
23467
  }
23113
23468
  ) : null,
23114
- !previewOnly ? /* @__PURE__ */ jsx19(
23469
+ !previewOnly ? /* @__PURE__ */ jsx20(
23115
23470
  LabelsPanel,
23116
23471
  {
23117
23472
  open: labelsOpen,
@@ -23136,7 +23491,7 @@ var ButexDocumentEditor = forwardRef2(
23136
23491
  ButexDocumentEditor.displayName = "ButexDocumentEditor";
23137
23492
 
23138
23493
  // src/react-document/ValidatedButexDocumentEditor.tsx
23139
- import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
23494
+ import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
23140
23495
  function imageValidationMessage(uiLocale) {
23141
23496
  return uiLocale === "ar" ? "\u0644\u0645 \u062A\u064F\u062D\u062F\u0651\u062F \u0635\u0648\u0631\u0629 \u0644\u0647\u0630\u0647 \u0627\u0644\u0643\u062A\u0644\u0629." : "No image has been selected for this block.";
23142
23497
  }
@@ -23195,7 +23550,7 @@ var ButexDocumentEditor3 = forwardRef3(
23195
23550
  return rendered;
23196
23551
  }
23197
23552
  const errorId = `butex-document-image-validation-${ctx.blockId}`;
23198
- return /* @__PURE__ */ jsxs19(
23553
+ return /* @__PURE__ */ jsxs20(
23199
23554
  "div",
23200
23555
  {
23201
23556
  role: "group",
@@ -23209,14 +23564,14 @@ var ButexDocumentEditor3 = forwardRef3(
23209
23564
  },
23210
23565
  children: [
23211
23566
  rendered,
23212
- /* @__PURE__ */ jsx20("p", { id: errorId, className: "butex-document-widget__field-error", children: imageValidationMessage(ctx.uiLocale) })
23567
+ /* @__PURE__ */ jsx21("p", { id: errorId, className: "butex-document-widget__field-error", children: imageValidationMessage(ctx.uiLocale) })
23213
23568
  ]
23214
23569
  }
23215
23570
  );
23216
23571
  },
23217
23572
  [renderImageBlockEditor]
23218
23573
  );
23219
- return /* @__PURE__ */ jsx20(
23574
+ return /* @__PURE__ */ jsx21(
23220
23575
  ButexDocumentEditor,
23221
23576
  {
23222
23577
  ref,
@@ -23235,7 +23590,7 @@ ButexDocumentEditor3.displayName = "ButexDocumentEditor";
23235
23590
 
23236
23591
  // src/react-document/ButexDocumentPreview.tsx
23237
23592
  import { useEffect as useEffect14, useMemo as useMemo3 } from "react";
23238
- import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
23593
+ import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
23239
23594
  function isRecord2(value) {
23240
23595
  return typeof value === "object" && value !== null;
23241
23596
  }
@@ -23310,20 +23665,20 @@ function ButexDocumentPreview({
23310
23665
  useEffect14(() => {
23311
23666
  injectBuTeXDocumentStyles();
23312
23667
  }, []);
23313
- return /* @__PURE__ */ jsx21(
23668
+ return /* @__PURE__ */ jsx22(
23314
23669
  "div",
23315
23670
  {
23316
23671
  className: ["butex-document-widget", "butex-document-preview", className].filter(Boolean).join(" "),
23317
23672
  dir: uiLocaleDirection(uiLocale),
23318
23673
  lang: uiLocale,
23319
- children: /* @__PURE__ */ jsxs20("div", { className: "butex-document-widget__shell", children: [
23320
- previewState.error ? /* @__PURE__ */ jsx21("p", { className: "butex-document-widget__error", children: previewState.error }) : null,
23321
- /* @__PURE__ */ jsx21("div", { className: "butex-document-widget__layout butex-document-widget__layout--editor-closed butex-document-widget__layout--preview-open", children: /* @__PURE__ */ jsx21(
23674
+ children: /* @__PURE__ */ jsxs21("div", { className: "butex-document-widget__shell", children: [
23675
+ previewState.error ? /* @__PURE__ */ jsx22("p", { className: "butex-document-widget__error", children: previewState.error }) : null,
23676
+ /* @__PURE__ */ jsx22("div", { className: "butex-document-widget__layout butex-document-widget__layout--editor-closed butex-document-widget__layout--preview-open", children: /* @__PURE__ */ jsx22(
23322
23677
  "section",
23323
23678
  {
23324
23679
  className: "butex-document-widget__panel butex-document-widget__preview-panel",
23325
23680
  "aria-label": messages.documentPreview,
23326
- children: /* @__PURE__ */ jsx21(
23681
+ children: /* @__PURE__ */ jsx22(
23327
23682
  DocumentPreview,
23328
23683
  {
23329
23684
  blocks: previewState.preview.blocks,