@uiwwsw/virtual-keyboard 2.0.1 → 2.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.
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { jsxs as Y, jsx as L, Fragment as Pe } from "react/jsx-runtime";
3
- import { useContext as tt, createContext as nt, forwardRef as rt, useId as qe, useRef as T, useState as $, useMemo as Fe, useCallback as E, useEffect as K, useImperativeHandle as ot, useLayoutEffect as at, createElement as ct } from "react";
4
- import { convertQwertyToHangul as Ye, assemble as it, removeLastCharacter as lt } from "es-hangul";
5
- import { createPortal as Ie } from "react-dom";
6
- class ut {
2
+ import { jsxs as X, jsx as P, Fragment as De } from "react/jsx-runtime";
3
+ import { useContext as it, createContext as ct, forwardRef as lt, useId as Je, useRef as M, useState as z, useMemo as Xe, useCallback as L, useEffect as D, useImperativeHandle as ut, useLayoutEffect as st, createElement as dt } from "react";
4
+ import { convertQwertyToHangul as Ge, assemble as ft, removeLastCharacter as pt } from "es-hangul";
5
+ import { createPortal as Be } from "react-dom";
6
+ class ht {
7
7
  past = [];
8
8
  future = [];
9
9
  record(n, r) {
@@ -21,26 +21,26 @@ class ut {
21
21
  this.past = [], this.future = [];
22
22
  }
23
23
  }
24
- const Ze = nt(null);
25
- function _e() {
26
- const e = tt(Ze);
24
+ const Qe = ct(null);
25
+ function Oe() {
26
+ const e = it(Qe);
27
27
  if (!e)
28
28
  throw new Error(
29
29
  "VirtualInput must be used within a <VirtualInputProvider>."
30
30
  );
31
31
  return e;
32
32
  }
33
- function we(e) {
33
+ function xe(e) {
34
34
  return /^[\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF]$/.test(e);
35
35
  }
36
- function st(e, n) {
36
+ function gt(e, n) {
37
37
  if (e.key === "HangulMode") return { handled: !0, toggleHangulMode: !0 };
38
38
  if (e.ctrlKey || e.metaKey || e.altKey || [...e.key].length !== 1 || /[\r\n\t]/.test(e.key))
39
39
  return { handled: !1 };
40
- const r = n && /^[A-Za-z]$/.test(e.key) ? Ye(e.key) : e.key;
41
- return { handled: !0, text: r, composing: we(r) };
40
+ const r = n && /^[A-Za-z]$/.test(e.key) ? Ge(e.key) : e.key;
41
+ return { handled: !0, text: r, composing: xe(r) };
42
42
  }
43
- const ee = [
43
+ const oe = [
44
44
  [
45
45
  {
46
46
  label: "q",
@@ -211,7 +211,7 @@ const ee = [
211
211
  width: 1.25
212
212
  }
213
213
  ]
214
- ], dt = [
214
+ ], vt = [
215
215
  [
216
216
  {
217
217
  label: "1",
@@ -280,7 +280,7 @@ const ee = [
280
280
  type: "action"
281
281
  }
282
282
  ]
283
- ], ft = [
283
+ ], mt = [
284
284
  [
285
285
  {
286
286
  label: "1",
@@ -363,7 +363,7 @@ const ee = [
363
363
  }
364
364
  ]
365
365
  ];
366
- function ge(e) {
366
+ function be(e) {
367
367
  switch (e) {
368
368
  case "hangul":
369
369
  return !0;
@@ -376,34 +376,34 @@ function ge(e) {
376
376
  return null;
377
377
  }
378
378
  }
379
- const he = () => !0, pt = {
379
+ const we = () => !0, wt = {
380
380
  text: {
381
381
  mode: "text",
382
- layout: ee,
383
- filterKey: he,
382
+ layout: oe,
383
+ filterKey: we,
384
384
  sanitizeValue: (e) => e.replace(/[\r\n\t]+/g, " ")
385
385
  },
386
386
  number: {
387
387
  mode: "number",
388
- layout: dt,
388
+ layout: vt,
389
389
  filterKey: (e) => /^[0-9.]+$/.test(e),
390
390
  sanitizeValue: (e) => e.replace(/[^0-9.]/g, "")
391
391
  },
392
392
  tel: {
393
393
  mode: "tel",
394
- layout: ft,
394
+ layout: mt,
395
395
  filterKey: (e) => /^[0-9*#+]+$/.test(e),
396
396
  sanitizeValue: (e) => e.replace(/[^0-9*#+]/g, "")
397
397
  },
398
398
  hangul: {
399
399
  mode: "hangul",
400
- layout: ee,
401
- filterKey: he,
400
+ layout: oe,
401
+ filterKey: we,
402
402
  sanitizeValue: (e) => e.replace(/[A-Za-z]/g, "")
403
403
  },
404
404
  alpha: {
405
405
  mode: "alpha",
406
- layout: ee,
406
+ layout: oe,
407
407
  filterKey: (e) => /^[A-Za-z]+$/.test(e),
408
408
  sanitizeValue: (e) => e.replace(/[^A-Za-z]/g, "")
409
409
  },
@@ -411,82 +411,74 @@ const he = () => !0, pt = {
411
411
  mode: "alphanumeric",
412
412
  layout: [
413
413
  Array.from("1234567890", (e) => ({ value: e })),
414
- ...ee
414
+ ...oe
415
415
  ],
416
416
  filterKey: (e) => /^[A-Za-z0-9]+$/.test(e),
417
417
  sanitizeValue: (e) => e.replace(/[^A-Za-z0-9]/g, "")
418
418
  },
419
419
  custom: {
420
420
  mode: "custom",
421
- layout: ee,
422
- filterKey: he,
421
+ layout: oe,
422
+ filterKey: we,
423
423
  sanitizeValue: (e) => e.replace(/[\r\n\t]+/g, " ")
424
424
  }
425
425
  };
426
- function Le(e) {
427
- const n = e?.mode ?? "text", r = pt[n];
426
+ function Te(e) {
427
+ const n = e?.mode ?? "text", r = wt[n];
428
428
  return {
429
429
  mode: n,
430
- layout: e?.layout ?? r.layout ?? ee,
431
- filterKey: e?.filterKey ?? r.filterKey ?? he,
432
- sanitizeValue: e?.sanitizeValue ?? r.sanitizeValue ?? ((a) => a)
430
+ layout: e?.layout ?? r.layout ?? oe,
431
+ filterKey: e?.filterKey ?? r.filterKey ?? we,
432
+ sanitizeValue: e?.sanitizeValue ?? r.sanitizeValue ?? ((i) => i)
433
433
  };
434
434
  }
435
- const ht = new Intl.Segmenter(void 0, { granularity: "grapheme" }), gt = new Intl.Segmenter(void 0, { granularity: "word" });
436
- function mt(e, n) {
437
- const r = Math.max(0, Math.min(n, e.length - 1));
438
- for (const a of gt.segment(e))
439
- if (r < a.index + a.segment.length)
440
- return [a.index, a.index + a.segment.length];
441
- return [0, 0];
442
- }
443
- const me = (e) => Array.from(ht.segment(e));
444
- function oe(e, n) {
435
+ const yt = new Intl.Segmenter(void 0, { granularity: "grapheme" }), Re = (e) => Array.from(yt.segment(e));
436
+ function Z(e, n) {
445
437
  return [
446
- ...me(e).map((a) => a.index),
438
+ ...Re(e).map((i) => i.index),
447
439
  e.length
448
- ].filter((a) => a <= Math.max(0, n)).at(-1) ?? 0;
440
+ ].filter((i) => i <= Math.max(0, n)).at(-1) ?? 0;
449
441
  }
450
- function Ce(e, n, r) {
451
- const a = [
452
- ...me(e).map((i) => i.index),
442
+ function Ve(e, n, r) {
443
+ const i = [
444
+ ...Re(e).map((l) => l.index),
453
445
  e.length
454
446
  ];
455
- return r < 0 ? a.filter((i) => i < n).at(-1) ?? 0 : a.find((i) => i > n) ?? e.length;
447
+ return r < 0 ? i.filter((l) => l < n).at(-1) ?? 0 : i.find((l) => l > n) ?? e.length;
456
448
  }
457
- const te = ({ anchor: e, caret: n }) => [Math.min(e, n), Math.max(e, n)];
458
- function wt(e, n, r = !1, a) {
459
- const [i, s] = te(e);
460
- let m = e.value.slice(0, i), v = n;
461
- i === s && e.composing && r && we(m.at(-1) ?? "") && (v = it([m.at(-1), n]), m = m.slice(0, -1));
462
- const d = m + v + e.value.slice(s);
463
- if (a !== void 0 && d.length > a) return e;
464
- const k = m.length + v.length;
465
- return { value: d, caret: k, anchor: k, composing: r };
449
+ const ie = ({ anchor: e, caret: n }) => [Math.min(e, n), Math.max(e, n)];
450
+ function Ke(e, n, r = !1, i) {
451
+ const [l, s] = ie(e);
452
+ let f = e.value.slice(0, l), m = n;
453
+ l === s && e.composing && r && xe(f.at(-1) ?? "") && (m = ft([f.at(-1), n]), f = f.slice(0, -1));
454
+ const u = f + m + e.value.slice(s);
455
+ if (i !== void 0 && u.length > i) return e;
456
+ const w = f.length + m.length;
457
+ return { value: u, caret: w, anchor: w, composing: r };
466
458
  }
467
- function ke(e, n) {
468
- let [r, a] = te(e);
469
- if (r === a) {
470
- if (n < 0 && e.composing && we(e.value[r - 1] ?? "")) {
471
- const i = e.value.slice(0, r - 1) + lt(e.value[r - 1]);
459
+ function ye(e, n) {
460
+ let [r, i] = ie(e);
461
+ if (r === i) {
462
+ if (n < 0 && e.composing && xe(e.value[r - 1] ?? "")) {
463
+ const l = e.value.slice(0, r - 1) + pt(e.value[r - 1]);
472
464
  return {
473
- value: i + e.value.slice(a),
474
- anchor: i.length,
475
- caret: i.length,
465
+ value: l + e.value.slice(i),
466
+ anchor: l.length,
467
+ caret: l.length,
476
468
  composing: !0
477
469
  };
478
470
  }
479
- n < 0 ? r = Ce(e.value, r, -1) : a = Ce(e.value, a, 1);
471
+ n < 0 ? r = Ve(e.value, r, -1) : i = Ve(e.value, i, 1);
480
472
  }
481
473
  return {
482
- value: e.value.slice(0, r) + e.value.slice(a),
474
+ value: e.value.slice(0, r) + e.value.slice(i),
483
475
  caret: r,
484
476
  anchor: r,
485
477
  composing: !1
486
478
  };
487
479
  }
488
- function je(e, n, r = !1) {
489
- const [a, i] = te(e), s = n === "home" ? 0 : n === "end" ? e.value.length : !r && a !== i ? n < 0 ? a : i : Ce(e.value, e.caret, n);
480
+ function Ye(e, n, r = !1) {
481
+ const [i, l] = ie(e), s = n === "home" ? 0 : n === "end" ? e.value.length : !r && i !== l ? n < 0 ? i : l : Ve(e.value, e.caret, n);
490
482
  return {
491
483
  ...e,
492
484
  caret: s,
@@ -494,279 +486,336 @@ function je(e, n, r = !1) {
494
486
  composing: !1
495
487
  };
496
488
  }
497
- function Ae(e) {
498
- const n = e.ownerDocument.getSelection();
499
- if (!n?.anchorNode || !n.focusNode || !e.contains(n.anchorNode) || !e.contains(n.focusNode))
500
- return null;
501
- const r = (i, s) => s >= 0 && s <= (i.nodeType === Node.TEXT_NODE ? i.textContent?.length ?? 0 : i.childNodes.length);
502
- if (!r(n.anchorNode, n.anchorOffset) || !r(n.focusNode, n.focusOffset))
503
- return null;
504
- const a = (i, s) => {
505
- const m = e.ownerDocument.createRange();
506
- return m.selectNodeContents(e), m.setEnd(i, s), m.toString().length;
507
- };
489
+ function bt(e, n, r, i, l, s) {
490
+ if (n === e.value) return e;
491
+ let f = 0;
492
+ for (; f < e.value.length && f < n.length && e.value[f] === n[f]; )
493
+ f++;
494
+ f = Math.min(
495
+ Z(e.value, f),
496
+ Z(n, f)
497
+ );
498
+ let m = e.value.length, u = n.length;
499
+ for (; m > f && u > f && e.value[m - 1] === n[u - 1]; )
500
+ m--, u--;
501
+ for (; Z(e.value, m) !== m || Z(n, u) !== u; )
502
+ m < e.value.length && m++, u < n.length && u++;
503
+ const w = n.slice(f, u), p = i(w).replace(/[\r\n\t]+/g, " ");
504
+ if (w && (!p || !l(p))) return e;
505
+ const c = { ...e, anchor: f, caret: m, composing: !1 }, a = w ? Ke(c, p, !1, s) : ye(c, -1);
506
+ if (a === c) return e;
507
+ const x = (y) => Z(
508
+ a.value,
509
+ y <= f ? y : y >= u ? y + p.length - w.length : f + i(w.slice(0, y - f)).replace(/[\r\n\t]+/g, " ").length
510
+ );
508
511
  return {
509
- anchor: a(n.anchorNode, n.anchorOffset),
510
- caret: a(n.focusNode, n.focusOffset)
512
+ ...a,
513
+ anchor: x(r.backward ? r.end : r.start),
514
+ caret: x(r.backward ? r.start : r.end)
511
515
  };
512
516
  }
513
- function vt(e, n, r) {
514
- const a = e.ownerDocument.getSelection();
515
- if (!a) return;
516
- const i = Ae(e);
517
- if (i?.anchor === n && i.caret === r) return;
518
- const s = (p) => {
519
- const l = e.ownerDocument.createTreeWalker(
520
- e,
521
- NodeFilter.SHOW_TEXT
522
- );
523
- let u = l.nextNode(), P = p;
524
- for (; u; ) {
525
- const w = u.textContent?.length ?? 0;
526
- if (P <= w) return [u, P];
527
- P -= w, u = l.nextNode();
528
- }
529
- return [e, e.childNodes.length];
530
- }, [m, v] = s(n), [d, k] = s(r);
531
- a.setBaseAndExtent(m, v, d, k);
532
- }
533
- const Xe = typeof window > "u" ? K : at, Dt = rt(
517
+ const xt = typeof window > "u" ? D : st, Dt = lt(
534
518
  function({
535
519
  value: n,
536
520
  defaultValue: r = "",
537
- placeholder: a,
538
- onChange: i,
521
+ placeholder: i,
522
+ onChange: l,
539
523
  onValueChange: s,
540
- onClipboardError: m,
541
- mode: v = "text",
542
- layout: d,
543
- filterKey: k,
524
+ onClipboardError: f,
525
+ mode: m = "text",
526
+ layout: u,
527
+ filterKey: w,
544
528
  sanitizeValue: p,
545
- disabled: l = !1,
546
- readOnly: u = !1,
547
- maxLength: P,
548
- ...w
549
- }, _) {
550
- const B = qe(), {
551
- focusId: ae,
552
- onFocus: Z,
529
+ disabled: c = !1,
530
+ readOnly: a = !1,
531
+ maxLength: x,
532
+ ...y
533
+ }, ee) {
534
+ const H = Je(), {
535
+ focusId: se,
536
+ onFocus: re,
553
537
  onBlur: F,
554
- defaultLayout: O,
555
- inputRef: X,
556
- hangulMode: ce,
557
- theme: ie,
558
- toggleKorean: h,
559
- setEditingStatus: b
560
- } = _e(), g = T(null), A = T(null), I = T(null), U = T(!1), [C, J] = $(() => ({
538
+ defaultLayout: ce,
539
+ inputRef: W,
540
+ hangulMode: G,
541
+ theme: ae,
542
+ toggleKorean: de,
543
+ setEditingStatus: g
544
+ } = Oe(), k = M(null), v = M(null), B = M(!1), E = M(!1), $ = M(null), [j, Y] = z(null), [q, A] = z(!1), [R, ge] = z(() => ({
561
545
  value: n ?? r,
562
546
  caret: (n ?? r).length,
563
547
  anchor: (n ?? r).length,
564
548
  composing: !1
565
- })), M = n ?? C.value, c = T(C), W = T(0), ne = T(new ut()), G = T(!1), V = ae === B, Q = T(V);
566
- Q.current = V;
567
- const le = n !== void 0 && n !== C.value;
568
- le && ne.current.clear(), c.current = {
569
- ...C,
570
- value: M,
571
- caret: oe(M, C.caret),
572
- anchor: oe(M, C.anchor),
573
- composing: le ? !1 : C.composing
549
+ })), N = n ?? R.value, d = M(R), fe = M(0), le = M(new ht()), Q = M(!1), h = se === H, C = M(h);
550
+ C.current = h;
551
+ const U = n !== void 0 && n !== R.value;
552
+ U && le.current.clear(), d.current = {
553
+ ...R,
554
+ value: N,
555
+ caret: Z(N, R.caret),
556
+ anchor: Z(N, R.anchor),
557
+ composing: U ? !1 : R.composing
574
558
  };
575
- const j = Fe(
576
- () => Le({
577
- mode: v,
578
- layout: d ?? (v === "text" || v === "custom" ? O : void 0),
579
- filterKey: k,
559
+ const T = Xe(
560
+ () => Te({
561
+ mode: m,
562
+ layout: u ?? (m === "text" || m === "custom" ? ce : void 0),
563
+ filterKey: w,
580
564
  sanitizeValue: p
581
565
  }),
582
- [v, d, O, k, p]
583
- ), [y, D] = $(""), q = T(
584
- void 0
585
- ), R = T(null), z = E(() => {
586
- clearTimeout(q.current), R.current = null;
566
+ [m, u, ce, w, p]
567
+ ), [ke, _] = z(""), [He, Fe] = z(!1), te = M(null), ve = M(null), pe = M({ disabled: c, readOnly: a, policy: T, maxLength: x });
568
+ pe.current = { disabled: c, readOnly: a, policy: T, maxLength: x };
569
+ const O = L(() => {
570
+ te.current && (te.current = null, Fe(!1));
587
571
  }, []);
588
- K(() => {
589
- (l || u) && z();
590
- }, [l, u, z]), K(() => {
591
- const t = (o) => {
592
- R.current && R.current.id !== o.pointerId && z();
593
- };
594
- return window.addEventListener("blur", z), window.addEventListener("scroll", z, !0), window.addEventListener("pointerdown", t, !0), document.addEventListener("visibilitychange", z), () => {
595
- z(), window.removeEventListener("blur", z), window.removeEventListener("scroll", z, !0), window.removeEventListener("pointerdown", t, !0), document.removeEventListener("visibilitychange", z);
596
- };
597
- }, [z]);
598
- const S = E(
599
- (t, o = !0, f = !1) => {
600
- const x = c.current.value;
601
- if (o && ne.current.record(c.current, t), U.current = !f, c.current = t, W.current++, D(""), J(t), t.value !== x) {
572
+ D(() => {
573
+ const t = te.current;
574
+ t && (!h || c || a || t.policy !== T || t.maxLength !== x || t.value !== N) && O();
575
+ }, [
576
+ h,
577
+ c,
578
+ a,
579
+ T,
580
+ x,
581
+ N,
582
+ O
583
+ ]);
584
+ const S = L(
585
+ (t, o = !0, b = !1) => {
586
+ O();
587
+ const I = d.current.value;
588
+ if (o && le.current.record(d.current, t), B.current = !b, d.current = t, fe.current++, _(""), ge(t), t.value !== I) {
602
589
  s?.(t.value);
603
- const N = { value: t.value };
604
- i?.({
605
- target: N,
606
- currentTarget: N
590
+ const K = { value: t.value };
591
+ l?.({
592
+ target: K,
593
+ currentTarget: K
607
594
  });
608
595
  }
609
596
  },
610
- [i, s]
611
- ), H = E(() => {
612
- const t = A.current;
613
- if (!t || l || U.current || t.textContent !== c.current.value)
597
+ [l, s, O]
598
+ ), V = L(() => {
599
+ const t = v.current;
600
+ if (!t || c || B.current || t.value !== d.current.value || E.current)
614
601
  return null;
615
- const o = Ae(t);
616
- if (!o) return null;
617
- const f = oe(c.current.value, o.anchor), x = oe(c.current.value, o.caret);
618
- return (f !== c.current.anchor || x !== c.current.caret || f !== o.anchor || x !== o.caret) && S(
619
- { ...c.current, anchor: f, caret: x, composing: !1 },
602
+ const o = t.selectionStart ?? 0, b = t.selectionEnd ?? o, I = t.selectionDirection === "backward" ? { anchor: b, caret: o } : { anchor: o, caret: b }, K = Z(d.current.value, I.anchor), J = Z(d.current.value, I.caret);
603
+ return (K !== d.current.anchor || J !== d.current.caret || K !== I.anchor || J !== I.caret) && S(
604
+ { ...d.current, anchor: K, caret: J, composing: !1 },
620
605
  !1,
621
- f === o.anchor && x === o.caret
622
- ), { anchor: f, caret: x };
623
- }, [l, S]);
624
- K(() => {
606
+ K === I.anchor && J === I.caret
607
+ ), { anchor: K, caret: J };
608
+ }, [c, S]);
609
+ D(() => {
625
610
  const t = () => {
626
- const o = H();
627
- o && o.anchor !== o.caret && (clearTimeout(q.current), R.current && (R.current.held = !0), !u && g.current && !Q.current && (g.current.focus({ preventScroll: !0 }), Z(B, g.current, j)));
611
+ document.activeElement === v.current && V();
612
+ }, o = v.current;
613
+ return document.addEventListener("selectionchange", t), o?.addEventListener("select", t), () => {
614
+ document.removeEventListener("selectionchange", t), o?.removeEventListener("select", t);
628
615
  };
629
- return document.addEventListener("selectionchange", t), () => document.removeEventListener("selectionchange", t);
630
- }, [H, u, Z, B, j]), Xe(() => {
631
- (V || document.activeElement === g.current) && !l && A.current && (U.current || le) && vt(
632
- A.current,
633
- c.current.anchor,
634
- c.current.caret
635
- ), U.current = !1;
636
- }), K(() => {
637
- if (!V) return;
638
- const [t, o] = te(c.current);
639
- b({
640
- selectionLength: me(M.slice(t, o)).length,
641
- hasValue: !!M,
642
- message: y
616
+ }, [V]), xt(() => {
617
+ if ($.current && $.current.value !== N && (E.current = !1, $.current = null, Y(null)), !c && v.current && !E.current && (B.current || U)) {
618
+ const { anchor: t, caret: o } = d.current, b = Math.min(t, o), I = Math.max(t, o), K = t > o ? "backward" : "forward";
619
+ (v.current.selectionStart !== b || v.current.selectionEnd !== I || b !== I && v.current.selectionDirection !== K) && v.current.setSelectionRange(b, I, K);
620
+ }
621
+ B.current = !1, ve.current !== null && (_(
622
+ N === ve.current ? "붙여넣었어요" : "입력값이 적용되지 않았어요"
623
+ ), ve.current = null);
624
+ }), D(() => {
625
+ if (!h) return;
626
+ const [t, o] = ie(d.current);
627
+ g({
628
+ selectionLength: Re(N.slice(t, o)).length,
629
+ hasValue: !!N,
630
+ message: ke,
631
+ pasting: He
643
632
  });
644
633
  }, [
645
- M,
646
- C.anchor,
647
- C.caret,
648
- y,
649
- V,
650
- b
634
+ N,
635
+ R.anchor,
636
+ R.caret,
637
+ ke,
638
+ He,
639
+ h,
640
+ g
651
641
  ]);
652
- const re = E(
642
+ const Ee = L(
653
643
  (t, o = !1) => {
654
- if (l || u) return;
655
- H();
656
- const f = j.sanitizeValue(t).replace(/[\r\n\t]+/g, " ");
657
- f && S(wt(c.current, f, o, P));
644
+ if (c || a) return;
645
+ V();
646
+ const b = T.sanitizeValue(t).replace(/[\r\n\t]+/g, " ");
647
+ b && S(Ke(d.current, b, o, x));
658
648
  },
659
- [l, u, j, P, S, H]
660
- ), ve = E(() => {
661
- !l && !u && S(ne.current.undo(c.current), !1);
662
- }, [l, u, S]), ye = E(() => {
663
- !l && !u && S(ne.current.redo(c.current), !1);
664
- }, [l, u, S]), De = E(
649
+ [c, a, T, x, S, V]
650
+ ), Se = L(
651
+ (t) => {
652
+ if (c || a || E.current) return;
653
+ if (V(), !t) {
654
+ _("붙여넣을 텍스트가 없어요");
655
+ return;
656
+ }
657
+ const o = T.sanitizeValue(t).replace(/[\r\n\t]+/g, " ");
658
+ if (!o || !T.filterKey(o)) {
659
+ _("이 입력란에 붙여넣을 수 없는 내용이에요");
660
+ return;
661
+ }
662
+ const b = Ke(d.current, o, !1, x);
663
+ if (b === d.current) {
664
+ _("입력 길이 제한을 초과했어요");
665
+ return;
666
+ }
667
+ ve.current = b.value, S(b), v.current?.focus({ preventScroll: !0 });
668
+ },
669
+ [c, a, T, x, V, S]
670
+ ), Le = L(() => {
671
+ !c && !a && S(le.current.undo(d.current), !1);
672
+ }, [c, a, S]), Ce = L(() => {
673
+ !c && !a && S(le.current.redo(d.current), !1);
674
+ }, [c, a, S]), je = L(
665
675
  () => S({
666
- ...c.current,
667
- caret: c.current.value.length,
676
+ ...d.current,
677
+ caret: d.current.value.length,
668
678
  anchor: 0,
669
679
  composing: !1
670
680
  }),
671
681
  [S]
672
- ), Ke = E(
682
+ ), Ne = L(
673
683
  (t, o = !1) => {
674
- H(), S(je(c.current, t === "left" ? -1 : 1, o));
684
+ V(), S(Ye(d.current, t === "left" ? -1 : 1, o));
675
685
  },
676
- [S, H]
677
- ), Ge = (t) => {
678
- if (w.onKeyDown?.(t), t.defaultPrevented || l) return;
679
- H();
686
+ [S, V]
687
+ ), tt = (t) => {
688
+ if (y.onKeyDown?.(t), t.defaultPrevented || c || E.current || t.nativeEvent.isComposing || t.keyCode === 229)
689
+ return;
690
+ V();
680
691
  const o = t.key;
681
692
  if (o === "Escape") {
682
- t.preventDefault(), S({ ...c.current, composing: !1 }), F(!0), g.current?.blur();
693
+ t.preventDefault(), S({ ...d.current, composing: !1 }), F(!0), v.current?.blur();
683
694
  return;
684
695
  }
685
696
  if (o === "HangulMode") {
686
- t.preventDefault(), S({ ...c.current, composing: !1 }), h();
697
+ t.preventDefault(), S({ ...d.current, composing: !1 }), de();
687
698
  return;
688
699
  }
689
- const f = t.ctrlKey || t.metaKey;
690
- if (f && ["z", "y"].includes(o.toLowerCase())) {
691
- t.preventDefault(), o.toLowerCase() === "y" || t.shiftKey ? ye() : ve();
700
+ const b = t.ctrlKey || t.metaKey;
701
+ if (b && ["z", "y"].includes(o.toLowerCase())) {
702
+ t.preventDefault(), o.toLowerCase() === "y" || t.shiftKey ? Ce() : Le();
692
703
  return;
693
704
  }
694
- if (f && o.toLowerCase() === "a") {
705
+ if (b && o.toLowerCase() === "a") {
695
706
  t.preventDefault(), S({
696
- ...c.current,
697
- caret: c.current.value.length,
707
+ ...d.current,
708
+ caret: d.current.value.length,
698
709
  anchor: 0,
699
710
  composing: !1
700
711
  });
701
712
  return;
702
713
  }
703
- const x = o === "Home" || o === "ArrowUp" || f && o === "ArrowLeft" ? "home" : o === "End" || o === "ArrowDown" || f && o === "ArrowRight" ? "end" : o === "ArrowLeft" ? -1 : o === "ArrowRight" ? 1 : null;
704
- if (x !== null) {
705
- t.preventDefault(), S(je(c.current, x, t.shiftKey));
714
+ const I = o === "Home" || o === "ArrowUp" || b && o === "ArrowLeft" ? "home" : o === "End" || o === "ArrowDown" || b && o === "ArrowRight" ? "end" : o === "ArrowLeft" ? -1 : o === "ArrowRight" ? 1 : null;
715
+ if (I !== null) {
716
+ t.preventDefault(), S(Ye(d.current, I, t.shiftKey));
706
717
  return;
707
718
  }
708
719
  if (o === "Tab" || o === "Enter") {
709
- S({ ...c.current, composing: !1 });
720
+ o === "Enter" && t.preventDefault(), S({ ...d.current, composing: !1 });
710
721
  return;
711
722
  }
712
- if (u) return;
723
+ if (a) return;
713
724
  if (o === "Backspace" || o === "Delete") {
714
- t.preventDefault(), S(ke(c.current, o === "Backspace" ? -1 : 1));
725
+ t.preventDefault(), S(ye(d.current, o === "Backspace" ? -1 : 1));
715
726
  return;
716
727
  }
717
- const N = st(
728
+ const K = gt(
718
729
  t,
719
- ge(j.mode) ?? ce
730
+ be(T.mode) ?? G
720
731
  );
721
- N.handled && N.text && (t.preventDefault(), j.filterKey(N.text) && re(N.text, N.composing));
722
- }, de = E(
732
+ K.handled && K.text && (t.preventDefault(), T.filterKey(K.text) && Ee(K.text, K.composing));
733
+ }, ue = L(
723
734
  (t) => {
724
735
  const o = t instanceof Error ? t : new Error(String(t));
725
- G.current && (D(
726
- "클립보드에 접근할 수 없습니다. 선택한 글자를 길게 눌러 기본 복사 메뉴를 사용해 주세요."
727
- ), m?.(o));
736
+ Q.current && (_(
737
+ "클립보드에 접근할 수 없습니다. 입력란을 길게 눌러 기본 편집 메뉴를 사용해 주세요."
738
+ ), f?.(o));
728
739
  },
729
- [m]
730
- ), fe = E(async () => {
731
- H();
732
- const [t, o] = te(c.current);
740
+ [f]
741
+ ), me = L(async () => {
742
+ V();
743
+ const [t, o] = ie(d.current);
733
744
  if (t === o) return;
734
- const f = c.current.value.slice(t, o);
745
+ const b = d.current.value, I = d.current.value.slice(t, o);
735
746
  try {
736
747
  if (!navigator.clipboard?.writeText)
737
748
  throw new Error("Clipboard API unavailable");
738
- await navigator.clipboard.writeText(f);
739
- } catch (x) {
740
- if (!A.current || document.getSelection()?.toString() !== f || !document.execCommand?.("copy"))
741
- throw x;
749
+ await navigator.clipboard.writeText(I);
750
+ } catch (K) {
751
+ V();
752
+ const J = v.current, [at, ot] = ie(d.current);
753
+ if (!J || !Q.current || d.current.value !== b || at !== t || ot !== o)
754
+ throw K;
755
+ let ne = document.activeElement;
756
+ const Ze = ne?.hasAttribute(
757
+ "data-virtual-keypad"
758
+ );
759
+ if (ne !== J && !Ze) throw K;
760
+ for (; ne?.shadowRoot?.activeElement; )
761
+ ne = ne.shadowRoot.activeElement;
762
+ J.focus({ preventScroll: !0 });
763
+ try {
764
+ if (!document.execCommand?.("copy")) throw K;
765
+ } finally {
766
+ ne instanceof HTMLElement && ne !== J && Ze && ne.focus({ preventScroll: !0 });
767
+ }
742
768
  }
743
- G.current && D("복사했어요");
744
- }, [H]), Ve = E(async () => {
745
- if (l || u) return;
746
- H();
747
- const t = c.current, o = W.current;
748
- t.anchor !== t.caret && (await fe(), G.current && Q.current && W.current === o && c.current.value === t.value && S(ke(t, -1)));
749
- }, [l, u, fe, S, H]), ze = E(async () => {
750
- if (l || u) return;
751
- H();
752
- const t = W.current, o = c.current.value, f = await navigator.clipboard.readText();
753
- G.current && Q.current && W.current === t && c.current.value === o && re(f);
754
- }, [l, u, re, H]), ue = Fe(
769
+ Q.current && _("복사했어요");
770
+ }, [V]), $e = L(async () => {
771
+ if (c || a) return;
772
+ V();
773
+ const t = d.current, o = fe.current;
774
+ t.anchor !== t.caret && (await me(), Q.current && C.current && fe.current === o && d.current.value === t.value && S(ye(t, -1)));
775
+ }, [c, a, me, S, V]), qe = L(async () => {
776
+ if (c || a || E.current || te.current)
777
+ return;
778
+ V();
779
+ const t = { value: d.current.value, policy: T, maxLength: x };
780
+ te.current = t, Fe(!0), _("");
781
+ const o = () => te.current === t && Q.current && C.current && !pe.current.disabled && !pe.current.readOnly && pe.current.policy === t.policy && pe.current.maxLength === t.maxLength && d.current.value === t.value;
782
+ try {
783
+ if (!navigator.clipboard?.readText)
784
+ throw new Error("Clipboard read unavailable");
785
+ const b = await navigator.clipboard.readText();
786
+ V(), o() && Se(b);
787
+ } catch (b) {
788
+ V(), o() && (v.current?.focus({ preventScroll: !0 }), ue(b), _(
789
+ "클립보드를 읽을 수 없어요. 입력란을 길게 눌러 ‘붙여넣기’를 선택해 주세요."
790
+ ));
791
+ } finally {
792
+ te.current === t && O();
793
+ }
794
+ }, [
795
+ c,
796
+ a,
797
+ T,
798
+ x,
799
+ Se,
800
+ V,
801
+ ue,
802
+ O
803
+ ]), he = Xe(
755
804
  () => ({
756
805
  focus: (t) => {
757
- l || g.current?.focus(t);
806
+ c || v.current?.focus(t);
758
807
  },
759
808
  blur: () => {
760
- g.current?.blur(), Q.current && F(!0);
809
+ v.current?.blur(), C.current && F(!0);
761
810
  },
762
- getValue: () => c.current.value,
811
+ getValue: () => d.current.value,
763
812
  setSelectionRange: (t, o) => S({
764
- ...c.current,
765
- anchor: oe(c.current.value, t),
766
- caret: oe(c.current.value, o),
813
+ ...d.current,
814
+ anchor: Z(d.current.value, t),
815
+ caret: Z(d.current.value, o),
767
816
  composing: !1
768
817
  }),
769
- handleKeyDown: (t) => g.current?.dispatchEvent(
818
+ handleKeyDown: (t) => v.current?.dispatchEvent(
770
819
  new KeyboardEvent("keydown", {
771
820
  key: t.key,
772
821
  shiftKey: t.shiftKey,
@@ -779,153 +828,90 @@ const Xe = typeof window > "u" ? K : at, Dt = rt(
779
828
  })
780
829
  ),
781
830
  insertText: (t, o) => {
782
- j.filterKey(t) && re(t, o);
831
+ T.filterKey(t) && Ee(t, o);
783
832
  },
784
- scrollIntoView: () => g.current?.scrollIntoView({ block: "nearest", inline: "nearest" }),
785
- moveCaret: Ke,
786
- undo: ve,
787
- redo: ye,
788
- selectAll: De,
789
- copySelection: () => fe().catch(de),
790
- pasteClipboard: () => ze().catch(de),
791
- cutSelection: () => Ve().catch(de)
833
+ scrollIntoView: () => k.current?.scrollIntoView({ block: "nearest", inline: "nearest" }),
834
+ moveCaret: Ne,
835
+ undo: Le,
836
+ redo: Ce,
837
+ selectAll: je,
838
+ copySelection: () => me().catch(ue),
839
+ pasteClipboard: () => qe().catch(ue),
840
+ cutSelection: () => $e().catch(ue)
792
841
  }),
793
842
  [
794
- j,
795
- re,
796
- Ke,
797
- fe,
798
- ze,
799
- Ve,
800
- de,
801
- ve,
802
- ye,
803
- De,
804
- l,
843
+ T,
844
+ Ee,
845
+ Ne,
846
+ me,
847
+ qe,
848
+ $e,
849
+ ue,
850
+ Le,
851
+ Ce,
852
+ je,
853
+ c,
805
854
  F,
806
855
  S
807
856
  ]
808
857
  );
809
- ot(_, () => ue, [ue]), K(() => {
810
- V || J(
858
+ ut(ee, () => he, [he]), D(() => {
859
+ h || ge(
811
860
  (t) => t.composing ? { ...t, composing: !1 } : t
812
861
  );
813
- }, [V]), K(() => {
814
- if (!(!V || l || u))
815
- return X.current = ue, () => {
816
- X.current === ue && (X.current = null);
862
+ }, [h]), D(() => {
863
+ if (!(!h || c || a))
864
+ return W.current = he, () => {
865
+ W.current === he && (W.current = null);
817
866
  };
818
- }, [V, l, u, ue, X]), K(() => {
819
- V && g.current && (l || u ? F(!0) : Z(B, g.current, j));
820
- }, [V, l, u, B, j, Z, F]), K(() => (G.current = !0, () => {
821
- G.current = !1, clearTimeout(q.current), Q.current && F(!0);
822
- }), [F]), Xe(() => {
823
- if (!g.current || !A.current || !I.current)
824
- return;
825
- const t = () => {
826
- const f = g.current, x = A.current, N = f.getBoundingClientRect(), $e = x.querySelector(
827
- `[data-char-index="${c.current.caret}"]`
828
- ), pe = ($e ?? x).getBoundingClientRect(), se = $e || !c.current.value ? pe.left : pe.right;
829
- Object.assign(I.current.style, {
830
- left: `${se - N.left + f.scrollLeft - f.clientLeft}px`,
831
- top: `${pe.top - N.top + f.scrollTop - f.clientTop}px`,
832
- height: `${pe.height}px`
833
- }), !(!V || c.current.anchor !== c.current.caret) && (se > N.right - 12 ? f.scrollLeft += se - N.right + 12 : se < N.left + 12 && (f.scrollLeft -= N.left + 12 - se));
834
- };
835
- t();
836
- const o = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
837
- return o?.observe(g.current), () => o?.disconnect();
838
- }, [M, C.caret, C.anchor, V]);
839
- const Ne = (t, o) => {
840
- if (o ? w.onCut?.(t) : w.onCopy?.(t), t.defaultPrevented || l || o && u) return;
841
- const f = document.getSelection();
842
- if (f && !f.isCollapsed && A.current && !Ae(A.current))
843
- return;
844
- H();
845
- const [x, N] = te(c.current);
846
- x !== N && (t.preventDefault(), t.clipboardData.setData(
867
+ }, [h, c, a, he, W]), D(() => {
868
+ h && k.current && (c || a ? F(!0) : re(H, k.current, T));
869
+ }, [h, c, a, H, T, re, F]), D(() => (Q.current = !0, () => {
870
+ Q.current = !1, te.current = null, C.current && F(!0);
871
+ }), [F]);
872
+ const Ue = (t, o) => {
873
+ if (o ? y.onCut?.(t) : y.onCopy?.(t), t.defaultPrevented || c || o && a || t.target !== v.current) return;
874
+ V();
875
+ const [b, I] = ie(d.current);
876
+ b !== I && (t.preventDefault(), t.clipboardData.setData(
847
877
  "text/plain",
848
- c.current.value.slice(x, N)
849
- ), o ? S(ke(c.current, -1)) : D("복사했어요"));
850
- }, be = (t, o = !0) => {
851
- for (const f of g.current?.querySelectorAll(
852
- "[data-char-index]"
853
- ) ?? []) {
854
- const x = f.getBoundingClientRect();
855
- if (t < x.left + x.width * (o ? 0.5 : 1))
856
- return Number(f.dataset.charIndex);
857
- }
858
- return c.current.value.length;
859
- }, xe = () => {
860
- g.current?.focus({ preventScroll: !0 }), !u && g.current && Z(B, g.current, j);
861
- }, Be = (t) => {
862
- const [o, f] = mt(
863
- c.current.value,
864
- be(t, !1)
865
- );
866
- xe(), S({ ...c.current, anchor: o, caret: f, composing: !1 });
867
- }, Qe = (t) => {
868
- if (w.onPointerDown?.(t), t.defaultPrevented || l || t.button !== 0) return;
869
- const o = t.pointerType === "mouse";
870
- if (R.current || t.isPrimary === !1) {
871
- z();
872
- return;
873
- }
874
- const f = be(t.clientX), x = t.shiftKey ? c.current.anchor : f;
875
- R.current = {
876
- id: t.pointerId,
877
- x: t.clientX,
878
- y: t.clientY,
879
- anchor: x,
880
- mouse: o,
881
- held: !1
882
- }, clearTimeout(q.current), o ? xe() : q.current = setTimeout(() => {
883
- R.current && (R.current.held = !0, Be(R.current.x));
884
- }, 550);
885
- }, [Re, He] = te(c.current), Oe = me(M), et = /* @__PURE__ */ L(
886
- "span",
887
- {
888
- ref: I,
889
- "aria-hidden": "true",
890
- className: "vk-caret",
891
- style: {
892
- display: V && !u && !l && Re === He ? "block" : "none",
893
- width: 0,
894
- height: "1.1em",
895
- position: "absolute",
896
- pointerEvents: "none",
897
- userSelect: "none"
878
+ d.current.value.slice(b, I)
879
+ ), o ? S(ye(d.current, -1)) : _("복사했어요"));
880
+ }, We = (t) => {
881
+ if (c || a) return;
882
+ const o = bt(
883
+ d.current,
884
+ t.value,
885
+ {
886
+ start: t.selectionStart ?? t.value.length,
887
+ end: t.selectionEnd ?? t.value.length,
888
+ backward: t.selectionDirection === "backward"
898
889
  },
899
- children: V && !u && !l && Re === He && /* @__PURE__ */ L(
900
- "span",
901
- {
902
- style: {
903
- position: "absolute",
904
- height: "100%",
905
- borderLeft: "2px solid currentColor"
906
- }
907
- }
890
+ T.sanitizeValue,
891
+ T.filterKey,
892
+ x
893
+ );
894
+ t.value = o.value, S({ ...o });
895
+ }, nt = Object.fromEntries(
896
+ Object.entries(y).filter(([t]) => t.startsWith("aria-"))
897
+ ), rt = Object.fromEntries(
898
+ Object.entries(y).filter(
899
+ ([t]) => !t.startsWith("aria-") && !["id", "tabIndex", "role", "contentEditable", "children"].includes(
900
+ t
908
901
  )
909
- }
902
+ )
910
903
  );
911
- return /* @__PURE__ */ Y(
904
+ return /* @__PURE__ */ X(
912
905
  "div",
913
906
  {
914
- ...w,
915
- ref: g,
916
- id: w.id ?? B,
917
- role: "textbox",
918
- tabIndex: l ? -1 : w.tabIndex ?? 0,
919
- "aria-disabled": l || void 0,
920
- "aria-readonly": u || void 0,
921
- "aria-multiline": "false",
922
- "aria-placeholder": a,
907
+ ...rt,
908
+ ref: k,
923
909
  "data-virtual-input": "true",
924
- "data-focused": V || void 0,
925
- "data-value": M,
910
+ "data-focused": h || void 0,
926
911
  style: {
927
- display: "block",
928
912
  position: "relative",
913
+ display: "flex",
914
+ alignItems: "center",
929
915
  boxSizing: "border-box",
930
916
  minHeight: "2.75em",
931
917
  padding: "0.65em 0.8em",
@@ -933,86 +919,89 @@ const Xe = typeof window > "u" ? K : at, Dt = rt(
933
919
  borderRadius: 8,
934
920
  font: "inherit",
935
921
  width: "100%",
936
- whiteSpace: "pre",
937
- overflowX: "auto",
938
- scrollbarWidth: "none",
939
- cursor: l ? "not-allowed" : "text",
940
- userSelect: l ? "none" : "text",
941
- WebkitUserSelect: l ? "none" : "text",
942
- WebkitTouchCallout: "default",
943
- touchAction: "manipulation",
944
- opacity: l ? 0.5 : 1,
945
- outlineOffset: 3,
946
- ...w.style
922
+ cursor: c ? "not-allowed" : "text",
923
+ opacity: c ? 0.5 : 1,
924
+ colorScheme: ae,
925
+ outline: q ? "2px solid currentColor" : void 0,
926
+ outlineOffset: 2,
927
+ ...y.style
947
928
  },
948
929
  onFocus: (t) => {
949
- w.onFocus?.(t), !t.defaultPrevented && !l && !u && Z(B, t.currentTarget, j);
930
+ A(!0), y.onFocus?.(t), !t.defaultPrevented && !c && !a && re(H, t.currentTarget, T);
950
931
  },
951
932
  onBlur: (t) => {
952
- w.onBlur?.(t), z(), t.defaultPrevented || F(t);
933
+ A(!1), t.relatedTarget instanceof Element && !t.relatedTarget.closest("[data-virtual-keypad]") && O(), y.onBlur?.(t), t.defaultPrevented || F(t);
953
934
  },
954
- onKeyDown: Ge,
955
- onCopy: (t) => Ne(t, !1),
956
- onCut: (t) => Ne(t, !0),
935
+ onKeyDown: tt,
936
+ onCopy: (t) => Ue(t, !1),
937
+ onCut: (t) => Ue(t, !0),
957
938
  onPaste: (t) => {
958
- w.onPaste?.(t), !t.defaultPrevented && !l && !u && (t.preventDefault(), re(t.clipboardData.getData("text/plain")));
959
- },
960
- onPointerDown: Qe,
961
- onDoubleClick: (t) => {
962
- w.onDoubleClick?.(t), !(t.defaultPrevented || l || t.button !== 0) && (t.preventDefault(), Be(t.clientX));
963
- },
964
- onPointerMove: (t) => {
965
- if (w.onPointerMove?.(t), t.defaultPrevented) {
966
- z();
967
- return;
968
- }
969
- !R.current || R.current.id !== t.pointerId || Math.hypot(
970
- t.clientX - R.current.x,
971
- t.clientY - R.current.y
972
- ) > 8 && (clearTimeout(q.current), R.current.mouse || z());
973
- },
974
- onPointerUp: (t) => {
975
- w.onPointerUp?.(t);
976
- const o = R.current;
977
- if (!t.defaultPrevented && o?.id === t.pointerId && !o.held && Math.hypot(t.clientX - o.x, t.clientY - o.y) <= 8) {
978
- const f = H();
979
- if (!f || !o.mouse && f.anchor === f.caret) {
980
- const x = be(t.clientX);
981
- xe(), S({
982
- ...c.current,
983
- caret: x,
984
- anchor: t.shiftKey ? o.anchor : x,
985
- composing: !1
986
- });
987
- }
988
- }
989
- z();
990
- },
991
- onPointerCancel: (t) => {
992
- w.onPointerCancel?.(t), z();
993
- },
994
- onLostPointerCapture: (t) => {
995
- w.onLostPointerCapture?.(t), R.current?.id === t.pointerId && z();
996
- },
997
- onContextMenu: (t) => {
998
- w.onContextMenu?.(t), t.defaultPrevented || H();
939
+ y.onPaste?.(t), !t.defaultPrevented && !c && !a && (t.preventDefault(), O(), Se(t.clipboardData.getData("text/plain")));
999
940
  },
1000
941
  children: [
1001
- /* @__PURE__ */ L("span", { ref: A, "data-input-text": "true", children: Oe.map(({ segment: t, index: o }) => /* @__PURE__ */ L("span", { "data-char-index": o, children: t }, o)) }),
1002
- et,
1003
- !M && /* @__PURE__ */ L(
1004
- "span",
942
+ /* @__PURE__ */ P(
943
+ "input",
1005
944
  {
1006
- "aria-hidden": "true",
945
+ ...nt,
946
+ ref: v,
947
+ id: y.id ?? H,
948
+ type: "text",
949
+ role: "textbox",
950
+ inputMode: "none",
951
+ autoComplete: "off",
952
+ autoCorrect: "off",
953
+ autoCapitalize: "off",
954
+ spellCheck: y.spellCheck ?? !1,
955
+ tabIndex: c ? -1 : y.tabIndex ?? 0,
956
+ disabled: c,
957
+ readOnly: a,
958
+ "aria-disabled": c || void 0,
959
+ "aria-readonly": a || void 0,
960
+ "data-virtual-input": "true",
961
+ "data-focused": h || void 0,
962
+ "data-value": N,
963
+ placeholder: i,
964
+ value: j ?? N,
1007
965
  style: {
1008
- color: ie === "dark" ? "#a6b7a9" : "#58665d",
1009
- userSelect: "none",
1010
- WebkitUserSelect: "none"
966
+ position: "absolute",
967
+ inset: 0,
968
+ boxSizing: "border-box",
969
+ display: "block",
970
+ width: "100%",
971
+ height: "100%",
972
+ minWidth: 0,
973
+ minHeight: "1.5em",
974
+ margin: 0,
975
+ padding: "inherit",
976
+ border: 0,
977
+ borderRadius: "inherit",
978
+ outline: "none",
979
+ background: "transparent",
980
+ color: "inherit",
981
+ caretColor: "currentColor",
982
+ font: "inherit",
983
+ lineHeight: "inherit",
984
+ letterSpacing: "inherit",
985
+ textAlign: "inherit",
986
+ appearance: "none",
987
+ WebkitAppearance: "none",
988
+ userSelect: "text",
989
+ WebkitUserSelect: "text",
990
+ touchAction: "manipulation"
991
+ },
992
+ onChange: (t) => {
993
+ E.current ? Y(t.currentTarget.value) : We(t.currentTarget);
1011
994
  },
1012
- children: a || " "
995
+ onSelect: V,
996
+ onCompositionStart: () => {
997
+ O(), V(), $.current = d.current, E.current = !0, Y(v.current?.value ?? d.current.value);
998
+ },
999
+ onCompositionEnd: (t) => {
1000
+ E.current = !1, Y(null), $.current?.value === d.current.value ? We(t.currentTarget) : (t.currentTarget.value = d.current.value, S({ ...d.current })), $.current = null;
1001
+ }
1013
1002
  }
1014
1003
  ),
1015
- /* @__PURE__ */ L(
1004
+ /* @__PURE__ */ P(
1016
1005
  "span",
1017
1006
  {
1018
1007
  role: "status",
@@ -1022,18 +1011,16 @@ const Xe = typeof window > "u" ? K : at, Dt = rt(
1022
1011
  height: 1,
1023
1012
  overflow: "hidden",
1024
1013
  clipPath: "inset(50%)",
1025
- whiteSpace: "nowrap",
1026
- userSelect: "none",
1027
- WebkitUserSelect: "none"
1014
+ whiteSpace: "nowrap"
1028
1015
  },
1029
- children: y
1016
+ children: ke
1030
1017
  }
1031
1018
  )
1032
1019
  ]
1033
1020
  }
1034
1021
  );
1035
1022
  }
1036
- ), yt = [
1023
+ ), kt = [
1037
1024
  [
1038
1025
  {
1039
1026
  value: "1"
@@ -1150,97 +1137,97 @@ const Xe = typeof window > "u" ? K : at, Dt = rt(
1150
1137
  }
1151
1138
  ]
1152
1139
  ];
1153
- function bt({
1140
+ function Et({
1154
1141
  tagName: e,
1155
1142
  css: n,
1156
1143
  children: r,
1157
- hostRef: a,
1158
- ...i
1144
+ hostRef: i,
1145
+ ...l
1159
1146
  }) {
1160
- const [s, m] = $(null), v = E(
1161
- (d) => {
1162
- a && (a.current = d), d && m(d.shadowRoot ?? d.attachShadow({ mode: "open" }));
1147
+ const [s, f] = z(null), m = L(
1148
+ (u) => {
1149
+ i && (i.current = u), u && f(u.shadowRoot ?? u.attachShadow({ mode: "open" }));
1163
1150
  },
1164
- [a]
1151
+ [i]
1165
1152
  );
1166
- return ct(
1153
+ return dt(
1167
1154
  e,
1168
- { ...i, ref: v },
1169
- s && Ie(
1170
- /* @__PURE__ */ Y(Pe, { children: [
1171
- n && /* @__PURE__ */ L("style", { children: n }),
1155
+ { ...l, ref: m },
1156
+ s && Be(
1157
+ /* @__PURE__ */ X(De, { children: [
1158
+ n && /* @__PURE__ */ P("style", { children: n }),
1172
1159
  r
1173
1160
  ] }),
1174
1161
  s
1175
1162
  )
1176
1163
  );
1177
1164
  }
1178
- function Ue(e, n, r) {
1165
+ function _e(e, n, r) {
1179
1166
  if (e.type === "action") return e.value === `
1180
1167
  ` ? "Enter" : e.value;
1181
1168
  if (!/^[a-zA-Z]$/.test(e.value)) return e.value;
1182
- const a = r ? e.value.toUpperCase() : e.value;
1183
- return n ? Ye(a) : a;
1169
+ const i = r ? e.value.toUpperCase() : e.value;
1170
+ return n ? Ge(i) : i;
1184
1171
  }
1185
- function Me(e, { disabled: n = !1, repeat: r = !1 } = {}) {
1186
- const a = T(e);
1187
- a.current = e;
1188
- const i = T(void 0), s = T(null), [m, v] = $(!1), d = E(() => {
1189
- clearTimeout(i.current), s.current = null, v(!1);
1172
+ function Ie(e, { disabled: n = !1, repeat: r = !1 } = {}) {
1173
+ const i = M(e);
1174
+ i.current = e;
1175
+ const l = M(void 0), s = M(null), [f, m] = z(!1), u = L(() => {
1176
+ clearTimeout(l.current), s.current = null, m(!1);
1190
1177
  }, []);
1191
- K(() => (window.addEventListener("blur", d), document.addEventListener("visibilitychange", d), () => {
1192
- d(), window.removeEventListener("blur", d), document.removeEventListener("visibilitychange", d);
1193
- }), [d]), K(() => {
1194
- n && d();
1195
- }, [n, d]);
1196
- const k = (p) => {
1197
- const l = s.current?.bounds;
1198
- return !!l && p.clientX >= l.left && p.clientX <= l.right && p.clientY >= l.top && p.clientY <= l.bottom;
1178
+ D(() => (window.addEventListener("blur", u), document.addEventListener("visibilitychange", u), () => {
1179
+ u(), window.removeEventListener("blur", u), document.removeEventListener("visibilitychange", u);
1180
+ }), [u]), D(() => {
1181
+ n && u();
1182
+ }, [n, u]);
1183
+ const w = (p) => {
1184
+ const c = s.current?.bounds;
1185
+ return !!c && p.clientX >= c.left && p.clientX <= c.right && p.clientY >= c.top && p.clientY <= c.bottom;
1199
1186
  };
1200
1187
  return {
1201
- "data-pressed": m || void 0,
1188
+ "data-pressed": f || void 0,
1202
1189
  onPointerDown: (p) => {
1203
1190
  if (!(n || p.button !== 0 || s.current)) {
1204
1191
  p.preventDefault(), s.current = {
1205
1192
  id: p.pointerId,
1206
1193
  bounds: p.currentTarget.getBoundingClientRect(),
1207
1194
  repeated: !1
1208
- }, v(!0);
1195
+ }, m(!0);
1209
1196
  try {
1210
1197
  p.currentTarget.setPointerCapture?.(p.pointerId);
1211
1198
  } catch {
1212
1199
  }
1213
1200
  if (r) {
1214
- const l = () => {
1215
- s.current && (s.current.repeated = !0, a.current(), i.current = setTimeout(l, 65));
1201
+ const c = () => {
1202
+ s.current && (s.current.repeated = !0, i.current(), l.current = setTimeout(c, 65));
1216
1203
  };
1217
- i.current = setTimeout(l, 450);
1204
+ l.current = setTimeout(c, 450);
1218
1205
  }
1219
1206
  }
1220
1207
  },
1221
1208
  onPointerMove: (p) => {
1222
- s.current?.id === p.pointerId && !k(p) && d();
1209
+ s.current?.id === p.pointerId && !w(p) && u();
1223
1210
  },
1224
1211
  onPointerUp: (p) => {
1225
1212
  if (s.current?.id !== p.pointerId) return;
1226
- const l = !n && k(p) && !s.current.repeated;
1227
- d(), l && a.current();
1213
+ const c = !n && w(p) && !s.current.repeated;
1214
+ u(), c && i.current();
1228
1215
  },
1229
1216
  onPointerCancel: (p) => {
1230
- s.current?.id === p.pointerId && d();
1217
+ s.current?.id === p.pointerId && u();
1231
1218
  },
1232
1219
  onLostPointerCapture: (p) => {
1233
- s.current?.id === p.pointerId && d();
1220
+ s.current?.id === p.pointerId && u();
1234
1221
  },
1235
1222
  onPointerLeave: (p) => {
1236
- s.current?.id === p.pointerId && !k(p) && d();
1223
+ s.current?.id === p.pointerId && !w(p) && u();
1237
1224
  },
1238
1225
  onClick: (p) => {
1239
- !n && p.detail === 0 && !s.current && a.current();
1226
+ !n && p.detail === 0 && !s.current && i.current();
1240
1227
  }
1241
1228
  };
1242
1229
  }
1243
- const Te = {
1230
+ const ze = {
1244
1231
  Shift: "Shift",
1245
1232
  HangulMode: "한영 전환",
1246
1233
  Backspace: "지우기",
@@ -1259,30 +1246,32 @@ const Te = {
1259
1246
  Redo: "다시 실행",
1260
1247
  SelectAll: "전체 선택"
1261
1248
  };
1262
- function We({
1249
+ function Ae({
1263
1250
  cell: e,
1264
1251
  label: n,
1265
1252
  value: r,
1266
- active: a,
1267
- disabled: i,
1268
- dispatch: s
1253
+ active: i,
1254
+ disabled: l,
1255
+ busy: s,
1256
+ dispatch: f
1269
1257
  }) {
1270
- const m = Me(s, {
1271
- disabled: i,
1258
+ const m = Ie(f, {
1259
+ disabled: l,
1272
1260
  repeat: ["Backspace", "Delete", "ArrowLeft", "ArrowRight"].includes(r)
1273
- }), v = e.type === "action" && r === "HangulMode", d = e.type === "action" && (r === "Backspace" && (!e.label || e.label === "⌫") || r === "Delete" && (!e.label || e.label === "⌦"));
1274
- return /* @__PURE__ */ L(
1261
+ }), u = e.type === "action" && r === "HangulMode", w = e.type === "action" && (r === "Backspace" && (!e.label || e.label === "⌫") || r === "Delete" && (!e.label || e.label === "⌦"));
1262
+ return /* @__PURE__ */ P(
1275
1263
  "button",
1276
1264
  {
1277
1265
  type: "button",
1278
- disabled: i,
1279
- "aria-label": Te[r] ?? n,
1280
- "aria-pressed": a,
1281
- className: v ? "key action language" : e.type === "action" ? "key action" : "key",
1282
- title: v ? i ? `${a ? "한국어" : "영어"} 전용` : `${a ? "영어" : "한국어"}로 전환` : void 0,
1266
+ disabled: l,
1267
+ "aria-label": ze[r] ?? n,
1268
+ "aria-pressed": i,
1269
+ "aria-busy": s || void 0,
1270
+ className: u ? "key action language" : e.type === "action" ? "key action" : "key",
1271
+ title: u ? l ? `${i ? "한국어" : "영어"} 전용` : `${i ? "영어" : "한국어"}로 전환` : void 0,
1283
1272
  style: { flex: e.width && e.width > 0 ? e.width : 1 },
1284
1273
  ...m,
1285
- children: d ? /* @__PURE__ */ Y(
1274
+ children: s ? "읽는 중…" : w ? /* @__PURE__ */ X(
1286
1275
  "svg",
1287
1276
  {
1288
1277
  "data-key-icon": r === "Backspace" ? "backspace" : "delete",
@@ -1298,12 +1287,12 @@ function We({
1298
1287
  focusable: "false",
1299
1288
  style: r === "Delete" ? { transform: "scaleX(-1)" } : void 0,
1300
1289
  children: [
1301
- /* @__PURE__ */ L("path", { d: "M9 5H20a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 20 19H9l-7-7 7-7Z" }),
1302
- /* @__PURE__ */ L("path", { d: "m12 9 6 6m0-6-6 6" })
1290
+ /* @__PURE__ */ P("path", { d: "M9 5H20a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 20 19H9l-7-7 7-7Z" }),
1291
+ /* @__PURE__ */ P("path", { d: "m12 9 6 6m0-6-6 6" })
1303
1292
  ]
1304
1293
  }
1305
- ) : v && !e.label ? /* @__PURE__ */ Y("span", { className: "language-label", "aria-hidden": "true", children: [
1306
- /* @__PURE__ */ Y(
1294
+ ) : u && !e.label ? /* @__PURE__ */ X("span", { className: "language-label", "aria-hidden": "true", children: [
1295
+ /* @__PURE__ */ X(
1307
1296
  "svg",
1308
1297
  {
1309
1298
  width: "19",
@@ -1316,120 +1305,122 @@ function We({
1316
1305
  strokeLinejoin: "round",
1317
1306
  focusable: "false",
1318
1307
  children: [
1319
- /* @__PURE__ */ L("circle", { cx: "12", cy: "12", r: "9" }),
1320
- /* @__PURE__ */ L("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
1321
- /* @__PURE__ */ L("path", { d: "M3 12h18" })
1308
+ /* @__PURE__ */ P("circle", { cx: "12", cy: "12", r: "9" }),
1309
+ /* @__PURE__ */ P("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
1310
+ /* @__PURE__ */ P("path", { d: "M3 12h18" })
1322
1311
  ]
1323
1312
  }
1324
1313
  ),
1325
- /* @__PURE__ */ L("span", { children: a ? "한" : "EN" })
1314
+ /* @__PURE__ */ P("span", { children: i ? "한" : "EN" })
1326
1315
  ] }) : n
1327
1316
  }
1328
1317
  );
1329
1318
  }
1330
- function xt({
1319
+ function St({
1331
1320
  layout: e,
1332
1321
  viewport: n,
1333
1322
  onHeightChange: r
1334
1323
  }) {
1335
- const a = _e(), {
1336
- inputRef: i,
1324
+ const i = Oe(), {
1325
+ inputRef: l,
1337
1326
  hangulMode: s,
1338
- shift: m,
1339
- shiftLocked: v,
1340
- theme: d,
1341
- selectionMode: k,
1327
+ shift: f,
1328
+ shiftLocked: m,
1329
+ theme: u,
1330
+ selectionMode: w,
1342
1331
  selectionAdjusting: p,
1343
- activeInputPolicy: l,
1344
- editingStatus: u,
1345
- onBlur: P
1346
- } = a, w = T(null), [_, B] = $(!1), ae = Me(() => B((h) => !h)), Z = Me(() => P(!0)), F = ["text", "hangul", "custom"].includes(
1347
- l.mode
1348
- ), O = _ && F && !k ? yt : e;
1349
- K(() => {
1350
- if (!w.current) return;
1351
- const h = () => {
1352
- const g = w.current?.getBoundingClientRect().height ?? 0;
1353
- r(g);
1332
+ activeInputPolicy: c,
1333
+ editingStatus: a,
1334
+ onBlur: x
1335
+ } = i, y = M(null), [ee, H] = z(!1), se = Ie(() => H((g) => !g)), re = Ie(() => x(!0)), F = ["text", "hangul", "custom"].includes(
1336
+ c.mode
1337
+ ), ce = ee && F && !w ? kt : e;
1338
+ D(() => {
1339
+ if (!y.current) return;
1340
+ const g = () => {
1341
+ const v = y.current?.getBoundingClientRect().height ?? 0;
1342
+ r(v);
1354
1343
  };
1355
- h();
1356
- const b = new ResizeObserver(h);
1357
- return b.observe(w.current), () => b.disconnect();
1358
- }, [r]), K(() => {
1359
- let h = null;
1360
- const b = /* @__PURE__ */ new Set(), g = (c) => c.composedPath().some(
1361
- (W) => W === w.current || W instanceof Element && W.hasAttribute("data-virtual-input")
1362
- ), A = (c) => {
1363
- b.add(c.pointerId), h = b.size !== 1 || c.button !== 0 || g(c) ? null : { x: c.clientX, y: c.clientY, id: c.pointerId };
1364
- }, I = (c) => {
1365
- h && h.id === c.pointerId && Math.hypot(c.clientX - h.x, c.clientY - h.y) < 10 && !g(c) && P(!0), h = null, b.delete(c.pointerId);
1366
- }, U = (c) => {
1367
- h?.id === c.pointerId && Math.hypot(c.clientX - h.x, c.clientY - h.y) >= 10 && (h = null);
1368
- }, C = () => {
1369
- h = null;
1370
- }, J = (c) => {
1371
- C(), b.delete(c.pointerId);
1372
- }, M = () => {
1373
- C(), b.clear();
1344
+ g();
1345
+ const k = new ResizeObserver(g);
1346
+ return k.observe(y.current), () => k.disconnect();
1347
+ }, [r]), D(() => {
1348
+ let g = null;
1349
+ const k = /* @__PURE__ */ new Set(), v = (A) => A.composedPath().some(
1350
+ (R) => R === y.current || R instanceof Element && R.hasAttribute("data-virtual-input")
1351
+ ), B = (A) => {
1352
+ k.add(A.pointerId), g = k.size !== 1 || A.button !== 0 || v(A) ? null : { x: A.clientX, y: A.clientY, id: A.pointerId };
1353
+ }, E = (A) => {
1354
+ g && g.id === A.pointerId && Math.hypot(A.clientX - g.x, A.clientY - g.y) < 10 && !v(A) && x(!0), g = null, k.delete(A.pointerId);
1355
+ }, $ = (A) => {
1356
+ g?.id === A.pointerId && Math.hypot(A.clientX - g.x, A.clientY - g.y) >= 10 && (g = null);
1357
+ }, j = () => {
1358
+ g = null;
1359
+ }, Y = (A) => {
1360
+ j(), k.delete(A.pointerId);
1361
+ }, q = () => {
1362
+ j(), k.clear();
1374
1363
  };
1375
- return window.addEventListener("pointerdown", A, !0), window.addEventListener("pointermove", U, !0), window.addEventListener("pointerup", I, !0), window.addEventListener("pointercancel", J, !0), window.addEventListener("scroll", C, !0), window.addEventListener("blur", M), document.addEventListener("visibilitychange", M), () => {
1376
- window.removeEventListener("pointerdown", A, !0), window.removeEventListener("pointermove", U, !0), window.removeEventListener("pointerup", I, !0), window.removeEventListener("pointercancel", J, !0), window.removeEventListener("scroll", C, !0), window.removeEventListener("blur", M), document.removeEventListener("visibilitychange", M);
1364
+ return window.addEventListener("pointerdown", B, !0), window.addEventListener("pointermove", $, !0), window.addEventListener("pointerup", E, !0), window.addEventListener("pointercancel", Y, !0), window.addEventListener("scroll", j, !0), window.addEventListener("blur", q), document.addEventListener("visibilitychange", q), () => {
1365
+ window.removeEventListener("pointerdown", B, !0), window.removeEventListener("pointermove", $, !0), window.removeEventListener("pointerup", E, !0), window.removeEventListener("pointercancel", Y, !0), window.removeEventListener("scroll", j, !0), window.removeEventListener("blur", q), document.removeEventListener("visibilitychange", q);
1377
1366
  };
1378
- }, [P]);
1379
- const X = (h) => {
1380
- const b = Ue(h, s, m);
1381
- if (h.type !== "action") {
1382
- i.current?.insertText(b, we(b)), a.consumeShift();
1367
+ }, [x]);
1368
+ const W = (g) => {
1369
+ const k = _e(g, s, f);
1370
+ if (g.type !== "action") {
1371
+ l.current?.insertText(k, xe(k)), i.consumeShift();
1383
1372
  return;
1384
1373
  }
1385
- switch (b) {
1374
+ switch (k) {
1386
1375
  case "Undo":
1387
- i.current?.undo();
1376
+ l.current?.undo();
1388
1377
  break;
1389
1378
  case "Redo":
1390
- i.current?.redo();
1379
+ l.current?.redo();
1391
1380
  break;
1392
1381
  case "SelectAll":
1393
- i.current?.selectAll();
1382
+ l.current?.selectAll();
1394
1383
  break;
1395
1384
  case "Shift":
1396
- a.toggleShift();
1385
+ i.toggleShift();
1397
1386
  break;
1398
1387
  case "HangulMode":
1399
- i.current?.handleKeyDown(
1400
- new KeyboardEvent("keydown", { key: b })
1388
+ l.current?.handleKeyDown(
1389
+ new KeyboardEvent("keydown", { key: k })
1401
1390
  );
1402
1391
  break;
1403
1392
  case "EnterSelectionMode":
1404
- B(!1), a.enterSelectionMode();
1393
+ H(!1), i.enterSelectionMode();
1405
1394
  break;
1406
1395
  case "ExitSelectionMode":
1407
- a.exitSelectionMode();
1396
+ i.exitSelectionMode();
1408
1397
  break;
1409
1398
  case "ToggleSelectionAdjust":
1410
- a.toggleSelectionAdjust();
1399
+ i.toggleSelectionAdjust();
1411
1400
  break;
1412
1401
  case "Copy":
1413
- i.current?.copySelection();
1402
+ l.current?.copySelection();
1414
1403
  break;
1415
1404
  case "Paste":
1416
- i.current?.pasteClipboard();
1405
+ l.current?.pasteClipboard();
1417
1406
  break;
1418
1407
  case "Cut":
1419
- i.current?.cutSelection();
1408
+ l.current?.cutSelection();
1420
1409
  break;
1421
1410
  case "ArrowLeft":
1422
- i.current?.moveCaret("left", p);
1411
+ l.current?.moveCaret("left", p);
1423
1412
  break;
1424
1413
  case "ArrowRight":
1425
- i.current?.moveCaret("right", p);
1414
+ l.current?.moveCaret("right", p);
1426
1415
  break;
1427
1416
  default:
1428
- b === " " ? i.current?.insertText(" ") : i.current?.handleKeyDown(
1429
- new KeyboardEvent("keydown", { key: b })
1417
+ k === " " ? l.current?.insertText(" ") : l.current?.handleKeyDown(
1418
+ new KeyboardEvent("keydown", { key: k })
1430
1419
  );
1431
1420
  }
1432
- }, ce = ge(l.mode) !== null, ie = {
1421
+ }, G = be(c.mode) !== null, ae = ["복사했어요", "붙여넣었어요"].includes(
1422
+ a.message
1423
+ ), de = {
1433
1424
  position: "fixed",
1434
1425
  zIndex: 9999,
1435
1426
  boxSizing: "border-box",
@@ -1440,33 +1431,33 @@ function xt({
1440
1431
  ...n.height ? { top: n.offsetTop + n.height } : { bottom: 0 },
1441
1432
  maxHeight: n.height ? n.height * 0.65 : "65dvh",
1442
1433
  overflowY: "auto",
1443
- colorScheme: d,
1444
- background: d === "dark" ? "#18201f" : "#e9eeeb",
1445
- color: d === "dark" ? "#eef4ef" : "#203b31",
1446
- border: "1px solid " + (d === "dark" ? "#35413c" : "#c8d3cb"),
1434
+ colorScheme: u,
1435
+ background: u === "dark" ? "#18201f" : "#e9eeeb",
1436
+ color: u === "dark" ? "#eef4ef" : "#203b31",
1437
+ border: "1px solid " + (u === "dark" ? "#35413c" : "#c8d3cb"),
1447
1438
  borderRadius: "20px 20px 0 0",
1448
1439
  boxShadow: "0 -8px 48px #10251a20",
1449
1440
  touchAction: "manipulation",
1450
1441
  userSelect: "none",
1451
1442
  WebkitUserSelect: "none"
1452
1443
  };
1453
- return Ie(
1454
- /* @__PURE__ */ L(
1455
- bt,
1444
+ return Be(
1445
+ /* @__PURE__ */ P(
1446
+ Et,
1456
1447
  {
1457
1448
  tagName: "virtual-keypad",
1458
- hostRef: w,
1449
+ hostRef: y,
1459
1450
  "data-virtual-keypad": "true",
1460
- style: ie,
1461
- onPointerDown: (h) => {
1462
- h.button === 0 && h.preventDefault();
1451
+ style: de,
1452
+ onPointerDown: (g) => {
1453
+ g.button === 0 && g.preventDefault();
1463
1454
  },
1464
- onMouseDown: (h) => {
1465
- h.button === 0 && h.preventDefault();
1455
+ onMouseDown: (g) => {
1456
+ g.button === 0 && g.preventDefault();
1466
1457
  },
1467
- onBlur: a.onBlur,
1468
- onKeyDown: (h) => {
1469
- h.key === "Escape" && (h.preventDefault(), P(!0));
1458
+ onBlur: i.onBlur,
1459
+ onKeyDown: (g) => {
1460
+ g.key === "Escape" && (g.preventDefault(), x(!0));
1470
1461
  },
1471
1462
  css: `
1472
1463
  * {
@@ -1490,6 +1481,23 @@ function xt({
1490
1481
  .toolbar span {
1491
1482
  opacity: 0.75;
1492
1483
  }
1484
+ .toolbar-caption {
1485
+ flex: 1;
1486
+ min-width: 0;
1487
+ overflow: hidden;
1488
+ white-space: nowrap;
1489
+ text-overflow: ellipsis;
1490
+ }
1491
+ .toolbar > .close,
1492
+ .paste-action {
1493
+ flex-shrink: 0;
1494
+ }
1495
+ .paste-action .key {
1496
+ padding: 8px 10px;
1497
+ font-size: 12px;
1498
+ box-shadow: none;
1499
+ white-space: nowrap;
1500
+ }
1493
1501
  .close {
1494
1502
  background: transparent;
1495
1503
  color: inherit;
@@ -1514,9 +1522,9 @@ function xt({
1514
1522
  min-height: 44px;
1515
1523
  border: 0;
1516
1524
  border-radius: 8px;
1517
- background: ${d === "dark" ? "#303c37" : "#fff"};
1525
+ background: ${u === "dark" ? "#303c37" : "#fff"};
1518
1526
  color: inherit;
1519
- box-shadow: 0 2px 0 ${d === "dark" ? "#0d1611" : "#bdc9c1"};
1527
+ box-shadow: 0 2px 0 ${u === "dark" ? "#0d1611" : "#bdc9c1"};
1520
1528
  font: inherit;
1521
1529
  padding: 8px 0;
1522
1530
  touch-action: none;
@@ -1524,7 +1532,7 @@ function xt({
1524
1532
  user-select: none;
1525
1533
  }
1526
1534
  .action {
1527
- background: ${d === "dark" ? "#414e46" : "#d7e1db"};
1535
+ background: ${u === "dark" ? "#414e46" : "#d7e1db"};
1528
1536
  font-size: 14px;
1529
1537
  }
1530
1538
  .selection-count {
@@ -1596,124 +1604,138 @@ function xt({
1596
1604
  }
1597
1605
  }
1598
1606
  `,
1599
- children: /* @__PURE__ */ Y("section", { className: "keyboard", role: "group", "aria-label": "가상 키보드", children: [
1600
- /* @__PURE__ */ Y("div", { className: "toolbar", children: [
1601
- u.selectionLength > 0 && !k ? /* @__PURE__ */ Y(Pe, { children: [
1602
- /* @__PURE__ */ L(
1607
+ children: /* @__PURE__ */ X("section", { className: "keyboard", role: "group", "aria-label": "가상 키보드", children: [
1608
+ /* @__PURE__ */ X("div", { className: "toolbar", children: [
1609
+ a.selectionLength > 0 && !w ? /* @__PURE__ */ X(De, { children: [
1610
+ /* @__PURE__ */ P(
1603
1611
  "span",
1604
1612
  {
1605
1613
  className: "selection-count",
1606
- title: u.message || void 0,
1607
- children: u.message === "복사했어요" ? "복사했어요" : `${u.selectionLength}자 선택`
1614
+ title: a.message || void 0,
1615
+ children: ae ? a.message : `${a.selectionLength}자 선택`
1608
1616
  }
1609
1617
  ),
1610
- /* @__PURE__ */ L(
1618
+ /* @__PURE__ */ P(
1611
1619
  "div",
1612
1620
  {
1613
1621
  className: "selection-actions",
1614
1622
  role: "group",
1615
1623
  "aria-label": "선택한 텍스트 편집",
1616
- children: ["Copy", "Cut", "SelectAll"].map((h) => /* @__PURE__ */ L(
1617
- We,
1624
+ children: ["Copy", "Cut", "Paste"].map((g) => /* @__PURE__ */ P(
1625
+ Ae,
1618
1626
  {
1619
- cell: { value: h, type: "action" },
1620
- value: h,
1621
- label: Te[h],
1622
- dispatch: () => X({ value: h, type: "action" })
1627
+ cell: { value: g, type: "action" },
1628
+ value: g,
1629
+ label: ze[g],
1630
+ disabled: g === "Paste" && a.pasting,
1631
+ busy: g === "Paste" && a.pasting,
1632
+ dispatch: () => W({ value: g, type: "action" })
1623
1633
  },
1624
- h
1634
+ g
1625
1635
  ))
1626
1636
  }
1627
1637
  )
1628
- ] }) : /* @__PURE__ */ Y("span", { children: [
1629
- k ? u.message === "복사했어요" ? "복사했어요" : "텍스트 편집" : _ && F ? "숫자 · 기호" : l.mode === "number" ? "숫자" : l.mode === "tel" ? "전화번호" : s ? "한국어 · 두벌식" : "English",
1630
- v ? " · Shift 고정" : ""
1638
+ ] }) : /* @__PURE__ */ X("span", { className: "toolbar-caption", children: [
1639
+ ae ? a.message : w ? "텍스트 편집" : ee && F ? "숫자 · 기호" : c.mode === "number" ? "숫자" : c.mode === "tel" ? "전화번호" : s ? "한국어 · 두벌식" : "English",
1640
+ m ? " · Shift 고정" : ""
1631
1641
  ] }),
1632
- F && !k && !u.selectionLength && /* @__PURE__ */ L(
1642
+ !w && !a.selectionLength && /* @__PURE__ */ P("div", { className: "paste-action", children: /* @__PURE__ */ P(
1643
+ Ae,
1644
+ {
1645
+ cell: { value: "Paste", type: "action" },
1646
+ value: "Paste",
1647
+ label: "붙여넣기",
1648
+ disabled: a.pasting,
1649
+ busy: a.pasting,
1650
+ dispatch: () => W({ value: "Paste", type: "action" })
1651
+ }
1652
+ ) }),
1653
+ F && !w && !a.selectionLength && /* @__PURE__ */ P(
1633
1654
  "button",
1634
1655
  {
1635
1656
  type: "button",
1636
1657
  className: "close",
1637
1658
  "aria-label": "숫자·기호 전환",
1638
- "aria-pressed": _,
1639
- ...ae,
1640
- children: _ ? "가 / ABC" : "123 / #+="
1659
+ "aria-pressed": ee,
1660
+ ...se,
1661
+ children: ee ? "가 / ABC" : "123 / #+="
1641
1662
  }
1642
1663
  ),
1643
- /* @__PURE__ */ L(
1664
+ /* @__PURE__ */ P(
1644
1665
  "button",
1645
1666
  {
1646
1667
  type: "button",
1647
1668
  className: "close",
1648
- ...Z,
1669
+ ...re,
1649
1670
  "aria-label": "키보드 닫기",
1650
1671
  children: "닫기 ↓"
1651
1672
  }
1652
1673
  )
1653
1674
  ] }),
1654
- u.message && u.message !== "복사했어요" && /* @__PURE__ */ L("p", { className: "feedback", children: u.message }),
1655
- O.map((h, b) => /* @__PURE__ */ L("div", { className: "row", children: h.map((g, A) => {
1656
- const I = Ue(g, s, m), U = g.type === "action" ? g.label ?? Te[I] ?? I : /^[A-Za-z]$/.test(g.value) ? I : g.label ?? I, C = g.value === "Shift" ? m : g.value === "HangulMode" ? s : g.value === "ToggleSelectionAdjust" ? p : void 0;
1657
- return /* @__PURE__ */ L(
1658
- We,
1675
+ a.message && !ae && /* @__PURE__ */ P("p", { className: "feedback", children: a.message }),
1676
+ ce.map((g, k) => /* @__PURE__ */ P("div", { className: "row", children: g.map((v, B) => {
1677
+ const E = _e(v, s, f), $ = v.type === "action" ? v.label ?? ze[E] ?? E : /^[A-Za-z]$/.test(v.value) ? E : v.label ?? E, j = v.value === "Shift" ? f : v.value === "HangulMode" ? s : v.value === "ToggleSelectionAdjust" ? p : void 0;
1678
+ return /* @__PURE__ */ P(
1679
+ Ae,
1659
1680
  {
1660
- cell: g,
1661
- label: U,
1662
- value: I,
1663
- active: C,
1664
- disabled: g.value === "HangulMode" && ce || ["Copy", "Cut"].includes(I) && !u.selectionLength || I === "SelectAll" && !u.hasValue || (g.type !== "action" || I === " ") && !l.filterKey(I),
1665
- dispatch: () => X(g)
1681
+ cell: v,
1682
+ label: $,
1683
+ value: E,
1684
+ active: j,
1685
+ busy: E === "Paste" && a.pasting,
1686
+ disabled: E === "Paste" && a.pasting || v.value === "HangulMode" && G || ["Copy", "Cut"].includes(E) && !a.selectionLength || E === "SelectAll" && !a.hasValue || (v.type !== "action" || E === " ") && !c.filterKey(E),
1687
+ dispatch: () => W(v)
1666
1688
  },
1667
- `${b}-${A}-${g.value}`
1689
+ `${k}-${B}-${v.value}`
1668
1690
  );
1669
- }) }, b))
1691
+ }) }, k))
1670
1692
  ] })
1671
1693
  }
1672
1694
  ),
1673
1695
  document.body
1674
1696
  );
1675
1697
  }
1676
- const Se = "virtual-keyboard:storage";
1677
- function kt(e, n) {
1678
- const r = T(n), [a, i] = $(n), s = T(a), m = E(
1698
+ const Me = "virtual-keyboard:storage";
1699
+ function Lt(e, n) {
1700
+ const r = M(n), [i, l] = z(n), s = M(i), f = L(
1679
1701
  () => r.current instanceof Function ? r.current() : r.current,
1680
1702
  []
1681
1703
  );
1682
- K(() => {
1683
- const d = (u) => {
1704
+ D(() => {
1705
+ const u = (a) => {
1684
1706
  try {
1685
- const P = u === null ? m() : JSON.parse(u);
1686
- return typeof P == typeof m() ? P : m();
1707
+ const x = a === null ? f() : JSON.parse(a);
1708
+ return typeof x == typeof f() ? x : f();
1687
1709
  } catch {
1688
- return m();
1710
+ return f();
1689
1711
  }
1690
- }, k = (u) => {
1691
- s.current = d(u), i(s.current);
1712
+ }, w = (a) => {
1713
+ s.current = u(a), l(s.current);
1692
1714
  };
1693
1715
  try {
1694
- k(window.localStorage.getItem(e));
1716
+ w(window.localStorage.getItem(e));
1695
1717
  } catch {
1696
1718
  }
1697
- const p = (u) => {
1719
+ const p = (a) => {
1698
1720
  try {
1699
- if (u.storageArea && u.storageArea !== window.localStorage)
1721
+ if (a.storageArea && a.storageArea !== window.localStorage)
1700
1722
  return;
1701
1723
  } catch {
1702
1724
  return;
1703
1725
  }
1704
- (u.key === e || u.key === null) && k(u.newValue);
1705
- }, l = (u) => {
1706
- const P = u.detail;
1707
- P.key === e && k(P.raw);
1726
+ (a.key === e || a.key === null) && w(a.newValue);
1727
+ }, c = (a) => {
1728
+ const x = a.detail;
1729
+ x.key === e && w(x.raw);
1708
1730
  };
1709
- return window.addEventListener("storage", p), window.addEventListener(Se, l), () => {
1710
- window.removeEventListener("storage", p), window.removeEventListener(Se, l);
1731
+ return window.addEventListener("storage", p), window.addEventListener(Me, c), () => {
1732
+ window.removeEventListener("storage", p), window.removeEventListener(Me, c);
1711
1733
  };
1712
- }, [e, m]);
1713
- const v = E(
1714
- (d) => {
1715
- s.current = d instanceof Function ? d(s.current) : d, i(s.current), window.dispatchEvent(
1716
- new CustomEvent(Se, {
1734
+ }, [e, f]);
1735
+ const m = L(
1736
+ (u) => {
1737
+ s.current = u instanceof Function ? u(s.current) : u, l(s.current), window.dispatchEvent(
1738
+ new CustomEvent(Me, {
1717
1739
  detail: { key: e, raw: JSON.stringify(s.current) }
1718
1740
  })
1719
1741
  );
@@ -1724,9 +1746,9 @@ function kt(e, n) {
1724
1746
  },
1725
1747
  [e]
1726
1748
  );
1727
- return [a, v];
1749
+ return [i, m];
1728
1750
  }
1729
- const St = [
1751
+ const Ct = [
1730
1752
  [
1731
1753
  {
1732
1754
  label: "전체 선택",
@@ -1806,7 +1828,7 @@ const St = [
1806
1828
  type: "action"
1807
1829
  }
1808
1830
  ]
1809
- ], Et = () => typeof window > "u" ? { width: 0, height: 0, scale: 1, offsetLeft: 0, offsetTop: 0 } : typeof window < "u" && window.visualViewport ? {
1831
+ ], At = () => typeof window > "u" ? { width: 0, height: 0, scale: 1, offsetLeft: 0, offsetTop: 0 } : typeof window < "u" && window.visualViewport ? {
1810
1832
  width: window.visualViewport.width,
1811
1833
  height: window.visualViewport.height,
1812
1834
  scale: window.visualViewport.scale,
@@ -1818,191 +1840,197 @@ const St = [
1818
1840
  scale: 1,
1819
1841
  offsetLeft: 0,
1820
1842
  offsetTop: 0
1821
- }, Lt = (e, n) => e.width === n.width && e.height === n.height && e.scale === n.scale && e.offsetLeft === n.offsetLeft && e.offsetTop === n.offsetTop, Ct = () => {
1822
- const [e, n] = $(() => ({
1843
+ }, Mt = (e, n) => e.width === n.width && e.height === n.height && e.scale === n.scale && e.offsetLeft === n.offsetLeft && e.offsetTop === n.offsetTop, Pt = () => {
1844
+ const [e, n] = z(() => ({
1823
1845
  width: 0,
1824
1846
  height: 0,
1825
1847
  scale: 1,
1826
1848
  offsetLeft: 0,
1827
1849
  offsetTop: 0
1828
1850
  }));
1829
- return K(() => {
1851
+ return D(() => {
1830
1852
  if (typeof window > "u") return;
1831
1853
  let r = null;
1832
- const a = () => {
1833
- const s = Et();
1854
+ const i = () => {
1855
+ const s = At();
1834
1856
  n(
1835
- (m) => Lt(m, s) ? m : s
1857
+ (f) => Mt(f, s) ? f : s
1836
1858
  );
1837
1859
  };
1838
- a();
1839
- const i = () => {
1840
- r !== null && cancelAnimationFrame(r), r = requestAnimationFrame(a);
1860
+ i();
1861
+ const l = () => {
1862
+ r !== null && cancelAnimationFrame(r), r = requestAnimationFrame(i);
1841
1863
  };
1842
- return window.visualViewport ? (window.visualViewport.addEventListener("resize", i, {
1864
+ return window.visualViewport ? (window.visualViewport.addEventListener("resize", l, {
1843
1865
  passive: !0
1844
- }), window.visualViewport.addEventListener("scroll", i, {
1866
+ }), window.visualViewport.addEventListener("scroll", l, {
1845
1867
  passive: !0
1846
- })) : window.addEventListener("resize", i, { passive: !0 }), () => {
1847
- r !== null && cancelAnimationFrame(r), window.visualViewport ? (window.visualViewport.removeEventListener("resize", i), window.visualViewport.removeEventListener("scroll", i)) : window.removeEventListener("resize", i);
1868
+ })) : window.addEventListener("resize", l, { passive: !0 }), () => {
1869
+ r !== null && cancelAnimationFrame(r), window.visualViewport ? (window.visualViewport.removeEventListener("resize", l), window.visualViewport.removeEventListener("scroll", l)) : window.removeEventListener("resize", l);
1848
1870
  };
1849
1871
  }, []), e;
1850
1872
  };
1851
- function At() {
1852
- const [e, n] = $("light");
1853
- return K(() => {
1873
+ function Tt() {
1874
+ const [e, n] = z("light");
1875
+ return D(() => {
1854
1876
  if (typeof window > "u" || !window.matchMedia) return;
1855
1877
  const r = window.matchMedia("(prefers-color-scheme: dark)");
1856
1878
  n(r.matches ? "dark" : "light");
1857
- const a = (i) => {
1858
- n(i.matches ? "dark" : "light");
1879
+ const i = (l) => {
1880
+ n(l.matches ? "dark" : "light");
1859
1881
  };
1860
- return r.addEventListener("change", a), () => r.removeEventListener("change", a);
1882
+ return r.addEventListener("change", i), () => r.removeEventListener("change", i);
1861
1883
  }, []), e;
1862
1884
  }
1863
- function Je(e) {
1885
+ function et(e) {
1864
1886
  return e !== void 0 ? /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
1865
1887
  e
1866
- ) : typeof navigator > "u" ? !1 : Je(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 || typeof window < "u" && !!window.matchMedia?.("(pointer: coarse)").matches;
1888
+ ) : typeof navigator > "u" ? !1 : et(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 || typeof window < "u" && !!window.matchMedia?.("(pointer: coarse)").matches;
1867
1889
  }
1868
- const Ee = "virtual-keyboard:focus-change";
1869
- function Kt({
1890
+ const Pe = "virtual-keyboard:focus-change";
1891
+ function Bt({
1870
1892
  children: e,
1871
- layout: n = ee,
1893
+ layout: n = oe,
1872
1894
  defaultHangulMode: r = !0,
1873
- theme: a,
1874
- keyboardVisibility: i = "auto"
1895
+ theme: i,
1896
+ keyboardVisibility: l = "auto"
1875
1897
  }) {
1876
- const s = qe(), m = T(null), v = T(null), d = T(
1898
+ const s = Je(), f = M(null), m = M(null), u = M(
1877
1899
  void 0
1878
- ), [k, p] = $(), [l, u] = $(0), [P, w] = $(!1), [_, B] = $(!1), [ae, Z] = $({
1900
+ ), [w, p] = z(), [c, a] = z(0), [x, y] = z(!1), [ee, H] = z(!1), [se, re] = z({
1879
1901
  selectionLength: 0,
1880
1902
  hasValue: !1,
1881
- message: ""
1882
- }), [F, O] = kt(
1903
+ message: "",
1904
+ pasting: !1
1905
+ }), F = L((h) => {
1906
+ re(
1907
+ (C) => C.selectionLength === h.selectionLength && C.hasValue === h.hasValue && C.message === h.message && C.pasting === h.pasting ? C : h
1908
+ );
1909
+ }, []), [ce, W] = Lt(
1883
1910
  "virtual-keyboard-hangul-mode",
1884
1911
  r
1885
- ), [X, ce] = $(
1886
- () => Le({ layout: n })
1887
- ), [ie, h] = $(!1), [b, g] = $(0), A = Ct(), I = At(), U = ge(X.mode) ?? F, C = !!k && (i === "always" || i === "auto" && ie), J = T(C);
1888
- J.current = C, K(() => {
1889
- const y = () => h(Je());
1890
- y();
1891
- const D = window.matchMedia?.("(pointer: coarse)");
1892
- return D?.addEventListener("change", y), () => D?.removeEventListener("change", y);
1912
+ ), [G, ae] = z(
1913
+ () => Te({ layout: n })
1914
+ ), [de, g] = z(!1), [k, v] = z(0), B = Pt(), E = Tt(), $ = be(G.mode) ?? ce, j = !!w && (l === "always" || l === "auto" && de), Y = M(j);
1915
+ Y.current = j, D(() => {
1916
+ const h = () => g(et());
1917
+ h();
1918
+ const C = window.matchMedia?.("(pointer: coarse)");
1919
+ return C?.addEventListener("change", h), () => C?.removeEventListener("change", h);
1893
1920
  }, []);
1894
- const M = E(() => {
1895
- clearTimeout(d.current), v.current = null, m.current = null, p(void 0), u(0), w(!1), B(!1);
1921
+ const q = L(() => {
1922
+ clearTimeout(u.current), m.current = null, f.current = null, p(void 0), a(0), y(!1), H(!1);
1896
1923
  }, []);
1897
- K(() => {
1898
- const y = (D) => {
1899
- D.detail !== s && M();
1924
+ D(() => {
1925
+ const h = (C) => {
1926
+ C.detail !== s && q();
1900
1927
  };
1901
- return window.addEventListener(Ee, y), () => {
1902
- window.removeEventListener(Ee, y), clearTimeout(d.current);
1928
+ return window.addEventListener(Pe, h), () => {
1929
+ window.removeEventListener(Pe, h), clearTimeout(u.current);
1903
1930
  };
1904
- }, [s, M]);
1905
- const c = E(
1906
- (y, D, q) => {
1907
- clearTimeout(d.current), v.current !== D && (u(0), w(!1), B(!1)), v.current = D, ce(Le(q)), p(y), window.dispatchEvent(
1908
- new CustomEvent(Ee, { detail: s })
1931
+ }, [s, q]);
1932
+ const A = L(
1933
+ (h, C, U) => {
1934
+ clearTimeout(u.current), m.current !== C && (a(0), y(!1), H(!1)), m.current = C, ae(Te(U)), p(h), window.dispatchEvent(
1935
+ new CustomEvent(Pe, { detail: s })
1909
1936
  );
1910
1937
  },
1911
1938
  [s]
1912
- ), W = E(
1913
- (y) => {
1914
- if (y === !0) {
1915
- M();
1939
+ ), R = L(
1940
+ (h) => {
1941
+ if (h === !0) {
1942
+ const U = document.activeElement, T = U instanceof HTMLElement && m.current?.contains(U);
1943
+ q(), T && U.blur();
1916
1944
  return;
1917
1945
  }
1918
- const D = typeof y == "object" ? y.relatedTarget : null;
1919
- D?.closest?.("[data-virtual-input], [data-virtual-keypad]") || !D && J.current || (clearTimeout(d.current), d.current = setTimeout(M, 0));
1946
+ const C = typeof h == "object" ? h.relatedTarget : null;
1947
+ C?.closest?.("[data-virtual-input], [data-virtual-keypad]") || !C && Y.current || (clearTimeout(u.current), u.current = setTimeout(q, 0));
1920
1948
  },
1921
- [M]
1949
+ [q]
1922
1950
  );
1923
- K(() => {
1924
- if (!C || !b || A.scale !== 1) return;
1925
- const y = requestAnimationFrame(() => {
1926
- const D = v.current?.getBoundingClientRect();
1927
- if (!D) return;
1928
- const q = A.offsetTop + A.height - b - 16;
1929
- D.bottom > q && window.scrollBy({ top: D.bottom - q, behavior: "instant" });
1951
+ D(() => {
1952
+ if (!j || !k || B.scale !== 1) return;
1953
+ const h = requestAnimationFrame(() => {
1954
+ const C = m.current?.getBoundingClientRect();
1955
+ if (!C) return;
1956
+ const U = B.offsetTop + B.height - k - 16;
1957
+ C.bottom > U && window.scrollBy({ top: C.bottom - U, behavior: "instant" });
1930
1958
  });
1931
- return () => cancelAnimationFrame(y);
1959
+ return () => cancelAnimationFrame(h);
1932
1960
  }, [
1961
+ w,
1962
+ j,
1933
1963
  k,
1934
- C,
1935
- b,
1936
- A.height,
1937
- A.offsetTop,
1938
- A.scale
1964
+ B.height,
1965
+ B.offsetTop,
1966
+ B.scale
1939
1967
  ]);
1940
- const ne = E(() => {
1941
- ge(X.mode) === null && O((y) => !y);
1942
- }, [X.mode, O]), G = E(
1943
- () => u((y) => (y + 1) % 3),
1968
+ const ge = L(() => {
1969
+ be(G.mode) === null && W((h) => !h);
1970
+ }, [G.mode, W]), N = L(
1971
+ () => a((h) => (h + 1) % 3),
1944
1972
  []
1945
- ), V = E(
1946
- () => u((y) => y === 1 ? 0 : y),
1973
+ ), d = L(
1974
+ () => a((h) => h === 1 ? 0 : h),
1947
1975
  []
1948
- ), Q = E(() => {
1949
- w(!0), B(!1);
1950
- }, []), le = E(() => {
1951
- w(!1), B(!1);
1952
- }, []), j = E(
1953
- () => B((y) => !y),
1976
+ ), fe = L(() => {
1977
+ y(!0), H(!1);
1978
+ }, []), le = L(() => {
1979
+ y(!1), H(!1);
1980
+ }, []), Q = L(
1981
+ () => H((h) => !h),
1954
1982
  []
1955
1983
  );
1956
- return /* @__PURE__ */ Y(
1957
- Ze.Provider,
1984
+ return /* @__PURE__ */ X(
1985
+ Qe.Provider,
1958
1986
  {
1959
1987
  value: {
1960
- inputRef: m,
1961
- focusId: k,
1962
- onFocus: c,
1963
- onBlur: W,
1988
+ inputRef: f,
1989
+ focusId: w,
1990
+ onFocus: A,
1991
+ onBlur: R,
1964
1992
  defaultLayout: n,
1965
- hangulMode: U,
1966
- shift: l > 0,
1967
- shiftLocked: l === 2,
1968
- theme: a ?? I,
1969
- toggleKorean: ne,
1970
- toggleShift: G,
1971
- consumeShift: V,
1972
- selectionMode: P,
1973
- selectionAdjusting: _,
1974
- enterSelectionMode: Q,
1993
+ hangulMode: $,
1994
+ shift: c > 0,
1995
+ shiftLocked: c === 2,
1996
+ theme: i ?? E,
1997
+ toggleKorean: ge,
1998
+ toggleShift: N,
1999
+ consumeShift: d,
2000
+ selectionMode: x,
2001
+ selectionAdjusting: ee,
2002
+ enterSelectionMode: fe,
1975
2003
  exitSelectionMode: le,
1976
- toggleSelectionAdjust: j,
1977
- activeInputPolicy: X,
1978
- editingStatus: ae,
1979
- setEditingStatus: Z
2004
+ toggleSelectionAdjust: Q,
2005
+ activeInputPolicy: G,
2006
+ editingStatus: se,
2007
+ setEditingStatus: F
1980
2008
  },
1981
2009
  children: [
1982
2010
  e,
1983
- C && /* @__PURE__ */ Y(Pe, { children: [
1984
- Ie(
1985
- /* @__PURE__ */ L(
2011
+ j && /* @__PURE__ */ X(De, { children: [
2012
+ Be(
2013
+ /* @__PURE__ */ P(
1986
2014
  "div",
1987
2015
  {
1988
2016
  "aria-hidden": "true",
1989
2017
  style: {
1990
- height: b,
2018
+ height: k,
1991
2019
  pointerEvents: "none",
1992
- background: (a ?? I) === "dark" ? "#121c17" : "#f7f8f4"
2020
+ background: (i ?? E) === "dark" ? "#121c17" : "#f7f8f4"
1993
2021
  }
1994
2022
  }
1995
2023
  ),
1996
2024
  document.body
1997
2025
  ),
1998
- /* @__PURE__ */ L(
1999
- xt,
2026
+ /* @__PURE__ */ P(
2027
+ St,
2000
2028
  {
2001
- layout: P ? St : X.layout,
2002
- viewport: A,
2003
- onHeightChange: g
2029
+ layout: x ? Ct : G.layout,
2030
+ viewport: B,
2031
+ onHeightChange: v
2004
2032
  },
2005
- k
2033
+ w
2006
2034
  )
2007
2035
  ] })
2008
2036
  ]
@@ -2011,5 +2039,5 @@ function Kt({
2011
2039
  }
2012
2040
  export {
2013
2041
  Dt as VirtualInput,
2014
- Kt as VirtualInputProvider
2042
+ Bt as VirtualInputProvider
2015
2043
  };