@uiwwsw/virtual-keyboard 2.1.0 → 2.2.1

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,118 @@
1
1
  "use client";
2
- import { jsxs as q, jsx as T, Fragment as Me } from "react/jsx-runtime";
3
- import { useContext as Oe, createContext as et, forwardRef as tt, useId as $e, useRef as I, useState as P, useMemo as He, useCallback as S, useEffect as z, useImperativeHandle as nt, useLayoutEffect as rt, createElement as at } from "react";
4
- import { convertQwertyToHangul as Ue, assemble as ot, removeLastCharacter as it } from "es-hangul";
5
- import { createPortal as Te } from "react-dom";
6
- class ct {
2
+ import { jsxs as X, jsx as T, Fragment as He } from "react/jsx-runtime";
3
+ import { useContext as st, createContext as ut, forwardRef as dt, useId as et, useCallback as E, useRef as P, useState as B, useMemo as Ge, useEffect as R, useImperativeHandle as pt, useLayoutEffect as ft, createElement as ht } from "react";
4
+ import { convertQwertyToHangul as tt, assemble as gt, removeLastCharacter as mt } from "es-hangul";
5
+ import { createPortal as Fe } from "react-dom";
6
+ const yt = {
7
+ "자유 입력": "Free text",
8
+ "한글과 영문을 오가며 자유롭게 입력해 보세요. 한 / EN 키로 언어를 바꿀 수 있습니다.": "Type in Korean or English. Use the 한 / EN key to switch input languages.",
9
+ "여기서 첫 문장을 시작해 보세요": "Start your first sentence here",
10
+ 한국어: "Korean",
11
+ "두벌식 자판으로 초성부터 받침까지. 조합 중에는 자모 단위로 지워집니다.": "Compose Korean syllables with the two-set layout. Backspace removes one component while composing.",
12
+ "한글을 한 글자씩 눌러보세요": "Try composing a Korean syllable",
13
+ 숫자: "Numbers",
14
+ "숫자와 소수점만 허용합니다. 붙여넣은 내용에도 같은 문자 규칙이 적용됩니다.": "Only numbers and a decimal point are accepted, including pasted text.",
15
+ "수량 또는 금액 입력": "Enter a quantity or amount",
16
+ 전화번호: "Phone number",
17
+ "숫자와 +, *, #을 지원하는 다이얼 패드입니다. 붙여넣을 때 구분 기호를 제거합니다.": "A dial pad for numbers, +, * and #. Separators are removed when pasting.",
18
+ 영문: "English letters",
19
+ "영문 알파벳만 입력합니다. Shift를 두 번 누르면 대문자 입력이 고정됩니다.": "Only English letters are accepted. Double-tap Shift to lock uppercase.",
20
+ "영문 이름 또는 태그": "English name or tag",
21
+ "영문 + 숫자": "Letters + numbers",
22
+ "영문과 숫자로 구성된 코드에 사용해 보세요. 물리 키보드 입력도 지원합니다.": "Use this for alphanumeric codes. Physical keyboard input works too.",
23
+ 커스텀: "Custom",
24
+ "한 번에 여러 글자를 입력하는 매크로 키입니다. 키에 표시할 이름과 실제 값을 따로 설정할 수 있습니다.": "Macro keys insert multiple characters. Configure the visible label separately from the inserted value.",
25
+ "빠른 문구를 선택해 보세요": "Choose a quick phrase",
26
+ 인사: "Hello",
27
+ 감사: "Thanks",
28
+ 확인: "Confirm",
29
+ 공백: "Space",
30
+ 완료: "Done",
31
+ "설치 명령어를 복사했습니다.": "Installation command copied.",
32
+ "복사할 수 없습니다. 아래 명령어를 직접 선택해 주세요.": "Copy unavailable. Select the command below manually.",
33
+ "실행 가능한 전체 예제를 복사했습니다.": "Complete runnable example copied.",
34
+ "복사할 수 없습니다. 코드를 직접 선택해 주세요.": "Copy unavailable. Select the code manually.",
35
+ "키보드 체험으로 건너뛰기": "Skip to keyboard playground",
36
+ "Virtual Keyboard 홈": "Virtual Keyboard home",
37
+ "주요 메뉴": "Main navigation",
38
+ "사용 방법": "Usage guide",
39
+ "입력의 감각까지,": "Design every detail",
40
+ "직접 설계하세요.": "of your input.",
41
+ "한글 조합부터 나만의 키패드까지.": "From Korean composition to your own custom keypad.",
42
+ "웹에서 자연스럽게 이어지는 입력 경험을 만드세요.": "Build a natural typing experience for the web.",
43
+ "직접 눌러보기": "Try the keyboard",
44
+ "생각에서 글자로, 끊김 없이.": "From thought to text, without interruption.",
45
+ "한글 조합": "Korean composition",
46
+ "초성부터 받침까지": "Complete syllable composition",
47
+ "7가지 모드": "7 input modes",
48
+ "입력에 맞춘 키패드": "A keypad for each input",
49
+ "간결한 컴포넌트 API": "A concise component API",
50
+ "눌러보면 알 수 있어요.": "Try it for yourself.",
51
+ 테마: "Theme",
52
+ "☀ 라이트": "☀ Light",
53
+ "☾ 다크": "☾ Dark",
54
+ "입력 모드": "Input mode",
55
+ "필요한 문자만,": "Only the characters you need,",
56
+ "원하는 방식으로.": "just the way you want.",
57
+ "직접 입력해 보세요": "Start typing",
58
+ "입력 내용": "Input value",
59
+ "초기화 ↺": "Reset ↺",
60
+ "커서 위치에 붙여넣기 · 길게 눌러 선택": "Paste at cursor · Hold to select",
61
+ "예시 채우기 ↗": "Fill example ↗",
62
+ "현재 값": "Current value",
63
+ "화면에 가상 키보드 표시": "Show the on-screen keyboard",
64
+ "예제 복사 ⧉": "Copy example ⧉",
65
+ "선택한 모드와 테마가 코드에 바로 반영됩니다.": "The code updates with your selected mode and theme.",
66
+ "입력란 이동": "Move between fields",
67
+ "범위 선택": "Select text",
68
+ "키보드 닫기": "Close keyboard",
69
+ "프로젝트에 더하는 건,": "Add it to your project",
70
+ "몇 줄이면 충분해요.": "in just a few lines.",
71
+ "Provider로 감싸고 VirtualInput을 추가하세요.": "Wrap your UI in the Provider and add VirtualInput.",
72
+ "기본 스타일과 키패드를 바로 사용할 수 있습니다.": "The default styling and keypads work immediately.",
73
+ "API 문서 살펴보기 ↗": "Read the API docs ↗",
74
+ "명령어 복사 ⧉": "Copy command ⧉",
75
+ "추가 스타일시트 없이 바로 시작하세요.": "Get started without an extra stylesheet.",
76
+ "의견 남기기 ↗": "Share feedback ↗",
77
+ "한영 전환": "Switch Korean / English",
78
+ 지우기: "Backspace",
79
+ "앞 글자 지우기": "Delete forward",
80
+ "입력 완료": "Done",
81
+ "텍스트 편집": "Edit text",
82
+ "키보드로 돌아가기": "Back to keyboard",
83
+ "선택 범위 조절": "Adjust selection",
84
+ "커서 왼쪽": "Move cursor left",
85
+ "커서 오른쪽": "Move cursor right",
86
+ 복사: "Copy",
87
+ 붙여넣기: "Paste",
88
+ 잘라내기: "Cut",
89
+ "실행 취소": "Undo",
90
+ "다시 실행": "Redo",
91
+ "전체 선택": "Select all",
92
+ "읽는 중…": "Reading…",
93
+ 복사했어요: "Copied",
94
+ 붙여넣었어요: "Pasted",
95
+ "입력값이 적용되지 않았어요": "The input value could not be applied",
96
+ "붙여넣을 텍스트가 없어요": "No text to paste",
97
+ "이 입력란에 붙여넣을 수 없는 내용이에요": "This content is not allowed in this field",
98
+ "입력 길이 제한을 초과했어요": "The input length limit was exceeded",
99
+ "클립보드에 접근할 수 없습니다. 입력란을 길게 눌러 기본 편집 메뉴를 사용해 주세요.": "Clipboard access is unavailable. Hold the input to use the native editing menu.",
100
+ "클립보드를 읽을 수 없어요. 입력란을 길게 눌러 ‘붙여넣기’를 선택해 주세요.": "Cannot read the clipboard. Hold the input and choose Paste.",
101
+ "가상 키보드": "Virtual keyboard",
102
+ "선택한 텍스트 편집": "Edit selected text",
103
+ "숫자 · 기호": "Numbers · symbols",
104
+ "한국어 · 두벌식": "Korean · two-set",
105
+ " · Shift 고정": " · Shift locked",
106
+ "숫자·기호 전환": "Switch numbers and symbols",
107
+ "닫기 ↓": "Close ↓",
108
+ 편집: "Edit",
109
+ 키보드: "Keyboard",
110
+ "범위 조절": "Adjust range"
111
+ };
112
+ function je(e, n) {
113
+ return n === "en" ? yt[e] ?? e : e;
114
+ }
115
+ class vt {
7
116
  past = [];
8
117
  future = [];
9
118
  record(n, r) {
@@ -21,26 +130,26 @@ class ct {
21
130
  this.past = [], this.future = [];
22
131
  }
23
132
  }
24
- const We = et(null);
25
- function Ze() {
26
- const e = Oe(We);
133
+ const nt = ut(null);
134
+ function xe() {
135
+ const e = st(nt);
27
136
  if (!e)
28
137
  throw new Error(
29
138
  "VirtualInput must be used within a <VirtualInputProvider>."
30
139
  );
31
140
  return e;
32
141
  }
33
- function we(e) {
142
+ function Se(e) {
34
143
  return /^[\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF]$/.test(e);
35
144
  }
36
- function lt(e, n) {
145
+ function wt(e, n) {
37
146
  if (e.key === "HangulMode") return { handled: !0, toggleHangulMode: !0 };
38
147
  if (e.ctrlKey || e.metaKey || e.altKey || [...e.key].length !== 1 || /[\r\n\t]/.test(e.key))
39
148
  return { handled: !1 };
40
- const r = n && /^[A-Za-z]$/.test(e.key) ? Ue(e.key) : e.key;
41
- return { handled: !0, text: r, composing: we(r) };
149
+ const r = n && /^[A-Za-z]$/.test(e.key) ? tt(e.key) : e.key;
150
+ return { handled: !0, text: r, composing: Se(r) };
42
151
  }
43
- const re = [
152
+ const ce = [
44
153
  [
45
154
  {
46
155
  label: "q",
@@ -211,7 +320,7 @@ const re = [
211
320
  width: 1.25
212
321
  }
213
322
  ]
214
- ], ut = [
323
+ ], bt = [
215
324
  [
216
325
  {
217
326
  label: "1",
@@ -280,7 +389,7 @@ const re = [
280
389
  type: "action"
281
390
  }
282
391
  ]
283
- ], st = [
392
+ ], kt = [
284
393
  [
285
394
  {
286
395
  label: "1",
@@ -363,7 +472,7 @@ const re = [
363
472
  }
364
473
  ]
365
474
  ];
366
- function me(e) {
475
+ function Ee(e) {
367
476
  switch (e) {
368
477
  case "hangul":
369
478
  return !0;
@@ -376,34 +485,34 @@ function me(e) {
376
485
  return null;
377
486
  }
378
487
  }
379
- const ge = () => !0, dt = {
488
+ const be = () => !0, xt = {
380
489
  text: {
381
490
  mode: "text",
382
- layout: re,
383
- filterKey: ge,
491
+ layout: ce,
492
+ filterKey: be,
384
493
  sanitizeValue: (e) => e.replace(/[\r\n\t]+/g, " ")
385
494
  },
386
495
  number: {
387
496
  mode: "number",
388
- layout: ut,
497
+ layout: bt,
389
498
  filterKey: (e) => /^[0-9.]+$/.test(e),
390
499
  sanitizeValue: (e) => e.replace(/[^0-9.]/g, "")
391
500
  },
392
501
  tel: {
393
502
  mode: "tel",
394
- layout: st,
503
+ layout: kt,
395
504
  filterKey: (e) => /^[0-9*#+]+$/.test(e),
396
505
  sanitizeValue: (e) => e.replace(/[^0-9*#+]/g, "")
397
506
  },
398
507
  hangul: {
399
508
  mode: "hangul",
400
- layout: re,
401
- filterKey: ge,
509
+ layout: ce,
510
+ filterKey: be,
402
511
  sanitizeValue: (e) => e.replace(/[A-Za-z]/g, "")
403
512
  },
404
513
  alpha: {
405
514
  mode: "alpha",
406
- layout: re,
515
+ layout: ce,
407
516
  filterKey: (e) => /^[A-Za-z]+$/.test(e),
408
517
  sanitizeValue: (e) => e.replace(/[^A-Za-z]/g, "")
409
518
  },
@@ -411,64 +520,64 @@ const ge = () => !0, dt = {
411
520
  mode: "alphanumeric",
412
521
  layout: [
413
522
  Array.from("1234567890", (e) => ({ value: e })),
414
- ...re
523
+ ...ce
415
524
  ],
416
525
  filterKey: (e) => /^[A-Za-z0-9]+$/.test(e),
417
526
  sanitizeValue: (e) => e.replace(/[^A-Za-z0-9]/g, "")
418
527
  },
419
528
  custom: {
420
529
  mode: "custom",
421
- layout: re,
422
- filterKey: ge,
530
+ layout: ce,
531
+ filterKey: be,
423
532
  sanitizeValue: (e) => e.replace(/[\r\n\t]+/g, " ")
424
533
  }
425
534
  };
426
- function Se(e) {
427
- const n = e?.mode ?? "text", r = dt[n];
535
+ function Ve(e) {
536
+ const n = e?.mode ?? "text", r = xt[n];
428
537
  return {
429
538
  mode: n,
430
- layout: e?.layout ?? r.layout ?? re,
431
- filterKey: e?.filterKey ?? r.filterKey ?? ge,
539
+ layout: e?.layout ?? r.layout ?? ce,
540
+ filterKey: e?.filterKey ?? r.filterKey ?? be,
432
541
  sanitizeValue: e?.sanitizeValue ?? r.sanitizeValue ?? ((a) => a)
433
542
  };
434
543
  }
435
- const ft = new Intl.Segmenter(void 0, { granularity: "grapheme" }), Ve = (e) => Array.from(ft.segment(e));
544
+ const Et = new Intl.Segmenter(void 0, { granularity: "grapheme" }), Ne = (e) => Array.from(Et.segment(e));
436
545
  function Z(e, n) {
437
546
  return [
438
- ...Ve(e).map((a) => a.index),
547
+ ...Ne(e).map((a) => a.index),
439
548
  e.length
440
549
  ].filter((a) => a <= Math.max(0, n)).at(-1) ?? 0;
441
550
  }
442
- function Le(e, n, r) {
551
+ function De(e, n, r) {
443
552
  const a = [
444
- ...Ve(e).map((i) => i.index),
553
+ ...Ne(e).map((l) => l.index),
445
554
  e.length
446
555
  ];
447
- return r < 0 ? a.filter((i) => i < n).at(-1) ?? 0 : a.find((i) => i > n) ?? e.length;
556
+ return r < 0 ? a.filter((l) => l < n).at(-1) ?? 0 : a.find((l) => l > n) ?? e.length;
448
557
  }
449
- const ae = ({ anchor: e, caret: n }) => [Math.min(e, n), Math.max(e, n)];
450
- function qe(e, n, r = !1, a) {
451
- const [i, s] = ae(e);
452
- let f = e.value.slice(0, i), v = n;
453
- i === s && e.composing && r && we(f.at(-1) ?? "") && (v = ot([f.at(-1), n]), f = f.slice(0, -1));
454
- const c = f + v + e.value.slice(s);
455
- if (a !== void 0 && c.length > a) return e;
456
- const m = f.length + v.length;
457
- return { value: c, caret: m, anchor: m, composing: r };
558
+ const se = ({ anchor: e, caret: n }) => [Math.min(e, n), Math.max(e, n)];
559
+ function ze(e, n, r = !1, a) {
560
+ const [l, c] = se(e);
561
+ let f = e.value.slice(0, l), v = n;
562
+ l === c && e.composing && r && Se(f.at(-1) ?? "") && (v = gt([f.at(-1), n]), f = f.slice(0, -1));
563
+ const u = f + v + e.value.slice(c);
564
+ if (a !== void 0 && u.length > a) return e;
565
+ const w = f.length + v.length;
566
+ return { value: u, caret: w, anchor: w, composing: r };
458
567
  }
459
- function ve(e, n) {
460
- let [r, a] = ae(e);
568
+ function ke(e, n) {
569
+ let [r, a] = se(e);
461
570
  if (r === a) {
462
- if (n < 0 && e.composing && we(e.value[r - 1] ?? "")) {
463
- const i = e.value.slice(0, r - 1) + it(e.value[r - 1]);
571
+ if (n < 0 && e.composing && Se(e.value[r - 1] ?? "")) {
572
+ const l = e.value.slice(0, r - 1) + mt(e.value[r - 1]);
464
573
  return {
465
- value: i + e.value.slice(a),
466
- anchor: i.length,
467
- caret: i.length,
574
+ value: l + e.value.slice(a),
575
+ anchor: l.length,
576
+ caret: l.length,
468
577
  composing: !0
469
578
  };
470
579
  }
471
- n < 0 ? r = Le(e.value, r, -1) : a = Le(e.value, a, 1);
580
+ n < 0 ? r = De(e.value, r, -1) : a = De(e.value, a, 1);
472
581
  }
473
582
  return {
474
583
  value: e.value.slice(0, r) + e.value.slice(a),
@@ -477,16 +586,16 @@ function ve(e, n) {
477
586
  composing: !1
478
587
  };
479
588
  }
480
- function Fe(e, n, r = !1) {
481
- const [a, i] = ae(e), s = n === "home" ? 0 : n === "end" ? e.value.length : !r && a !== i ? n < 0 ? a : i : Le(e.value, e.caret, n);
589
+ function Qe(e, n, r = !1) {
590
+ const [a, l] = se(e), c = n === "home" ? 0 : n === "end" ? e.value.length : !r && a !== l ? n < 0 ? a : l : De(e.value, e.caret, n);
482
591
  return {
483
592
  ...e,
484
- caret: s,
485
- anchor: r ? e.anchor : s,
593
+ caret: c,
594
+ anchor: r ? e.anchor : c,
486
595
  composing: !1
487
596
  };
488
597
  }
489
- function pt(e, n, r, a, i, s) {
598
+ function St(e, n, r, a, l, c) {
490
599
  if (n === e.value) return e;
491
600
  let f = 0;
492
601
  for (; f < e.value.length && f < n.length && e.value[f] === n[f]; )
@@ -495,262 +604,332 @@ function pt(e, n, r, a, i, s) {
495
604
  Z(e.value, f),
496
605
  Z(n, f)
497
606
  );
498
- let v = e.value.length, c = n.length;
499
- for (; v > f && c > f && e.value[v - 1] === n[c - 1]; )
500
- v--, c--;
501
- for (; Z(e.value, v) !== v || Z(n, c) !== c; )
502
- v < e.value.length && v++, c < n.length && c++;
503
- const m = n.slice(f, c), p = a(m).replace(/[\r\n\t]+/g, " ");
504
- if (m && (!p || !i(p))) return e;
505
- const l = { ...e, anchor: f, caret: v, composing: !1 }, u = m ? qe(l, p, !1, s) : ve(l, -1);
506
- if (u === l) return e;
507
- const V = (w) => Z(
508
- u.value,
509
- w <= f ? w : w >= c ? w + p.length - m.length : f + a(m.slice(0, w - f)).replace(/[\r\n\t]+/g, " ").length
607
+ let v = e.value.length, u = n.length;
608
+ for (; v > f && u > f && e.value[v - 1] === n[u - 1]; )
609
+ v--, u--;
610
+ for (; Z(e.value, v) !== v || Z(n, u) !== u; )
611
+ v < e.value.length && v++, u < n.length && u++;
612
+ const w = n.slice(f, u), d = a(w).replace(/[\r\n\t]+/g, " ");
613
+ if (w && (!d || !l(d))) return e;
614
+ const i = { ...e, anchor: f, caret: v, composing: !1 }, s = w ? ze(i, d, !1, c) : ke(i, -1);
615
+ if (s === i) return e;
616
+ const h = (C) => Z(
617
+ s.value,
618
+ C <= f ? C : C >= u ? C + d.length - w.length : f + a(w.slice(0, C - f)).replace(/[\r\n\t]+/g, " ").length
510
619
  );
511
620
  return {
512
- ...u,
513
- anchor: V(r.backward ? r.end : r.start),
514
- caret: V(r.backward ? r.start : r.end)
621
+ ...s,
622
+ anchor: h(r.backward ? r.end : r.start),
623
+ caret: h(r.backward ? r.start : r.end)
515
624
  };
516
625
  }
517
- const ht = typeof window > "u" ? z : rt, Mt = tt(
626
+ const Ct = typeof window > "u" ? R : ft, Ft = dt(
518
627
  function({
519
628
  value: n,
520
629
  defaultValue: r = "",
521
630
  placeholder: a,
522
- onChange: i,
523
- onValueChange: s,
631
+ onChange: l,
632
+ onValueChange: c,
524
633
  onClipboardError: f,
525
634
  mode: v = "text",
526
- layout: c,
527
- filterKey: m,
528
- sanitizeValue: p,
529
- disabled: l = !1,
530
- readOnly: u = !1,
531
- maxLength: V,
532
- ...w
533
- }, Q) {
534
- const H = $e(), {
535
- focusId: le,
536
- onFocus: te,
537
- onBlur: F,
538
- defaultLayout: oe,
539
- inputRef: X,
540
- hangulMode: J,
541
- theme: ue,
542
- toggleKorean: g,
543
- setEditingStatus: L
544
- } = Ze(), y = I(null), A = I(null), x = I(!1), B = I(!1), R = I(null), [Y, N] = P(null), [b, O] = P(!1), [U, de] = P(() => ({
635
+ layout: u,
636
+ filterKey: w,
637
+ sanitizeValue: d,
638
+ disabled: i = !1,
639
+ readOnly: s = !1,
640
+ maxLength: h,
641
+ ...C
642
+ }, $) {
643
+ const U = et(), {
644
+ focusId: Y,
645
+ onFocus: oe,
646
+ onBlur: q,
647
+ defaultLayout: O,
648
+ inputRef: ee,
649
+ hangulMode: te,
650
+ theme: G,
651
+ toggleKorean: ie,
652
+ setEditingStatus: ue
653
+ } = xe(), { locale: g } = xe(), m = E((t) => je(t, g), [g]), L = P(null), k = P(null), M = P(!1), H = P(!1), z = P(null), [le, F] = B(null), [A, ne] = B(!1), [W, ye] = B(() => ({
545
654
  value: n ?? r,
546
655
  caret: (n ?? r).length,
547
656
  anchor: (n ?? r).length,
548
657
  composing: !1
549
- })), W = n ?? U.value, d = I(U), ne = I(0), ie = I(new ct()), G = I(!1), h = le === H, k = I(h);
550
- k.current = h;
551
- const $ = n !== void 0 && n !== U.value;
552
- $ && ie.current.clear(), d.current = {
553
- ...U,
554
- value: W,
555
- caret: Z(W, U.caret),
556
- anchor: Z(W, U.anchor),
557
- composing: $ ? !1 : U.composing
658
+ })), j = n ?? W.value, p = P(W), fe = P(0), de = P(new vt()), y = P(!1), b = Y === U, N = P(b);
659
+ N.current = b;
660
+ const he = n !== void 0 && n !== W.value;
661
+ he && de.current.clear(), p.current = {
662
+ ...W,
663
+ value: j,
664
+ caret: Z(j, W.caret),
665
+ anchor: Z(j, W.anchor),
666
+ composing: he ? !1 : W.composing
558
667
  };
559
- const j = He(
560
- () => Se({
668
+ const V = Ge(
669
+ () => Ve({
561
670
  mode: v,
562
- layout: c ?? (v === "text" || v === "custom" ? oe : void 0),
563
- filterKey: m,
564
- sanitizeValue: p
671
+ layout: u ?? (v === "text" || v === "custom" ? O : void 0),
672
+ filterKey: w,
673
+ sanitizeValue: d
565
674
  }),
566
- [v, c, oe, m, p]
567
- ), [ye, fe] = P(""), E = S(
568
- (t, o = !0, C = !1) => {
569
- const K = d.current.value;
570
- if (o && ie.current.record(d.current, t), x.current = !C, d.current = t, ne.current++, fe(""), de(t), t.value !== K) {
571
- s?.(t.value);
572
- const M = { value: t.value };
573
- i?.({
574
- target: M,
575
- currentTarget: M
675
+ [v, u, O, w, d]
676
+ ), [Ce, _] = B(""), [$e, Ue] = B(!1), re = P(null), ve = P(null), ge = P({ disabled: i, readOnly: s, policy: V, maxLength: h });
677
+ ge.current = { disabled: i, readOnly: s, policy: V, maxLength: h };
678
+ const Q = E(() => {
679
+ re.current && (re.current = null, Ue(!1));
680
+ }, []);
681
+ R(() => {
682
+ const t = re.current;
683
+ t && (!b || i || s || t.policy !== V || t.maxLength !== h || t.value !== j) && Q();
684
+ }, [
685
+ b,
686
+ i,
687
+ s,
688
+ V,
689
+ h,
690
+ j,
691
+ Q
692
+ ]);
693
+ const S = E(
694
+ (t, o = !0, x = !1) => {
695
+ Q();
696
+ const D = p.current.value;
697
+ if (o && de.current.record(p.current, t), M.current = !x, p.current = t, fe.current++, _(""), ye(t), t.value !== D) {
698
+ c?.(t.value);
699
+ const I = { value: t.value };
700
+ l?.({
701
+ target: I,
702
+ currentTarget: I
576
703
  });
577
704
  }
578
705
  },
579
- [i, s]
580
- ), D = S(() => {
581
- const t = A.current;
582
- if (!t || l || x.current || t.value !== d.current.value || B.current)
706
+ [l, c, Q]
707
+ ), K = E(() => {
708
+ const t = k.current;
709
+ if (!t || i || M.current || t.value !== p.current.value || H.current)
583
710
  return null;
584
- const o = t.selectionStart ?? 0, C = t.selectionEnd ?? o, K = t.selectionDirection === "backward" ? { anchor: C, caret: o } : { anchor: o, caret: C }, M = Z(d.current.value, K.anchor), _ = Z(d.current.value, K.caret);
585
- return (M !== d.current.anchor || _ !== d.current.caret || M !== K.anchor || _ !== K.caret) && E(
586
- { ...d.current, anchor: M, caret: _, composing: !1 },
711
+ const o = t.selectionStart ?? 0, x = t.selectionEnd ?? o, D = t.selectionDirection === "backward" ? { anchor: x, caret: o } : { anchor: o, caret: x }, I = Z(p.current.value, D.anchor), J = Z(p.current.value, D.caret);
712
+ return (I !== p.current.anchor || J !== p.current.caret || I !== D.anchor || J !== D.caret) && S(
713
+ { ...p.current, anchor: I, caret: J, composing: !1 },
587
714
  !1,
588
- M === K.anchor && _ === K.caret
589
- ), { anchor: M, caret: _ };
590
- }, [l, E]);
591
- z(() => {
715
+ I === D.anchor && J === D.caret
716
+ ), { anchor: I, caret: J };
717
+ }, [i, S]);
718
+ R(() => {
592
719
  const t = () => {
593
- document.activeElement === A.current && D();
594
- }, o = A.current;
720
+ document.activeElement === k.current && K();
721
+ }, o = k.current;
595
722
  return document.addEventListener("selectionchange", t), o?.addEventListener("select", t), () => {
596
723
  document.removeEventListener("selectionchange", t), o?.removeEventListener("select", t);
597
724
  };
598
- }, [D]), ht(() => {
599
- if (R.current && R.current.value !== W && (B.current = !1, R.current = null, N(null)), !l && A.current && !B.current && (x.current || $)) {
600
- const { anchor: t, caret: o } = d.current, C = Math.min(t, o), K = Math.max(t, o), M = t > o ? "backward" : "forward";
601
- (A.current.selectionStart !== C || A.current.selectionEnd !== K || C !== K && A.current.selectionDirection !== M) && A.current.setSelectionRange(C, K, M);
725
+ }, [K, m]), Ct(() => {
726
+ if (z.current && z.current.value !== j && (H.current = !1, z.current = null, F(null)), !i && k.current && !H.current && (M.current || he)) {
727
+ const { anchor: t, caret: o } = p.current, x = Math.min(t, o), D = Math.max(t, o), I = t > o ? "backward" : "forward";
728
+ (k.current.selectionStart !== x || k.current.selectionEnd !== D || x !== D && k.current.selectionDirection !== I) && k.current.setSelectionRange(x, D, I);
602
729
  }
603
- x.current = !1;
604
- }), z(() => {
605
- if (!h) return;
606
- const [t, o] = ae(d.current);
607
- L({
608
- selectionLength: Ve(W.slice(t, o)).length,
609
- hasValue: !!W,
610
- message: ye
730
+ M.current = !1, ve.current !== null && (_(
731
+ j === ve.current ? m("붙여넣었어요") : m("입력값이 적용되지 않았어요")
732
+ ), ve.current = null);
733
+ }), R(() => {
734
+ if (!b) return;
735
+ const [t, o] = se(p.current);
736
+ ue({
737
+ selectionLength: Ne(j.slice(t, o)).length,
738
+ hasValue: !!j,
739
+ message: Ce,
740
+ pasting: $e
611
741
  });
612
742
  }, [
613
- W,
614
- U.anchor,
615
- U.caret,
616
- ye,
617
- h,
618
- L
743
+ j,
744
+ W.anchor,
745
+ W.caret,
746
+ Ce,
747
+ $e,
748
+ b,
749
+ ue
619
750
  ]);
620
- const ce = S(
751
+ const Le = E(
621
752
  (t, o = !1) => {
622
- if (l || u) return;
623
- D();
624
- const C = j.sanitizeValue(t).replace(/[\r\n\t]+/g, " ");
625
- C && E(qe(d.current, C, o, V));
753
+ if (i || s) return;
754
+ K();
755
+ const x = V.sanitizeValue(t).replace(/[\r\n\t]+/g, " ");
756
+ x && S(ze(p.current, x, o, h));
757
+ },
758
+ [i, s, V, h, S, K]
759
+ ), Ae = E(
760
+ (t) => {
761
+ if (i || s || H.current) return;
762
+ if (K(), !t) {
763
+ _(m("붙여넣을 텍스트가 없어요"));
764
+ return;
765
+ }
766
+ const o = V.sanitizeValue(t).replace(/[\r\n\t]+/g, " ");
767
+ if (!o || !V.filterKey(o)) {
768
+ _(m("이 입력란에 붙여넣을 수 없는 내용이에요"));
769
+ return;
770
+ }
771
+ const x = ze(p.current, o, !1, h);
772
+ if (x === p.current) {
773
+ _(m("입력 길이 제한을 초과했어요"));
774
+ return;
775
+ }
776
+ ve.current = x.value, S(x), k.current?.focus({ preventScroll: !0 });
626
777
  },
627
- [l, u, j, V, E, D]
628
- ), be = S(() => {
629
- !l && !u && E(ie.current.undo(d.current), !1);
630
- }, [l, u, E]), xe = S(() => {
631
- !l && !u && E(ie.current.redo(d.current), !1);
632
- }, [l, u, E]), Ke = S(
633
- () => E({
634
- ...d.current,
635
- caret: d.current.value.length,
778
+ [i, s, V, h, K, S, m]
779
+ ), Pe = E(() => {
780
+ !i && !s && S(de.current.undo(p.current), !1);
781
+ }, [i, s, S]), Te = E(() => {
782
+ !i && !s && S(de.current.redo(p.current), !1);
783
+ }, [i, s, S]), qe = E(
784
+ () => S({
785
+ ...p.current,
786
+ caret: p.current.value.length,
636
787
  anchor: 0,
637
788
  composing: !1
638
789
  }),
639
- [E]
640
- ), Ie = S(
790
+ [S]
791
+ ), We = E(
641
792
  (t, o = !1) => {
642
- D(), E(Fe(d.current, t === "left" ? -1 : 1, o));
793
+ K(), S(Qe(p.current, t === "left" ? -1 : 1, o));
643
794
  },
644
- [E, D]
645
- ), Ye = (t) => {
646
- if (w.onKeyDown?.(t), t.defaultPrevented || l || B.current || t.nativeEvent.isComposing || t.keyCode === 229)
795
+ [S, K]
796
+ ), at = (t) => {
797
+ if (C.onKeyDown?.(t), t.defaultPrevented || i || H.current || t.nativeEvent.isComposing || t.keyCode === 229)
647
798
  return;
648
- D();
799
+ K();
649
800
  const o = t.key;
650
801
  if (o === "Escape") {
651
- t.preventDefault(), E({ ...d.current, composing: !1 }), F(!0), A.current?.blur();
802
+ t.preventDefault(), S({ ...p.current, composing: !1 }), q(!0), k.current?.blur();
652
803
  return;
653
804
  }
654
805
  if (o === "HangulMode") {
655
- t.preventDefault(), E({ ...d.current, composing: !1 }), g();
806
+ t.preventDefault(), S({ ...p.current, composing: !1 }), ie();
656
807
  return;
657
808
  }
658
- const C = t.ctrlKey || t.metaKey;
659
- if (C && ["z", "y"].includes(o.toLowerCase())) {
660
- t.preventDefault(), o.toLowerCase() === "y" || t.shiftKey ? xe() : be();
809
+ const x = t.ctrlKey || t.metaKey;
810
+ if (x && ["z", "y"].includes(o.toLowerCase())) {
811
+ t.preventDefault(), o.toLowerCase() === "y" || t.shiftKey ? Te() : Pe();
661
812
  return;
662
813
  }
663
- if (C && o.toLowerCase() === "a") {
664
- t.preventDefault(), E({
665
- ...d.current,
666
- caret: d.current.value.length,
814
+ if (x && o.toLowerCase() === "a") {
815
+ t.preventDefault(), S({
816
+ ...p.current,
817
+ caret: p.current.value.length,
667
818
  anchor: 0,
668
819
  composing: !1
669
820
  });
670
821
  return;
671
822
  }
672
- const K = o === "Home" || o === "ArrowUp" || C && o === "ArrowLeft" ? "home" : o === "End" || o === "ArrowDown" || C && o === "ArrowRight" ? "end" : o === "ArrowLeft" ? -1 : o === "ArrowRight" ? 1 : null;
673
- if (K !== null) {
674
- t.preventDefault(), E(Fe(d.current, K, t.shiftKey));
823
+ const D = o === "Home" || o === "ArrowUp" || x && o === "ArrowLeft" ? "home" : o === "End" || o === "ArrowDown" || x && o === "ArrowRight" ? "end" : o === "ArrowLeft" ? -1 : o === "ArrowRight" ? 1 : null;
824
+ if (D !== null) {
825
+ t.preventDefault(), S(Qe(p.current, D, t.shiftKey));
675
826
  return;
676
827
  }
677
828
  if (o === "Tab" || o === "Enter") {
678
- o === "Enter" && t.preventDefault(), E({ ...d.current, composing: !1 });
829
+ o === "Enter" && t.preventDefault(), S({ ...p.current, composing: !1 });
679
830
  return;
680
831
  }
681
- if (u) return;
832
+ if (s) return;
682
833
  if (o === "Backspace" || o === "Delete") {
683
- t.preventDefault(), E(ve(d.current, o === "Backspace" ? -1 : 1));
834
+ t.preventDefault(), S(ke(p.current, o === "Backspace" ? -1 : 1));
684
835
  return;
685
836
  }
686
- const M = lt(
837
+ const I = wt(
687
838
  t,
688
- me(j.mode) ?? J
839
+ Ee(V.mode) ?? te
689
840
  );
690
- M.handled && M.text && (t.preventDefault(), j.filterKey(M.text) && ce(M.text, M.composing));
691
- }, pe = S(
841
+ I.handled && I.text && (t.preventDefault(), V.filterKey(I.text) && Le(I.text, I.composing));
842
+ }, pe = E(
692
843
  (t) => {
693
844
  const o = t instanceof Error ? t : new Error(String(t));
694
- G.current && (fe(
695
- "클립보드에 접근할 수 없습니다. 입력란을 길게 눌러 기본 편집 메뉴를 사용해 주세요."
845
+ y.current && (_(
846
+ m(
847
+ "클립보드에 접근할 수 없습니다. 입력란을 길게 눌러 기본 편집 메뉴를 사용해 주세요."
848
+ )
696
849
  ), f?.(o));
697
850
  },
698
- [f]
699
- ), he = S(async () => {
700
- D();
701
- const [t, o] = ae(d.current);
851
+ [f, m]
852
+ ), we = E(async () => {
853
+ K();
854
+ const [t, o] = se(p.current);
702
855
  if (t === o) return;
703
- const C = d.current.value, K = d.current.value.slice(t, o);
856
+ const x = p.current.value, D = p.current.value.slice(t, o);
704
857
  try {
705
858
  if (!navigator.clipboard?.writeText)
706
859
  throw new Error("Clipboard API unavailable");
707
- await navigator.clipboard.writeText(K);
708
- } catch (M) {
709
- D();
710
- const _ = A.current, [Ge, Qe] = ae(d.current);
711
- if (!_ || !G.current || d.current.value !== C || Ge !== t || Qe !== o)
712
- throw M;
713
- let ee = document.activeElement;
714
- const Re = ee?.hasAttribute(
860
+ await navigator.clipboard.writeText(D);
861
+ } catch (I) {
862
+ K();
863
+ const J = k.current, [lt, ct] = se(p.current);
864
+ if (!J || !y.current || p.current.value !== x || lt !== t || ct !== o)
865
+ throw I;
866
+ let ae = document.activeElement;
867
+ const Je = ae?.hasAttribute(
715
868
  "data-virtual-keypad"
716
869
  );
717
- if (ee !== _ && !Re) throw M;
718
- for (; ee?.shadowRoot?.activeElement; )
719
- ee = ee.shadowRoot.activeElement;
720
- _.focus({ preventScroll: !0 });
870
+ if (ae !== J && !Je) throw I;
871
+ for (; ae?.shadowRoot?.activeElement; )
872
+ ae = ae.shadowRoot.activeElement;
873
+ J.focus({ preventScroll: !0 });
721
874
  try {
722
- if (!document.execCommand?.("copy")) throw M;
875
+ if (!document.execCommand?.("copy")) throw I;
723
876
  } finally {
724
- ee instanceof HTMLElement && ee !== _ && Re && ee.focus({ preventScroll: !0 });
877
+ ae instanceof HTMLElement && ae !== J && Je && ae.focus({ preventScroll: !0 });
725
878
  }
726
879
  }
727
- G.current && fe("복사했어요");
728
- }, [D]), Pe = S(async () => {
729
- if (l || u) return;
730
- D();
731
- const t = d.current, o = ne.current;
732
- t.anchor !== t.caret && (await he(), G.current && k.current && ne.current === o && d.current.value === t.value && E(ve(t, -1)));
733
- }, [l, u, he, E, D]), De = S(async () => {
734
- if (l || u) return;
735
- D();
736
- const t = ne.current, o = d.current.value, C = await navigator.clipboard.readText();
737
- G.current && k.current && ne.current === t && d.current.value === o && ce(C);
738
- }, [l, u, ce, D]), se = He(
880
+ y.current && _(m("복사했어요"));
881
+ }, [K, m]), Ze = E(async () => {
882
+ if (i || s) return;
883
+ K();
884
+ const t = p.current, o = fe.current;
885
+ t.anchor !== t.caret && (await we(), y.current && N.current && fe.current === o && p.current.value === t.value && S(ke(t, -1)));
886
+ }, [i, s, we, S, K]), Xe = E(async () => {
887
+ if (i || s || H.current || re.current)
888
+ return;
889
+ K();
890
+ const t = { value: p.current.value, policy: V, maxLength: h };
891
+ re.current = t, Ue(!0), _("");
892
+ const o = () => re.current === t && y.current && N.current && !ge.current.disabled && !ge.current.readOnly && ge.current.policy === t.policy && ge.current.maxLength === t.maxLength && p.current.value === t.value;
893
+ try {
894
+ if (!navigator.clipboard?.readText)
895
+ throw new Error("Clipboard read unavailable");
896
+ const x = await navigator.clipboard.readText();
897
+ K(), o() && Ae(x);
898
+ } catch (x) {
899
+ K(), o() && (k.current?.focus({ preventScroll: !0 }), pe(x), _(
900
+ m(
901
+ "클립보드를 읽을 수 없어요. 입력란을 길게 눌러 ‘붙여넣기’를 선택해 주세요."
902
+ )
903
+ ));
904
+ } finally {
905
+ re.current === t && Q();
906
+ }
907
+ }, [
908
+ i,
909
+ s,
910
+ V,
911
+ h,
912
+ Ae,
913
+ K,
914
+ pe,
915
+ m,
916
+ Q
917
+ ]), me = Ge(
739
918
  () => ({
740
919
  focus: (t) => {
741
- l || A.current?.focus(t);
920
+ i || k.current?.focus(t);
742
921
  },
743
922
  blur: () => {
744
- A.current?.blur(), k.current && F(!0);
923
+ k.current?.blur(), N.current && q(!0);
745
924
  },
746
- getValue: () => d.current.value,
747
- setSelectionRange: (t, o) => E({
748
- ...d.current,
749
- anchor: Z(d.current.value, t),
750
- caret: Z(d.current.value, o),
925
+ getValue: () => p.current.value,
926
+ setSelectionRange: (t, o) => S({
927
+ ...p.current,
928
+ anchor: Z(p.current.value, t),
929
+ caret: Z(p.current.value, o),
751
930
  composing: !1
752
931
  }),
753
- handleKeyDown: (t) => A.current?.dispatchEvent(
932
+ handleKeyDown: (t) => k.current?.dispatchEvent(
754
933
  new KeyboardEvent("keydown", {
755
934
  key: t.key,
756
935
  shiftKey: t.shiftKey,
@@ -763,86 +942,86 @@ const ht = typeof window > "u" ? z : rt, Mt = tt(
763
942
  })
764
943
  ),
765
944
  insertText: (t, o) => {
766
- j.filterKey(t) && ce(t, o);
945
+ V.filterKey(t) && Le(t, o);
767
946
  },
768
- scrollIntoView: () => y.current?.scrollIntoView({ block: "nearest", inline: "nearest" }),
769
- moveCaret: Ie,
770
- undo: be,
771
- redo: xe,
772
- selectAll: Ke,
773
- copySelection: () => he().catch(pe),
774
- pasteClipboard: () => De().catch(pe),
775
- cutSelection: () => Pe().catch(pe)
947
+ scrollIntoView: () => L.current?.scrollIntoView({ block: "nearest", inline: "nearest" }),
948
+ moveCaret: We,
949
+ undo: Pe,
950
+ redo: Te,
951
+ selectAll: qe,
952
+ copySelection: () => we().catch(pe),
953
+ pasteClipboard: () => Xe().catch(pe),
954
+ cutSelection: () => Ze().catch(pe)
776
955
  }),
777
956
  [
778
- j,
779
- ce,
780
- Ie,
781
- he,
782
- De,
783
- Pe,
957
+ V,
958
+ Le,
959
+ We,
960
+ we,
961
+ Xe,
962
+ Ze,
784
963
  pe,
785
- be,
786
- xe,
787
- Ke,
788
- l,
789
- F,
790
- E
964
+ Pe,
965
+ Te,
966
+ qe,
967
+ i,
968
+ q,
969
+ S
791
970
  ]
792
971
  );
793
- nt(Q, () => se, [se]), z(() => {
794
- h || de(
972
+ pt($, () => me, [me]), R(() => {
973
+ b || ye(
795
974
  (t) => t.composing ? { ...t, composing: !1 } : t
796
975
  );
797
- }, [h]), z(() => {
798
- if (!(!h || l || u))
799
- return X.current = se, () => {
800
- X.current === se && (X.current = null);
976
+ }, [b]), R(() => {
977
+ if (!(!b || i || s))
978
+ return ee.current = me, () => {
979
+ ee.current === me && (ee.current = null);
801
980
  };
802
- }, [h, l, u, se, X]), z(() => {
803
- h && y.current && (l || u ? F(!0) : te(H, y.current, j));
804
- }, [h, l, u, H, j, te, F]), z(() => (G.current = !0, () => {
805
- G.current = !1, k.current && F(!0);
806
- }), [F]);
807
- const ze = (t, o) => {
808
- if (o ? w.onCut?.(t) : w.onCopy?.(t), t.defaultPrevented || l || o && u || t.target !== A.current) return;
809
- D();
810
- const [C, K] = ae(d.current);
811
- C !== K && (t.preventDefault(), t.clipboardData.setData(
981
+ }, [b, i, s, me, ee]), R(() => {
982
+ b && L.current && (i || s ? q(!0) : oe(U, L.current, V));
983
+ }, [b, i, s, U, V, oe, q]), R(() => (y.current = !0, () => {
984
+ y.current = !1, re.current = null, N.current && q(!0);
985
+ }), [q]);
986
+ const Ye = (t, o) => {
987
+ if (o ? C.onCut?.(t) : C.onCopy?.(t), t.defaultPrevented || i || o && s || t.target !== k.current) return;
988
+ K();
989
+ const [x, D] = se(p.current);
990
+ x !== D && (t.preventDefault(), t.clipboardData.setData(
812
991
  "text/plain",
813
- d.current.value.slice(C, K)
814
- ), o ? E(ve(d.current, -1)) : fe("복사했어요"));
815
- }, Be = (t) => {
816
- if (l || u) return;
817
- const o = pt(
818
- d.current,
992
+ p.current.value.slice(x, D)
993
+ ), o ? S(ke(p.current, -1)) : _(m("복사했어요")));
994
+ }, _e = (t) => {
995
+ if (i || s) return;
996
+ const o = St(
997
+ p.current,
819
998
  t.value,
820
999
  {
821
1000
  start: t.selectionStart ?? t.value.length,
822
1001
  end: t.selectionEnd ?? t.value.length,
823
1002
  backward: t.selectionDirection === "backward"
824
1003
  },
825
- j.sanitizeValue,
826
- j.filterKey,
827
- V
1004
+ V.sanitizeValue,
1005
+ V.filterKey,
1006
+ h
828
1007
  );
829
- t.value = o.value, E({ ...o });
830
- }, _e = Object.fromEntries(
831
- Object.entries(w).filter(([t]) => t.startsWith("aria-"))
832
- ), Je = Object.fromEntries(
833
- Object.entries(w).filter(
1008
+ t.value = o.value, S({ ...o });
1009
+ }, ot = Object.fromEntries(
1010
+ Object.entries(C).filter(([t]) => t.startsWith("aria-"))
1011
+ ), it = Object.fromEntries(
1012
+ Object.entries(C).filter(
834
1013
  ([t]) => !t.startsWith("aria-") && !["id", "tabIndex", "role", "contentEditable", "children"].includes(
835
1014
  t
836
1015
  )
837
1016
  )
838
1017
  );
839
- return /* @__PURE__ */ q(
1018
+ return /* @__PURE__ */ X(
840
1019
  "div",
841
1020
  {
842
- ...Je,
843
- ref: y,
1021
+ ...it,
1022
+ ref: L,
844
1023
  "data-virtual-input": "true",
845
- "data-focused": h || void 0,
1024
+ "data-focused": b || void 0,
846
1025
  style: {
847
1026
  position: "relative",
848
1027
  display: "flex",
@@ -854,49 +1033,49 @@ const ht = typeof window > "u" ? z : rt, Mt = tt(
854
1033
  borderRadius: 8,
855
1034
  font: "inherit",
856
1035
  width: "100%",
857
- cursor: l ? "not-allowed" : "text",
858
- opacity: l ? 0.5 : 1,
859
- colorScheme: ue,
860
- outline: b ? "2px solid currentColor" : void 0,
1036
+ cursor: i ? "not-allowed" : "text",
1037
+ opacity: i ? 0.5 : 1,
1038
+ colorScheme: G,
1039
+ outline: A ? "2px solid currentColor" : void 0,
861
1040
  outlineOffset: 2,
862
- ...w.style
1041
+ ...C.style
863
1042
  },
864
1043
  onFocus: (t) => {
865
- O(!0), w.onFocus?.(t), !t.defaultPrevented && !l && !u && te(H, t.currentTarget, j);
1044
+ ne(!0), C.onFocus?.(t), !t.defaultPrevented && !i && !s && oe(U, t.currentTarget, V);
866
1045
  },
867
1046
  onBlur: (t) => {
868
- O(!1), w.onBlur?.(t), t.defaultPrevented || F(t);
1047
+ ne(!1), t.relatedTarget instanceof Element && !t.relatedTarget.closest("[data-virtual-keypad]") && Q(), C.onBlur?.(t), t.defaultPrevented || q(t);
869
1048
  },
870
- onKeyDown: Ye,
871
- onCopy: (t) => ze(t, !1),
872
- onCut: (t) => ze(t, !0),
1049
+ onKeyDown: at,
1050
+ onCopy: (t) => Ye(t, !1),
1051
+ onCut: (t) => Ye(t, !0),
873
1052
  onPaste: (t) => {
874
- w.onPaste?.(t), !t.defaultPrevented && !l && !u && (t.preventDefault(), ce(t.clipboardData.getData("text/plain")));
1053
+ C.onPaste?.(t), !t.defaultPrevented && !i && !s && (t.preventDefault(), Q(), Ae(t.clipboardData.getData("text/plain")));
875
1054
  },
876
1055
  children: [
877
1056
  /* @__PURE__ */ T(
878
1057
  "input",
879
1058
  {
880
- ..._e,
881
- ref: A,
882
- id: w.id ?? H,
1059
+ ...ot,
1060
+ ref: k,
1061
+ id: C.id ?? U,
883
1062
  type: "text",
884
1063
  role: "textbox",
885
1064
  inputMode: "none",
886
1065
  autoComplete: "off",
887
1066
  autoCorrect: "off",
888
1067
  autoCapitalize: "off",
889
- spellCheck: w.spellCheck ?? !1,
890
- tabIndex: l ? -1 : w.tabIndex ?? 0,
891
- disabled: l,
892
- readOnly: u,
893
- "aria-disabled": l || void 0,
894
- "aria-readonly": u || void 0,
1068
+ spellCheck: C.spellCheck ?? !1,
1069
+ tabIndex: i ? -1 : C.tabIndex ?? 0,
1070
+ disabled: i,
1071
+ readOnly: s,
1072
+ "aria-disabled": i || void 0,
1073
+ "aria-readonly": s || void 0,
895
1074
  "data-virtual-input": "true",
896
- "data-focused": h || void 0,
897
- "data-value": W,
1075
+ "data-focused": b || void 0,
1076
+ "data-value": j,
898
1077
  placeholder: a,
899
- value: Y ?? W,
1078
+ value: le ?? j,
900
1079
  style: {
901
1080
  position: "absolute",
902
1081
  inset: 0,
@@ -925,14 +1104,14 @@ const ht = typeof window > "u" ? z : rt, Mt = tt(
925
1104
  touchAction: "manipulation"
926
1105
  },
927
1106
  onChange: (t) => {
928
- B.current ? N(t.currentTarget.value) : Be(t.currentTarget);
1107
+ H.current ? F(t.currentTarget.value) : _e(t.currentTarget);
929
1108
  },
930
- onSelect: D,
1109
+ onSelect: K,
931
1110
  onCompositionStart: () => {
932
- D(), R.current = d.current, B.current = !0, N(A.current?.value ?? d.current.value);
1111
+ Q(), K(), z.current = p.current, H.current = !0, F(k.current?.value ?? p.current.value);
933
1112
  },
934
1113
  onCompositionEnd: (t) => {
935
- B.current = !1, N(null), R.current?.value === d.current.value ? Be(t.currentTarget) : (t.currentTarget.value = d.current.value, E({ ...d.current })), R.current = null;
1114
+ H.current = !1, F(null), z.current?.value === p.current.value ? _e(t.currentTarget) : (t.currentTarget.value = p.current.value, S({ ...p.current })), z.current = null;
936
1115
  }
937
1116
  }
938
1117
  ),
@@ -948,14 +1127,14 @@ const ht = typeof window > "u" ? z : rt, Mt = tt(
948
1127
  clipPath: "inset(50%)",
949
1128
  whiteSpace: "nowrap"
950
1129
  },
951
- children: ye
1130
+ children: Ce
952
1131
  }
953
1132
  )
954
1133
  ]
955
1134
  }
956
1135
  );
957
1136
  }
958
- ), gt = [
1137
+ ), Lt = [
959
1138
  [
960
1139
  {
961
1140
  value: "1"
@@ -1072,97 +1251,97 @@ const ht = typeof window > "u" ? z : rt, Mt = tt(
1072
1251
  }
1073
1252
  ]
1074
1253
  ];
1075
- function vt({
1254
+ function At({
1076
1255
  tagName: e,
1077
1256
  css: n,
1078
1257
  children: r,
1079
1258
  hostRef: a,
1080
- ...i
1259
+ ...l
1081
1260
  }) {
1082
- const [s, f] = P(null), v = S(
1083
- (c) => {
1084
- a && (a.current = c), c && f(c.shadowRoot ?? c.attachShadow({ mode: "open" }));
1261
+ const [c, f] = B(null), v = E(
1262
+ (u) => {
1263
+ a && (a.current = u), u && f(u.shadowRoot ?? u.attachShadow({ mode: "open" }));
1085
1264
  },
1086
1265
  [a]
1087
1266
  );
1088
- return at(
1267
+ return ht(
1089
1268
  e,
1090
- { ...i, ref: v },
1091
- s && Te(
1092
- /* @__PURE__ */ q(Me, { children: [
1269
+ { ...l, ref: v },
1270
+ c && Fe(
1271
+ /* @__PURE__ */ X(He, { children: [
1093
1272
  n && /* @__PURE__ */ T("style", { children: n }),
1094
1273
  r
1095
1274
  ] }),
1096
- s
1275
+ c
1097
1276
  )
1098
1277
  );
1099
1278
  }
1100
- function je(e, n, r) {
1279
+ function Oe(e, n, r) {
1101
1280
  if (e.type === "action") return e.value === `
1102
1281
  ` ? "Enter" : e.value;
1103
1282
  if (!/^[a-zA-Z]$/.test(e.value)) return e.value;
1104
1283
  const a = r ? e.value.toUpperCase() : e.value;
1105
- return n ? Ue(a) : a;
1284
+ return n ? tt(a) : a;
1106
1285
  }
1107
- function Ae(e, { disabled: n = !1, repeat: r = !1 } = {}) {
1108
- const a = I(e);
1286
+ function Be(e, { disabled: n = !1, repeat: r = !1 } = {}) {
1287
+ const a = P(e);
1109
1288
  a.current = e;
1110
- const i = I(void 0), s = I(null), [f, v] = P(!1), c = S(() => {
1111
- clearTimeout(i.current), s.current = null, v(!1);
1289
+ const l = P(void 0), c = P(null), [f, v] = B(!1), u = E(() => {
1290
+ clearTimeout(l.current), c.current = null, v(!1);
1112
1291
  }, []);
1113
- z(() => (window.addEventListener("blur", c), document.addEventListener("visibilitychange", c), () => {
1114
- c(), window.removeEventListener("blur", c), document.removeEventListener("visibilitychange", c);
1115
- }), [c]), z(() => {
1116
- n && c();
1117
- }, [n, c]);
1118
- const m = (p) => {
1119
- const l = s.current?.bounds;
1120
- return !!l && p.clientX >= l.left && p.clientX <= l.right && p.clientY >= l.top && p.clientY <= l.bottom;
1292
+ R(() => (window.addEventListener("blur", u), document.addEventListener("visibilitychange", u), () => {
1293
+ u(), window.removeEventListener("blur", u), document.removeEventListener("visibilitychange", u);
1294
+ }), [u]), R(() => {
1295
+ n && u();
1296
+ }, [n, u]);
1297
+ const w = (d) => {
1298
+ const i = c.current?.bounds;
1299
+ return !!i && d.clientX >= i.left && d.clientX <= i.right && d.clientY >= i.top && d.clientY <= i.bottom;
1121
1300
  };
1122
1301
  return {
1123
1302
  "data-pressed": f || void 0,
1124
- onPointerDown: (p) => {
1125
- if (!(n || p.button !== 0 || s.current)) {
1126
- p.preventDefault(), s.current = {
1127
- id: p.pointerId,
1128
- bounds: p.currentTarget.getBoundingClientRect(),
1303
+ onPointerDown: (d) => {
1304
+ if (!(n || d.button !== 0 || c.current)) {
1305
+ d.preventDefault(), c.current = {
1306
+ id: d.pointerId,
1307
+ bounds: d.currentTarget.getBoundingClientRect(),
1129
1308
  repeated: !1
1130
1309
  }, v(!0);
1131
1310
  try {
1132
- p.currentTarget.setPointerCapture?.(p.pointerId);
1311
+ d.currentTarget.setPointerCapture?.(d.pointerId);
1133
1312
  } catch {
1134
1313
  }
1135
1314
  if (r) {
1136
- const l = () => {
1137
- s.current && (s.current.repeated = !0, a.current(), i.current = setTimeout(l, 65));
1315
+ const i = () => {
1316
+ c.current && (c.current.repeated = !0, a.current(), l.current = setTimeout(i, 65));
1138
1317
  };
1139
- i.current = setTimeout(l, 450);
1318
+ l.current = setTimeout(i, 450);
1140
1319
  }
1141
1320
  }
1142
1321
  },
1143
- onPointerMove: (p) => {
1144
- s.current?.id === p.pointerId && !m(p) && c();
1322
+ onPointerMove: (d) => {
1323
+ c.current?.id === d.pointerId && !w(d) && u();
1145
1324
  },
1146
- onPointerUp: (p) => {
1147
- if (s.current?.id !== p.pointerId) return;
1148
- const l = !n && m(p) && !s.current.repeated;
1149
- c(), l && a.current();
1325
+ onPointerUp: (d) => {
1326
+ if (c.current?.id !== d.pointerId) return;
1327
+ const i = !n && w(d) && !c.current.repeated;
1328
+ u(), i && a.current();
1150
1329
  },
1151
- onPointerCancel: (p) => {
1152
- s.current?.id === p.pointerId && c();
1330
+ onPointerCancel: (d) => {
1331
+ c.current?.id === d.pointerId && u();
1153
1332
  },
1154
- onLostPointerCapture: (p) => {
1155
- s.current?.id === p.pointerId && c();
1333
+ onLostPointerCapture: (d) => {
1334
+ c.current?.id === d.pointerId && u();
1156
1335
  },
1157
- onPointerLeave: (p) => {
1158
- s.current?.id === p.pointerId && !m(p) && c();
1336
+ onPointerLeave: (d) => {
1337
+ c.current?.id === d.pointerId && !w(d) && u();
1159
1338
  },
1160
- onClick: (p) => {
1161
- !n && p.detail === 0 && !s.current && a.current();
1339
+ onClick: (d) => {
1340
+ !n && d.detail === 0 && !c.current && a.current();
1162
1341
  }
1163
1342
  };
1164
1343
  }
1165
- const Ce = {
1344
+ const Re = {
1166
1345
  Shift: "Shift",
1167
1346
  HangulMode: "한영 전환",
1168
1347
  Backspace: "지우기",
@@ -1181,30 +1360,32 @@ const Ce = {
1181
1360
  Redo: "다시 실행",
1182
1361
  SelectAll: "전체 선택"
1183
1362
  };
1184
- function Ne({
1363
+ function Me({
1185
1364
  cell: e,
1186
1365
  label: n,
1187
1366
  value: r,
1188
1367
  active: a,
1189
- disabled: i,
1190
- dispatch: s
1368
+ disabled: l,
1369
+ busy: c,
1370
+ dispatch: f
1191
1371
  }) {
1192
- const f = Ae(s, {
1193
- disabled: i,
1372
+ const { locale: v } = xe(), u = (s) => je(s, v), w = Be(f, {
1373
+ disabled: l,
1194
1374
  repeat: ["Backspace", "Delete", "ArrowLeft", "ArrowRight"].includes(r)
1195
- }), v = e.type === "action" && r === "HangulMode", c = e.type === "action" && (r === "Backspace" && (!e.label || e.label === "⌫") || r === "Delete" && (!e.label || e.label === "⌦"));
1375
+ }), d = e.type === "action" && r === "HangulMode", i = e.type === "action" && (r === "Backspace" && (!e.label || e.label === "⌫") || r === "Delete" && (!e.label || e.label === "⌦"));
1196
1376
  return /* @__PURE__ */ T(
1197
1377
  "button",
1198
1378
  {
1199
1379
  type: "button",
1200
- disabled: i,
1201
- "aria-label": Ce[r] ?? n,
1380
+ disabled: l,
1381
+ "aria-label": u(Re[r] ?? n),
1202
1382
  "aria-pressed": a,
1203
- className: v ? "key action language" : e.type === "action" ? "key action" : "key",
1204
- title: v ? i ? `${a ? "한국어" : "영어"} 전용` : `${a ? "영어" : "한국어"}로 전환` : void 0,
1383
+ "aria-busy": c || void 0,
1384
+ className: d ? "key action language" : e.type === "action" ? "key action" : "key",
1385
+ title: d ? l ? v === "en" ? `${a ? "Korean" : "English"} only` : `${a ? "한국어" : "영어"} 전용` : v === "en" ? `Switch to ${a ? "English" : "Korean"}` : `${a ? "영어" : "한국어"}로 전환` : void 0,
1205
1386
  style: { flex: e.width && e.width > 0 ? e.width : 1 },
1206
- ...f,
1207
- children: c ? /* @__PURE__ */ q(
1387
+ ...w,
1388
+ children: c ? u("읽는 중…") : i ? /* @__PURE__ */ X(
1208
1389
  "svg",
1209
1390
  {
1210
1391
  "data-key-icon": r === "Backspace" ? "backspace" : "delete",
@@ -1224,8 +1405,8 @@ function Ne({
1224
1405
  /* @__PURE__ */ T("path", { d: "m12 9 6 6m0-6-6 6" })
1225
1406
  ]
1226
1407
  }
1227
- ) : v && !e.label ? /* @__PURE__ */ q("span", { className: "language-label", "aria-hidden": "true", children: [
1228
- /* @__PURE__ */ q(
1408
+ ) : d && !e.label ? /* @__PURE__ */ X("span", { className: "language-label", "aria-hidden": "true", children: [
1409
+ /* @__PURE__ */ X(
1229
1410
  "svg",
1230
1411
  {
1231
1412
  width: "19",
@@ -1245,85 +1426,85 @@ function Ne({
1245
1426
  }
1246
1427
  ),
1247
1428
  /* @__PURE__ */ T("span", { children: a ? "한" : "EN" })
1248
- ] }) : n
1429
+ ] }) : e.type === "action" ? u(n) : n
1249
1430
  }
1250
1431
  );
1251
1432
  }
1252
- function mt({
1433
+ function Pt({
1253
1434
  layout: e,
1254
1435
  viewport: n,
1255
1436
  onHeightChange: r
1256
1437
  }) {
1257
- const a = Ze(), {
1258
- inputRef: i,
1259
- hangulMode: s,
1260
- shift: f,
1261
- shiftLocked: v,
1262
- theme: c,
1263
- selectionMode: m,
1264
- selectionAdjusting: p,
1265
- activeInputPolicy: l,
1266
- editingStatus: u,
1267
- onBlur: V
1268
- } = a, w = I(null), [Q, H] = P(!1), le = Ae(() => H((g) => !g)), te = Ae(() => V(!0)), F = ["text", "hangul", "custom"].includes(
1269
- l.mode
1270
- ), oe = Q && F && !m ? gt : e;
1271
- z(() => {
1272
- if (!w.current) return;
1438
+ const a = xe(), l = (g) => je(g, a.locale), {
1439
+ inputRef: c,
1440
+ hangulMode: f,
1441
+ shift: v,
1442
+ shiftLocked: u,
1443
+ theme: w,
1444
+ selectionMode: d,
1445
+ selectionAdjusting: i,
1446
+ activeInputPolicy: s,
1447
+ editingStatus: h,
1448
+ onBlur: C
1449
+ } = a, $ = P(null), [U, Y] = B(!1), oe = Be(() => Y((g) => !g)), q = Be(() => C(!0)), O = ["text", "hangul", "custom"].includes(
1450
+ s.mode
1451
+ ), ee = U && O && !d ? Lt : e;
1452
+ R(() => {
1453
+ if (!$.current) return;
1273
1454
  const g = () => {
1274
- const y = w.current?.getBoundingClientRect().height ?? 0;
1275
- r(y);
1455
+ const L = $.current?.getBoundingClientRect().height ?? 0;
1456
+ r(L);
1276
1457
  };
1277
1458
  g();
1278
- const L = new ResizeObserver(g);
1279
- return L.observe(w.current), () => L.disconnect();
1280
- }, [r]), z(() => {
1459
+ const m = new ResizeObserver(g);
1460
+ return m.observe($.current), () => m.disconnect();
1461
+ }, [r]), R(() => {
1281
1462
  let g = null;
1282
- const L = /* @__PURE__ */ new Set(), y = (b) => b.composedPath().some(
1283
- (O) => O === w.current || O instanceof Element && O.hasAttribute("data-virtual-input")
1284
- ), A = (b) => {
1285
- L.add(b.pointerId), g = L.size !== 1 || b.button !== 0 || y(b) ? null : { x: b.clientX, y: b.clientY, id: b.pointerId };
1286
- }, x = (b) => {
1287
- g && g.id === b.pointerId && Math.hypot(b.clientX - g.x, b.clientY - g.y) < 10 && !y(b) && V(!0), g = null, L.delete(b.pointerId);
1288
- }, B = (b) => {
1289
- g?.id === b.pointerId && Math.hypot(b.clientX - g.x, b.clientY - g.y) >= 10 && (g = null);
1290
- }, R = () => {
1463
+ const m = /* @__PURE__ */ new Set(), L = (A) => A.composedPath().some(
1464
+ (ne) => ne === $.current || ne instanceof Element && ne.hasAttribute("data-virtual-input")
1465
+ ), k = (A) => {
1466
+ m.add(A.pointerId), g = m.size !== 1 || A.button !== 0 || L(A) ? null : { x: A.clientX, y: A.clientY, id: A.pointerId };
1467
+ }, M = (A) => {
1468
+ g && g.id === A.pointerId && Math.hypot(A.clientX - g.x, A.clientY - g.y) < 10 && !L(A) && C(!0), g = null, m.delete(A.pointerId);
1469
+ }, H = (A) => {
1470
+ g?.id === A.pointerId && Math.hypot(A.clientX - g.x, A.clientY - g.y) >= 10 && (g = null);
1471
+ }, z = () => {
1291
1472
  g = null;
1292
- }, Y = (b) => {
1293
- R(), L.delete(b.pointerId);
1294
- }, N = () => {
1295
- R(), L.clear();
1473
+ }, le = (A) => {
1474
+ z(), m.delete(A.pointerId);
1475
+ }, F = () => {
1476
+ z(), m.clear();
1296
1477
  };
1297
- return window.addEventListener("pointerdown", A, !0), window.addEventListener("pointermove", B, !0), window.addEventListener("pointerup", x, !0), window.addEventListener("pointercancel", Y, !0), window.addEventListener("scroll", R, !0), window.addEventListener("blur", N), document.addEventListener("visibilitychange", N), () => {
1298
- window.removeEventListener("pointerdown", A, !0), window.removeEventListener("pointermove", B, !0), window.removeEventListener("pointerup", x, !0), window.removeEventListener("pointercancel", Y, !0), window.removeEventListener("scroll", R, !0), window.removeEventListener("blur", N), document.removeEventListener("visibilitychange", N);
1478
+ return window.addEventListener("pointerdown", k, !0), window.addEventListener("pointermove", H, !0), window.addEventListener("pointerup", M, !0), window.addEventListener("pointercancel", le, !0), window.addEventListener("scroll", z, !0), window.addEventListener("blur", F), document.addEventListener("visibilitychange", F), () => {
1479
+ window.removeEventListener("pointerdown", k, !0), window.removeEventListener("pointermove", H, !0), window.removeEventListener("pointerup", M, !0), window.removeEventListener("pointercancel", le, !0), window.removeEventListener("scroll", z, !0), window.removeEventListener("blur", F), document.removeEventListener("visibilitychange", F);
1299
1480
  };
1300
- }, [V]);
1301
- const X = (g) => {
1302
- const L = je(g, s, f);
1481
+ }, [C]);
1482
+ const te = (g) => {
1483
+ const m = Oe(g, f, v);
1303
1484
  if (g.type !== "action") {
1304
- i.current?.insertText(L, we(L)), a.consumeShift();
1485
+ c.current?.insertText(m, Se(m)), a.consumeShift();
1305
1486
  return;
1306
1487
  }
1307
- switch (L) {
1488
+ switch (m) {
1308
1489
  case "Undo":
1309
- i.current?.undo();
1490
+ c.current?.undo();
1310
1491
  break;
1311
1492
  case "Redo":
1312
- i.current?.redo();
1493
+ c.current?.redo();
1313
1494
  break;
1314
1495
  case "SelectAll":
1315
- i.current?.selectAll();
1496
+ c.current?.selectAll();
1316
1497
  break;
1317
1498
  case "Shift":
1318
1499
  a.toggleShift();
1319
1500
  break;
1320
1501
  case "HangulMode":
1321
- i.current?.handleKeyDown(
1322
- new KeyboardEvent("keydown", { key: L })
1502
+ c.current?.handleKeyDown(
1503
+ new KeyboardEvent("keydown", { key: m })
1323
1504
  );
1324
1505
  break;
1325
1506
  case "EnterSelectionMode":
1326
- H(!1), a.enterSelectionMode();
1507
+ Y(!1), a.enterSelectionMode();
1327
1508
  break;
1328
1509
  case "ExitSelectionMode":
1329
1510
  a.exitSelectionMode();
@@ -1332,26 +1513,28 @@ function mt({
1332
1513
  a.toggleSelectionAdjust();
1333
1514
  break;
1334
1515
  case "Copy":
1335
- i.current?.copySelection();
1516
+ c.current?.copySelection();
1336
1517
  break;
1337
1518
  case "Paste":
1338
- i.current?.pasteClipboard();
1519
+ c.current?.pasteClipboard();
1339
1520
  break;
1340
1521
  case "Cut":
1341
- i.current?.cutSelection();
1522
+ c.current?.cutSelection();
1342
1523
  break;
1343
1524
  case "ArrowLeft":
1344
- i.current?.moveCaret("left", p);
1525
+ c.current?.moveCaret("left", i);
1345
1526
  break;
1346
1527
  case "ArrowRight":
1347
- i.current?.moveCaret("right", p);
1528
+ c.current?.moveCaret("right", i);
1348
1529
  break;
1349
1530
  default:
1350
- L === " " ? i.current?.insertText(" ") : i.current?.handleKeyDown(
1351
- new KeyboardEvent("keydown", { key: L })
1531
+ m === " " ? c.current?.insertText(" ") : c.current?.handleKeyDown(
1532
+ new KeyboardEvent("keydown", { key: m })
1352
1533
  );
1353
1534
  }
1354
- }, J = me(l.mode) !== null, ue = {
1535
+ }, G = Ee(s.mode) !== null, ie = [l("복사했어요"), l("붙여넣었어요")].includes(
1536
+ h.message
1537
+ ), ue = {
1355
1538
  position: "fixed",
1356
1539
  zIndex: 9999,
1357
1540
  boxSizing: "border-box",
@@ -1362,22 +1545,22 @@ function mt({
1362
1545
  ...n.height ? { top: n.offsetTop + n.height } : { bottom: 0 },
1363
1546
  maxHeight: n.height ? n.height * 0.65 : "65dvh",
1364
1547
  overflowY: "auto",
1365
- colorScheme: c,
1366
- background: c === "dark" ? "#18201f" : "#e9eeeb",
1367
- color: c === "dark" ? "#eef4ef" : "#203b31",
1368
- border: "1px solid " + (c === "dark" ? "#35413c" : "#c8d3cb"),
1548
+ colorScheme: w,
1549
+ background: w === "dark" ? "#18201f" : "#e9eeeb",
1550
+ color: w === "dark" ? "#eef4ef" : "#203b31",
1551
+ border: "1px solid " + (w === "dark" ? "#35413c" : "#c8d3cb"),
1369
1552
  borderRadius: "20px 20px 0 0",
1370
1553
  boxShadow: "0 -8px 48px #10251a20",
1371
1554
  touchAction: "manipulation",
1372
1555
  userSelect: "none",
1373
1556
  WebkitUserSelect: "none"
1374
1557
  };
1375
- return Te(
1558
+ return Fe(
1376
1559
  /* @__PURE__ */ T(
1377
- vt,
1560
+ At,
1378
1561
  {
1379
1562
  tagName: "virtual-keypad",
1380
- hostRef: w,
1563
+ hostRef: $,
1381
1564
  "data-virtual-keypad": "true",
1382
1565
  style: ue,
1383
1566
  onPointerDown: (g) => {
@@ -1388,7 +1571,7 @@ function mt({
1388
1571
  },
1389
1572
  onBlur: a.onBlur,
1390
1573
  onKeyDown: (g) => {
1391
- g.key === "Escape" && (g.preventDefault(), V(!0));
1574
+ g.key === "Escape" && (g.preventDefault(), C(!0));
1392
1575
  },
1393
1576
  css: `
1394
1577
  * {
@@ -1412,6 +1595,23 @@ function mt({
1412
1595
  .toolbar span {
1413
1596
  opacity: 0.75;
1414
1597
  }
1598
+ .toolbar-caption {
1599
+ flex: 1;
1600
+ min-width: 0;
1601
+ overflow: hidden;
1602
+ white-space: nowrap;
1603
+ text-overflow: ellipsis;
1604
+ }
1605
+ .toolbar > .close,
1606
+ .paste-action {
1607
+ flex-shrink: 0;
1608
+ }
1609
+ .paste-action .key {
1610
+ padding: 8px 10px;
1611
+ font-size: 12px;
1612
+ box-shadow: none;
1613
+ white-space: nowrap;
1614
+ }
1415
1615
  .close {
1416
1616
  background: transparent;
1417
1617
  color: inherit;
@@ -1436,9 +1636,9 @@ function mt({
1436
1636
  min-height: 44px;
1437
1637
  border: 0;
1438
1638
  border-radius: 8px;
1439
- background: ${c === "dark" ? "#303c37" : "#fff"};
1639
+ background: ${w === "dark" ? "#303c37" : "#fff"};
1440
1640
  color: inherit;
1441
- box-shadow: 0 2px 0 ${c === "dark" ? "#0d1611" : "#bdc9c1"};
1641
+ box-shadow: 0 2px 0 ${w === "dark" ? "#0d1611" : "#bdc9c1"};
1442
1642
  font: inherit;
1443
1643
  padding: 8px 0;
1444
1644
  touch-action: none;
@@ -1446,7 +1646,7 @@ function mt({
1446
1646
  user-select: none;
1447
1647
  }
1448
1648
  .action {
1449
- background: ${c === "dark" ? "#414e46" : "#d7e1db"};
1649
+ background: ${w === "dark" ? "#414e46" : "#d7e1db"};
1450
1650
  font-size: 14px;
1451
1651
  }
1452
1652
  .selection-count {
@@ -1518,15 +1718,15 @@ function mt({
1518
1718
  }
1519
1719
  }
1520
1720
  `,
1521
- children: /* @__PURE__ */ q("section", { className: "keyboard", role: "group", "aria-label": "가상 키보드", children: [
1522
- /* @__PURE__ */ q("div", { className: "toolbar", children: [
1523
- u.selectionLength > 0 && !m ? /* @__PURE__ */ q(Me, { children: [
1721
+ children: /* @__PURE__ */ X("section", { className: "keyboard", role: "group", "aria-label": l("가상 키보드"), children: [
1722
+ /* @__PURE__ */ X("div", { className: "toolbar", children: [
1723
+ h.selectionLength > 0 && !d ? /* @__PURE__ */ X(He, { children: [
1524
1724
  /* @__PURE__ */ T(
1525
1725
  "span",
1526
1726
  {
1527
1727
  className: "selection-count",
1528
- title: u.message || void 0,
1529
- children: u.message === "복사했어요" ? "복사했어요" : `${u.selectionLength}자 선택`
1728
+ title: h.message || void 0,
1729
+ children: ie ? h.message : a.locale === "en" ? `${h.selectionLength} characters selected` : `${h.selectionLength}자 선택`
1530
1730
  }
1531
1731
  ),
1532
1732
  /* @__PURE__ */ T(
@@ -1534,32 +1734,45 @@ function mt({
1534
1734
  {
1535
1735
  className: "selection-actions",
1536
1736
  role: "group",
1537
- "aria-label": "선택한 텍스트 편집",
1538
- children: ["Copy", "Cut", "SelectAll"].map((g) => /* @__PURE__ */ T(
1539
- Ne,
1737
+ "aria-label": l("선택한 텍스트 편집"),
1738
+ children: ["Copy", "Cut", "Paste"].map((g) => /* @__PURE__ */ T(
1739
+ Me,
1540
1740
  {
1541
1741
  cell: { value: g, type: "action" },
1542
1742
  value: g,
1543
- label: Ce[g],
1544
- dispatch: () => X({ value: g, type: "action" })
1743
+ label: l(Re[g]),
1744
+ disabled: g === "Paste" && h.pasting,
1745
+ busy: g === "Paste" && h.pasting,
1746
+ dispatch: () => te({ value: g, type: "action" })
1545
1747
  },
1546
1748
  g
1547
1749
  ))
1548
1750
  }
1549
1751
  )
1550
- ] }) : /* @__PURE__ */ q("span", { children: [
1551
- m ? u.message === "복사했어요" ? "복사했어요" : "텍스트 편집" : Q && F ? "숫자 · 기호" : l.mode === "number" ? "숫자" : l.mode === "tel" ? "전화번호" : s ? "한국어 · 두벌식" : "English",
1552
- v ? " · Shift 고정" : ""
1752
+ ] }) : /* @__PURE__ */ X("span", { className: "toolbar-caption", children: [
1753
+ ie ? h.message : d ? l("텍스트 편집") : U && O ? l("숫자 · 기호") : s.mode === "number" ? l("숫자") : s.mode === "tel" ? l("전화번호") : f ? l("한국어 · 두벌식") : "English",
1754
+ u ? l(" · Shift 고정") : ""
1553
1755
  ] }),
1554
- F && !m && !u.selectionLength && /* @__PURE__ */ T(
1756
+ !d && !h.selectionLength && /* @__PURE__ */ T("div", { className: "paste-action", children: /* @__PURE__ */ T(
1757
+ Me,
1758
+ {
1759
+ cell: { value: "Paste", type: "action" },
1760
+ value: "Paste",
1761
+ label: l("붙여넣기"),
1762
+ disabled: h.pasting,
1763
+ busy: h.pasting,
1764
+ dispatch: () => te({ value: "Paste", type: "action" })
1765
+ }
1766
+ ) }),
1767
+ O && !d && !h.selectionLength && /* @__PURE__ */ T(
1555
1768
  "button",
1556
1769
  {
1557
1770
  type: "button",
1558
1771
  className: "close",
1559
- "aria-label": "숫자·기호 전환",
1560
- "aria-pressed": Q,
1561
- ...le,
1562
- children: Q ? "가 / ABC" : "123 / #+="
1772
+ "aria-label": l("숫자·기호 전환"),
1773
+ "aria-pressed": U,
1774
+ ...oe,
1775
+ children: U ? "가 / ABC" : "123 / #+="
1563
1776
  }
1564
1777
  ),
1565
1778
  /* @__PURE__ */ T(
@@ -1567,80 +1780,81 @@ function mt({
1567
1780
  {
1568
1781
  type: "button",
1569
1782
  className: "close",
1570
- ...te,
1571
- "aria-label": "키보드 닫기",
1572
- children: "닫기 ↓"
1783
+ ...q,
1784
+ "aria-label": l("키보드 닫기"),
1785
+ children: l("닫기 ↓")
1573
1786
  }
1574
1787
  )
1575
1788
  ] }),
1576
- u.message && u.message !== "복사했어요" && /* @__PURE__ */ T("p", { className: "feedback", children: u.message }),
1577
- oe.map((g, L) => /* @__PURE__ */ T("div", { className: "row", children: g.map((y, A) => {
1578
- const x = je(y, s, f), B = y.type === "action" ? y.label ?? Ce[x] ?? x : /^[A-Za-z]$/.test(y.value) ? x : y.label ?? x, R = y.value === "Shift" ? f : y.value === "HangulMode" ? s : y.value === "ToggleSelectionAdjust" ? p : void 0;
1789
+ h.message && !ie && /* @__PURE__ */ T("p", { className: "feedback", children: h.message }),
1790
+ ee.map((g, m) => /* @__PURE__ */ T("div", { className: "row", children: g.map((L, k) => {
1791
+ const M = Oe(L, f, v), H = L.type === "action" ? L.label ?? Re[M] ?? M : /^[A-Za-z]$/.test(L.value) ? M : L.label ?? M, z = L.value === "Shift" ? v : L.value === "HangulMode" ? f : L.value === "ToggleSelectionAdjust" ? i : void 0;
1579
1792
  return /* @__PURE__ */ T(
1580
- Ne,
1793
+ Me,
1581
1794
  {
1582
- cell: y,
1583
- label: B,
1584
- value: x,
1585
- active: R,
1586
- disabled: y.value === "HangulMode" && J || ["Copy", "Cut"].includes(x) && !u.selectionLength || x === "SelectAll" && !u.hasValue || (y.type !== "action" || x === " ") && !l.filterKey(x),
1587
- dispatch: () => X(y)
1795
+ cell: L,
1796
+ label: H,
1797
+ value: M,
1798
+ active: z,
1799
+ busy: M === "Paste" && h.pasting,
1800
+ disabled: M === "Paste" && h.pasting || L.value === "HangulMode" && G || ["Copy", "Cut"].includes(M) && !h.selectionLength || M === "SelectAll" && !h.hasValue || (L.type !== "action" || M === " ") && !s.filterKey(M),
1801
+ dispatch: () => te(L)
1588
1802
  },
1589
- `${L}-${A}-${y.value}`
1803
+ `${m}-${k}-${L.value}`
1590
1804
  );
1591
- }) }, L))
1805
+ }) }, m))
1592
1806
  ] })
1593
1807
  }
1594
1808
  ),
1595
1809
  document.body
1596
1810
  );
1597
1811
  }
1598
- const ke = "virtual-keyboard:storage";
1599
- function wt(e, n) {
1600
- const r = I(n), [a, i] = P(n), s = I(a), f = S(
1812
+ const Ke = "virtual-keyboard:storage";
1813
+ function Tt(e, n) {
1814
+ const r = P(n), [a, l] = B(n), c = P(a), f = E(
1601
1815
  () => r.current instanceof Function ? r.current() : r.current,
1602
1816
  []
1603
1817
  );
1604
- z(() => {
1605
- const c = (u) => {
1818
+ R(() => {
1819
+ const u = (s) => {
1606
1820
  try {
1607
- const V = u === null ? f() : JSON.parse(u);
1608
- return typeof V == typeof f() ? V : f();
1821
+ const h = s === null ? f() : JSON.parse(s);
1822
+ return typeof h == typeof f() ? h : f();
1609
1823
  } catch {
1610
1824
  return f();
1611
1825
  }
1612
- }, m = (u) => {
1613
- s.current = c(u), i(s.current);
1826
+ }, w = (s) => {
1827
+ c.current = u(s), l(c.current);
1614
1828
  };
1615
1829
  try {
1616
- m(window.localStorage.getItem(e));
1830
+ w(window.localStorage.getItem(e));
1617
1831
  } catch {
1618
1832
  }
1619
- const p = (u) => {
1833
+ const d = (s) => {
1620
1834
  try {
1621
- if (u.storageArea && u.storageArea !== window.localStorage)
1835
+ if (s.storageArea && s.storageArea !== window.localStorage)
1622
1836
  return;
1623
1837
  } catch {
1624
1838
  return;
1625
1839
  }
1626
- (u.key === e || u.key === null) && m(u.newValue);
1627
- }, l = (u) => {
1628
- const V = u.detail;
1629
- V.key === e && m(V.raw);
1840
+ (s.key === e || s.key === null) && w(s.newValue);
1841
+ }, i = (s) => {
1842
+ const h = s.detail;
1843
+ h.key === e && w(h.raw);
1630
1844
  };
1631
- return window.addEventListener("storage", p), window.addEventListener(ke, l), () => {
1632
- window.removeEventListener("storage", p), window.removeEventListener(ke, l);
1845
+ return window.addEventListener("storage", d), window.addEventListener(Ke, i), () => {
1846
+ window.removeEventListener("storage", d), window.removeEventListener(Ke, i);
1633
1847
  };
1634
1848
  }, [e, f]);
1635
- const v = S(
1636
- (c) => {
1637
- s.current = c instanceof Function ? c(s.current) : c, i(s.current), window.dispatchEvent(
1638
- new CustomEvent(ke, {
1639
- detail: { key: e, raw: JSON.stringify(s.current) }
1849
+ const v = E(
1850
+ (u) => {
1851
+ c.current = u instanceof Function ? u(c.current) : u, l(c.current), window.dispatchEvent(
1852
+ new CustomEvent(Ke, {
1853
+ detail: { key: e, raw: JSON.stringify(c.current) }
1640
1854
  })
1641
1855
  );
1642
1856
  try {
1643
- window.localStorage.setItem(e, JSON.stringify(s.current));
1857
+ window.localStorage.setItem(e, JSON.stringify(c.current));
1644
1858
  } catch {
1645
1859
  }
1646
1860
  },
@@ -1648,7 +1862,7 @@ function wt(e, n) {
1648
1862
  );
1649
1863
  return [a, v];
1650
1864
  }
1651
- const yt = [
1865
+ const Mt = [
1652
1866
  [
1653
1867
  {
1654
1868
  label: "전체 선택",
@@ -1728,7 +1942,7 @@ const yt = [
1728
1942
  type: "action"
1729
1943
  }
1730
1944
  ]
1731
- ], bt = () => typeof window > "u" ? { width: 0, height: 0, scale: 1, offsetLeft: 0, offsetTop: 0 } : typeof window < "u" && window.visualViewport ? {
1945
+ ], Kt = () => typeof window > "u" ? { width: 0, height: 0, scale: 1, offsetLeft: 0, offsetTop: 0 } : typeof window < "u" && window.visualViewport ? {
1732
1946
  width: window.visualViewport.width,
1733
1947
  height: window.visualViewport.height,
1734
1948
  scale: window.visualViewport.scale,
@@ -1740,196 +1954,199 @@ const yt = [
1740
1954
  scale: 1,
1741
1955
  offsetLeft: 0,
1742
1956
  offsetTop: 0
1743
- }, xt = (e, n) => e.width === n.width && e.height === n.height && e.scale === n.scale && e.offsetLeft === n.offsetLeft && e.offsetTop === n.offsetTop, kt = () => {
1744
- const [e, n] = P(() => ({
1957
+ }, It = (e, n) => e.width === n.width && e.height === n.height && e.scale === n.scale && e.offsetLeft === n.offsetLeft && e.offsetTop === n.offsetTop, Vt = () => {
1958
+ const [e, n] = B(() => ({
1745
1959
  width: 0,
1746
1960
  height: 0,
1747
1961
  scale: 1,
1748
1962
  offsetLeft: 0,
1749
1963
  offsetTop: 0
1750
1964
  }));
1751
- return z(() => {
1965
+ return R(() => {
1752
1966
  if (typeof window > "u") return;
1753
1967
  let r = null;
1754
1968
  const a = () => {
1755
- const s = bt();
1969
+ const c = Kt();
1756
1970
  n(
1757
- (f) => xt(f, s) ? f : s
1971
+ (f) => It(f, c) ? f : c
1758
1972
  );
1759
1973
  };
1760
1974
  a();
1761
- const i = () => {
1975
+ const l = () => {
1762
1976
  r !== null && cancelAnimationFrame(r), r = requestAnimationFrame(a);
1763
1977
  };
1764
- return window.visualViewport ? (window.visualViewport.addEventListener("resize", i, {
1978
+ return window.visualViewport ? (window.visualViewport.addEventListener("resize", l, {
1765
1979
  passive: !0
1766
- }), window.visualViewport.addEventListener("scroll", i, {
1980
+ }), window.visualViewport.addEventListener("scroll", l, {
1767
1981
  passive: !0
1768
- })) : window.addEventListener("resize", i, { passive: !0 }), () => {
1769
- r !== null && cancelAnimationFrame(r), window.visualViewport ? (window.visualViewport.removeEventListener("resize", i), window.visualViewport.removeEventListener("scroll", i)) : window.removeEventListener("resize", i);
1982
+ })) : window.addEventListener("resize", l, { passive: !0 }), () => {
1983
+ r !== null && cancelAnimationFrame(r), window.visualViewport ? (window.visualViewport.removeEventListener("resize", l), window.visualViewport.removeEventListener("scroll", l)) : window.removeEventListener("resize", l);
1770
1984
  };
1771
1985
  }, []), e;
1772
1986
  };
1773
- function Et() {
1774
- const [e, n] = P("light");
1775
- return z(() => {
1987
+ function Dt() {
1988
+ const [e, n] = B("light");
1989
+ return R(() => {
1776
1990
  if (typeof window > "u" || !window.matchMedia) return;
1777
1991
  const r = window.matchMedia("(prefers-color-scheme: dark)");
1778
1992
  n(r.matches ? "dark" : "light");
1779
- const a = (i) => {
1780
- n(i.matches ? "dark" : "light");
1993
+ const a = (l) => {
1994
+ n(l.matches ? "dark" : "light");
1781
1995
  };
1782
1996
  return r.addEventListener("change", a), () => r.removeEventListener("change", a);
1783
1997
  }, []), e;
1784
1998
  }
1785
- function Xe(e) {
1999
+ function rt(e) {
1786
2000
  return e !== void 0 ? /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
1787
2001
  e
1788
- ) : typeof navigator > "u" ? !1 : Xe(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 || typeof window < "u" && !!window.matchMedia?.("(pointer: coarse)").matches;
2002
+ ) : typeof navigator > "u" ? !1 : rt(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 || typeof window < "u" && !!window.matchMedia?.("(pointer: coarse)").matches;
1789
2003
  }
1790
- const Ee = "virtual-keyboard:focus-change";
1791
- function Tt({
2004
+ const Ie = "virtual-keyboard:focus-change";
2005
+ function jt({
1792
2006
  children: e,
1793
- layout: n = re,
1794
- defaultHangulMode: r = !0,
1795
- theme: a,
1796
- keyboardVisibility: i = "auto"
2007
+ locale: n = "ko",
2008
+ layout: r = ce,
2009
+ defaultHangulMode: a = !0,
2010
+ theme: l,
2011
+ keyboardVisibility: c = "auto"
1797
2012
  }) {
1798
- const s = $e(), f = I(null), v = I(null), c = I(
2013
+ const f = et(), v = P(null), u = P(null), w = P(
1799
2014
  void 0
1800
- ), [m, p] = P(), [l, u] = P(0), [V, w] = P(!1), [Q, H] = P(!1), [le, te] = P({
2015
+ ), [d, i] = B(), [s, h] = B(0), [C, $] = B(!1), [U, Y] = B(!1), [oe, q] = B({
1801
2016
  selectionLength: 0,
1802
2017
  hasValue: !1,
1803
- message: ""
1804
- }), F = S((h) => {
1805
- te(
1806
- (k) => k.selectionLength === h.selectionLength && k.hasValue === h.hasValue && k.message === h.message ? k : h
2018
+ message: "",
2019
+ pasting: !1
2020
+ }), O = E((y) => {
2021
+ q(
2022
+ (b) => b.selectionLength === y.selectionLength && b.hasValue === y.hasValue && b.message === y.message && b.pasting === y.pasting ? b : y
1807
2023
  );
1808
- }, []), [oe, X] = wt(
2024
+ }, []), [ee, te] = Tt(
1809
2025
  "virtual-keyboard-hangul-mode",
1810
- r
1811
- ), [J, ue] = P(
1812
- () => Se({ layout: n })
1813
- ), [g, L] = P(!1), [y, A] = P(0), x = kt(), B = Et(), R = me(J.mode) ?? oe, Y = !!m && (i === "always" || i === "auto" && g), N = I(Y);
1814
- N.current = Y, z(() => {
1815
- const h = () => L(Xe());
1816
- h();
1817
- const k = window.matchMedia?.("(pointer: coarse)");
1818
- return k?.addEventListener("change", h), () => k?.removeEventListener("change", h);
2026
+ a
2027
+ ), [G, ie] = B(
2028
+ () => Ve({ layout: r })
2029
+ ), [ue, g] = B(!1), [m, L] = B(0), k = Vt(), M = Dt(), H = Ee(G.mode) ?? ee, z = !!d && (c === "always" || c === "auto" && ue), le = P(z);
2030
+ le.current = z, R(() => {
2031
+ const y = () => g(rt());
2032
+ y();
2033
+ const b = window.matchMedia?.("(pointer: coarse)");
2034
+ return b?.addEventListener("change", y), () => b?.removeEventListener("change", y);
1819
2035
  }, []);
1820
- const b = S(() => {
1821
- clearTimeout(c.current), v.current = null, f.current = null, p(void 0), u(0), w(!1), H(!1);
2036
+ const F = E(() => {
2037
+ clearTimeout(w.current), u.current = null, v.current = null, i(void 0), h(0), $(!1), Y(!1);
1822
2038
  }, []);
1823
- z(() => {
1824
- const h = (k) => {
1825
- k.detail !== s && b();
2039
+ R(() => {
2040
+ const y = (b) => {
2041
+ b.detail !== f && F();
1826
2042
  };
1827
- return window.addEventListener(Ee, h), () => {
1828
- window.removeEventListener(Ee, h), clearTimeout(c.current);
2043
+ return window.addEventListener(Ie, y), () => {
2044
+ window.removeEventListener(Ie, y), clearTimeout(w.current);
1829
2045
  };
1830
- }, [s, b]);
1831
- const O = S(
1832
- (h, k, $) => {
1833
- clearTimeout(c.current), v.current !== k && (u(0), w(!1), H(!1)), v.current = k, ue(Se($)), p(h), window.dispatchEvent(
1834
- new CustomEvent(Ee, { detail: s })
2046
+ }, [f, F]);
2047
+ const A = E(
2048
+ (y, b, N) => {
2049
+ clearTimeout(w.current), u.current !== b && (h(0), $(!1), Y(!1)), u.current = b, ie(Ve(N)), i(y), window.dispatchEvent(
2050
+ new CustomEvent(Ie, { detail: f })
1835
2051
  );
1836
2052
  },
1837
- [s]
1838
- ), U = S(
1839
- (h) => {
1840
- if (h === !0) {
1841
- const $ = document.activeElement, j = $ instanceof HTMLElement && v.current?.contains($);
1842
- b(), j && $.blur();
2053
+ [f]
2054
+ ), ne = E(
2055
+ (y) => {
2056
+ if (y === !0) {
2057
+ const N = document.activeElement, he = N instanceof HTMLElement && u.current?.contains(N);
2058
+ F(), he && N.blur();
1843
2059
  return;
1844
2060
  }
1845
- const k = typeof h == "object" ? h.relatedTarget : null;
1846
- k?.closest?.("[data-virtual-input], [data-virtual-keypad]") || !k && N.current || (clearTimeout(c.current), c.current = setTimeout(b, 0));
2061
+ const b = typeof y == "object" ? y.relatedTarget : null;
2062
+ b?.closest?.("[data-virtual-input], [data-virtual-keypad]") || !b && le.current || (clearTimeout(w.current), w.current = setTimeout(F, 0));
1847
2063
  },
1848
- [b]
2064
+ [F]
1849
2065
  );
1850
- z(() => {
1851
- if (!Y || !y || x.scale !== 1) return;
1852
- const h = requestAnimationFrame(() => {
1853
- const k = v.current?.getBoundingClientRect();
1854
- if (!k) return;
1855
- const $ = x.offsetTop + x.height - y - 16;
1856
- k.bottom > $ && window.scrollBy({ top: k.bottom - $, behavior: "instant" });
2066
+ R(() => {
2067
+ if (!z || !m || k.scale !== 1) return;
2068
+ const y = requestAnimationFrame(() => {
2069
+ const b = u.current?.getBoundingClientRect();
2070
+ if (!b) return;
2071
+ const N = k.offsetTop + k.height - m - 16;
2072
+ b.bottom > N && window.scrollBy({ top: b.bottom - N, behavior: "instant" });
1857
2073
  });
1858
- return () => cancelAnimationFrame(h);
2074
+ return () => cancelAnimationFrame(y);
1859
2075
  }, [
2076
+ d,
2077
+ z,
1860
2078
  m,
1861
- Y,
1862
- y,
1863
- x.height,
1864
- x.offsetTop,
1865
- x.scale
2079
+ k.height,
2080
+ k.offsetTop,
2081
+ k.scale
1866
2082
  ]);
1867
- const de = S(() => {
1868
- me(J.mode) === null && X((h) => !h);
1869
- }, [J.mode, X]), W = S(
1870
- () => u((h) => (h + 1) % 3),
2083
+ const W = E(() => {
2084
+ Ee(G.mode) === null && te((y) => !y);
2085
+ }, [G.mode, te]), ye = E(
2086
+ () => h((y) => (y + 1) % 3),
1871
2087
  []
1872
- ), d = S(
1873
- () => u((h) => h === 1 ? 0 : h),
2088
+ ), j = E(
2089
+ () => h((y) => y === 1 ? 0 : y),
1874
2090
  []
1875
- ), ne = S(() => {
1876
- w(!0), H(!1);
1877
- }, []), ie = S(() => {
1878
- w(!1), H(!1);
1879
- }, []), G = S(
1880
- () => H((h) => !h),
2091
+ ), p = E(() => {
2092
+ $(!0), Y(!1);
2093
+ }, []), fe = E(() => {
2094
+ $(!1), Y(!1);
2095
+ }, []), de = E(
2096
+ () => Y((y) => !y),
1881
2097
  []
1882
2098
  );
1883
- return /* @__PURE__ */ q(
1884
- We.Provider,
2099
+ return /* @__PURE__ */ X(
2100
+ nt.Provider,
1885
2101
  {
1886
2102
  value: {
1887
- inputRef: f,
1888
- focusId: m,
1889
- onFocus: O,
1890
- onBlur: U,
1891
- defaultLayout: n,
1892
- hangulMode: R,
1893
- shift: l > 0,
1894
- shiftLocked: l === 2,
1895
- theme: a ?? B,
1896
- toggleKorean: de,
1897
- toggleShift: W,
1898
- consumeShift: d,
1899
- selectionMode: V,
1900
- selectionAdjusting: Q,
1901
- enterSelectionMode: ne,
1902
- exitSelectionMode: ie,
1903
- toggleSelectionAdjust: G,
1904
- activeInputPolicy: J,
1905
- editingStatus: le,
1906
- setEditingStatus: F
2103
+ locale: n,
2104
+ inputRef: v,
2105
+ focusId: d,
2106
+ onFocus: A,
2107
+ onBlur: ne,
2108
+ defaultLayout: r,
2109
+ hangulMode: H,
2110
+ shift: s > 0,
2111
+ shiftLocked: s === 2,
2112
+ theme: l ?? M,
2113
+ toggleKorean: W,
2114
+ toggleShift: ye,
2115
+ consumeShift: j,
2116
+ selectionMode: C,
2117
+ selectionAdjusting: U,
2118
+ enterSelectionMode: p,
2119
+ exitSelectionMode: fe,
2120
+ toggleSelectionAdjust: de,
2121
+ activeInputPolicy: G,
2122
+ editingStatus: oe,
2123
+ setEditingStatus: O
1907
2124
  },
1908
2125
  children: [
1909
2126
  e,
1910
- Y && /* @__PURE__ */ q(Me, { children: [
1911
- Te(
2127
+ z && /* @__PURE__ */ X(He, { children: [
2128
+ Fe(
1912
2129
  /* @__PURE__ */ T(
1913
2130
  "div",
1914
2131
  {
1915
2132
  "aria-hidden": "true",
1916
2133
  style: {
1917
- height: y,
2134
+ height: m,
1918
2135
  pointerEvents: "none",
1919
- background: (a ?? B) === "dark" ? "#121c17" : "#f7f8f4"
2136
+ background: (l ?? M) === "dark" ? "#121c17" : "#f7f8f4"
1920
2137
  }
1921
2138
  }
1922
2139
  ),
1923
2140
  document.body
1924
2141
  ),
1925
2142
  /* @__PURE__ */ T(
1926
- mt,
2143
+ Pt,
1927
2144
  {
1928
- layout: V ? yt : J.layout,
1929
- viewport: x,
1930
- onHeightChange: A
2145
+ layout: C ? Mt : G.layout,
2146
+ viewport: k,
2147
+ onHeightChange: L
1931
2148
  },
1932
- m
2149
+ d
1933
2150
  )
1934
2151
  ] })
1935
2152
  ]
@@ -1937,6 +2154,6 @@ function Tt({
1937
2154
  );
1938
2155
  }
1939
2156
  export {
1940
- Mt as VirtualInput,
1941
- Tt as VirtualInputProvider
2157
+ Ft as VirtualInput,
2158
+ jt as VirtualInputProvider
1942
2159
  };