@lucian-seo/lucian-ui 0.1.4 → 0.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/README.md +35 -2
- package/dist/lib/{Menu-B3G64GV4.js → Pagination-AWL5k5zG.js} +177 -48
- package/dist/lib/{Menu-B3G64GV4.js.map → Pagination-AWL5k5zG.js.map} +1 -1
- package/dist/lib/{Toolbar-DpCq_HXG.js → Toolbar-DDOaxG3B.js} +65 -194
- package/dist/lib/Toolbar-DDOaxG3B.js.map +1 -0
- package/dist/lib/{VoiceControlBar-CZL-k7ym.js → VoiceControlBar-lMPuJMcF.js} +1767 -404
- package/dist/lib/VoiceControlBar-lMPuJMcF.js.map +1 -0
- package/dist/lib/components/composed/index.js +3 -3
- package/dist/lib/components/extended/DataGrid/DataGrid.d.ts +30 -45
- package/dist/lib/components/extended/DataGrid/DataGrid.features.d.ts +155 -0
- package/dist/lib/components/extended/DataGrid/DataGridComplete.d.ts +4 -0
- package/dist/lib/components/extended/DataGrid/index.d.ts +2 -0
- package/dist/lib/components/extended/index.js +2 -2
- package/dist/lib/index.js +4 -4
- package/dist/lib/styles.css +1 -1
- package/docs/DATAGRID.md +127 -0
- package/docs/README.md +37 -0
- package/package.json +6 -2
- package/dist/lib/Toolbar-DpCq_HXG.js.map +0 -1
- package/dist/lib/VoiceControlBar-CZL-k7ym.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VoiceControlBar-lMPuJMcF.js","names":[],"sources":["../../src/components/extended/ActivityList/ActivityList.tsx","../../src/components/extended/BackgroundProgress/BackgroundProgress.tsx","../../src/components/extended/AddressForm/AddressForm.tsx","../../src/components/extended/ApprovalGate/ApprovalGate.tsx","../../src/components/extended/Citation/Citation.tsx","../../src/components/extended/CommentThread/CommentThread.tsx","../../src/components/extended/Composer/Composer.tsx","../../src/components/extended/CouponField/CouponField.tsx","../../src/components/extended/DataGrid/DataGrid.state.ts","../../src/components/extended/DataGrid/DataGrid.features.ts","../../src/components/extended/DataGrid/DataGridComplete.tsx","../../src/components/extended/DataGrid/DataGrid.tsx","../../src/components/extended/Dropzone/Dropzone.tsx","../../src/components/extended/FeedbackControl/FeedbackControl.tsx","../../src/components/extended/FilterBuilder/FilterBuilder.tsx","../../src/components/extended/FollowUpList/FollowUpList.tsx","../../src/foundation/josa.ts","../../src/components/extended/KanbanColumn/KanbanColumn.tsx","../../src/components/extended/Message/Message.tsx","../../src/components/extended/MessageList/MessageList.tsx","../../src/components/extended/MetricCard/MetricCard.tsx","../../src/components/extended/PriceDisplay/PriceDisplay.tsx","../../src/components/extended/OrderSummary/OrderSummary.tsx","../../src/components/extended/PaymentMethodSelector/PaymentMethodSelector.tsx","../../src/components/extended/PresenceBar/PresenceBar.tsx","../../src/components/extended/ProductCard/ProductCard.tsx","../../src/components/extended/QuantityStepper/QuantityStepper.tsx","../../src/components/extended/ReasoningDisclosure/ReasoningDisclosure.tsx","../../src/components/extended/RecognitionFallback/RecognitionFallback.tsx","../../src/components/extended/RunStatusCard/RunStatusCard.tsx","../../src/components/extended/SavedViewTabs/SavedViewTabs.tsx","../../src/components/extended/SourceChip/SourceChip.tsx","../../src/components/extended/SourceChipRow/SourceChipRow.tsx","../../src/components/extended/SourcePanel/SourcePanel.tsx","../../src/components/extended/StreamingText/StreamingText.tsx","../../src/components/extended/ToolCallCard/ToolCallCard.tsx","../../src/components/extended/TranscriptSync/TranscriptSync.tsx","../../src/components/extended/TrustBlock/TrustBlock.tsx","../../src/components/extended/VoiceControlBar/VoiceControlBar.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { AlertCircle, Check, Minus } from \"lucide-react\";\nimport { Icon } from \"../../common/Icon\";\nimport { Spinner } from \"../../common/Spinner\";\nimport { VisuallyHidden } from \"../../common/VisuallyHidden\";\nimport \"./ActivityList.css\";\n\nexport type ActivityState = \"pending\" | \"running\" | \"done\" | \"failed\" | \"skipped\";\n\nexport type ActivityStep = {\n id: string;\n label: string;\n /** What it found, what it is doing — one line, under the label. */\n detail?: ReactNode;\n state: ActivityState;\n /** \"3.2초\". A string, because the component does not own a clock. */\n duration?: string;\n};\n\nexport type ActivityListProps = {\n steps: ActivityStep[];\n /** What the whole run is. Names the list. */\n label: string;\n /** Say the current step as it changes. Off for a run that has already finished. */\n announce?: boolean;\n size?: \"sm\" | \"md\";\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\nconst SAID: Record<ActivityState, string> = {\n pending: \"대기 중\",\n running: \"진행 중\",\n done: \"완료\",\n failed: \"실패\",\n skipped: \"건너뜀\",\n};\n\n/**\n * What the agent is doing, step by step.\n *\n * An ordered list, because the order is the content — and `<ol>` gives a reader \"3 중 2번째\"\n * without a word of ARIA.\n *\n * The announcement is one line, not the list. Marking the whole thing live means every state\n * change re-reads every step, and by the fourth one the reader is three steps behind what\n * they are hearing. What is announced is the step that is running now; the rest is there to\n * be read at leisure.\n *\n * The state is never only the colour. A green ring and an amber ring are the same ring to a\n * reader who cannot separate them, so the glyph differs — a tick, a cross, a dash — and the\n * state is in the accessible name in words.\n */\nexport function ActivityList({\n steps,\n label,\n announce,\n size = \"md\",\n className,\n ...rest\n}: ActivityListProps) {\n const running = steps.find((step) => step.state === \"running\");\n\n return (\n /* The spread comes first, as everywhere else in this layer: written after `data-size` it\n * let a caller's stray `data-size` replace the one the `size` prop chose, and the CSS then\n * sized a list the component believed was the other size. */\n <div {...rest} className={`activity-list ${className ?? \"\"}`.trim()} data-size={size}>\n <ol className=\"activity-list__steps\" aria-label={label}>\n {steps.map((step) => (\n <li key={step.id} className=\"activity-list__step\" data-state={step.state} data-part=\"step\">\n <span className=\"activity-list__mark\" aria-hidden=\"true\">\n {step.state === \"running\" ? (\n /* One step down from the ring, not the same number: the mark is\n * `--activity-mark` across and its border eats a token off each side, so a\n * spinner of the ring's own size overhangs it by a pixel all round. */\n <Spinner size={size === \"sm\" ? \"xs\" : \"sm\"} />\n ) : step.state === \"done\" ? (\n <Icon icon={Check} size=\"xs\" />\n ) : step.state === \"failed\" ? (\n <Icon icon={AlertCircle} size=\"xs\" />\n ) : step.state === \"skipped\" ? (\n <Icon icon={Minus} size=\"xs\" />\n ) : null}\n </span>\n <span className=\"activity-list__body\">\n <span className=\"activity-list__label\">\n {step.label}\n {/* The state in words, for the reader the ring says nothing to. */}\n <VisuallyHidden> — {SAID[step.state]}</VisuallyHidden>\n </span>\n {step.detail ? <span className=\"activity-list__detail\">{step.detail}</span> : null}\n </span>\n {step.duration ? (\n <span className=\"activity-list__duration\">{step.duration}</span>\n ) : null}\n </li>\n ))}\n </ol>\n\n {announce ? (\n <VisuallyHidden>\n <p aria-live=\"polite\">{running ? `${running.label} — 진행 중` : \"\"}</p>\n </VisuallyHidden>\n ) : null}\n </div>\n );\n}\n","import { useEffect, useRef, useState } from \"react\";\nimport { CheckCircle2, ChevronDown, X, XCircle } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport { Icon } from \"../../common/Icon\";\nimport { IconButton } from \"../../common/IconButton\";\nimport { Progress } from \"../../common/Progress\";\nimport { VisuallyHidden } from \"../../common/VisuallyHidden\";\nimport \"./BackgroundProgress.css\";\n\nexport type BackgroundJobState = \"running\" | \"done\" | \"failed\";\n\nexport type BackgroundJob = {\n id: string;\n /** What is being done, in the reader's words. A file name, a report title. */\n label: string;\n state?: BackgroundJobState;\n /**\n * How far along, 0 to 100. Omitted means there is no measurable end — which is a different\n * statement, and `Progress` draws it differently.\n */\n value?: number;\n /** One line under the label: a size, a stage, or why it failed. */\n detail?: ReactNode;\n onCancel?: () => void;\n};\n\nexport type BackgroundProgressProps = {\n /** What the batch is. \"파일 4개 업로드 중\". Names the region. */\n title: string;\n jobs: BackgroundJob[];\n /**\n * The whole batch's progress, 0 to 100.\n *\n * Taken rather than worked out. A mean of the jobs' percentages is only the batch's progress\n * when every job is the same size, and it never is — a 2 KB file and a 2 GB one at 50% each\n * is not a batch at 50%. The caller knows the weights; this does not, and a number that is\n * confidently wrong is worse than no number.\n */\n value?: number;\n /** Expanded. Collapsed, the panel is one line and a bar. */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Given, the panel can be put away. Without it there is no close button. */\n onDismiss?: () => void;\n /**\n * The viewport, or the box it was put in.\n *\n * `AppShell` learned this one: a panel with its position welded to the window cannot be\n * embedded or demonstrated. Everything in this repository that pins itself takes this.\n */\n fit?: \"viewport\" | \"container\";\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\nconst GLYPH = { done: CheckCircle2, failed: XCircle };\nconst SAID: Record<BackgroundJobState, string> = { running: \"진행 중\", done: \"완료\", failed: \"실패\" };\n\n/**\n * Work that kept going after the reader looked away.\n *\n * **It is a way back, not a notification.** A toast says a thing happened and leaves; this\n * stays because the thing has not happened yet. The reader started an upload, navigated\n * somewhere else, and the only question that matters is whether they can get back to it —\n * `docs/최신-UI-신규-컴포넌트.md` 2.2 calls that the re-entry point, and every reference\n * screen puts it in the same corner and keeps it there across navigation.\n *\n * **Collapsed is the resting state and it still reports.** A panel that hides the number when\n * it is out of the way is a panel the reader has to open to learn anything, which is the\n * interruption it was built to avoid. Collapsed shows the title and the bar; expanded adds the\n * list and the cancels.\n *\n * **A failure does not close it.** The one job that needs the reader is the one they would\n * lose if this tidied itself away on the last completion.\n */\nexport function BackgroundProgress({\n title,\n jobs,\n value,\n open = false,\n onOpenChange,\n onDismiss,\n fit = \"viewport\",\n className,\n ...rest\n}: BackgroundProgressProps) {\n const failed = jobs.filter((job) => job.state === \"failed\").length;\n const running = jobs.filter((job) => (job.state ?? \"running\") === \"running\").length;\n\n const root = useRef<HTMLElement>(null);\n\n /*\n * A job finishing is the whole point of the panel, and nothing said it.\n *\n * The reader looked away — that is the premise — so a change drawn only as a tick beside a\n * name inside a disclosure that may be shut reaches nobody who is not watching. The region\n * is mounted from the first render and empty; a region created at the moment its words are\n * is a region several screen readers never announce.\n */\n const seen = useRef(new Map<string, BackgroundJobState>());\n const [settled, setSettled] = useState(\"\");\n useEffect(() => {\n const before = seen.current;\n const lines = jobs\n .filter((job) => {\n const state = job.state ?? \"running\";\n return state !== \"running\" && before.has(job.id) && before.get(job.id) !== state;\n })\n .map((job) => `${job.label} ${SAID[job.state ?? \"running\"]}`);\n seen.current = new Map(jobs.map((job) => [job.id, job.state ?? \"running\"]));\n if (lines.length) setSettled(lines.join(\", \"));\n }, [jobs]);\n\n /*\n * Cancelling a job takes the button that was cancelled it out of the document, and focus\n * with it. The reader is left at `<body>` — at the top of the page, several tabs from the\n * panel they were working in. Focus goes to whatever took the row's place, or to the\n * disclosure if that was the last one.\n */\n const cancelled = useRef<number | null>(null);\n useEffect(() => {\n const at = cancelled.current;\n if (at === null) return;\n cancelled.current = null;\n const node = root.current;\n if (!node || document.activeElement !== document.body) return;\n const buttons = [...node.querySelectorAll<HTMLElement>('[data-part=\"cancel\"]')];\n const next = buttons[Math.min(at, buttons.length - 1)] ?? node.querySelector<HTMLElement>('[data-part=\"toggle\"]');\n next?.focus();\n }, [jobs]);\n\n return (\n <section\n {...rest}\n ref={root}\n className={`background-progress ${className ?? \"\"}`.trim()}\n data-fit={fit}\n data-open={open ? \"\" : undefined}\n data-failed={failed > 0 ? \"\" : undefined}\n aria-label={title}\n >\n {/* First, and always: the region has to have been watched before it has anything to say. */}\n <VisuallyHidden as=\"p\">\n <span role=\"status\" data-part=\"live\">\n {settled}\n </span>\n </VisuallyHidden>\n <div className=\"background-progress__head\">\n {/*\n * The disclosure is the title, so the whole line is the target rather than a chevron a\n * thumb has to find. `aria-expanded` because here there really are two states.\n */}\n <button\n type=\"button\"\n className=\"background-progress__toggle\"\n aria-expanded={open}\n onClick={() => onOpenChange?.(!open)}\n data-part=\"toggle\"\n >\n <Icon icon={ChevronDown} size=\"sm\" className=\"background-progress__chevron\" aria-hidden=\"true\" />\n <span className=\"background-progress__title\">{title}</span>\n </button>\n\n {/*\n * The count, and the failures said in words next to it. A red panel edge is a colour,\n * and the reader who cannot see it would otherwise learn nothing from a batch that\n * half failed.\n */}\n <p className=\"background-progress__count\" data-part=\"count\">\n {failed > 0 ? `${failed}개 실패 · ` : null}\n {running > 0 ? `${running}개 진행 중` : \"모두 끝남\"}\n </p>\n\n {onDismiss ? (\n <IconButton\n icon={X}\n label={`${title} 닫기`}\n size=\"sm\"\n variant=\"ghost\"\n tone=\"neutral\"\n onClick={onDismiss}\n data-part=\"dismiss\"\n />\n ) : null}\n </div>\n\n {/* Collapsed still reports: the bar is outside the disclosure on purpose. */}\n <Progress\n value={value}\n max={100}\n label={title}\n size=\"sm\"\n tone={failed > 0 ? \"danger\" : \"accent\"}\n className=\"background-progress__bar\"\n data-part=\"overall\"\n />\n\n {open ? (\n <ul className=\"background-progress__jobs\" data-part=\"jobs\">\n {jobs.map((job) => {\n const state = job.state ?? \"running\";\n return (\n <li className=\"background-progress__job\" key={job.id} data-state={state} data-part={job.id}>\n <div className=\"background-progress__job-text\">\n {/* The name is its own box, because the ellipsis has to be. `text-overflow`\n * applies to a block container and this row is a flex one — the same shape\n * `.background-progress__title` uses two elements up. */}\n <p className=\"background-progress__job-label\">\n {state === \"running\" ? null : (\n <Icon icon={GLYPH[state]} size=\"xs\" className=\"background-progress__job-glyph\" aria-hidden=\"true\" />\n )}\n <span className=\"background-progress__job-name\">{job.label}</span>\n {/* The state in words, because a tick and a cross are two shapes. */}\n <span className=\"background-progress__said\">{` — ${SAID[state]}`}</span>\n </p>\n {job.detail ? <p className=\"background-progress__job-detail\">{job.detail}</p> : null}\n </div>\n\n {state === \"running\" ? (\n <Progress\n value={job.value}\n max={100}\n label={job.label}\n size=\"sm\"\n className=\"background-progress__job-bar\"\n data-part=\"job-bar\"\n />\n ) : null}\n\n {job.onCancel && state === \"running\" ? (\n <IconButton\n icon={X}\n label={`${job.label} 취소`}\n size=\"sm\"\n variant=\"ghost\"\n tone=\"neutral\"\n onClick={(event) => {\n const buttons = [\n ...(root.current?.querySelectorAll<HTMLElement>('[data-part=\"cancel\"]') ?? []),\n ];\n cancelled.current = Math.max(0, buttons.indexOf(event.currentTarget));\n job.onCancel?.();\n }}\n data-part=\"cancel\"\n />\n ) : null}\n </li>\n );\n })}\n </ul>\n ) : null}\n </section>\n );\n}\n","import { useId } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { Button } from \"../../common/Button\";\nimport { Field } from \"../../composed/Field\";\nimport { Input } from \"../../common/Input\";\nimport { Select } from \"../../common/Select\";\nimport \"./AddressForm.css\";\n\nexport type AddressCountry = \"KR\" | \"US\";\n\nexport type Address = {\n country: AddressCountry;\n name: string;\n phone: string;\n postalCode: string;\n /** 도로명 주소 / street address. */\n line1: string;\n /** 상세주소 / apartment, suite. */\n line2: string;\n /** 시·군·구 / city. */\n city: string;\n /** 시·도 / state. Not used in the Korean layout — the postcode carries it. */\n region: string;\n};\n\nexport type AddressFormProps = {\n value: Address;\n onChange: (value: Address) => void;\n /** What this address is for. Names the group. */\n label: string;\n /**\n * Open the postcode lookup.\n *\n * In Korea an address starts here rather than ending here, and nobody types the five\n * digits — see the note.\n */\n onFindPostcode?: () => void;\n /** Per-field messages, keyed by the field's name. */\n errors?: Partial<Record<keyof Address, ReactNode>>;\n countries?: AddressCountry[];\n /**\n * The states the American layout offers, in the order they are listed.\n *\n * Six codes ship as the default because a demo needs something to open, not because six is\n * a list anybody would ship. A real form passes all fifty — which is why this is a prop and\n * not a constant in the file, where the limit was invisible until someone deployed it.\n */\n regions?: string[];\n /**\n * Prepended to every control's `name`, joined with a dot — `\"shipping\"` gives\n * `shipping.postalCode`.\n *\n * A checkout asks for two addresses on one screen, and two sets of controls called\n * `postalCode` submit one value between them. Same reason the ids are generated.\n */\n namePrefix?: string;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\nconst SAID: Record<AddressCountry, string> = { KR: \"대한민국\", US: \"미국\" };\n\n/**\n * The Korean layout puts the postcode first because that is where the address is found;\n * the American one puts the ZIP last because that is where it is checked.\n */\nconst ORDER: Record<AddressCountry, (keyof Address)[]> = {\n KR: [\"postalCode\", \"line1\", \"line2\"],\n US: [\"line1\", \"line2\", \"city\", \"region\", \"postalCode\"],\n};\n\nconst LABEL: Record<AddressCountry, Partial<Record<keyof Address, string>>> = {\n KR: { postalCode: \"우편번호\", line1: \"도로명 주소\", line2: \"상세주소\" },\n US: { line1: \"Street address\", line2: \"Apartment, suite, etc.\", city: \"City\", region: \"State\", postalCode: \"ZIP code\" },\n};\n\n/** The tokens a browser fills from. Getting these wrong is most of what makes a form slow. */\nconst AUTO: Record<keyof Address, string> = {\n country: \"country\",\n name: \"name\",\n phone: \"tel\",\n postalCode: \"postal-code\",\n line1: \"address-line1\",\n line2: \"address-line2\",\n city: \"address-level2\",\n region: \"address-level1\",\n};\n\n/** Enough to open the list. The real one is fifty, and it comes in through `regions`. */\nconst US_STATES = [\"CA\", \"NY\", \"TX\", \"WA\", \"IL\", \"MA\"];\n\n/**\n * An address, in the shape the country actually uses.\n *\n * **The shape is the whole component.** A form with 도로명 주소 · 상세주소 · 우편번호 in that\n * order is wrong in Korea and a form with Street · City · State · ZIP is wrong everywhere\n * else. The order differs, the labels differ, and which fields exist differs — the Korean\n * layout has no state field at all, because the postcode carries the province and the city\n * and asking again is asking the reader to check the system's work.\n *\n * **In Korea the postcode is found, not typed.** The five digits are looked up from the road\n * name in a dialog that every Korean shop uses, and the two address lines are filled from\n * what comes back. A Korean address form with a bare postcode text field is a form the reader\n * has to leave to use, and this is the single most common way one is got wrong.\n *\n * **Every field carries its `autocomplete` token.** That is what lets a browser fill six\n * fields in one press, and it is the difference between thirty seconds and four. The tokens\n * are not guessable — `address-level1` is the state and `address-level2` is the city, which\n * reads backwards until you know it means \"how far down the administrative tree\".\n */\nexport function AddressForm({\n value,\n onChange,\n label,\n onFindPostcode,\n errors,\n countries = [\"KR\", \"US\"],\n regions = US_STATES,\n namePrefix,\n className,\n ...rest\n}: AddressFormProps) {\n const set = (patch: Partial<Address>) => onChange({ ...value, ...patch });\n const order = ORDER[value.country];\n const labels = LABEL[value.country];\n\n /*\n * Generated, not written down.\n *\n * A checkout puts a shipping address and a billing address on one screen, and a fixed\n * `address-postal` makes the second `<label for>` point at the first form's field: pressing\n * the billing label focuses the shipping input, and every screen reader reads the wrong\n * name. `useId` is per instance, so two copies never collide.\n */\n const uid = useId();\n const at = (key: keyof Address) => `${uid}-${key}`;\n /*\n * And a `name` on every control. Without one nothing here is submitted and nothing reaches\n * `FormData` — which is also what makes the postcode's `readOnly` an argument it can win,\n * because \"the value is still submitted\" was not true of a control with no name.\n */\n const named = (key: keyof Address) => (namePrefix ? `${namePrefix}.${key}` : key);\n\n /*\n * Changing the country empties the address, and keeps the person.\n *\n * The country is not a label over one fixed set of fields — it decides which fields exist.\n * Carried across the change, `region` stays \"서울\" in a list of US states, and a select with\n * no matching option draws nothing: the box reads as blank while the value underneath is\n * still there to be submitted. 받는 사람 and 연락처 survive, because the person did not\n * change.\n */\n const setCountry = (next: AddressCountry) => {\n if (next === value.country) return;\n onChange({ ...value, country: next, postalCode: \"\", line1: \"\", line2: \"\", city: \"\", region: \"\" });\n };\n\n return (\n <div {...rest} className={`address-form ${className ?? \"\"}`.trim()} role=\"group\" aria-label={label}>\n <Field label=\"국가/지역\" id={at(\"country\")} error={errors?.country}>\n {(field) => (\n <Select\n {...field}\n name={named(\"country\")}\n value={value.country}\n autoComplete={AUTO.country}\n /* Changing the country changes which fields exist, so it comes first. */\n onChange={(event) => setCountry(event.target.value as AddressCountry)}\n data-part=\"country\"\n >\n {countries.map((code) => (\n <option key={code} value={code}>\n {SAID[code]}\n </option>\n ))}\n </Select>\n )}\n </Field>\n\n <div className=\"address-form__pair\">\n <Field label=\"받는 사람\" id={at(\"name\")} error={errors?.name} required>\n {(field) => (\n <Input\n {...field}\n name={named(\"name\")}\n value={value.name}\n autoComplete={AUTO.name}\n onChange={(event) => set({ name: event.target.value })}\n data-part=\"name\"\n />\n )}\n </Field>\n <Field label=\"연락처\" id={at(\"phone\")} error={errors?.phone} required>\n {(field) => (\n <Input\n {...field}\n name={named(\"phone\")}\n type=\"tel\"\n inputMode=\"tel\"\n value={value.phone}\n autoComplete={AUTO.phone}\n onChange={(event) => set({ phone: event.target.value })}\n data-part=\"phone\"\n />\n )}\n </Field>\n </div>\n\n {order.map((key) => {\n if (key === \"postalCode\" && value.country === \"KR\") {\n return (\n <Field\n key={key}\n label={labels[key]!}\n id={at(\"postalCode\")}\n hint=\"도로명이나 건물 이름으로 찾습니다\"\n error={errors?.postalCode}\n required\n >\n {(field) => (\n <div className=\"address-form__lookup\">\n <Input\n {...field}\n name={named(\"postalCode\")}\n value={value.postalCode}\n inputMode=\"numeric\"\n autoComplete={AUTO.postalCode}\n /*\n * Read-only rather than disabled: the value is still submitted (it carries\n * a `name`), still copyable, and still in the tab order — it simply is not\n * typed.\n *\n * Only while there is a lookup to type it for the reader. Without\n * `onFindPostcode` a read-only field is a field nothing can ever fill, so\n * the button stands down and the reader gets the keyboard back.\n */\n readOnly={Boolean(onFindPostcode)}\n onChange={(event) => {\n if (!onFindPostcode) set({ postalCode: event.target.value });\n }}\n data-part=\"postal\"\n />\n <Button\n variant=\"outline\"\n tone=\"neutral\"\n /* A button with no handler answers a press with nothing and says nothing\n * about why. `Button` renders `disabled` as `aria-disabled`, so it keeps\n * its tab stop and reports the state. */\n disabled={!onFindPostcode}\n onClick={onFindPostcode}\n data-part=\"find\"\n >\n 주소 찾기\n </Button>\n </div>\n )}\n </Field>\n );\n }\n\n if (key === \"region\" && value.country === \"US\") {\n return (\n <Field key={key} label={labels[key]!} id={at(\"region\")} error={errors?.region} required>\n {(field) => (\n <Select\n {...field}\n name={named(\"region\")}\n value={value.region}\n autoComplete={AUTO.region}\n onChange={(event) => set({ region: event.target.value })}\n data-part=\"region\"\n >\n <option value=\"\">Choose</option>\n {regions.map((code) => (\n <option key={code} value={code}>\n {code}\n </option>\n ))}\n </Select>\n )}\n </Field>\n );\n }\n\n return (\n <Field\n key={key}\n label={labels[key]!}\n id={at(key)}\n error={errors?.[key]}\n /* One flag or the other, never both: `line2` is the only optional line in an\n * address, and the rest are required. */\n {...(key === \"line2\" ? ({ optional: true } as const) : ({ required: true } as const))}\n >\n {(field) => (\n <Input\n {...field}\n name={named(key)}\n value={value[key] as string}\n inputMode={key === \"postalCode\" ? \"numeric\" : undefined}\n autoComplete={AUTO[key]}\n onChange={(event) => set({ [key]: event.target.value } as Partial<Address>)}\n data-part={key}\n />\n )}\n </Field>\n );\n })}\n </div>\n );\n}\n","import { useEffect, useId, useRef } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { ShieldAlert, ShieldCheck, ShieldX } from \"lucide-react\";\nimport { Button } from \"../../common/Button\";\nimport { Icon } from \"../../common/Icon\";\nimport { Radio } from \"../../common/Radio\";\nimport \"./ApprovalGate.css\";\n\nexport type ApprovalState = \"waiting\" | \"approved\" | \"denied\" | \"expired\";\nexport type ApprovalRisk = \"normal\" | \"high\";\n\nexport type ApprovalScope = {\n id: string;\n /** \"이번만\", \"이 대화 동안\", \"항상\" */\n label: string;\n /** Exactly what that covers. A scope with no description is a blank cheque. */\n description: string;\n};\n\nexport type ApprovalGateProps = {\n /** What is being asked, as a question. \"이 명령을 실행할까요?\" */\n title: string;\n /**\n * The action itself, in specifics.\n *\n * The file, the command, the address. \"이 도구를 실행할까요?\" is not a request anyone can\n * answer; it is a request to trust the asker.\n */\n action: ReactNode;\n /** What it will do, or what it cannot be undone from. */\n detail?: ReactNode;\n scopes?: ApprovalScope[];\n scope?: string;\n onScopeChange?: (id: string) => void;\n onApprove?: () => void;\n onDeny?: () => void;\n approveLabel?: string;\n denyLabel?: string;\n risk?: ApprovalRisk;\n state?: ApprovalState;\n /** What was decided and when, once it has been. */\n decision?: ReactNode;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * A permission request, and the decision.\n *\n * This is the highest-stakes component in the library, and almost everything about it is\n * about slowing the reader down by exactly one beat.\n *\n * **Nothing is focused and nothing submits by default.** Not a `<form>`, no `autoFocus`, and\n * no button that Enter reaches on its own. A reader who has pressed Enter five times to send\n * five messages will press it a sixth time, and if the sixth one approves a `rm -rf` then the\n * component built that outcome, not the reader.\n *\n * **A dangerous approval is not the primary button.** At `risk=\"high\"` the approve control is\n * an outline in the danger tone and 거부 is the filled one, because the button that looks like\n * the button is the one that gets pressed. Making the safe choice the good-looking choice is\n * the only styling decision here that matters.\n *\n * **The scope is stated, not implied.** \"항상 허용\" that does not say what \"항상\" covers is a\n * blank cheque, so each option carries the sentence describing what it grants.\n *\n * **The decision stays on the page.** A gate that vanishes once answered leaves no record of\n * what was agreed to, which is the one thing anyone will want afterwards.\n */\nexport function ApprovalGate({\n title,\n action,\n detail,\n scopes,\n scope,\n onScopeChange,\n onApprove,\n onDeny,\n approveLabel = \"허용\",\n denyLabel = \"거부\",\n risk = \"normal\",\n state = \"waiting\",\n decision,\n className,\n ...rest\n}: ApprovalGateProps) {\n const titleId = useId();\n const scopeName = useId();\n const waiting = state === \"waiting\";\n\n /*\n * The decision takes the focus the decided-on button was holding.\n *\n * 허용 and 거부 leave the document in the same render the decision arrives in, and focus\n * falls to `<body>` — a keyboard reader is then at the top of the page with no idea what\n * happened, and the next Tab starts the document over. The decision is the answer to the\n * question they just asked, so it is where they belong; `tabIndex={-1}` makes it a place\n * focus can be put without putting it in the tab order.\n */\n const decided = useRef<HTMLParagraphElement>(null);\n const was = useRef(waiting);\n useEffect(() => {\n const left = was.current && !waiting;\n was.current = waiting;\n /* Only when the focus actually fell. A gate that expires while the reader is elsewhere\n * must not pull them back. */\n if (!left || document.activeElement !== document.body) return;\n decided.current?.focus();\n }, [waiting]);\n\n return (\n <section\n {...rest}\n className={`approval-gate ${className ?? \"\"}`.trim()}\n data-risk={risk}\n data-state={state}\n aria-labelledby={titleId}\n /*\n * Announced when it appears, and only while it is waiting. A run that has silently\n * stopped to ask a question is a run a reader is still waiting on; after the decision\n * there is nothing left to interrupt anyone about.\n */\n aria-live={waiting ? \"assertive\" : undefined}\n >\n <div className=\"approval-gate__head\">\n <span className=\"approval-gate__mark\" aria-hidden=\"true\">\n <Icon\n icon={state === \"approved\" ? ShieldCheck : state === \"denied\" ? ShieldX : ShieldAlert}\n size=\"sm\"\n />\n </span>\n <h3 className=\"approval-gate__title\" id={titleId}>\n {title}\n </h3>\n </div>\n\n {/* The specifics. Code, because it is code — and never truncated. */}\n <div className=\"approval-gate__action\" data-part=\"action\">\n {action}\n </div>\n\n {detail ? <p className=\"approval-gate__detail\">{detail}</p> : null}\n\n {waiting && scopes?.length ? (\n <fieldset className=\"approval-gate__scopes\">\n <legend className=\"approval-gate__legend\">이 결정이 미치는 범위</legend>\n {/*\n * The description goes inside the radio's own label rather than beside it. `Radio`\n * renders a `<label>`, and a label inside a label is invalid HTML that browsers\n * resolve by dropping one of the associations — usually the outer one, so the\n * words stop being a click target and stop being the control's name.\n */}\n {scopes.map((option) => (\n <Radio\n key={option.id}\n className=\"approval-gate__scope\"\n name={scopeName}\n value={option.id}\n checked={scope === option.id}\n onChange={() => onScopeChange?.(option.id)}\n data-part={`scope-${option.id}`}\n >\n <span className=\"approval-gate__scope-text\">\n <span className=\"approval-gate__scope-label\">{option.label}</span>\n <span className=\"approval-gate__scope-detail\">{option.description}</span>\n </span>\n </Radio>\n ))}\n </fieldset>\n ) : null}\n\n {/*\n * The live region is here from the first render, and the buttons and the decision take\n * turns inside it.\n *\n * A region that is created at the moment its words are is a region several screen\n * readers never announce — they have to have been watching it beforehand, and the old\n * shape mounted the decision and unmounted the `aria-live` on the section in the same\n * render. Polite rather than assertive: the reader asked the question, so the answer\n * does not have to interrupt them to reach them.\n */}\n <div className=\"approval-gate__resolve\" aria-live=\"polite\" data-part=\"live\">\n {waiting ? (\n <div className=\"approval-gate__decide\">\n {/*\n * Order and weight, both deliberate. 거부 comes first and — when the action is\n * dangerous — is the filled button, so the one that looks like the answer is the\n * one that cannot be regretted.\n */}\n <Button\n variant={risk === \"high\" ? \"solid\" : \"outline\"}\n tone=\"neutral\"\n onClick={onDeny}\n data-part=\"deny\"\n >\n {denyLabel}\n </Button>\n <Button\n variant={risk === \"high\" ? \"outline\" : \"solid\"}\n tone={risk === \"high\" ? \"danger\" : \"accent\"}\n onClick={onApprove}\n data-part=\"approve\"\n >\n {approveLabel}\n </Button>\n </div>\n ) : (\n <p className=\"approval-gate__decision\" ref={decided} tabIndex={-1} data-part=\"decision\">\n {decision ??\n (state === \"approved\"\n ? \"허용했습니다.\"\n : state === \"denied\"\n ? \"거부했습니다.\"\n : \"요청이 만료되었습니다.\")}\n </p>\n )}\n </div>\n </section>\n );\n}\n","import type { MouseEvent } from \"react\";\nimport { Tooltip } from \"../../common/Tooltip\";\nimport { VisuallyHidden } from \"../../common/VisuallyHidden\";\nimport \"./Citation.css\";\n\ntype CitationBase = {\n /**\n * The number this citation carries in the answer.\n *\n * The same number `SourceChip` and `SourcePanel` already take, and for the same reason:\n * it is the claim's number, not a position in any list. Two sentences citing the same\n * source both say 3.\n */\n index: number;\n /** The source's own title. What the hover shows and what a screen reader hears. */\n title: string;\n domain?: string;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * One of the two destinations is required, in the type.\n *\n * A marker with neither is a control that takes focus and then does nothing with it, which\n * is worse than no marker at all: a reader tabs to it, hears a source name, presses Enter\n * and nothing happens. The union refuses that call at compile time; the runtime draws a\n * plain, unfocusable marker rather than a dead button for the callers TypeScript cannot see.\n */\nexport type CitationProps = CitationBase &\n (\n | {\n /** Given, the marker is a link that opens the source in a new tab. */\n href: string;\n /** Take the reader to this source in the panel beside the answer. */\n onActivate?: () => void;\n }\n | {\n href?: undefined;\n /** Without `href` the marker is a button and this is the only way out of it. */\n onActivate: () => void;\n }\n );\n\n/**\n * A source, marked inside the sentence it supports.\n *\n * `SourceChip` lives under a paragraph; this lives in one. That is the whole difference and\n * it is not cosmetic — a row of chips says \"these are the sources for all of this\", and a\n * reader checking one claim has to guess which chip answers it. A marker in the sentence\n * says which.\n *\n * **It must not change the height of the line it is in.** A superscript is the one inline\n * element that routinely does: `vertical-align: super` lifts the box and the line grows to\n * contain it, so a paragraph with citations has looser leading than the paragraph above it,\n * and the two do not look like the same document. The fix is to lift by offset instead —\n * relative positioning moves no layout — and to give the marker a line box of zero. That is\n * what `--leading-none` was written for.\n *\n * **It goes straight after the word, with no space.** JSX turns a line break before an\n * element into one, so `…입니다\\n<Citation />` renders `…입니다 ¹` — the marker detaches from\n * the claim it marks and drifts toward the full stop after it. Written inline, it reads the\n * way a footnote marker is supposed to.\n *\n * The target is smaller than 24px and that is allowed: WCAG 2.2's target-size rule exempts a\n * target in a sentence, because making it 24px is making the sentence 24px. What is not\n * exempt is the name — a bare \"3\" is what every implementation ships and what no screen\n * reader can use, so the number is decorative and the name says what it is.\n */\nexport function Citation({ index, title, domain, href, onActivate, className, ...rest }: CitationProps) {\n const source = domain ? `출처 ${index}: ${title} · ${domain}` : `출처 ${index}: ${title}`;\n /* `SourceChip` says the same thing at the end of its own name, and for the same reason: a\n * link that moves the reader to another tab has to say so before it is followed. */\n const name = href ? `${source} · 새 창에서 열림` : source;\n\n const activate = (event: MouseEvent) => {\n if (!onActivate) return;\n /* A link with somewhere to go keeps going there on a modified click — the panel is the\n * convenience, the source is the destination. */\n if (href && (event.metaKey || event.ctrlKey || event.shiftKey)) return;\n event.preventDefault();\n onActivate();\n };\n\n const inner = (\n <>\n <span aria-hidden=\"true\">{index}</span>\n <VisuallyHidden>{name}</VisuallyHidden>\n </>\n );\n\n return (\n <sup className={`citation ${className ?? \"\"}`.trim()} {...rest}>\n <Tooltip content={domain ? `${title} · ${domain}` : title}>\n {href ? (\n <a className=\"citation__mark\" href={href} target=\"_blank\" rel=\"noreferrer\" onClick={activate} data-part=\"mark\">\n {inner}\n </a>\n ) : onActivate ? (\n <button type=\"button\" className=\"citation__mark\" onClick={activate} data-part=\"mark\">\n {inner}\n </button>\n ) : (\n /* Neither destination. Still a marker, never a target: the name is read where the\n * sentence is read, and nothing offers a press that leads nowhere. */\n <span className=\"citation__mark\" data-static=\"\" data-part=\"mark\">\n {inner}\n </span>\n )}\n </Tooltip>\n </sup>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { Check } from \"lucide-react\";\nimport { Avatar } from \"../../common/Avatar\";\nimport { Icon } from \"../../common/Icon\";\nimport { Button } from \"../../common/Button\";\nimport { Skeleton } from \"../../common/Skeleton\";\nimport \"./CommentThread.css\";\n\nexport type Comment = {\n id: string;\n author: string;\n /** `YYYY-MM-DD HH:mm`. A string; see the note in `DatePicker`. */\n time: string;\n /** What a reader sees — \"3분 전\". The exact time stays in the attribute. */\n timeLabel?: string;\n body: ReactNode;\n edited?: boolean;\n /**\n * One level. A reply to a reply is a reply to the same comment.\n *\n * Deeper lists are not refused, they are flattened onto this one: a caller who nests\n * further gets every reply, in order, at the single depth the CSS and the count know about.\n */\n replies?: Comment[];\n /** Per-comment controls, painted out until wanted. */\n actions?: ReactNode;\n};\n\nexport type CommentThreadProps = {\n comments: Comment[];\n /** What the thread is about. Names the region. */\n label: string;\n resolved?: boolean;\n onResolve?: () => void;\n onReopen?: () => void;\n /** The box at the end. Given, it is the last thing in the thread. */\n composer?: ReactNode;\n /**\n * The thread is waiting for its comments.\n *\n * A thread hangs off something else — a line of a document, a cell, a design — and it opens\n * before its comments have been asked for. Without this, an open thread that has not\n * answered yet looks exactly like a thread nobody has written in, and the reader writes the\n * comment that was already there.\n */\n loading?: boolean;\n loadingComments?: number;\n /** What to say when the thread really is new. */\n empty?: ReactNode;\n /** What went wrong. Error, then waiting, then empty, then comments. */\n error?: ReactNode;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/*\n * Every reply below a comment, at one depth.\n *\n * The rendering used to recurse, so a caller who nested replies got a second and third level\n * that no stylesheet had a rule for and that the resolved count did not count — the number on\n * screen and the number in \"해결됨 · 댓글 N개\" disagreed. Flattening keeps the words and drops\n * only the indent.\n */\nfunction flatten(replies: Comment[] | undefined): Comment[] {\n if (!replies?.length) return [];\n return replies.flatMap((one) => [one, ...flatten(one.replies)]);\n}\n\nfunction One({ comment, reply }: { comment: Comment; reply?: boolean }) {\n /* A reply never opens a list of its own; its children were flattened into the list it is in. */\n const replies = reply ? [] : flatten(comment.replies);\n return (\n <li className=\"comment-thread__comment\" data-reply={reply ? \"\" : undefined} data-part=\"comment\">\n <Avatar name={comment.author} size=\"sm\" decorative />\n <div className=\"comment-thread__body\">\n <p className=\"comment-thread__head\">\n <span className=\"comment-thread__author\">{comment.author}</span>\n {/*\n * The machine form in the attribute and the human one in the text. \"3분 전\" is what\n * a reader wants and is wrong the moment the page has been open for an hour; the\n * exact time cannot rot where it is.\n */}\n <time className=\"comment-thread__time\" dateTime={comment.time}>\n {comment.timeLabel ?? comment.time}\n </time>\n {comment.edited ? <span className=\"comment-thread__edited\">편집됨</span> : null}\n </p>\n <div className=\"comment-thread__text\">{comment.body}</div>\n {comment.actions ? <div className=\"comment-thread__actions\">{comment.actions}</div> : null}\n\n {replies.length ? (\n <ul className=\"comment-thread__replies\">\n {replies.map((child) => (\n <One key={child.id} comment={child} reply />\n ))}\n </ul>\n ) : null}\n </div>\n </li>\n );\n}\n\n/**\n * A comment and what came back.\n *\n * **Replies are one level deep, and that is a decision rather than a limitation.** Nesting\n * that goes on forever is unreadable by the fourth level — forty characters of indent on a\n * phone leaves room for two words a line — and every product that shipped it eventually\n * flattened it. A reply to a reply attaches to the same comment, which is what the reader\n * meant anyway.\n *\n * **Resolving folds the thread; it does not delete it.** The decision and the argument that\n * produced it are the record, and a resolve that removes them removes the only reason anyone\n * would look.\n */\nexport function CommentThread({\n comments,\n label,\n resolved,\n onResolve,\n onReopen,\n composer,\n loading,\n loadingComments = 2,\n empty = \"아직 댓글이 없습니다.\",\n error,\n className,\n ...rest\n}: CommentThreadProps) {\n /* Every comment the thread draws, at whatever depth it was handed in — the count on the\n * folded thread is the number the reader just saw, not the number of top-level rows. */\n const total = comments.reduce((count, one) => count + 1 + flatten(one.replies).length, 0);\n\n return (\n <section\n {...rest}\n className={`comment-thread ${className ?? \"\"}`.trim()}\n data-resolved={resolved ? \"\" : undefined}\n aria-label={label}\n >\n {resolved ? (\n <div className=\"comment-thread__resolved\" data-part=\"resolved\">\n <span className=\"comment-thread__resolved-mark\" aria-hidden=\"true\">\n <Icon icon={Check} size=\"xs\" />\n </span>\n <p className=\"comment-thread__resolved-text\">\n 해결됨 · 댓글 {total}개\n </p>\n {onReopen ? (\n <Button size=\"sm\" variant=\"ghost\" tone=\"neutral\" onClick={onReopen} data-part=\"reopen\">\n 다시 열기\n </Button>\n ) : null}\n </div>\n ) : (\n <>\n {/*\n * `role=\"log\"` — `aria-live=\"polite\"` with only additions announced, the same\n * treatment `MessageList` gives its scroller. The list is the live region and the\n * comments are its contents, so the region is mounted before anything is put in it:\n * a live region that arrives together with its text is announced by nothing.\n */}\n <ul\n className=\"comment-thread__comments\"\n role=\"log\"\n aria-label={label}\n aria-busy={loading || undefined}\n >\n {error ? (\n <li className=\"comment-thread__state\" role=\"alert\" data-part=\"error\">\n {error}\n </li>\n ) : loading ? (\n Array.from({ length: loadingComments }, (_, index) => (\n <li className=\"comment-thread__comment\" key={`waiting-${index}`} data-part=\"waiting-comment\">\n <Skeleton shape=\"circle\" size=\"sm\" />\n <div className=\"comment-thread__body\">\n <Skeleton shape=\"text\" lines={1} />\n <Skeleton shape=\"text\" lines={2} />\n </div>\n </li>\n ))\n ) : comments.length === 0 ? (\n <li className=\"comment-thread__state\" data-part=\"empty\">\n {empty}\n </li>\n ) : (\n comments.map((comment) => <One key={comment.id} comment={comment} />)\n )}\n </ul>\n\n {composer ? <div className=\"comment-thread__composer\">{composer}</div> : null}\n\n {onResolve ? (\n <div className=\"comment-thread__foot\">\n <Button size=\"sm\" variant=\"outline\" tone=\"neutral\" iconStart={Check} onClick={onResolve} data-part=\"resolve\">\n 해결로 표시\n </Button>\n </div>\n ) : null}\n </>\n )}\n </section>\n );\n}\n","import { useEffect, useState } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport { ArrowUp, Square } from \"lucide-react\";\nimport { IconButton } from \"../../common/IconButton\";\nimport \"./Composer.css\";\n\nexport type ComposerRows = 4 | 6 | 8 | 10 | 12;\n\nexport type ComposerProps = {\n value: string;\n onValueChange: (value: string) => void;\n onSubmit: () => void;\n /** Called instead of `onSubmit` while `running`. Without it the run cannot be stopped. */\n onStop?: () => void;\n running?: boolean;\n /** Names the field. A composer with no label is an unlabelled textarea. */\n label: string;\n placeholder?: string;\n /** How tall it grows before it starts scrolling instead. */\n maxRows?: ComposerRows;\n /** Files and images already attached, above the field. */\n attachments?: ReactNode;\n /** Mode, model, tools — whatever sits on the left of the bottom row. */\n tools?: ReactNode;\n /** A line in the tool row, to the left of the send button. Keep it short; it is read every time. */\n hint?: ReactNode;\n disabled?: boolean;\n /**\n * Enter sends and Shift+Enter breaks the line.\n *\n * Left alone this follows the pointer: on a coarse one there is no Shift key to hold, so\n * Enter has to be a newline and the button is the only way to send. A desktop default\n * shipped to a phone makes a line break impossible to type.\n */\n enterSends?: boolean;\n sendLabel?: string;\n stopLabel?: string;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/** True when the primary pointer cannot hover — a finger. */\nfunction useCoarsePointer() {\n const [coarse, setCoarse] = useState(() =>\n typeof window === \"undefined\" ? false : window.matchMedia(\"(pointer: coarse)\").matches,\n );\n useEffect(() => {\n const query = window.matchMedia(\"(pointer: coarse)\");\n const listen = () => setCoarse(query.matches);\n query.addEventListener(\"change\", listen);\n return () => query.removeEventListener(\"change\", listen);\n }, []);\n return coarse;\n}\n\n/**\n * What the reader types, and the controls around it.\n *\n * Three things here are the whole reason this is a component rather than a textarea with a\n * button next to it.\n *\n * **한글 is composed before it is typed.** While a syllable is being assembled, every\n * keystroke — including Enter, which commits it — fires `keydown` with `isComposing` set.\n * A composer that sends on Enter without checking sends on the Enter that finishes 안녕, so\n * the message goes out as 안녕하세 and the last syllable lands in the next one. This is not\n * an edge case in Korean; it is every sentence. Older engines report the same state as\n * `keyCode === 229`, which is why both are checked.\n *\n * **It grows without an inline style.** The field is stacked on a hidden copy of its own\n * value in one grid cell, so the cell is as tall as the text and the textarea stretches to\n * it. The usual answer — measuring `scrollHeight` and writing `element.style.height` — puts\n * a value in the one place no stylesheet can reach.\n *\n * **Send and stop are the same button.** A run is stopped from where it was started; a stop\n * control that appears somewhere else moves the target under a hand already on its way.\n */\nexport function Composer({\n value,\n onValueChange,\n onSubmit,\n onStop,\n running,\n label,\n placeholder,\n maxRows = 8,\n attachments,\n tools,\n hint,\n disabled,\n enterSends,\n sendLabel = \"보내기\",\n stopLabel = \"중지\",\n className,\n ...rest\n}: ComposerProps) {\n const coarse = useCoarsePointer();\n const sendsOnEnter = enterSends ?? !coarse;\n const empty = value.trim().length === 0;\n\n const sendable = !running && !disabled && !empty;\n\n const send = () => {\n if (!sendable) return;\n onSubmit();\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key !== \"Enter\" || event.shiftKey || !sendsOnEnter) return;\n /*\n * Mid-composition. The Enter that commits 안녕 is the same key as the Enter that sends,\n * and the browser tells them apart with this flag and nothing else.\n */\n if (event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) return;\n /*\n * Nothing is sent, so nothing is suppressed. `preventDefault` used to run before this\n * check, which left Enter doing neither of the two things it can do: while a run was\n * going — or on a value that is only whitespace — the key sent nothing and broke no line,\n * and the field looked broken. An Enter that cannot send is an Enter that types a newline.\n */\n if (!sendable) return;\n event.preventDefault();\n onSubmit();\n };\n\n return (\n <form\n {...rest}\n className={`composer ${className ?? \"\"}`.trim()}\n data-running={running ? \"\" : undefined}\n data-disabled={disabled ? \"\" : undefined}\n onSubmit={(event) => {\n event.preventDefault();\n send();\n }}\n >\n {attachments ? (\n <div className=\"composer__attachments\" data-part=\"attachments\">\n {attachments}\n </div>\n ) : null}\n\n {/*\n * The hidden copy and the field share one grid cell. `data-value` carries the text into\n * CSS through `content: attr()`; the trailing space is what keeps the box one line\n * taller the moment a newline is typed, before any character follows it.\n */}\n <div className=\"composer__grow\" data-value={`${value} `} data-rows={maxRows}>\n <textarea\n className=\"composer__field\"\n value={value}\n onChange={(event) => onValueChange(event.target.value)}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n aria-label={label}\n disabled={disabled}\n rows={1}\n data-part=\"field\"\n />\n </div>\n\n <div className=\"composer__bar\">\n <div className=\"composer__tools\">{tools}</div>\n {hint ? <p className=\"composer__hint\">{hint}</p> : null}\n {running ? (\n <IconButton\n icon={Square}\n label={stopLabel}\n type=\"button\"\n variant=\"solid\"\n tone=\"neutral\"\n shape=\"circle\"\n onClick={onStop}\n /* No `onStop` means the run cannot be stopped. A stop button that looks live and\n * does nothing is worse than one that says it is unavailable. */\n disabled={!onStop}\n data-part=\"stop\"\n />\n ) : (\n <IconButton\n icon={ArrowUp}\n label={sendLabel}\n type=\"submit\"\n variant=\"solid\"\n tone=\"accent\"\n shape=\"circle\"\n /* `aria-disabled`, not `disabled` — the rule Button set. A control that leaves\n * the tab order the moment the field empties takes the reader standing on it. */\n disabled={disabled || empty}\n data-part=\"send\"\n />\n )}\n </div>\n </form>\n );\n}\n","import { useEffect, useId, useRef, useState } from \"react\";\nimport type { FormEvent, KeyboardEvent, ReactNode } from \"react\";\nimport { Tag as TagIcon, X } from \"lucide-react\";\nimport { Button } from \"../../common/Button\";\nimport { Icon } from \"../../common/Icon\";\nimport { IconButton } from \"../../common/IconButton\";\nimport { Input } from \"../../common/Input\";\nimport { InputGroup } from \"../../derived/InputGroup\";\nimport \"./CouponField.css\";\n\nexport type AppliedCoupon = {\n code: string;\n /** What it did, in words. \"10% 할인\", \"배송비 무료\". */\n effect: ReactNode;\n};\n\nexport type CouponFieldProps = {\n value: string;\n onValueChange: (value: string) => void;\n onApply: () => void;\n /** What is already on the order. Several, because several can be. */\n applied?: AppliedCoupon[];\n onRemove?: (code: string) => void;\n /** Why the last code was refused. Kept until the reader types something else. */\n error?: ReactNode;\n pending?: boolean;\n /**\n * Which element the field is drawn as. `\"form\"` on its own, `\"div\"` inside another form.\n *\n * A code and an apply button are a form, and standing alone that is what this should be.\n * Put inside a checkout's form it becomes a form inside a form, which HTML does not have:\n * the browser drops the inner one, React warns, and pressing 적용 submits the *outer* form\n * natively — the page navigates to `/?` and this component's own `preventDefault` never\n * runs, because the handler is on an element that no longer exists as a form.\n *\n * As `\"div\"` the apply button is a plain button, Enter in the field is caught and stopped\n * here, and nothing reaches the surrounding form. That last part is the reason this is not\n * simply \"render a div\": Enter in a text input submits the form that owns it, so a coupon\n * code typed and confirmed would place the order.\n */\n as?: \"form\" | \"div\";\n label?: string;\n placeholder?: string;\n applyLabel?: string;\n disabled?: boolean;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * A code, and what it turned into.\n *\n * `InputGroup` with three facts about a checkout on top.\n *\n * **An applied coupon stops being text in a field.** It becomes a line saying what it did and\n * a way to take it off. Leaving the code in the box is how a reader ends up pressing 적용\n * twice, and how a shop ends up with a field whose contents mean two different things\n * depending on state nobody can see.\n *\n * **A refusal needs its reason.** \"사용할 수 없는 코드입니다\" is the same sentence for\n * expired, already used, below the minimum and wrong shop, and only one of those four is\n * worth the reader's next thirty seconds.\n *\n * **The field is not cleared on failure.** The reader typed it; if it was refused they will\n * want to look at what they typed. Clearing it makes them find the email again.\n *\n * **It is a `<form>` alone and a `<div>` inside one.** See the note on `as`.\n */\nexport function CouponField({\n value,\n onValueChange,\n onApply,\n applied = [],\n onRemove,\n error,\n pending,\n as = \"form\",\n label = \"쿠폰 코드\",\n placeholder = \"코드를 넣으세요\",\n applyLabel = \"적용\",\n disabled,\n className,\n ...rest\n}: CouponFieldProps) {\n /*\n * Generated, never written down. `id=\"coupon-field-error\"` is unique until the second\n * field appears on the same checkout — and then both describe the first paragraph, so a\n * reader on the shipping coupon hears the billing coupon's refusal.\n */\n const errorId = useId();\n\n /*\n * A code being accepted is the answer to what the reader just did, and nothing said it.\n *\n * The applied list is not a live region and it cannot become one: it is only mounted once\n * there is something in it, and a region announced into existence is a region several\n * screen readers never read. So the words go to a slot that has been in the document since\n * the first render, next to the one the refusals already use.\n */\n const seen = useRef<string[]>(applied.map((coupon) => coupon.code));\n const [added, setAdded] = useState(\"\");\n useEffect(() => {\n const before = seen.current;\n const fresh = applied.filter((coupon) => !before.includes(coupon.code));\n seen.current = applied.map((coupon) => coupon.code);\n if (fresh.length) setAdded(fresh.map((coupon) => `${coupon.code} 쿠폰을 적용했습니다`).join(\", \"));\n }, [applied]);\n\n const apply = () => {\n if (pending || disabled || !value.trim()) return;\n onApply();\n };\n\n const submit = (event: FormEvent) => {\n event.preventDefault();\n apply();\n };\n\n const standalone = as === \"form\";\n\n /*\n * As a `div`, Enter is stopped here.\n *\n * A text input hands Enter to the form that owns it, and inside a checkout that form is the\n * order. Without this, typing a code and pressing Enter places the order — the failure this\n * shape exists to prevent is not only the 적용 button's.\n */\n const enter = (event: KeyboardEvent<HTMLInputElement>) => {\n if (standalone || event.key !== \"Enter\" || event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) return;\n event.preventDefault();\n apply();\n };\n\n const inner = (\n <>\n {applied.length ? (\n <ul className=\"coupon-field__applied\" data-part=\"applied\">\n {applied.map((coupon) => (\n <li className=\"coupon-field__coupon\" key={coupon.code}>\n <Icon icon={TagIcon} size=\"sm\" tone=\"success\" aria-hidden=\"true\" />\n <span className=\"coupon-field__code\">{coupon.code}</span>\n <span className=\"coupon-field__effect\">{coupon.effect}</span>\n {onRemove ? (\n <IconButton\n icon={X}\n /* Named after the code, not \"제거\" — there can be three of these. */\n label={`${coupon.code} 쿠폰 빼기`}\n size=\"sm\"\n onClick={() => onRemove(coupon.code)}\n data-part=\"remove\"\n />\n ) : null}\n </li>\n ))}\n </ul>\n ) : null}\n\n <InputGroup label={label}>\n <Input\n value={value}\n onChange={(event) => onValueChange(event.target.value)}\n onKeyDown={enter}\n placeholder={placeholder}\n aria-label={label}\n aria-invalid={error ? true : undefined}\n aria-describedby={error ? errorId : undefined}\n disabled={disabled}\n /* Codes are printed in capitals and typed in whatever the keyboard was in. */\n autoCapitalize=\"characters\"\n autoCorrect=\"off\"\n spellCheck={false}\n data-part=\"field\"\n />\n <Button\n /* A submit button in a `div` submits whatever form happens to be around it. */\n type={standalone ? \"submit\" : \"button\"}\n onClick={standalone ? undefined : apply}\n variant=\"outline\"\n tone=\"neutral\"\n loading={pending}\n disabled={disabled || !value.trim()}\n data-part=\"apply\"\n >\n {applyLabel}\n </Button>\n </InputGroup>\n\n {/*\n * Always in the document, so a reader is told what changed rather than being handed a\n * region that appeared and disappeared. The same shape `Field` settled on.\n */}\n <p className=\"coupon-field__error\" id={errorId} aria-live=\"polite\" data-part=\"error\">\n {error}\n </p>\n\n {/* Acceptance, said. Off the screen because the list beside it already shows it — what\n * is missing is a reader who is not looking at the list being told it changed. */}\n <p className=\"coupon-field__announced\" role=\"status\" data-part=\"announced\">\n {added}\n </p>\n </>\n );\n\n const shell = `coupon-field ${className ?? \"\"}`.trim();\n\n return standalone ? (\n <form {...rest} className={shell} onSubmit={submit}>\n {inner}\n </form>\n ) : (\n <div {...rest} className={shell}>\n {inner}\n </div>\n );\n}\n","import type { DataGridColumn } from \"./DataGrid\";\n\n/**\n * What the grid decides, with the DOM taken out.\n *\n * `docs/COMPONENT-AUDIT.md` found one piece of god-code in the library and this was it: 672\n * lines holding eight things. Its conclusion was that splitting the MARKUP would be wrong —\n * the cursor has to know whether a cell is being edited, editing has to know the columns, and\n * three components passing that between them as props is the same tangle in a worse shape.\n *\n * What could come out is what never touched the DOM in the first place. Every function here\n * takes values and returns values, which buys the thing the audit actually wanted:\n *\n * These rules were reachable only through Playwright. A cursor that has to stay inside a\n * grid that just lost four rows is a claim about arithmetic, and proving it by driving a\n * browser to a filtered grid and pressing the down arrow is slow, indirect, and silent\n * about the case nobody thought to click. `tests/components/data-grid-state.spec.ts` states\n * them directly, the way `tests/brand.spec.ts` does for the colour maths.\n *\n * Nothing here is new behaviour. Each function is the body it was lifted from, including the\n * clamping order, which matters: see `clampCursor`.\n */\n\n/** A rendered column: the selection box, or one of the caller's. */\nexport type Slot<T> = { id: string; kind: \"select\" } | { id: string; kind: \"data\"; column: DataGridColumn<T> };\n\nexport type Cursor = { row: number; column: number };\n\n/** How far the cursor may go. Both are counts, not last indices. */\nexport type Bounds = { rows: number; columns: number };\n\n/**\n * The columns actually drawn, in order, with the selection box first when there is one.\n *\n * Hidden columns are dropped here rather than skipped at render, so everything downstream —\n * the cursor's column count above all — counts what the reader can see.\n */\nexport function slotsFor<T>(columns: DataGridColumn<T>[], hidden: Set<string>, selecting: boolean): Slot<T>[] {\n const data = columns\n .filter((column) => !hidden.has(column.id))\n .map((column) => ({ id: column.id, kind: \"data\" as const, column }));\n return selecting ? [{ id: \"__select\", kind: \"select\" as const }, ...data] : data;\n}\n\n/**\n * The cursor, held inside the grid.\n *\n * `Math.max(0, …)` runs OUTSIDE `Math.min(count - 1, …)` and the order is load-bearing. An\n * empty grid makes `count - 1` equal -1, the inner `min` returns -1 for any input, and the\n * outer `max` lifts it back to 0. Written the other way round the cursor would sit at -1 and\n * no cell would carry `tabindex=\"0\"`.\n */\nexport function clampCursor(cursor: Cursor, bounds: Bounds): Cursor {\n return {\n row: Math.max(0, Math.min(bounds.rows - 1, cursor.row)),\n column: Math.max(0, Math.min(bounds.columns - 1, cursor.column)),\n };\n}\n\n/**\n * One key press worth of movement.\n *\n * `absolute` is Home and End, which name a position rather than a distance. A field left out\n * of it keeps the axis where it was, which is what Home without a modifier means: the start of\n * this row, not the start of the grid.\n */\nexport function moveCursor(\n cursor: Cursor,\n bounds: Bounds,\n rowDelta: number,\n columnDelta: number,\n absolute?: { row?: number; column?: number },\n): Cursor {\n return clampCursor(\n {\n row: absolute?.row ?? cursor.row + rowDelta,\n column: absolute?.column ?? cursor.column + columnDelta,\n },\n bounds,\n );\n}\n\nexport type BodyState = \"error\" | \"loading\" | \"empty\" | \"rows\";\n\n/**\n * One state, decided once: error, then loading, then empty, then rows.\n *\n * The rows used to be drawn whenever `loading` was false, so a grid that failed kept the rows\n * it had before the request threw sitting under the alert. The reader is told it failed and\n * shown values anyway, with nothing saying which of the two to believe.\n */\nexport function bodyState(error: boolean, loading: boolean, rowCount: number): BodyState {\n if (error) return \"error\";\n if (loading) return \"loading\";\n return rowCount === 0 ? \"empty\" : \"rows\";\n}\n\n/**\n * How many rows the body is drawing, which is what `aria-rowcount` has to count.\n *\n * Not the row count: while the grid waits, the body holds placeholders and the rows are\n * usually empty, so the grid announced itself as one row tall — a header — with five rows\n * under it that carried no `aria-rowindex` at all.\n */\nexport function bodyRowCount(state: BodyState, rowCount: number, loadingRows: number): number {\n if (state === \"loading\") return loadingRows;\n return state === \"rows\" ? rowCount : 0;\n}\n\n/** A key added or removed. Used for one row's checkbox and for one column's visibility alike. */\nexport function toggleKey(keys: Iterable<string>, key: string): string[] {\n const next = new Set(keys);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return [...next];\n}\n\n/**\n * Select-all over the rows the grid is holding, leaving the rest of the selection alone.\n *\n * Replacing the whole array is what a one-page grid looks like from the inside, and it\n * silently drops everything the reader chose on the pages before this one. The same gesture\n * cannot mean two different things in two components that sit next to each other.\n */\nexport function toggleAllKeys(chosen: Iterable<string>, pageKeys: string[], remove: boolean): string[] {\n const next = new Set(chosen);\n for (const key of pageKeys) {\n if (remove) next.delete(key);\n else next.add(key);\n }\n return [...next];\n}\n","import {\n stockFeatures, tableFeatures, constructFilterFn, createFilteredRowModel, createSortedRowModel,\n createGroupedRowModel, createExpandedRowModel, createPaginatedRowModel,\n createFacetedRowModel, createFacetedUniqueValues, createFacetedMinMaxValues,\n filterFn_includesString, filterFn_equalsString, filterFn_inNumberRange,\n sortFn_alphanumeric, sortFn_basic, sortFn_datetime,\n aggregationFn_sum, aggregationFn_min, aggregationFn_max, aggregationFn_mean, aggregationFn_median,\n aggregationFn_count, aggregationFn_uniqueCount, aggregationFn_first, aggregationFn_last,\n aggregationFn_extent, aggregationFn_unique,\n filterFns,\n sortFns,\n} from \"@tanstack/react-table\";\nimport type { ReactNode } from \"react\";\n\n/** Subsequence matching, including case/diacritic normalization. No regular expression input. */\nexport function fuzzyMatch(value: unknown, query: unknown): boolean {\n const normalize = (text: unknown) => String(text ?? \"\").normalize(\"NFKD\").replace(/[\\u0300-\\u036f]/g, \"\").toLocaleLowerCase();\n const haystack = normalize(value), needle = normalize(query).trim();\n let position = 0;\n for (const character of needle) {\n position = haystack.indexOf(character, position);\n if (position < 0) return false;\n position++;\n }\n return true;\n}\n\nconst fuzzy = constructFilterFn({ filter: fuzzyMatch, autoRemove: value => !String(value ?? \"\").trim() });\n/** All 17 stable Table features. Client row models are bypassed in server mode. */\nexport const completeFeatures = tableFeatures({\n ...stockFeatures,\n filteredRowModel: createFilteredRowModel(), sortedRowModel: createSortedRowModel(),\n groupedRowModel: createGroupedRowModel(), expandedRowModel: createExpandedRowModel(),\n paginatedRowModel: createPaginatedRowModel(), facetedRowModel: createFacetedRowModel(),\n facetedUniqueValues: createFacetedUniqueValues(), facetedMinMaxValues: createFacetedMinMaxValues(),\n filterFns: { ...filterFns, includesString: filterFn_includesString, equalsString: filterFn_equalsString, inNumberRange: filterFn_inNumberRange, fuzzy },\n sortFns: { ...sortFns, alphanumeric: sortFn_alphanumeric, basic: sortFn_basic, datetime: sortFn_datetime },\n aggregationFns: {\n sum: aggregationFn_sum, min: aggregationFn_min, max: aggregationFn_max, mean: aggregationFn_mean,\n median: aggregationFn_median, count: aggregationFn_count, uniqueCount: aggregationFn_uniqueCount,\n first: aggregationFn_first, last: aggregationFn_last, extent: aggregationFn_extent, unique: aggregationFn_unique,\n },\n});\n\nexport type DataGridAggregation = \"sum\" | \"min\" | \"max\" | \"mean\" | \"median\" | \"count\" | \"uniqueCount\" | \"first\" | \"last\" | \"extent\" | \"unique\";\nexport type DataGridFilterOperator = keyof typeof filterFns | \"fuzzy\";\nexport type DataGridSortType = keyof typeof sortFns | \"auto\";\nexport type DataGridFilter = { id: string; value: unknown };\nexport type DataGridCellRange = { anchorRowId: string; anchorColumnId: string; focusRowId: string; focusColumnId: string; operation?: \"include\" | \"exclude\" };\nexport type DataGridViewState = {\n search: string;\n filters: DataGridFilter[];\n sorting: { columnId: string; direction: \"asc\" | \"desc\" }[];\n pagination: { pageIndex: number; pageSize: number };\n columnOrder: string[];\n columnSizes: Record<string, number>;\n hiddenColumns: string[];\n columnPinning: { start: string[]; end: string[] };\n grouping: string[];\n expanded: true | Record<string, boolean>;\n rowPinning: { top: string[]; bottom: string[] };\n selectedKeys: string[];\n cellSelection: DataGridCellRange[];\n};\nexport type DataGridFeatures<T> = {\n /** Client mode processes the full supplied dataset. Server mode emits state only. */\n processing?: \"client\" | \"server\";\n /** Server result count, not the current page length. Required for a server pager. */\n rowCount?: number;\n search?: boolean;\n fuzzySearch?: boolean;\n filtering?: boolean;\n faceting?: boolean;\n pagination?: boolean;\n pageSizes?: number[];\n multiSort?: boolean;\n columnResizing?: boolean;\n columnOrdering?: boolean;\n columnPinning?: boolean;\n grouping?: boolean;\n aggregation?: boolean;\n expanding?: boolean;\n rowPinning?: boolean;\n rowSelection?: boolean;\n cellSelection?: boolean;\n cellSpanning?: boolean;\n columnVirtualization?: boolean;\n getSubRows?: (row: T) => T[] | undefined;\n renderDetail?: (row: T) => ReactNode;\n /** Each supplied state field is controlled; omitted fields remain local. */\n state?: Partial<DataGridViewState>;\n defaultState?: Partial<DataGridViewState>;\n onStateChange?: (state: DataGridViewState) => void;\n /** Optional precomputed server aggregation values, keyed by column id. */\n totals?: Record<string, ReactNode>;\n /** Server-computed facets/ranges must describe the result set, not one page. */\n facets?: Record<string, { value: string; label?: string; count?: number }[]>;\n ranges?: Record<string, [number, number]>;\n};\n\nexport function initialViewState(seed?: Partial<DataGridViewState>): DataGridViewState {\n return {\n search: \"\", filters: [], sorting: [], pagination: { pageIndex: 0, pageSize: 25 },\n columnOrder: [], columnSizes: {}, hiddenColumns: [], columnPinning: { start: [], end: [] },\n grouping: [], expanded: {}, rowPinning: { top: [], bottom: [] }, selectedKeys: [], cellSelection: [],\n ...seed,\n };\n}\n","import { useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport type { CSSProperties, KeyboardEvent, ReactNode } from \"react\";\nimport { functionalUpdate, useTable } from \"@tanstack/react-table\";\nimport type { Cell, Column, ColumnDef, Row, Updater } from \"@tanstack/react-table\";\nimport { defaultRangeExtractor, useVirtualizer } from \"@tanstack/react-virtual\";\nimport { ArrowDown, ArrowUp, ChevronDown, ChevronRight, MoreHorizontal, Search, SlidersHorizontal } from \"lucide-react\";\nimport { Button } from \"../../common/Button\";\nimport { Checkbox } from \"../../common/Checkbox\";\nimport { IconButton } from \"../../common/IconButton\";\nimport { Input } from \"../../common/Input\";\nimport { Select } from \"../../common/Select\";\nimport { Skeleton } from \"../../common/Skeleton\";\nimport { Menu, MenuCheckboxItem, MenuItem, MenuSeparator } from \"../../composed/Menu\";\nimport { Pagination } from \"../../composed/Pagination\";\nimport { bodyState, clampCursor } from \"./DataGrid.state\";\nimport { completeFeatures, initialViewState } from \"./DataGrid.features\";\nimport type { DataGridViewState } from \"./DataGrid.features\";\nimport type { DataGridColumn, DataGridProps } from \"./DataGrid\";\nimport \"./DataGridComplete.css\";\n\ntype Datum<T> = { data: T; key: string; children?: Datum<T>[] };\ntype GridRow<T> = Row<typeof completeFeatures, Datum<T>>;\ntype GridColumn<T> = Column<typeof completeFeatures, Datum<T>, unknown>;\ntype GridCell<T> = Cell<typeof completeFeatures, Datum<T>, unknown>;\nconst CONTROL = \"__data_grid_controls\";\nconst widths = { sm: 128, md: 192, lg: 288, grow: 224 };\nconst aggregationLabels: Record<string, string> = { sum: \"합계\", min: \"최소\", max: \"최대\", mean: \"평균\", median: \"중앙값\", count: \"행 수\", uniqueCount: \"고유 값 수\", first: \"첫 값\", last: \"마지막 값\", extent: \"범위\", unique: \"고유 값\" };\nconst formatValue = (value: unknown): ReactNode => {\n if (value == null) return \"—\";\n if (Array.isArray(value)) return value.map(item => String(item ?? \"—\")).join(\" · \");\n if (typeof value === \"object\") return Object.entries(value).map(([key, item]) => `${aggregationLabels[key] ?? key}: ${formatValue(item)}`).join(\" · \");\n return String(value);\n};\nconst cellValue = <T,>(column: DataGridColumn<T>, row: T): unknown => {\n if (column.accessor) return column.accessor(row);\n if (column.value) return column.value(row);\n if (row != null && typeof row === \"object\" && column.id in row) return (row as Record<string, unknown>)[column.id];\n const value = column.cell(row);\n return typeof value === \"number\" || typeof value === \"string\" ? value : \"\";\n};\n\n/** Full-feature rendering is opt-in; the existing controlled grid remains compatible. */\nexport function DataGridComplete<T>(props: DataGridProps<T>) {\n const dataAttributes = Object.fromEntries(Object.entries(props).filter(([key]) => key.startsWith(\"data-\")));\n const options = props.features === \"all\" ? {} : props.features ?? {};\n const enabled = (feature: keyof typeof options) => options[feature] !== false;\n const server = options.processing === \"server\";\n const uid = useId();\n const gridSelector = '[role=\"grid\"], [role=\"treegrid\"]';\n const viewport = useRef<HTMLDivElement>(null);\n const grid = useRef<HTMLDivElement>(null);\n const head = useRef<HTMLDivElement>(null);\n const top = useRef<HTMLDivElement>(null);\n const bottom = useRef<HTMLDivElement>(null);\n const foot = useRef<HTMLDivElement>(null);\n const [geometry, setGeometry] = useState({ head: 40, top: 0, bottom: 0, foot: 0, row: 36 });\n const [local, setLocal] = useState(() => initialViewState({\n ...options.defaultState,\n ...(props.sort ? { sorting: [props.sort] } : {}),\n ...(props.hiddenColumns ? { hiddenColumns: props.hiddenColumns } : {}),\n ...(props.selectedKeys ? { selectedKeys: props.selectedKeys } : {}),\n }));\n const view: DataGridViewState = { ...local, ...options.state,\n ...(props.sort !== undefined ? { sorting: props.sort ? [props.sort] : [] } : {}),\n ...(props.hiddenColumns !== undefined ? { hiddenColumns: props.hiddenColumns } : {}),\n ...(props.selectedKeys !== undefined ? { selectedKeys: props.selectedKeys } : {}),\n };\n const current = useRef(view); current.current = view;\n const change = <K extends keyof DataGridViewState>(key: K, updater: Updater<DataGridViewState[K]>, resetPage = false) => {\n const previous = current.current;\n const value = functionalUpdate(updater, previous[key]);\n const next = { ...previous, [key]: value,\n ...(resetPage ? { pagination: { ...previous.pagination, pageIndex: 0 } } : {}),\n };\n current.current = next;\n setLocal(next);\n options.onStateChange?.(next);\n if (key === \"sorting\") props.onSortChange?.(next.sorting[0] ?? null);\n if (key === \"hiddenColumns\") props.onHiddenColumnsChange?.(next.hiddenColumns);\n if (key === \"selectedKeys\") props.onSelectedChange?.(next.selectedKeys);\n };\n const [cursor, setCursor] = useState({ row: 0, column: 0 });\n const focusIntent = useRef(false);\n const [focusedId, setFocusedId] = useState<string | null>(null);\n const [editing, setEditing] = useState<{ rowId: string; columnId: string; draft: string } | null>(null);\n const editingRef = useRef(editing); editingRef.current = editing;\n const [copyStatus, setCopyStatus] = useState(\"\");\n const [recovering, setRecovering] = useState<{ rowId: string; columnId: string } | null>(null);\n const [dragColumn, setDragColumn] = useState<string | null>(null);\n const rowHeights = useRef(new Map<string, number>());\n\n const data = useMemo(() => {\n const wrap = (rows: T[]): Datum<T>[] => rows.map(row => ({ data: row, key: props.rowKey(row), children: options.getSubRows ? wrap(options.getSubRows(row) ?? []) : undefined }));\n return wrap(props.rows);\n }, [props.rows, props.rowKey, options.getSubRows]);\n const originals = useMemo(() => new Map(props.columns.map(column => [column.id, column])), [props.columns]);\n const selecting = enabled(\"rowSelection\");\n const controls = selecting || enabled(\"rowPinning\");\n const definitions = useMemo<ColumnDef<typeof completeFeatures, Datum<T>>[]>(() => {\n const leaves: ColumnDef<typeof completeFeatures, Datum<T>>[] = props.columns.map(column => ({\n id: column.id, header: column.header,\n accessorFn: row => cellValue(column, row.data),\n size: column.size ?? widths[column.width ?? \"md\"], minSize: column.minSize ?? 72, maxSize: column.maxSize ?? 1200,\n enableSorting: column.sortable !== false, enableHiding: column.hideable !== false,\n enableColumnFilter: column.filter !== false, enableGrouping: column.groupable !== false,\n filterFn: column.filterOperator ?? (column.filter === \"number\" ? \"inNumberRange\" : column.filter === \"select\" ? \"equalsString\" : column.filter === \"fuzzy\" ? \"fuzzy\" : \"includesString\"),\n sortFn: column.sortType ?? (column.numeric || column.filter === \"number\" ? \"basic\" : \"auto\"), sortDescFirst: false,\n aggregationFn: column.aggregation,\n spanColumns: typeof column.spanColumns === \"function\" ? ({ row }) => (column.spanColumns as (row: T) => number)(row.original.data) : column.spanColumns,\n spanRows: column.spanRows ? context => {\n if (options.renderDetail && (context.anchorRow.getIsExpanded() || context.previousRow.getIsExpanded() || context.row.getIsExpanded())) return false;\n return typeof column.spanRows === \"function\" ? column.spanRows(context.anchorRow.original.data, context.row.original.data) : context.value != null && Object.is(context.anchorValue, context.value);\n } : false,\n }));\n const result: ColumnDef<typeof completeFeatures, Datum<T>>[] = [];\n for (let index = 0; index < leaves.length; index++) {\n const group = props.columns[index].headerGroup;\n if (!group) result.push(leaves[index]);\n else {\n const existing = result.find(item => item.id === `__group_${group}`);\n if (existing && \"columns\" in existing) existing.columns = [...existing.columns ?? [], leaves[index]];\n else result.push({ id: `__group_${group}`, header: group, columns: [leaves[index]] });\n }\n }\n if (controls) result.unshift({ id: CONTROL, header: \"행 작업\", size: 128, minSize: 128, maxSize: 192,\n enableSorting: false, enableHiding: false, enableColumnFilter: false, enableGlobalFilter: false,\n enableGrouping: false, enableCellSelection: false, enableCellSpanning: false, enableResizing: false });\n return result;\n }, [props.columns, controls, options.renderDetail, view.expanded]);\n\n const table = useTable({\n features: completeFeatures, data, columns: definitions, getRowId: row => row.key, getSubRows: row => row.children,\n state: {\n globalFilter: view.search, columnFilters: view.filters,\n sorting: view.sorting.map(item => ({ id: item.columnId, desc: item.direction === \"desc\" })),\n pagination: view.pagination, columnOrder: view.columnOrder, columnSizing: view.columnSizes,\n columnVisibility: Object.fromEntries(view.hiddenColumns.map(id => [id, false])), columnPinning: view.columnPinning,\n grouping: view.grouping, expanded: view.expanded, rowPinning: view.rowPinning,\n rowSelection: Object.fromEntries(view.selectedKeys.map(id => [id, true as const])), cellSelection: view.cellSelection,\n },\n onGlobalFilterChange: updater => change(\"search\", updater, true),\n onColumnFiltersChange: updater => change(\"filters\", updater, true),\n onSortingChange: updater => change(\"sorting\", previous => functionalUpdate(updater, previous.map(item => ({ id: item.columnId, desc: item.direction === \"desc\" }))).map(item => ({ columnId: item.id, direction: item.desc ? \"desc\" : \"asc\" })), true),\n onPaginationChange: updater => change(\"pagination\", updater),\n onColumnOrderChange: updater => change(\"columnOrder\", updater),\n onColumnSizingChange: updater => change(\"columnSizes\", updater),\n onColumnVisibilityChange: updater => change(\"hiddenColumns\", previous => Object.entries(functionalUpdate(updater, Object.fromEntries(previous.map(id => [id, false])))).filter(([, visible]) => !visible).map(([id]) => id)),\n onColumnPinningChange: updater => change(\"columnPinning\", updater),\n onGroupingChange: updater => change(\"grouping\", updater, true),\n onExpandedChange: updater => change(\"expanded\", updater),\n onRowPinningChange: updater => change(\"rowPinning\", updater),\n onRowSelectionChange: updater => change(\"selectedKeys\", previous => Object.keys(functionalUpdate(updater, Object.fromEntries(previous.map(id => [id, true as const]))))),\n onCellSelectionChange: updater => change(\"cellSelection\", updater),\n manualSorting: server, manualFiltering: server, manualGrouping: server, manualAggregation: server || !enabled(\"aggregation\"),\n manualPagination: server || !enabled(\"pagination\"), rowCount: server ? options.rowCount : undefined,\n enableMultiSort: enabled(\"multiSort\"), enableColumnResizing: enabled(\"columnResizing\"), columnResizeMode: \"onChange\",\n enableColumnPinning: enabled(\"columnPinning\"), enableGrouping: enabled(\"grouping\"), groupedColumnMode: false,\n enableExpanding: enabled(\"expanding\"), getRowCanExpand: row => enabled(\"expanding\") && (row.subRows.length > 0 || Boolean(options.renderDetail) && !row.getIsGrouped()),\n enableRowPinning: enabled(\"rowPinning\"), keepPinnedRows: false, enableRowSelection: selecting,\n enableCellSelection: enabled(\"cellSelection\"), enableCellSpanning: enabled(\"cellSpanning\"),\n globalFilterFn: enabled(\"fuzzySearch\") ? \"fuzzy\" : \"includesString\",\n autoResetPageIndex: false, autoResetExpanded: false, autoResetCellSelection: false,\n });\n const columns = [...table.getStartVisibleLeafColumns(), ...table.getCenterVisibleLeafColumns(), ...table.getEndVisibleLeafColumns()];\n const centerColumns = table.getCenterVisibleLeafColumns();\n const topRows = table.getTopRows(), bottomRows = table.getBottomRows(), centerRows = table.getCenterRows();\n const displayRows = [...topRows, ...centerRows, ...bottomRows];\n const selectionRows = (row: GridRow<T>) => row.getIsGrouped() ? row.getLeafRows() : [row];\n const chosen = new Set(view.selectedKeys);\n const isChosen = (row: GridRow<T>) => selectionRows(row).every(item => chosen.has(item.id));\n const isPartial = (row: GridRow<T>) => !isChosen(row) && selectionRows(row).some(item => chosen.has(item.id));\n const pageKeys = [...new Set(table.getRowModel().rows.flatMap(row => selectionRows(row).map(item => item.id)))];\n const allPageChosen = pageKeys.length > 0 && pageKeys.every(id => chosen.has(id));\n const somePageChosen = pageKeys.some(id => chosen.has(id));\n const toggleKeys = (keys: string[], remove: boolean) => change(\"selectedKeys\", previous => {\n const next = new Set(previous);\n for (const key of keys) { if (remove) next.delete(key); else next.add(key); }\n return [...next];\n });\n const toggleRow = (row: GridRow<T>) => {\n if (row.getIsGrouped()) toggleKeys(selectionRows(row).map(item => item.id), isChosen(row));\n else row.toggleSelected();\n };\n const rowPositions = new Map(displayRows.map((row, index) => [row.id, index]));\n const headerLevels = table.getHeaderGroups().length;\n const hierarchical = Boolean(options.getSubRows || options.renderDetail || view.grouping.length);\n const headerRows = headerLevels + (enabled(\"filtering\") ? 1 : 0);\n const hasFooter = enabled(\"aggregation\") || props.columns.some(column => column.footer);\n const retaining = Boolean(props.error) && props.retainRowsOnError && props.rows.length > 0;\n const status = retaining ? \"rows\" : bodyState(Boolean(props.error), Boolean(props.loading), displayRows.length);\n const showFooter = hasFooter && status === \"rows\";\n const virtualRows = props.virtualize !== false && status === \"rows\";\n const virtualColumns = enabled(\"columnVirtualization\") && status === \"rows\";\n const detailOpen = (row: GridRow<T>) => Boolean(options.renderDetail) && row.getIsExpanded() && !row.getIsGrouped() && row.subRows.length === 0;\n const detailBefore = new Map<string, number>();\n let detailCount = 0;\n for (const row of displayRows) { detailBefore.set(row.id, detailCount); if (detailOpen(row)) detailCount++; }\n const pageOffset = enabled(\"pagination\") ? view.pagination.pageIndex * view.pagination.pageSize : 0;\n const allLogicalRows = server ? displayRows : table.getPrePaginatedRowModel().rows;\n const allDetails = allLogicalRows.filter(detailOpen).length;\n const earlierDetails = server ? 0 : allLogicalRows.slice(0, pageOffset).filter(detailOpen).length;\n const logicalRowCount = headerRows + (status === \"loading\" ? props.loadingRows ?? 5 : status === \"rows\" ? (server ? options.rowCount ?? displayRows.length : table.getRowCount()) + allDetails : 0) + (showFooter ? 1 : 0);\n const spanIndex = enabled(\"cellSpanning\") ? table.getCellSpanIndex() : null;\n const retainedRows = new Set<number>();\n for (const id of [editing?.rowId, focusedId, displayRows[cursor.row]?.id]) {\n const index = centerRows.findIndex(row => row.id === id);\n if (index >= 0) retainedRows.add(index);\n }\n const keepSpanAnchors = (range: { startIndex: number; endIndex: number; overscan: number; count: number }) => {\n const indices = new Set([...defaultRangeExtractor(range), ...retainedRows]);\n if (spanIndex) {\n const spanOffset = topRows.length;\n for (const spans of Object.values(spanIndex.rowSpans)) {\n for (let index = 0; index <= range.endIndex + spanOffset && index < spans.length; index++) {\n if (spans[index] > 1 && index + spans[index] > range.startIndex + spanOffset) {\n const anchor = index - spanOffset;\n if (anchor >= 0 && anchor < centerRows.length) indices.add(anchor);\n }\n }\n }\n }\n return [...indices].filter(index => index >= 0 && index < centerRows.length).sort((a, b) => a - b);\n };\n const rowVirtualizer = useVirtualizer({\n count: centerRows.length, getScrollElement: () => viewport.current, getItemKey: index => centerRows[index].id,\n estimateSize: index => (detailOpen(centerRows[index]) ? geometry.row * 3 : geometry.row),\n enabled: virtualRows, overscan: 5, rangeExtractor: keepSpanAnchors,\n scrollMargin: geometry.head + geometry.top, scrollPaddingStart: geometry.head + geometry.top,\n scrollPaddingEnd: geometry.foot + geometry.bottom,\n measureElement: element => {\n const height = element.getBoundingClientRect().height;\n const id = element.getAttribute(\"data-row-id\"); if (id) rowHeights.current.set(id, height);\n return height;\n },\n });\n const spanningColumns = new Set<number>();\n if (spanIndex) for (const spans of spanIndex.colSpans) if (spans) {\n for (let index = 0; index < spans.length; index++) if (spans[index] > 1) {\n const id = columns[index]?.id, centerIndex = centerColumns.findIndex(column => column.id === id);\n if (centerIndex >= 0) spanningColumns.add(centerIndex);\n }\n }\n const columnVirtualizer = useVirtualizer({\n count: centerColumns.length, horizontal: true, getScrollElement: () => viewport.current,\n getItemKey: index => centerColumns[index].id, estimateSize: index => centerColumns[index].getSize(),\n enabled: virtualColumns, overscan: 2, scrollMargin: table.getStartTotalSize(),\n scrollPaddingStart: table.getStartTotalSize(), scrollPaddingEnd: table.getEndTotalSize(),\n rangeExtractor: range => [...new Set([...defaultRangeExtractor(range), ...spanningColumns,\n centerColumns.findIndex(column => column.id === columns[cursor.column]?.id),\n ])].filter(index => index >= 0 && index < centerColumns.length).sort((a, b) => a - b),\n });\n const visibleColumns = new Set(virtualColumns ? columnVirtualizer.getVirtualItems().map(item => centerColumns[item.index].id) : centerColumns.map(column => column.id));\n for (const column of columns) if (column.getIsPinned()) visibleColumns.add(column.id);\n const visibleRows = virtualRows ? rowVirtualizer.getVirtualItems().map(item => ({ row: centerRows[item.index], index: item.index, offset: item.start - geometry.head - geometry.top }))\n : centerRows.map((row, index) => ({ row, index, offset: 0 }));\n\n useEffect(() => {\n const measure = () => {\n const row = grid.current?.querySelector<HTMLElement>('[data-dg=\"row\"]');\n const next = { head: head.current?.getBoundingClientRect().height ?? 0, top: top.current?.getBoundingClientRect().height ?? 0,\n bottom: bottom.current?.getBoundingClientRect().height ?? 0, foot: foot.current?.getBoundingClientRect().height ?? 0,\n row: row ? parseFloat(getComputedStyle(row).minBlockSize) || 36 : 36 };\n setGeometry(previous => Object.keys(next).every(key => next[key as keyof typeof next] === previous[key as keyof typeof next]) ? previous : next);\n rowVirtualizer.measure();\n };\n measure(); const observer = new ResizeObserver(measure);\n for (const element of [head.current, top.current, bottom.current, foot.current]) if (element) observer.observe(element);\n return () => observer.disconnect();\n }, [props.density, headerRows, view.grouping.length, topRows.length, bottomRows.length, hasFooter, status, rowVirtualizer]);\n useEffect(() => { columnVirtualizer.measure(); }, [view.columnSizes, view.columnOrder, view.hiddenColumns, view.columnPinning, columnVirtualizer]);\n useEffect(() => {\n setCursor(previous => {\n const next = clampCursor(previous, { rows: displayRows.length, columns: columns.length });\n for (let step = 0; step < displayRows.length + columns.length; step++) {\n const cell = displayRows[next.row]?.getVisibleCells().find(item => item.column.id === columns[next.column]?.id);\n if (!cell?.getIsCovered()) break;\n if (cell.getRowSpan() === 0 && next.row > 0) next.row--;\n else if (next.column > 0) next.column--;\n else break;\n }\n return next.row === previous.row && next.column === previous.column ? previous : next;\n });\n }, [displayRows.length, columns.length, data, definitions, view.sorting, view.filters, view.grouping, view.columnOrder, view.columnPinning]);\n useEffect(() => {\n if (!server && enabled(\"pagination\")) {\n const last = Math.max(0, table.getPageCount() - 1);\n if (view.pagination.pageIndex > last) table.setPageIndex(last);\n }\n }, [data, view.filters, view.search, view.grouping, view.pagination.pageIndex, server, options.pagination, table]);\n useEffect(() => {\n if (editing && (status !== \"rows\" || !displayRows.some(row => row.id === editing.rowId) || !columns.some(column => column.id === editing.columnId))) {\n editingRef.current = null; setEditing(null);\n }\n }, [editing, displayRows, columns, status]);\n useEffect(() => {\n if (!focusIntent.current) return;\n const row = displayRows[cursor.row], column = columns[cursor.column];\n if (!row || !column) return;\n const index = centerRows.findIndex(item => item.id === row.id);\n if (virtualRows && index >= 0) rowVirtualizer.scrollToIndex(index, { align: \"auto\" });\n const colIndex = centerColumns.findIndex(item => item.id === column.id);\n if (virtualColumns && colIndex >= 0) columnVirtualizer.scrollToIndex(colIndex, { align: \"auto\" });\n const cell = [...(grid.current?.querySelectorAll<HTMLElement>('[role=\"gridcell\"]') ?? [])].find(node => node.dataset.rowId === row.id && node.dataset.columnId === column.id);\n if (cell) { if (!cell.querySelector('[data-dg=\"editor\"]')) cell.focus({ preventScroll: true }); focusIntent.current = false; }\n }, [cursor, visibleRows, columns, displayRows, centerRows, centerColumns, virtualRows, virtualColumns, rowVirtualizer, columnVirtualizer]);\n\n const openEditor = (row: GridRow<T>, column: DataGridColumn<T>) => {\n if (row.getIsGrouped() || !column.editable || !props.onCellCommit || props.cellState?.(row.original.data, column)?.pending) return;\n setEditing({ rowId: row.id, columnId: column.id, draft: props.cellState?.(row.original.data, column)?.draft ?? column.value?.(row.original.data) ?? String(cellValue(column, row.original.data) ?? \"\") });\n };\n const closeEditor = (commit: boolean, restore = false) => {\n const value = editingRef.current; if (!value) return;\n editingRef.current = null; setEditing(null);\n if (commit) {\n const row = displayRows.find(item => item.id === value.rowId);\n if (row) props.onCellCommit?.(row.original.data, value.columnId, value.draft);\n }\n if (restore) { focusIntent.current = true; setCursor(previous => ({ ...previous })); }\n };\n useEffect(() => {\n if (!recovering) return;\n const column = originals.get(recovering.columnId);\n if (!column || !columns.some(item => item.id === recovering.columnId)) return;\n const index = table.getPrePaginatedRowModel().rows.findIndex(row => row.id === recovering.rowId);\n if (index < 0) {\n setCopyStatus(\"입력 복구 대상을 표시하려면 검색 조건을 해제하세요.\"); setRecovering(null); return;\n }\n const page = Math.floor(index / view.pagination.pageSize);\n if (!server && enabled(\"pagination\") && page !== view.pagination.pageIndex) { table.setPageIndex(page); return; }\n const row = displayRows.find(item => item.id === recovering.rowId);\n if (!row) return;\n openEditor(row, column);\n focusIntent.current = true;\n setCursor({ row: rowPositions.get(row.id) ?? 0, column: columns.findIndex(item => item.id === column.id) });\n setRecovering(null);\n }, [recovering, view.expanded, view.pagination, columns, displayRows, table, server]);\n const reorder = (id: string, beforeId: string) => {\n const order = columns.map(column => column.id).filter(column => column !== id);\n order.splice(Math.max(0, order.indexOf(beforeId)), 0, id); table.setColumnOrder(order);\n };\n const moveColumn = (id: string, delta: number) => {\n const order = columns.map(column => column.id), index = order.indexOf(id), target = index + delta;\n if (target < 0 || target >= order.length || order[target] === CONTROL) return;\n [order[index], order[target]] = [order[target], order[index]]; table.setColumnOrder(order);\n };\n const selectedText = () => table.getSelectedCellRangesData().map(region => region.map(row => row.map(value => String(value ?? \"\").replace(/[\\t\\r\\n]+/g, \" \")).join(\"\\t\")).join(\"\\n\")).join(\"\\n\\n\");\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const target = event.target;\n if (!(target instanceof HTMLElement) || !target.matches('[role=\"gridcell\"]') || target.closest(gridSelector) !== event.currentTarget || editing) return;\n const index = rowPositions.get(target.dataset.rowId ?? \"\") ?? cursor.row;\n const columnIndex = columns.findIndex(column => column.id === target.dataset.columnId);\n const arrows: Record<string, [number, number]> = { ArrowDown: [1, 0], ArrowUp: [-1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1], PageDown: [10, 0], PageUp: [-10, 0] };\n let next = { row: index, column: Math.max(0, columnIndex) };\n if (arrows[event.key]) { next = { row: next.row + arrows[event.key][0], column: next.column + arrows[event.key][1] }; }\n else if (event.key === \"Home\") next = { row: event.ctrlKey || event.metaKey ? 0 : index, column: 0 };\n else if (event.key === \"End\") next = { row: event.ctrlKey || event.metaKey ? displayRows.length - 1 : index, column: columns.length - 1 };\n else if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === \"a\" && enabled(\"cellSelection\")) { event.preventDefault(); table.selectAllCells(); return; }\n else if ((event.ctrlKey || event.metaKey) && event.key === \" \" && enabled(\"cellSelection\") && target.dataset.columnId !== CONTROL) {\n event.preventDefault();\n const row = displayRows[index], column = target.dataset.columnId!;\n const cell = row.getVisibleCells().find(item => item.column.id === column);\n table.selectCellRange({ anchorRowId: row.id, focusRowId: row.id, anchorColumnId: column, focusColumnId: column }, { mode: cell?.getIsSelected() ? \"exclude\" : \"include\" });\n return;\n }\n else if (event.key === \"Escape\") { table.resetCellSelection(true); return; }\n else if (event.key === \"Enter\" || event.key === \"F2\") {\n const row = displayRows[index], column = originals.get(target.dataset.columnId ?? \"\");\n if (row && column?.editable && props.onCellCommit) { event.preventDefault(); openEditor(row, column); }\n else if (row?.getCanExpand()) { event.preventDefault(); row.toggleExpanded(); }\n else if (row && !row.getIsGrouped()) props.onRowActivate?.(row.original.data);\n return;\n } else if (event.key === \" \" && selecting && displayRows[index]) { event.preventDefault(); toggleRow(displayRows[index]); return; }\n else return;\n event.preventDefault(); next = clampCursor(next, { rows: displayRows.length, columns: columns.length });\n // Covered positions are not focus targets. Step over a merged run or reach its anchor.\n for (let attempt = 0; attempt < displayRows.length + columns.length; attempt++) {\n const candidate = displayRows[next.row]?.getVisibleCells().find(item => item.column.id === columns[next.column]?.id);\n if (!candidate?.getIsCovered()) break;\n const following = candidate.getRowSpan() === 0\n ? { row: next.row + (next.row > index ? 1 : -1), column: next.column }\n : { row: next.row, column: next.column + (next.column > columnIndex && next.row === index ? 1 : -1) };\n if (following.row < 0 || following.row >= displayRows.length || following.column < 0 || following.column >= columns.length) {\n next = { row: index, column: columnIndex }; break;\n }\n next = following;\n }\n const row = displayRows[next.row], column = columns[next.column];\n if (enabled(\"cellSelection\") && row && column?.id !== CONTROL) {\n if (event.shiftKey) {\n const previous = view.cellSelection.at(-1);\n table.selectCellRange({ anchorRowId: previous?.anchorRowId ?? displayRows[index].id,\n anchorColumnId: previous?.anchorColumnId ?? target.dataset.columnId!, focusRowId: row.id, focusColumnId: column.id });\n } else table.setFocusedCell(row.id, column.id);\n }\n focusIntent.current = true; setCursor(next);\n };\n\n const columnStyle = (column: GridColumn<T>, width = column.getSize(), spanHeight = geometry.row): CSSProperties => ({\n \"--dg-cell-size\": `${width}px`, \"--dg-pin-offset\": `${column.getIsPinned() === \"end\" ? column.getAfter(\"end\") : column.getStart(\"start\")}px`,\n \"--dg-span-size\": `${spanHeight}px`,\n } as CSSProperties);\n const renderColumnMenu = (column: GridColumn<T>) => column.getCanSort() || column.getCanHide() || enabled(\"columnPinning\") || enabled(\"columnOrdering\") || enabled(\"grouping\") && column.getCanGroup() || enabled(\"columnResizing\") && column.getCanResize() ? <Menu items={<>\n {column.getCanSort() ? <>\n <MenuItem icon={ArrowUp} onSelect={() => column.toggleSorting(false, false)}>오름차순</MenuItem>\n <MenuItem icon={ArrowDown} onSelect={() => column.toggleSorting(true, false)}>내림차순</MenuItem>\n {enabled(\"multiSort\") ? <MenuItem onSelect={() => column.toggleSorting(false, true)}>다중 정렬에 추가</MenuItem> : null}\n <MenuItem onSelect={() => column.clearSorting()}>정렬 해제</MenuItem><MenuSeparator />\n </> : null}\n {enabled(\"columnPinning\") ? <>\n <MenuItem onSelect={() => column.pin(\"start\")}>왼쪽에 고정</MenuItem>\n <MenuItem onSelect={() => column.pin(\"end\")}>오른쪽에 고정</MenuItem>\n <MenuItem onSelect={() => column.pin(false)}>열 고정 해제</MenuItem>\n </> : null}\n {enabled(\"columnOrdering\") ? <>\n <MenuItem onSelect={() => moveColumn(column.id, -1)}>열을 앞으로 이동</MenuItem>\n <MenuItem onSelect={() => moveColumn(column.id, 1)}>열을 뒤로 이동</MenuItem>\n </> : null}\n {enabled(\"grouping\") && column.getCanGroup() ? <MenuItem onSelect={() => column.toggleGrouping()}>{column.getIsGrouped() ? \"그룹 해제\" : \"이 열로 그룹화\"}</MenuItem> : null}\n {enabled(\"columnResizing\") && column.getCanResize() ? <MenuItem onSelect={() => column.resetSize()}>열 너비 초기화</MenuItem> : null}\n {column.getCanHide() ? <MenuItem onSelect={() => column.toggleVisibility(false)}>이 열 숨기기</MenuItem> : null}\n </>}><IconButton icon={ChevronDown} size=\"sm\" variant=\"ghost\" tone=\"neutral\" label={`${originals.get(column.id)?.header ?? column.id} 열 설정`} data-dg=\"column-menu\" /></Menu> : null;\n\n const spacer = (key: string, size: number) => size > 0 ? <div key={key} className=\"dg-complete__spacer\" aria-hidden=\"true\" style={{ \"--dg-gap\": `${size}px` } as CSSProperties} /> : null;\n const layout = (render: (column: GridColumn<T>, index: number) => ReactNode, row?: GridRow<T>) => {\n const result: ReactNode[] = []; let offset = 0, painted = 0;\n const cells = row ? new Map(row.getVisibleCells().map(cell => [cell.column.id, cell])) : null;\n for (let index = 0; index < columns.length; index++) {\n const column = columns[index], cell = cells?.get(column.id), width = column.getSize();\n if (cell?.getIsCovered() && cell.getColSpan() === 0 && cell.getRowSpan() !== 0) { offset += width; continue; }\n if (visibleColumns.has(column.id) || cell && cell.getColSpan() > 1) {\n if (offset > painted) result.push(spacer(`gap-${column.id}`, offset - painted));\n result.push(render(column, index));\n let spanWidth = width;\n if (cell && !cell.getIsCovered()) for (let extra = 1; extra < cell.getColSpan(); extra++) spanWidth += columns[index + extra]?.getSize() ?? 0;\n painted = offset + spanWidth;\n }\n offset += width;\n }\n if (offset > painted) result.push(spacer(\"gap-end\", offset - painted));\n return result;\n };\n\n const renderCell = (row: GridRow<T>, column: GridColumn<T>, columnIndex: number) => {\n const cell = row.getVisibleCells().find(item => item.column.id === column.id)!;\n const rowIndex = rowPositions.get(row.id) ?? 0, original = originals.get(column.id);\n const here = cursor.row === rowIndex && cursor.column === columnIndex;\n const saving = original && !row.getIsGrouped() ? props.cellState?.(row.original.data, original) : undefined;\n const open = editing?.rowId === row.id && editing.columnId === column.id;\n const rowSpan = cell.getRowSpan(), colSpan = cell.getColSpan();\n let width = column.getSize(); for (let extra = 1; extra < colSpan; extra++) width += columns[columnIndex + extra]?.getSize() ?? 0;\n let spanHeight = 0; for (let extra = 0; extra < Math.max(1, rowSpan); extra++) {\n const item = displayRows[rowIndex + extra]; if (item) spanHeight += rowHeights.current.get(item.id) ?? geometry.row;\n }\n if (cell.getIsCovered()) return <div key={column.id} className=\"dg-complete__covered\" aria-hidden=\"true\" style={columnStyle(column)} />;\n return <div key={column.id} role=\"gridcell\" className=\"dg-complete__cell\"\n data-dg=\"cell\" data-row-id={row.id} data-column-id={column.id} data-pin={column.getIsPinned() || undefined}\n data-numeric={original?.numeric ? \"\" : undefined} data-cell-selected={cell.getIsSelected() ? \"\" : undefined}\n data-editable={original?.editable && props.onCellCommit && !row.getIsGrouped() ? \"\" : undefined}\n aria-colindex={columnIndex + 1} aria-colspan={colSpan > 1 ? colSpan : undefined} aria-rowspan={rowSpan > 1 ? rowSpan : undefined}\n aria-selected={enabled(\"cellSelection\") && column.id !== CONTROL ? cell.getIsSelected() : undefined}\n aria-busy={saving?.pending || undefined} aria-describedby={saving?.pending || saving?.error ? `${uid}-${row.id}-${column.id}` : undefined}\n tabIndex={here && !open ? 0 : -1} style={columnStyle(column, width, spanHeight)}\n onFocus={event => { if (event.target === event.currentTarget) setCursor({ row: rowIndex, column: columnIndex }); }}\n onMouseDown={event => {\n if (event.button !== 0 || (event.target as HTMLElement).closest('button,input,a,select,textarea') || column.id === CONTROL) return;\n if (enabled(\"cellSelection\")) cell.getSelectionStartHandler(event.currentTarget.ownerDocument)(event);\n event.currentTarget.focus(); setCursor({ row: rowIndex, column: columnIndex });\n }}\n onMouseEnter={event => { if (enabled(\"cellSelection\")) cell.getSelectionExtendHandler()(event); }}\n onDoubleClick={() => { if (original?.editable && props.onCellCommit) openEditor(row, original); else if (!row.getIsGrouped()) props.onRowActivate?.(row.original.data); }}>\n <div className=\"dg-complete__value\" data-row-span={rowSpan > 1 ? \"\" : undefined}>\n {column.id === CONTROL ? <>\n {selecting ? <Checkbox checked={isChosen(row)} indeterminate={isPartial(row) || row.getIsSomeSelected()} onChange={() => toggleRow(row)} aria-label={`${row.getIsGrouped() ? \"그룹\" : props.rowLabel ? props.rowLabel(row.original.data) : row.id} 선택`} data-dg=\"select-row\" /> : null}\n {enabled(\"rowPinning\") ? <Menu items={<>\n <MenuItem onSelect={() => row.pin(\"top\")}>행을 위에 고정</MenuItem>\n <MenuItem onSelect={() => row.pin(\"bottom\")}>행을 아래에 고정</MenuItem>\n <MenuItem onSelect={() => row.pin(false)}>행 고정 해제</MenuItem>\n </>}><IconButton icon={MoreHorizontal} size=\"sm\" variant=\"ghost\" tone=\"neutral\" label={`${row.getIsGrouped() ? \"그룹\" : props.rowLabel?.(row.original.data) ?? row.id} 행 설정`} data-dg=\"row-menu\" /></Menu> : null}\n </> : open ? <Input aria-label={`${original?.header} 고치기`} value={editing.draft} size=\"sm\" data-dg=\"editor\"\n ref={(node: HTMLInputElement | null) => { if (node && node.ownerDocument.activeElement !== node) node.focus(); }}\n onChange={event => setEditing(previous => previous ? { ...previous, draft: event.target.value } : null)}\n onBlur={() => closeEditor(true)} onKeyDown={event => {\n event.stopPropagation(); if (event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) return;\n if (event.key === \"Enter\" || event.key === \"Escape\") { event.preventDefault(); closeEditor(event.key === \"Enter\", true); }\n }} /> : <>\n {columnIndex === (controls ? 1 : 0) && row.getCanExpand() ? <IconButton icon={row.getIsExpanded() ? ChevronDown : ChevronRight} label={row.getIsExpanded() ? \"행 접기\" : \"행 펼치기\"} size=\"sm\" variant=\"ghost\" tone=\"neutral\" onClick={() => row.toggleExpanded()} aria-expanded={row.getIsExpanded()} data-dg=\"expand\" /> : null}\n <span className=\"dg-complete__content\">{cell.getIsGrouped() ? <>{formatValue(cell.getValue())} ({row.getLeafRows().length})</> : cell.getIsAggregated() ? formatValue(cell.getValue()) : row.getIsGrouped() ? \"\" : original?.cell(row.original.data)}</span>\n {original && !row.getIsGrouped() && props.changed?.(row.original.data, original) !== undefined ? <span className=\"data-grid__flash\" key={props.changed(row.original.data, original)} aria-hidden=\"true\" /> : null}\n </>}\n </div>\n </div>;\n };\n const renderRow = (row: GridRow<T>, centerIndex?: number, offset = 0) => {\n const rowIndex = rowPositions.get(row.id) ?? 0;\n const logical = headerRows + rowIndex + (detailBefore.get(row.id) ?? 0) + 1 + pageOffset + earlierDetails;\n return <div key={row.id} className=\"dg-complete__entry\" data-row-id={row.id} data-index={centerIndex}\n data-virtual={centerIndex !== undefined && virtualRows ? \"\" : undefined}\n ref={centerIndex !== undefined && virtualRows ? rowVirtualizer.measureElement : undefined}\n style={{ \"--dg-row-offset\": `${offset}px` } as CSSProperties}>\n <div role=\"row\" className=\"dg-complete__row\" data-dg=\"row\" data-row-id={row.id} aria-rowindex={logical}\n aria-selected={selecting ? isChosen(row) : undefined} aria-expanded={row.getCanExpand() ? row.getIsExpanded() : undefined}\n aria-level={hierarchical ? row.depth + 1 : undefined} data-selected={isChosen(row) ? \"\" : undefined} data-grouped={row.getIsGrouped() ? \"\" : undefined}>\n {layout((column, index) => renderCell(row, column, index), row)}\n </div>\n {detailOpen(row) ? <div role=\"row\" className=\"dg-complete__detail\" aria-rowindex={logical + 1} aria-level={row.depth + 2} data-dg=\"detail\">\n <div role=\"gridcell\" aria-colspan={columns.length} aria-colindex={1}>{options.renderDetail?.(row.original.data)}</div>\n </div> : null}\n </div>;\n };\n\n return <div {...dataAttributes} className={`data-grid data-grid-complete ${props.className ?? \"\"}`.trim()} data-row-density={props.density ?? \"compact\"} data-height={props.height ?? \"md\"}\n style={{ \"--dg-grid-size\": `${table.getTotalSize()}px`, \"--dg-head-size\": `${geometry.head}px`, \"--dg-foot-size\": `${geometry.foot}px` } as CSSProperties}>\n <div className=\"dg-complete__toolbar\" role=\"group\" aria-label={`${props.label} 도구`}>\n {enabled(\"search\") ? <Input size=\"sm\" iconStart={Search} value={view.search} onChange={event => table.setGlobalFilter(event.target.value)} aria-label={`${props.label} 검색`} placeholder=\"전체 열 검색\" data-dg=\"search\" /> : null}\n <Menu items={table.getAllLeafColumns().filter(column => column.id !== CONTROL).map(column => <MenuCheckboxItem key={column.id} checked={column.getIsVisible()} disabled={!column.getCanHide()} onCheckedChange={() => column.toggleVisibility()}>{originals.get(column.id)?.header ?? column.id}</MenuCheckboxItem>)}>\n <Button size=\"sm\" variant=\"outline\" tone=\"neutral\" iconStart={SlidersHorizontal} data-dg=\"columns\">열 {columns.length - (controls ? 1 : 0)}/{props.columns.length}</Button>\n </Menu>\n {enabled(\"grouping\") && view.grouping.length ? <Button size=\"sm\" variant=\"outline\" onClick={() => table.resetGrouping(true)} data-dg=\"ungroup\">그룹 모두 해제</Button> : null}\n {enabled(\"expanding\") ? <Button size=\"sm\" variant=\"ghost\" tone=\"neutral\" onClick={() => table.toggleAllRowsExpanded()} data-dg=\"expand-all\">{table.getIsAllRowsExpanded() ? \"모두 접기\" : \"모두 펼치기\"}</Button> : null}\n {enabled(\"cellSelection\") ? <Button size=\"sm\" variant=\"outline\" tone=\"neutral\" disabled={!table.getSelectedCellCount()} onClick={async () => {\n try { await navigator.clipboard.writeText(selectedText()); setCopyStatus(\"선택한 셀을 복사했습니다.\"); }\n catch { setCopyStatus(\"복사 권한이 없습니다. 셀에서 Ctrl+C를 눌러 복사하세요.\"); }\n }} data-dg=\"copy\">선택 셀 복사</Button> : null}\n <Button size=\"sm\" variant=\"ghost\" tone=\"neutral\" onClick={() => {\n const next = initialViewState(options.defaultState); current.current = next; setLocal(next); options.onStateChange?.(next);\n props.onSelectedChange?.(next.selectedKeys); props.onHiddenColumnsChange?.(next.hiddenColumns); props.onSortChange?.(next.sorting[0] ?? null);\n }} data-dg=\"reset\">보기 초기화</Button>\n </div>\n {view.sorting.length ? <p className=\"dg-complete__summary\" data-dg=\"sort-status\">정렬: {view.sorting.map((item, index) => `${index + 1}. ${originals.get(item.columnId)?.header ?? item.columnId} ${item.direction === \"asc\" ? \"오름차순\" : \"내림차순\"}`).join(\" · \")}</p> : null}\n <div ref={viewport} className=\"data-grid__scroll dg-complete__scroll\" data-dg=\"scroll\">\n <div ref={grid} role={hierarchical ? \"treegrid\" : \"grid\"} className=\"dg-complete__grid\" aria-label={props.label} aria-colcount={columns.length}\n aria-rowcount={server && status === \"rows\" && (options.rowCount === undefined || Boolean(options.renderDetail)) ? -1 : logicalRowCount}\n aria-busy={status === \"loading\" || undefined}\n aria-multiselectable={selecting || enabled(\"cellSelection\") || undefined} onKeyDown={onKeyDown}\n onFocusCapture={event => { if (event.target.closest(gridSelector) === event.currentTarget) setFocusedId(event.target.closest<HTMLElement>('[data-dg=\"row\"]')?.dataset.rowId ?? null); }}\n onBlurCapture={event => { if (!event.currentTarget.contains(event.relatedTarget)) setFocusedId(null); }}\n onCopy={event => { if (enabled(\"cellSelection\") && !(event.target as HTMLElement).closest('input,textarea') && table.getSelectedCellCount()) { event.clipboardData.setData(\"text/plain\", selectedText()); event.preventDefault(); } }}>\n <div ref={head} role=\"rowgroup\" className=\"dg-complete__head\">\n {table.getHeaderGroups().slice(0, -1).map((group, index) => <div key={group.id} role=\"row\" className=\"dg-complete__row\" aria-rowindex={index + 1}>\n {group.headers.map(header => <div key={header.id} role=\"columnheader\" className=\"dg-complete__group-header\" aria-colspan={header.colSpan}\n style={{ \"--dg-cell-size\": `${header.getSize()}px` } as CSSProperties}>{header.isPlaceholder ? \"\" : String(header.column.columnDef.header ?? \"\")}</div>)}\n </div>)}\n <div role=\"row\" className=\"dg-complete__row\" aria-rowindex={headerLevels}>\n {layout((column, index) => {\n const original = originals.get(column.id), order = view.sorting.findIndex(item => item.columnId === column.id);\n const header = table.getFlatHeaders().find(item => item.column.id === column.id && item.subHeaders.length === 0);\n return <div key={column.id} role=\"columnheader\" className=\"dg-complete__cell dg-complete__header\" data-column-id={column.id} data-pin={column.getIsPinned() || undefined}\n aria-colindex={index + 1} aria-sort={column.getCanSort() ? order < 0 ? \"none\" : order > 0 ? \"other\" : view.sorting[order].direction === \"asc\" ? \"ascending\" : \"descending\" : undefined} style={columnStyle(column)}\n draggable={enabled(\"columnOrdering\") && column.id !== CONTROL}\n onDragStart={event => { setDragColumn(column.id); event.dataTransfer.setData(\"text/plain\", column.id); }}\n onDragOver={event => { if (dragColumn && column.id !== CONTROL) event.preventDefault(); }}\n onDrop={event => { event.preventDefault(); if (dragColumn && dragColumn !== column.id && column.id !== CONTROL) reorder(dragColumn, column.id); setDragColumn(null); }}>\n {column.id === CONTROL ? <>\n {selecting ? <Checkbox checked={allPageChosen} indeterminate={!allPageChosen && somePageChosen} onChange={() => toggleKeys(pageKeys, allPageChosen)} aria-label=\"현재 페이지 전체 선택\" data-dg=\"select-all\" /> : null}\n <span className=\"dg-complete__control-label\">행 작업</span>\n </> : <>\n <button type=\"button\" className=\"dg-complete__sort\" disabled={!column.getCanSort()} aria-label={`${original?.header} 정렬${order >= 0 ? `, ${order + 1}순위 ${view.sorting[order].direction === \"asc\" ? \"오름차순\" : \"내림차순\"}` : \"\"}`} onClick={event => column.toggleSorting(undefined, event.shiftKey && enabled(\"multiSort\"))} data-dg=\"sort\">\n {original?.header}{order >= 0 ? <span>{view.sorting[order].direction === \"asc\" ? \" ↑\" : \" ↓\"}{view.sorting.length > 1 ? order + 1 : \"\"}</span> : null}\n </button>\n {renderColumnMenu(column)}\n {enabled(\"columnResizing\") && header && column.getCanResize() ? <button type=\"button\" className=\"dg-complete__resize\" role=\"separator\" aria-orientation=\"vertical\"\n aria-label={`${original?.header} 열 너비`} aria-valuemin={column.columnDef.minSize} aria-valuemax={column.columnDef.maxSize} aria-valuenow={Math.round(column.getSize())}\n onMouseDown={header.getResizeHandler()} onTouchStart={header.getResizeHandler()} onDoubleClick={() => column.resetSize()}\n onKeyDown={event => { if (event.key === \"ArrowLeft\" || event.key === \"ArrowRight\") { event.preventDefault(); event.stopPropagation(); table.setColumnSizing(previous => ({ ...previous, [column.id]: Math.max(column.columnDef.minSize ?? 72, Math.min(column.columnDef.maxSize ?? 1200, column.getSize() + (event.key === \"ArrowRight\" ? 16 : -16))) })); } }} data-dg=\"resize\" /> : null}\n </>}\n </div>;\n })}\n </div>\n {enabled(\"filtering\") ? <div role=\"row\" className=\"dg-complete__row dg-complete__filters\" aria-label=\"열 필터\" aria-rowindex={headerRows}>\n {layout((column, columnIndex) => {\n const original = originals.get(column.id), value = column.getFilterValue();\n const facets = options.facets?.[column.id]?.map(item => [item.value, item.count] as const)\n ?? (enabled(\"faceting\") && !server && column.getCanFilter() ? [...column.getFacetedUniqueValues().entries()] : []);\n const choices = original?.filterOptions ?? options.facets?.[column.id]?.map(item => ({ value: item.value, label: `${item.label ?? item.value}${item.count === undefined ? \"\" : ` (${item.count})`}` }))\n ?? facets.map(([value, count]) => ({ value: String(value), label: `${value}${count === undefined ? \"\" : ` (${count})`}` }));\n const range = options.ranges?.[column.id] ?? (original?.filter === \"number\" && !server ? column.getFacetedMinMaxValues() : undefined);\n return <div key={column.id} role=\"gridcell\" aria-colindex={columnIndex + 1} className=\"dg-complete__cell\" data-pin={column.getIsPinned() || undefined} style={columnStyle(column)}>\n {!column.getCanFilter() || !original ? null : original.filter === \"select\" ? <Select size=\"sm\" value={String(value ?? \"\")} onChange={event => column.setFilterValue(event.target.value || undefined)} aria-label={`${original.header} 필터`} data-dg=\"filter-select\">\n <option value=\"\">전체</option>{choices.map(item => <option key={item.value} value={item.value}>{item.label}</option>)}\n </Select> : original.filter === \"number\" && (!original.filterOperator || original.filterOperator === \"inNumberRange\") ? <div className=\"dg-complete__range\">\n <Input size=\"sm\" type=\"number\" aria-label={`${original.header} 최솟값`} placeholder={range ? String(range[0]) : \"최소\"} value={String((value as [unknown, unknown] | undefined)?.[0] ?? \"\")} onChange={event => column.setFilterValue([(event.target.value === \"\" ? undefined : Number(event.target.value)), (value as [unknown, unknown] | undefined)?.[1]])} />\n <Input size=\"sm\" type=\"number\" aria-label={`${original.header} 최댓값`} placeholder={range ? String(range[1]) : \"최대\"} value={String((value as [unknown, unknown] | undefined)?.[1] ?? \"\")} onChange={event => column.setFilterValue([(value as [unknown, unknown] | undefined)?.[0], event.target.value === \"\" ? undefined : Number(event.target.value)])} />\n </div> : <Input size=\"sm\" aria-label={`${original.header} 필터`} placeholder={facets.length ? `${facets.length}개 값 검색` : \"필터\"} value={String(value ?? \"\")} onChange={event => column.setFilterValue(event.target.value === \"\" ? undefined : original.parseFilter ? original.parseFilter(event.target.value) : event.target.value)} />}\n\n </div>;\n })}\n </div> : null}\n </div>\n {status === \"rows\" ? <>\n <div ref={top} role={topRows.length ? \"rowgroup\" : undefined} className=\"dg-complete__pinned-top\" data-dg=\"pinned-top\">{topRows.map(row => renderRow(row))}</div>\n <div role=\"rowgroup\" className=\"dg-complete__body\" data-virtual={virtualRows ? \"\" : undefined} style={{ \"--dg-total\": `${virtualRows ? rowVirtualizer.getTotalSize() : 0}px` } as CSSProperties}>\n {visibleRows.map(item => renderRow(item.row, item.index, item.offset))}\n </div>\n <div ref={bottom} role={bottomRows.length ? \"rowgroup\" : undefined} className=\"dg-complete__pinned-bottom\" data-dg=\"pinned-bottom\">{bottomRows.map(row => renderRow(row))}</div>\n </> : status === \"loading\" ? <div role=\"rowgroup\" aria-busy=\"true\">{Array.from({ length: props.loadingRows ?? 5 }, (_, index) => <div key={index} role=\"row\" className=\"dg-complete__row\" aria-rowindex={headerRows + index + 1} data-dg=\"waiting-row\">{layout((column, columnIndex) => <div key={column.id} role=\"gridcell\" aria-colindex={columnIndex + 1} className=\"dg-complete__cell\" style={columnStyle(column)}><Skeleton shape=\"text\" lines={1} /></div>)}</div>)}</div> : null}\n {showFooter ? <div ref={foot} role=\"rowgroup\" className=\"dg-complete__foot\"><div role=\"row\" className=\"dg-complete__row\" data-dg=\"totals\" aria-rowindex={server && Boolean(options.renderDetail) ? undefined : logicalRowCount}>\n {layout((column, columnIndex) => <div key={column.id} role=\"gridcell\" aria-colindex={columnIndex + 1} className=\"dg-complete__cell\" data-pin={column.getIsPinned() || undefined} style={columnStyle(column)}>\n {column.id === CONTROL ? \"집계\" : options.totals?.[column.id] ?? (server ? originals.get(column.id)?.footer?.(props.rows) : originals.get(column.id)?.aggregation ? formatValue(column.getAggregationValue()) : originals.get(column.id)?.footer?.(props.rows))}\n </div>)}\n </div></div> : null}\n </div>\n </div>\n {status === \"error\" || retaining ? <p role=\"alert\" className=\"data-grid__state\" data-dg=\"error\">{props.error}{retaining ? <> 이전 결과를 표시합니다.{props.lastUpdated ? <> 마지막 갱신: {props.lastUpdated}</> : null}</> : null}</p> : status === \"empty\" ? <p className=\"data-grid__empty\" data-dg=\"empty\">{props.empty ?? \"행이 없습니다.\"}</p> : null}\n {enabled(\"pagination\") ? <div className=\"dg-complete__pager\">\n <Pagination label={`${props.label} 페이지`} page={view.pagination.pageIndex + 1} pageCount={server && options.rowCount === undefined ? view.pagination.pageIndex + 1 : Math.max(1, table.getPageCount())} onPageChange={page => table.setPageIndex(page - 1)} responsive size=\"sm\" />\n <Select className=\"dg-complete__page-size\" size=\"sm\" value={String(view.pagination.pageSize)} onChange={event => table.setPageSize(Number(event.target.value))} aria-label=\"페이지당 행 수\" data-dg=\"page-size\">\n {(options.pageSizes ?? [10, 25, 50, 100]).map(size => <option key={size} value={String(size)}>{size}행씩</option>)}\n </Select>\n </div> : null}\n <p role=\"status\" className=\"dg-complete__summary\" data-dg=\"status\">{props.meta ?? `${server ? options.rowCount ?? props.rows.length : table.getRowCount()}행`}{selecting ? ` · 선택 ${view.selectedKeys.length}행` : \"\"}{enabled(\"cellSelection\") ? ` · 선택 ${table.getSelectedCellCount()}셀` : \"\"}{copyStatus ? ` · ${copyStatus}` : \"\"}{server && options.rowCount === undefined && enabled(\"pagination\") ? \" · 전체 행 수가 필요합니다.\" : \"\"}</p>\n {props.cellState ? <ul className=\"data-grid__save-status\">{table.getCoreRowModel().flatRows.map(row => row.original).flatMap(item => props.columns.flatMap(column => {\n const saving = props.cellState?.(item.data, column); if (!saving?.pending && !saving?.error) return [];\n return [<li key={`${item.key}-${column.id}`} id={`${uid}-${item.key}-${column.id}`}><span role={saving.pending ? \"status\" : \"alert\"}>{props.rowLabel?.(item.data) ?? item.key} · {column.header}: {saving.pending ? \"저장 중입니다.\" : saving.error}</span>\n {!saving.pending && saving.error && column.editable && props.onCellCommit ? <Button size=\"sm\" variant=\"outline\" onClick={() => {\n table.getColumn(column.id)?.toggleVisibility(true); table.setExpanded(true); setRecovering({ rowId: item.key, columnId: column.id });\n }}>입력 복구</Button> : null}</li>];\n }))}</ul> : null}\n </div>;\n}\n","import { useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport type { CSSProperties, KeyboardEvent, ReactNode } from \"react\";\nimport { columnVisibilityFeature, functionalUpdate, rowSelectionFeature, rowSortingFeature, tableFeatures, useTable } from \"@tanstack/react-table\";\nimport type { ColumnDef, ColumnVisibilityState, RowSelectionState, SortingState } from \"@tanstack/react-table\";\nimport { defaultRangeExtractor, useVirtualizer } from \"@tanstack/react-virtual\";\nimport { ArrowDown, ArrowUp, ChevronDown, EyeOff, SlidersHorizontal } from \"lucide-react\";\nimport { Checkbox } from \"../../common/Checkbox\";\nimport { Skeleton } from \"../../common/Skeleton\";\nimport { IconButton } from \"../../common/IconButton\";\nimport { Button } from \"../../common/Button\";\nimport { Menu, MenuCheckboxItem, MenuItem, MenuSeparator } from \"../../composed/Menu\";\nimport {\n bodyRowCount,\n bodyState,\n clampCursor,\n moveCursor,\n} from \"./DataGrid.state\";\nimport type { Slot } from \"./DataGrid.state\";\nimport \"./DataGrid.css\";\nimport { DataGridComplete } from \"./DataGridComplete\";\nimport type { DataGridAggregation, DataGridFeatures, DataGridFilterOperator, DataGridSortType } from \"./DataGrid.features\";\n\nconst features = tableFeatures({ columnVisibilityFeature, rowSelectionFeature, rowSortingFeature });\ntype EngineRow<T> = { data: T; key: string };\n\nexport type DataGridWidth = \"sm\" | \"md\" | \"lg\" | \"grow\";\nexport type DataGridDensity = \"compact\" | \"comfortable\";\nexport type DataGridHeight = \"sm\" | \"md\" | \"lg\";\nexport type DataGridSortDirection = \"asc\" | \"desc\";\nexport type DataGridSort = { columnId: string; direction: DataGridSortDirection };\nexport type DataGridCellState = { pending?: boolean; error?: ReactNode; draft?: string };\n\nexport type DataGridColumn<T> = {\n id: string;\n header: string;\n cell: (row: T) => ReactNode;\n /** Enumerated, not measured. See the note on why there is no computed template. */\n width?: DataGridWidth;\n align?: \"start\" | \"end\";\n /** Tabular figures and no wrapping — a column of amounts. */\n numeric?: boolean;\n /**\n * Offers sorting in this column's menu.\n *\n * The grid does not sort. It reports what the reader asked for and renders the order it was\n * given back — because the rows it holds are usually a page of a much larger answer, and a\n * grid that sorted its own ten thousand would be sorting the wrong ten thousand.\n */\n sortable?: boolean;\n sortType?: DataGridSortType;\n /** Whether the reader may hide it. The column that identifies the row usually may not. */\n hideable?: boolean;\n /** Opens an editor in the cell. Needs `value` to know what the editor starts with. */\n editable?: boolean;\n value?: (row: T) => string;\n /** Raw data for sorting, filtering, grouping and aggregation. */\n accessor?: (row: T) => unknown;\n size?: number;\n minSize?: number;\n maxSize?: number;\n headerGroup?: string;\n filter?: \"text\" | \"select\" | \"number\" | \"fuzzy\" | false;\n filterOperator?: DataGridFilterOperator;\n filterOptions?: { value: string; label: string }[];\n parseFilter?: (text: string) => unknown;\n groupable?: boolean;\n aggregation?: DataGridAggregation | DataGridAggregation[];\n /** Merge adjacent equal values, or select adjacent rows with a predicate. */\n spanRows?: boolean | ((anchor: T, row: T) => boolean);\n spanColumns?: number | ((row: T) => number);\n /**\n * What stands under the column — a count, a max, a sum.\n *\n * Given the rows the grid is holding, and that is the whole contract: at ten thousand rows\n * these are the ten thousand, and at a server-paged fifty they are the fifty. A footer that\n * says `합계 137` under fifty rows is a footer the caller computed from the answer rather\n * than from the page, which is the caller's business and not something this can guess.\n */\n footer?: (rows: T[]) => ReactNode;\n};\n\nexport type DataGridProps<T> = {\n /** Opt into the complete grid. Omitted keeps the existing controlled API behavior. */\n features?: \"all\" | DataGridFeatures<T>;\n rows: T[];\n columns: DataGridColumn<T>[];\n /**\n * Which cells changed under the reader, and what makes each change distinct.\n *\n * Returns a token for a cell that changed without this reader doing it — an updated-at, a\n * version, the new value itself — and `undefined` for one that did not. The cell flashes\n * once each time the token differs from the one it was drawn with. `Table` takes the same\n * prop for the same reason and with the same shape; a grid holding a live answer is the\n * place it matters most, because the reader cannot re-read ten thousand rows to find what\n * moved.\n */\n changed?: (row: T, column: DataGridColumn<T>) => string | number | undefined;\n rowKey: (row: T) => string;\n /** What the grid is. Names it, and a grid must be named. */\n label: string;\n /** Keep the first column in place while the rest scroll under it. */\n pinFirst?: boolean;\n /**\n * Row density, and it reaches the DOM as `data-row-density` rather than `data-density`.\n *\n * `[data-density]` is the page-level scope that rescales `--space-*` for everything under\n * it. If this component minted the same attribute, `<DataGrid density=\"compact\">` would match\n * that scope too and rescale the whole subtree — the rows would compact once here and\n * again through every token inside them, and a badge in a compact row would shrink for a\n * reason nobody could find. The two are different variations: one is how much room this\n * component gives its rows, the other is how much room the page gives everything.\n */\n density?: DataGridDensity;\n height?: DataGridHeight;\n /** Window the rendered rows. Disable for native browser find across all supplied rows. */\n virtualize?: boolean;\n onRowActivate?: (row: T) => void;\n empty?: ReactNode;\n /**\n * The grid is waiting for its rows.\n *\n * It draws its own skeleton at the row height it already declares as a token, so the box\n * does not change size when the answer lands. A grid that grows on arrival moves everything\n * under it, and the reader was already looking somewhere.\n */\n loading?: boolean;\n loadingRows?: number;\n /**\n * What went wrong. Error, then loading, then empty, then rows — one at a time.\n *\n * A grid that failed is not an empty grid. Telling the reader 행이 없습니다 when the request\n * threw sends them to change the filter, which fails again, and nothing ever says why.\n */\n error?: ReactNode;\n /** Explicitly retain previous rows after a failed refresh, with a stale-data notice. */\n retainRowsOnError?: boolean;\n lastUpdated?: ReactNode;\n\n /**\n * The keys of the chosen rows. Controlled — the grid never holds this.\n *\n * Selection is the join. `BulkActionBar` needs a count, `FilterBar` narrows what can be\n * chosen and `SavedViewTabs` switches between whole sets of both, and until this existed\n * those three had nothing to say to each other: four parts, each in its own demo. What\n * connects them is one array of keys, and it belongs to whoever is holding the four.\n */\n selectedKeys?: string[];\n onSelectedChange?: (keys: string[]) => void;\n /** Names each row's checkbox: \"12345 고르기\". Required once selection is on. */\n rowLabel?: (row: T) => string;\n\n sort?: DataGridSort | null;\n onSortChange?: (sort: DataGridSort | null) => void;\n\n hiddenColumns?: string[];\n onHiddenColumnsChange?: (ids: string[]) => void;\n\n /** Called when an editor commits. The grid does not change the row; the caller does. */\n onCellCommit?: (row: T, columnId: string, value: string) => void;\n /** The host owns requests, saving state, failures and the rejected draft. */\n cellState?: (row: T, column: DataGridColumn<T>) => DataGridCellState | undefined;\n\n /** What the result is — \"6행 · 388ms\". Rendered under the grid, read as a status. */\n meta?: ReactNode;\n\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * TanStack Table owns row identity and controlled column, selection and sorting models.\n * The caller still owns server queries and edits; no client sorting is applied to a page.\n * TanStack Virtual windows the final row model and measures actual row heights. The cursor,\n * focused control and editor remain mounted outside that window to preserve interaction.\n * Layout measurements use local CSS custom properties so adopters retain styling control.\n */\nexport function DataGrid<T>(props: DataGridProps<T>) {\n return props.features ? <DataGridComplete {...props} /> : <DataGridBasic {...props} />;\n}\n\nfunction DataGridBasic<T>({\n rows,\n columns,\n changed,\n rowKey,\n label,\n pinFirst,\n density = \"compact\",\n height = \"md\",\n virtualize = true,\n onRowActivate,\n empty = \"행이 없습니다.\",\n loading,\n loadingRows = 5,\n error,\n retainRowsOnError = false,\n lastUpdated,\n selectedKeys,\n onSelectedChange,\n rowLabel,\n sort,\n onSortChange,\n hiddenColumns,\n onHiddenColumnsChange,\n onCellCommit,\n cellState,\n meta,\n className,\n ...rest\n}: DataGridProps<T>) {\n const grid = useRef<HTMLDivElement>(null);\n const scroll = useRef<HTMLDivElement>(null);\n const head = useRef<HTMLDivElement>(null);\n const foot = useRef<HTMLDivElement>(null);\n const [geometry, setGeometry] = useState({ head: 0, foot: 0, row: 32 });\n const [focusedRow, setFocusedRow] = useState<number | null>(null);\n const feedbackId = useId();\n /* The cell cursor. The cells share one tab stop between them — ten thousand rows of one tab\n * stop each is a grid a keyboard cannot get past. */\n const [at, setAt] = useState({ row: 0, column: 0 });\n /** Which cell is open for editing, by row key and column id. One at a time. */\n const [editing, setEditing] = useState<{ key: string; columnId: string } | null>(null);\n const [draft, setDraft] = useState(\"\");\n const editorFocusIntent = useRef<boolean | null>(null);\n const scrollToCursor = useRef(false);\n\n const selecting = Boolean(onSelectedChange);\n const chosen = useMemo(() => new Set(selectedKeys ?? []), [selectedKeys]);\n const hidden = useMemo(() => new Set(hiddenColumns ?? []), [hiddenColumns]);\n\n const data = useMemo(() => rows.map(row => ({ data: row, key: rowKey(row) })), [rows, rowKey]);\n const definitions = useMemo<ColumnDef<typeof features, EngineRow<T>>[]>(() => columns.map(column => ({\n id: column.id,\n accessorFn: row => column.value?.(row.data),\n enableHiding: column.hideable !== false,\n enableSorting: Boolean(column.sortable),\n })), [columns]);\n const visibility = useMemo<ColumnVisibilityState>(() => Object.fromEntries(\n [...hidden].map(id => [id, false]),\n ), [hidden]);\n const selection = useMemo<RowSelectionState>(() => Object.fromEntries(\n [...chosen].map(key => [key, true as const]),\n ), [chosen]);\n const sorting = useMemo<SortingState>(() => sort ? [{ id: sort.columnId, desc: sort.direction === \"desc\" }] : [], [sort]);\n const table = useTable({\n features, data, columns: definitions, getRowId: row => row.key,\n manualSorting: true,\n state: { columnVisibility: visibility, rowSelection: selection, sorting },\n onColumnVisibilityChange: updater => {\n const next = functionalUpdate(updater, visibility);\n onHiddenColumnsChange?.(Object.keys(next).filter(id => next[id] === false));\n },\n onRowSelectionChange: updater => onSelectedChange?.(Object.keys(functionalUpdate(updater, selection))),\n onSortingChange: updater => {\n const next = functionalUpdate(updater, sorting)[0];\n onSortChange?.(next ? { columnId: next.id, direction: next.desc ? \"desc\" : \"asc\" } : null);\n },\n });\n const model = table.getRowModel().rows;\n const byColumn = new Map(columns.map(column => [column.id, column]));\n const slots: Slot<T>[] = table.getVisibleLeafColumns().map(column => ({\n id: column.id, kind: \"data\", column: byColumn.get(column.id)!,\n }));\n if (selecting) slots.unshift({ id: \"__select\", kind: \"select\" });\n\n const hasFooter = columns.some((column) => column.footer);\n\n const retaining = Boolean(error) && retainRowsOnError && rows.length > 0;\n const state = retaining ? \"rows\" : bodyState(Boolean(error), Boolean(loading), rows.length);\n const bodyRows = bodyRowCount(state, rows.length, loadingRows);\n\n const editingIndex = editing ? model.findIndex(row => row.id === editing.key) : -1;\n useEffect(() => {\n // A server refresh can remove the edited row or column without dispatching blur.\n if (editing && (state !== \"rows\" || editingIndex < 0 || hidden.has(editing.columnId) || !columns.some(column => column.id === editing.columnId))) {\n setEditing(null);\n }\n }, [editing, editingIndex, hidden, columns, state]);\n const windowed = virtualize && state === \"rows\";\n const virtualizer = useVirtualizer({\n count: model.length,\n getScrollElement: () => scroll.current,\n getItemKey: index => model[index].id,\n estimateSize: () => geometry.row,\n enabled: windowed,\n overscan: 5,\n scrollMargin: geometry.head,\n scrollPaddingStart: geometry.head,\n scrollPaddingEnd: geometry.foot,\n rangeExtractor: range => [...new Set([\n ...defaultRangeExtractor(range),\n Math.min(at.row, model.length - 1),\n editingIndex,\n focusedRow ?? -1,\n ])].filter(index => index >= 0 && index < model.length).sort((a, b) => a - b),\n });\n\n // Re-read token-derived geometry when density, header or cell content changes size.\n useEffect(() => {\n const update = () => {\n const first = grid.current?.querySelector<HTMLElement>('[data-part=\"row\"]');\n const next = {\n head: head.current?.getBoundingClientRect().height ?? 0,\n foot: foot.current?.getBoundingClientRect().height ?? 0,\n row: first ? parseFloat(getComputedStyle(first).minBlockSize) || 32 : 32,\n };\n setGeometry(was => was.head === next.head && was.foot === next.foot && was.row === next.row ? was : next);\n virtualizer.measure();\n };\n update();\n const observer = new ResizeObserver(update);\n if (head.current) observer.observe(head.current);\n if (foot.current) observer.observe(foot.current);\n return () => observer.disconnect();\n }, [density, slots.length, virtualize, state, virtualizer]);\n\n const rendered = windowed\n ? virtualizer.getVirtualItems().map(item => ({ modelRow: model[item.index], index: item.index, start: item.start - geometry.head }))\n : model.map((modelRow, index) => ({ modelRow, index, start: 0 }));\n\n useEffect(() => {\n if (scrollToCursor.current && windowed) virtualizer.scrollToIndex(at.row, { align: \"auto\" });\n scrollToCursor.current = false;\n }, [at.row, at.column, windowed, virtualizer]);\n\n const move = useCallback(\n (rowDelta: number, columnDelta: number, absolute?: { row?: number; column?: number }) => {\n editorFocusIntent.current = true;\n scrollToCursor.current = true;\n setAt((was) => moveCursor(was, { rows: rows.length, columns: slots.length }, rowDelta, columnDelta, absolute));\n },\n [rows.length, slots.length],\n );\n\n /*\n * The cursor cannot point past what is there.\n *\n * A hidden column shortens the row and a narrowed query shortens the grid, and only the cell\n * under the cursor carries `tabindex=\"0\"`. Watching the columns alone is why filtering down\n * to fewer rows than the cursor's index left the grid with no tabbable cell at all: neither\n * Tab nor an arrow key could get back in, because the arrows are handled by a cell that could\n * no longer be focused.\n */\n useEffect(() => {\n setAt((was) => {\n const next = clampCursor(was, { rows: rows.length, columns: slots.length });\n return next.row === was.row && next.column === was.column ? was : next;\n });\n }, [rows.length, slots.length]);\n\n const toggleRow = (row: T) => table.getRow(rowKey(row)).toggleSelected();\n\n const allChosen = rows.length > 0 && rows.every((row) => chosen.has(rowKey(row)));\n const someChosen = rows.some((row) => chosen.has(rowKey(row)));\n\n const toggleAll = () => table.toggleAllRowsSelected(!allChosen);\n\n const openEditor = (row: T, column: DataGridColumn<T>) => {\n if (!column.editable || !onCellCommit) return;\n const saving = cellState?.(row, column);\n if (saving?.pending) return;\n setDraft(saving?.draft ?? column.value?.(row) ?? \"\");\n setEditing({ key: rowKey(row), columnId: column.id });\n };\n\n const closeEditor = (commit: boolean, row: T, column: DataGridColumn<T>, restoreFocus = false) => {\n editorFocusIntent.current = restoreFocus;\n if (commit && onCellCommit) onCellCommit(row, column.id, draft);\n setEditing(null);\n };\n\n const askSort = (column: DataGridColumn<T>, direction: DataGridSortDirection | null) => {\n table.setSorting(direction ? [{ id: column.id, desc: direction === \"desc\" }] : []);\n };\n\n const toggleColumn = (id: string) => table.getColumn(id)?.toggleVisibility();\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n /* Only this grid's own cells use its cursor. Native controls and nested grids keep\n * their keys, including events that bubble through React from a portalled menu. */\n const target = event.target;\n if (\n event.defaultPrevented ||\n !(target instanceof HTMLElement) ||\n !target.matches('.data-grid__cell[role=\"gridcell\"]') ||\n target.closest('[role=\"grid\"]') !== event.currentTarget\n ) return;\n\n /* While an editor is open the arrows belong to the caret, not to the grid. */\n if (editing) return;\n\n const keys: Record<string, () => void> = {\n ArrowDown: () => move(1, 0),\n ArrowUp: () => move(-1, 0),\n ArrowRight: () => move(0, 1),\n ArrowLeft: () => move(0, -1),\n PageDown: () => move(10, 0),\n PageUp: () => move(-10, 0),\n Home: () => move(0, 0, event.ctrlKey || event.metaKey ? { row: 0, column: 0 } : { column: 0 }),\n End: () =>\n move(0, 0, event.ctrlKey || event.metaKey ? { row: rows.length - 1, column: slots.length - 1 } : { column: slots.length - 1 }),\n };\n const handler = keys[event.key];\n if (handler) {\n event.preventDefault();\n handler();\n return;\n }\n\n const row = rows[at.row];\n const slot = slots[at.column];\n if (!row || !slot) return;\n\n if (slot.kind === \"select\" && (event.key === \"Enter\" || event.key === \" \")) {\n event.preventDefault();\n toggleRow(row);\n return;\n }\n if (slot.kind === \"data\" && slot.column.editable && onCellCommit && event.key === \"Enter\") {\n event.preventDefault();\n openEditor(row, slot.column);\n return;\n }\n if ((event.key === \"Enter\" || event.key === \" \") && onRowActivate) {\n event.preventDefault();\n onRowActivate(row);\n }\n };\n\n /*\n * Focus follows the cursor. `block: \"nearest\"` so a cell already on screen does not jump,\n * and focusing into a skipped subtree is what makes the browser render it.\n */\n const hold = useCallback((node: HTMLDivElement | null) => {\n if (!node) return;\n /* Keyboard completion returns to the cell; blur preserves the new focus target. */\n const shouldFocus = editorFocusIntent.current ?? grid.current?.contains(document.activeElement);\n editorFocusIntent.current = null;\n if (shouldFocus) {\n node.focus({ preventScroll: true });\n node.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n }\n }, []);\n\n const headerFor = (slot: Slot<T>) =>\n slot.kind === \"select\" ? (\n <Checkbox\n checked={allChosen}\n indeterminate={!allChosen && someChosen}\n onChange={toggleAll}\n aria-label={allChosen ? \"전부 고르기 해제\" : \"전부 고르기\"}\n data-part=\"select-all\"\n />\n ) : (\n <>\n <span className=\"data-grid__header-label\">{slot.column.header}</span>\n {(slot.column.sortable && onSortChange) || (slot.column.hideable !== false && onHiddenColumnsChange) ? (\n <Menu\n items={\n <>\n {slot.column.sortable && onSortChange ? (\n <>\n <MenuItem icon={ArrowUp} onSelect={() => askSort(slot.column, \"asc\")}>\n 오름차순\n </MenuItem>\n <MenuItem icon={ArrowDown} onSelect={() => askSort(slot.column, \"desc\")}>\n 내림차순\n </MenuItem>\n {sort?.columnId === slot.column.id ? (\n <MenuItem onSelect={() => askSort(slot.column, null)}>정렬 없애기</MenuItem>\n ) : null}\n </>\n ) : null}\n {slot.column.sortable && onSortChange && slot.column.hideable !== false && onHiddenColumnsChange ? (\n <MenuSeparator />\n ) : null}\n {slot.column.hideable !== false && onHiddenColumnsChange ? (\n <MenuItem icon={EyeOff} onSelect={() => toggleColumn(slot.column.id)}>\n 이 열 숨기기\n </MenuItem>\n ) : null}\n </>\n }\n >\n <IconButton\n icon={ChevronDown}\n label={`${slot.column.header} 열 설정`}\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n data-part=\"column-menu\"\n />\n </Menu>\n ) : null}\n </>\n );\n\n return (\n <div\n {...rest}\n className={`data-grid ${className ?? \"\"}`.trim()}\n data-row-density={density}\n data-height={height}\n data-pinned={pinFirst ? \"\" : undefined}\n >\n {onHiddenColumnsChange ? (\n <div className=\"data-grid__bar\">\n <Menu\n items={columns.map((column) => (\n <MenuCheckboxItem\n key={column.id}\n checked={!hidden.has(column.id)}\n onCheckedChange={() => toggleColumn(column.id)}\n disabled={column.hideable === false}\n >\n {column.header}\n </MenuCheckboxItem>\n ))}\n >\n <Button variant=\"outline\" tone=\"neutral\" size=\"sm\" iconStart={SlidersHorizontal} data-part=\"columns\">\n 열 {columns.length - hidden.size}/{columns.length}\n </Button>\n </Menu>\n </div>\n ) : null}\n\n <div ref={scroll} className=\"data-grid__scroll\" data-part=\"scroll\">\n <div\n ref={grid}\n className=\"data-grid__grid\"\n role=\"grid\"\n aria-label={label}\n aria-describedby={retaining ? `${feedbackId}-refresh` : undefined}\n /* The truth about what the grid is showing, header and footer included — and while\n * it waits, that is the placeholders rather than the rows it does not have yet. */\n aria-rowcount={bodyRows + 1 + (hasFooter ? 1 : 0)}\n aria-colcount={slots.length}\n aria-multiselectable={selecting || undefined}\n onKeyDown={onKeyDown}\n onFocusCapture={event => {\n if (event.target.closest('[role=\"grid\"]') !== event.currentTarget) return;\n const row = event.target.closest<HTMLElement>('[data-part=\"row\"]');\n setFocusedRow(row ? Number(row.dataset.index) : null);\n }}\n onBlurCapture={event => {\n if (!event.currentTarget.contains(event.relatedTarget)) setFocusedRow(null);\n }}\n >\n <div ref={head} role=\"rowgroup\" className=\"data-grid__head\">\n <div role=\"row\" className=\"data-grid__row\" aria-rowindex={1}>\n {slots.map((slot, index) => (\n <div\n key={slot.id}\n role=\"columnheader\"\n className=\"data-grid__cell\"\n aria-colindex={index + 1}\n aria-sort={\n slot.kind === \"data\" && slot.column.sortable\n ? sort?.columnId === slot.column.id\n ? sort.direction === \"asc\"\n ? \"ascending\"\n : \"descending\"\n : \"none\"\n : undefined\n }\n data-width={slot.kind === \"select\" ? \"select\" : slot.column.width ?? \"md\"}\n data-align={slot.kind === \"select\" ? \"start\" : slot.column.align ?? \"start\"}\n data-pin={pinFirst && index === 0 ? \"\" : undefined}\n data-part={slot.kind === \"select\" ? \"select-header\" : undefined}\n >\n {headerFor(slot)}\n </div>\n ))}\n </div>\n </div>\n\n <div role=\"rowgroup\" className=\"data-grid__body\" aria-busy={state === \"loading\" || undefined}\n data-virtualized={windowed ? \"\" : undefined}\n style={{ \"--data-grid-total\": `${windowed ? virtualizer.getTotalSize() : 0}px` } as CSSProperties}>\n {state === \"loading\"\n ? Array.from({ length: loadingRows }, (_, index) => (\n <div\n role=\"row\"\n className=\"data-grid__row\"\n key={`waiting-${index}`}\n /* A placeholder row is still a row in the count above it. Left off, the grid\n * announced five unnumbered rows inside a one-row table. */\n aria-rowindex={index + 2}\n data-part=\"waiting-row\"\n >\n {slots.map((slot, columnIndex) => (\n <div\n key={slot.id}\n role=\"gridcell\"\n className=\"data-grid__cell\"\n aria-colindex={columnIndex + 1}\n data-width={slot.kind === \"select\" ? \"select\" : slot.column.width ?? \"md\"}\n data-pin={pinFirst && columnIndex === 0 ? \"\" : undefined}\n >\n <Skeleton shape=\"text\" lines={1} />\n </div>\n ))}\n </div>\n ))\n : null}\n {state === \"rows\" ? rendered.map(({ modelRow, index: rowIndex, start }) => {\n const row = modelRow.original.data;\n const key = modelRow.id;\n const picked = modelRow.getIsSelected();\n return (\n <div\n key={key}\n role=\"row\"\n className=\"data-grid__row\"\n aria-rowindex={rowIndex + 2}\n aria-selected={selecting ? picked : undefined}\n data-part=\"row\"\n data-index={rowIndex}\n ref={windowed ? virtualizer.measureElement : undefined}\n style={{ \"--data-grid-offset\": `${start}px` } as CSSProperties}\n data-selected={picked ? \"\" : undefined}\n >\n {slots.map((slot, columnIndex) => {\n const here = at.row === rowIndex && at.column === columnIndex;\n const open =\n slot.kind === \"data\" && editing?.key === key && editing.columnId === slot.column.id;\n const saving = slot.kind === \"data\" ? cellState?.(row, slot.column) : undefined;\n return (\n <div\n key={slot.id}\n ref={here && !open ? hold : undefined}\n role=\"gridcell\"\n className=\"data-grid__cell\"\n aria-colindex={columnIndex + 1}\n aria-busy={saving?.pending || undefined}\n aria-describedby={saving?.pending || saving?.error ? `${feedbackId}-${rowIndex}-${columnIndex}` : undefined}\n data-save-error={saving?.error ? \"\" : undefined}\n data-width={slot.kind === \"select\" ? \"select\" : slot.column.width ?? \"md\"}\n data-align={slot.kind === \"select\" ? \"start\" : slot.column.align ?? \"start\"}\n data-numeric={slot.kind === \"data\" && slot.column.numeric ? \"\" : undefined}\n data-pin={pinFirst && columnIndex === 0 ? \"\" : undefined}\n data-here={here ? \"\" : undefined}\n data-editable={slot.kind === \"data\" && slot.column.editable && onCellCommit ? \"\" : undefined}\n tabIndex={here && !open ? 0 : -1}\n onFocus={(event) => {\n /* A child's focus must not arm this cell's ref and steal it back. */\n if (event.target === event.currentTarget) {\n setAt({ row: rowIndex, column: columnIndex });\n }\n }}\n onDoubleClick={\n slot.kind === \"data\" && slot.column.editable && onCellCommit\n ? () => openEditor(row, slot.column)\n : onRowActivate\n ? () => onRowActivate(row)\n : undefined\n }\n >\n {slot.kind === \"select\" ? (\n <Checkbox\n checked={picked}\n onChange={() => toggleRow(row)}\n aria-label={rowLabel ? rowLabel(row) : `${key} 고르기`}\n data-part=\"select-row\"\n />\n ) : open ? (\n <input\n className=\"data-grid__editor\"\n /* Autofocus by ref rather than by attribute: the attribute only\n * fires on the first mount, and this input is mounted once per\n * cell the reader opens. */\n ref={(node) => node?.focus()}\n value={draft}\n aria-label={`${slot.column.header} 고치기`}\n data-part=\"editor\"\n onChange={(event) => setDraft(event.target.value)}\n onBlur={() => closeEditor(true, row, slot.column)}\n onKeyDown={(event) => {\n /* Keep editor keys out of the grid and any parent dialog. */\n event.stopPropagation();\n /* Let the IME confirm or cancel composition without closing\n * the editor or preventing its native default action. */\n if (event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) return;\n if (event.key === \"Enter\") {\n event.preventDefault();\n closeEditor(true, row, slot.column, true);\n } else if (event.key === \"Escape\") {\n event.preventDefault();\n closeEditor(false, row, slot.column, true);\n }\n }}\n />\n ) : (\n <>\n {/*\n * Keyed by the token, so this re-mounts — and its animation runs\n * again — every time the cell is told something else. Behind the\n * value rather than over it.\n */}\n {(() => {\n const token = changed?.(row, slot.column);\n return token === undefined ? null : (\n <span\n key={token}\n className=\"data-grid__flash\"\n data-part=\"flash\"\n aria-hidden=\"true\"\n />\n );\n })()}\n {slot.column.cell(row)}\n </>\n )}\n </div>\n );\n })}\n </div>\n );\n }) : null}\n </div>\n\n {hasFooter ? (\n <div ref={foot} role=\"rowgroup\" className=\"data-grid__foot\">\n <div role=\"row\" className=\"data-grid__row\" aria-rowindex={bodyRows + 2}>\n {slots.map((slot, index) => (\n <div\n key={slot.id}\n role=\"gridcell\"\n className=\"data-grid__cell\"\n aria-colindex={index + 1}\n data-width={slot.kind === \"select\" ? \"select\" : slot.column.width ?? \"md\"}\n data-align={slot.kind === \"select\" ? \"start\" : slot.column.align ?? \"start\"}\n data-numeric={slot.kind === \"data\" && slot.column.numeric ? \"\" : undefined}\n data-pin={pinFirst && index === 0 ? \"\" : undefined}\n >\n {slot.kind === \"data\" ? slot.column.footer?.(rows) : null}\n </div>\n ))}\n </div>\n </div>\n ) : null}\n </div>\n </div>\n\n {/* One place, one order. Two of these at once is a grid that failed *and* has no rows,\n * which is one fact told twice. */}\n {state === \"error\" || retaining ? (\n <p className=\"data-grid__state\" role=\"alert\" data-part=\"error\" id={`${feedbackId}-refresh`} data-retained={retaining ? \"\" : undefined}>\n {error}\n {retaining ? <> 이전 결과를 표시합니다.{lastUpdated ? <> 마지막 갱신: {lastUpdated}</> : null}</> : null}\n </p>\n ) : state === \"empty\" ? (\n <p className=\"data-grid__empty\" data-part=\"empty\">{empty}</p>\n ) : null}\n\n {cellState && state === \"rows\" ? (\n <ul className=\"data-grid__save-status\" data-part=\"save-status\">\n {rows.flatMap((row, rowIndex) => slots.flatMap((slot, columnIndex) => {\n if (slot.kind !== \"data\") return [];\n const saving = cellState(row, slot.column);\n if (!saving?.pending && !saving?.error) return [];\n return [<li key={JSON.stringify([rowKey(row), slot.id])} id={`${feedbackId}-${rowIndex}-${columnIndex}`}>\n <span role={saving.pending ? \"status\" : \"alert\"}>\n {rowLabel ? rowLabel(row) : rowKey(row)} · {slot.column.header}: {saving.pending ? \"저장 중입니다\" : saving.error}\n </span>\n {!saving.pending && saving.error && slot.column.editable && onCellCommit ? (\n <Button size=\"sm\" variant=\"outline\" onClick={() => openEditor(row, slot.column)} data-part=\"recover-draft\">입력 복구</Button>\n ) : null}\n </li>];\n }))}\n </ul>\n ) : null}\n\n {/* A status, not a caption: it changes when the query does, and a reader who is not\n * looking at it still needs to be told the answer is a different size now. */}\n {meta ? (\n <p className=\"data-grid__meta\" role=\"status\" data-part=\"meta\">\n {meta}\n </p>\n ) : null}\n </div>\n );\n}\n","import { useId, useRef, useState } from \"react\";\nimport type { ChangeEvent, DragEvent, ReactNode } from \"react\";\nimport { CheckCircle2, RotateCcw, Upload, X, XCircle } from \"lucide-react\";\nimport { Icon } from \"../../common/Icon\";\nimport { IconButton } from \"../../common/IconButton\";\nimport { MorphIcon } from \"../../derived/MorphIcon\";\nimport { Progress } from \"../../common/Progress\";\nimport \"./Dropzone.css\";\n\nexport type DropzoneFileState = \"queued\" | \"uploading\" | \"done\" | \"failed\";\n\nexport type DropzoneFile = {\n id: string;\n name: string;\n /** Already formatted — \"2.4 MB\". Bytes are the adopter's to turn into a sentence. */\n size?: ReactNode;\n state?: DropzoneFileState;\n /** 0 to 100 while uploading. Omitted means no measurable end. */\n value?: number;\n /** Why it failed, in the reader's words. Not \"Error 413\". */\n error?: ReactNode;\n onCancel?: () => void;\n onRetry?: () => void;\n};\n\nexport type DropzoneProps = {\n /** What is being collected. \"자료 올리기\". The field's name. */\n label: string;\n /** What is accepted, in words a reader can act on. \"PDF · DOCX · TXT · 20MB까지\". */\n hint?: ReactNode;\n /** Decorative content replacing the upload icon. Use null to omit it. No controls. */\n illustration?: ReactNode;\n /**\n * What the field takes, in the syntax the `accept` attribute uses. The sentence above is\n * what a person reads.\n *\n * It reaches the input, so the picker filters by it — and the drop handler runs the same\n * test, because a file dragged in never goes near the input. Left to the attribute alone,\n * `accept=\".pdf\"` was a rule the picker kept and drag and drop did not.\n */\n accept?: string;\n /**\n * Whether more than one file may be handed over at a time.\n *\n * Same story as `accept`: the attribute governs the picker, and the drop handler keeps the\n * first file and drops the rest so that both paths mean the same thing.\n */\n multiple?: boolean;\n /**\n * The field's name in the form it is inside.\n *\n * The area is a real `<input type=\"file\">` so that a form can own its value, and without a\n * name the input is not submitted at all — the value existed and never went anywhere. Given\n * one, each picker change or drop replaces the input with the accepted files only. An\n * entirely refused batch clears the previous selection and calls `onFiles([])`.\n * Unnamed inputs are cleared after each change so the same file can be offered again.\n */\n name?: string;\n onFiles: (files: File[]) => void;\n /** What has been handed over, and how each one is going. */\n files?: DropzoneFile[];\n disabled?: boolean;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * Whether a file matches an `accept` list, by the rules the attribute uses.\n *\n * Three forms and no others: `.pdf` against the end of the name, `image/*` against the start\n * of the type, and a full type against the whole of it. The picker already applies these; this\n * is what lets the drop path say the same thing.\n */\nfunction permitted(accept: string | undefined, file: File) {\n const patterns = (accept ?? \"\").split(\",\").map((entry) => entry.trim().toLowerCase()).filter(Boolean);\n if (patterns.length === 0) return true;\n const name = file.name.toLowerCase();\n const type = file.type.toLowerCase();\n return patterns.some((pattern) => {\n if (pattern.startsWith(\".\")) return name.endsWith(pattern);\n if (pattern.endsWith(\"/*\")) return type.startsWith(pattern.slice(0, -1));\n return type === pattern;\n });\n}\n\nconst GLYPH = { done: CheckCircle2, failed: XCircle };\nconst SAID: Record<DropzoneFileState, string> = {\n queued: \"대기 중\",\n uploading: \"올리는 중\",\n done: \"완료\",\n failed: \"실패\",\n};\n\n/**\n * A place to put files, and what happened to them after.\n *\n * **It is a file input, not a button that opens one.** The area is a `<label>` around a real\n * `<input type=\"file\">`, so the keyboard reaches it, the space bar opens the picker, the label\n * is announced, and the form owns the value. The common alternative — a `<div>` with a click\n * handler calling `input.click()` — looks identical and is reachable by exactly one input\n * device.\n *\n * **A drag over its own children is not a drag leaving.** `dragleave` fires every time the\n * pointer crosses into a child, so the naive version flickers the whole time a file is held\n * over the list. The depth is counted instead.\n *\n * **It refuses what the picker refuses, and nothing beyond that.** `accept` and `multiple` are\n * attributes on the input, so the picker has always held to them and drag and drop went around\n * the input entirely: three files landed in a `multiple={false}` area and a `.exe` landed in a\n * PDF one. Both paths run the same two tests now — **and a refused file is told about.** A drop\n * that leaves nothing used to return in silence, which is a gesture the reader repeats because\n * nothing said it failed; the reason goes into a live region, in the same words `FileInput`\n * uses for the same refusal.\n *\n * **Everything else is the adopter's.** How large is too large, what already exists, what this\n * account is allowed to send: facts this does not have. Everything that survives the two tests\n * is handed over, and a file that comes back `failed` with a sentence is how a refusal is\n * shown — which also means the reason is written by whoever knows it.\n */\nexport function Dropzone({\n label,\n hint,\n illustration,\n accept,\n multiple = true,\n name,\n onFiles,\n files = [],\n disabled,\n className,\n ...rest\n}: DropzoneProps) {\n const id = useId();\n const depth = useRef(0);\n const field = useRef<HTMLInputElement>(null);\n const [over, setOver] = useState(false);\n const [refused, setRefused] = useState<string[]>([]);\n\n /**\n * What survives `accept` and `multiple`, and what to say about the rest.\n *\n * A refused file used to be dropped and nothing else: `onFiles` was called with what was\n * left, or not at all, and a `.exe` on a PDF area was a gesture that did nothing at all.\n * `FileInput` has always written the reason into a live region, and two components cannot\n * answer the same act differently. The sentence is the same one, word for word.\n *\n * Only `accept` produces a reason. `multiple` keeping the first file is what the picker\n * itself does with the same drop, and it is visible — the file is on the list.\n */\n const keep = (list: FileList | null) => {\n const offered = Array.from(list ?? []);\n const why: string[] = [];\n const passing = offered.filter((file) => {\n if (permitted(accept, file)) return true;\n why.push(`${file.name} — 받지 않는 형식입니다. ${accept}만 받습니다`);\n return false;\n });\n setRefused(why);\n return multiple ? passing : passing.slice(0, 1);\n };\n\n const receive = (list: FileList | null) => {\n if (disabled) return;\n const taken = keep(list);\n const input = field.current;\n if (input) {\n /* Clear first: neither a refused file nor a previous batch may be submitted. */\n input.value = \"\";\n if (name && taken.length > 0) {\n const carrier = new DataTransfer();\n for (const file of taken) carrier.items.add(file);\n input.files = carrier.files;\n }\n }\n /* Named fields report an empty replacement too, so controlled lists can clear. */\n if (name || taken.length > 0) onFiles(taken);\n };\n\n const enter = (event: DragEvent) => {\n if (disabled) return;\n event.preventDefault();\n depth.current += 1;\n setOver(true);\n };\n\n const leave = () => {\n depth.current = Math.max(0, depth.current - 1);\n if (depth.current === 0) setOver(false);\n };\n\n return (\n <div {...rest} className={`dropzone ${className ?? \"\"}`.trim()} data-disabled={disabled ? \"\" : undefined}>\n <label\n className=\"dropzone__area\"\n htmlFor={id}\n data-over={over ? \"\" : undefined}\n data-part=\"area\"\n onDragEnter={enter}\n onDragOver={(event) => {\n if (disabled) return;\n event.preventDefault();\n }}\n onDragLeave={leave}\n onDrop={(event) => {\n if (disabled) return;\n event.preventDefault();\n depth.current = 0;\n setOver(false);\n /* Text and link drops are not a replacement file selection. */\n if (event.dataTransfer.files.length === 0) return;\n receive(event.dataTransfer.files);\n }}\n >\n {illustration === undefined ? <Icon icon={Upload} size=\"md\" className=\"dropzone__glyph\" aria-hidden=\"true\" /> : illustration}\n <span className=\"dropzone__label\">{label}</span>\n {hint ? <span className=\"dropzone__hint\">{hint}</span> : null}\n <input\n ref={field}\n id={id}\n name={name}\n type=\"file\"\n className=\"dropzone__input\"\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n onChange={(event: ChangeEvent<HTMLInputElement>) => {\n receive(event.currentTarget.files);\n }}\n />\n </label>\n\n {/*\n * Mounted whether or not anything was refused, and empty when nothing was.\n *\n * A live region that appears at the same moment as its first sentence announces nothing\n * in several screen readers — the region has to be there before the change. `:empty`\n * keeps the blank one from taking a line.\n */}\n <p className=\"dropzone__refused\" role=\"alert\" data-part=\"refused\">\n {refused.join(\" · \")}\n </p>\n\n {files.length > 0 ? (\n <ul className=\"dropzone__files\" data-part=\"files\">\n {files.map((file) => {\n const state = file.state ?? \"queued\";\n return (\n <li className=\"dropzone__file\" key={file.id} data-state={state} data-part={file.id}>\n <div className=\"dropzone__file-text\">\n <p className=\"dropzone__file-name\">\n {/*\n * The slot is there before the result is.\n *\n * The glyph used to be rendered only once the file was done or failed,\n * so the name shifted sideways the moment the tick landed — on every\n * row, at a different moment for each. A result arriving is worth\n * drawing precisely because nothing else about the row changed.\n */}\n <MorphIcon\n icon={state === \"done\" || state === \"failed\" ? GLYPH[state] : undefined}\n tone={state === \"done\" ? \"success\" : state === \"failed\" ? \"danger\" : \"neutral\"}\n size=\"xs\"\n className=\"dropzone__file-glyph\"\n data-part=\"glyph\"\n />\n {file.name}\n {/* The state in words: a tick and a cross are two shapes to a reader who\n * can see them and one to everybody else. */}\n <span className=\"dropzone__said\">{` — ${SAID[state]}`}</span>\n </p>\n {/*\n * Why it failed, in the same slot the size was in. \"Error 413\" is a number\n * the reader cannot act on; \"20MB를 넘습니다\" is the same fact and a next\n * step.\n */}\n {state === \"failed\" && file.error ? (\n <p className=\"dropzone__file-why\" role=\"alert\" data-part=\"why\">\n {file.error}\n </p>\n ) : file.size ? (\n <p className=\"dropzone__file-size\">{file.size}</p>\n ) : null}\n </div>\n\n {state === \"uploading\" ? (\n <Progress\n value={file.value}\n max={100}\n label={file.name}\n size=\"sm\"\n className=\"dropzone__file-bar\"\n data-part=\"bar\"\n />\n ) : null}\n\n <div className=\"dropzone__file-actions\">\n {state === \"failed\" && file.onRetry ? (\n <IconButton\n icon={RotateCcw}\n label={`${file.name} 다시 올리기`}\n size=\"sm\"\n variant=\"ghost\"\n tone=\"neutral\"\n onClick={file.onRetry}\n data-part=\"retry\"\n />\n ) : null}\n {file.onCancel ? (\n <IconButton\n icon={X}\n label={state === \"done\" ? `${file.name} 지우기` : `${file.name} 취소`}\n size=\"sm\"\n variant=\"ghost\"\n tone=\"neutral\"\n onClick={file.onCancel}\n data-part=\"cancel\"\n />\n ) : null}\n </div>\n </li>\n );\n })}\n </ul>\n ) : null}\n </div>\n );\n}\n","import { useEffect, useId, useRef, useState } from \"react\";\nimport { ThumbsDown, ThumbsUp } from \"lucide-react\";\nimport { Button } from \"../../common/Button\";\nimport { Textarea } from \"../../common/Textarea\";\nimport { ToggleButton } from \"../../derived/ToggleButton\";\nimport \"./FeedbackControl.css\";\n\nexport type FeedbackRating = \"up\" | \"down\";\n\nexport type FeedbackReason = {\n id: string;\n /** Why it was wrong, in the reader's words. \"사실이 틀렸어요\", \"질문과 상관없어요\". */\n label: string;\n};\n\nexport type FeedbackControlProps = {\n /** Which way the reader voted. Controlled — this component never owns the verdict. */\n value: FeedbackRating | null;\n onRate: (rating: FeedbackRating | null) => void;\n /** Offered after a rating. Empty, and this is two buttons and nothing else. */\n reasons?: FeedbackReason[];\n /** The reader sent their reasons. Chosen ids, and whatever they typed. */\n onReasons?: (reasons: string[], note: string) => void;\n /** Which verdict opens the reason step. Both, when a product wants to know what worked. */\n askOn?: \"down\" | \"both\";\n label?: string;\n noteLabel?: string;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * Was this any good — and then the question every implementation stops before.\n *\n * **Why**. A thumbs-down with no second step tells a product that something was wrong and\n * nothing about what, which is a metric that goes down and a team that cannot act. The\n * reason step is not a nicety bolted onto the rating; it is the part that makes the rating\n * worth collecting.\n *\n * It does not block. Nothing is disabled while it is open, the answer above stays readable,\n * and the reader can walk away having voted and said nothing — a modal here would be asking\n * a person who just told you the answer was bad to fill in a form before continuing.\n *\n * **The press is acknowledged.** A thumbs press that changes nothing a reader can perceive is\n * a press people repeat, and then the product counts two. The verdict shows on the button and\n * the sending is announced.\n *\n * The verdict stays changeable after it is sent. A reader who pressed the wrong one and can\n * only watch it sit there is a reader who has learned not to press either.\n *\n * The two buttons are `ToggleButton`s and their labels name what they mean, not what state\n * they are in — the rule that component was written to hold. \"도움이 됐어요\" with\n * `aria-pressed` is one fact told once; a label that flips to \"도움이 안 됐어요\" while\n * `aria-pressed` also flips is the same fact told twice, in opposite directions.\n */\nexport function FeedbackControl({\n value,\n onRate,\n reasons = [],\n onReasons,\n askOn = \"down\",\n label = \"이 답이 도움이 됐나요?\",\n noteLabel = \"더 알려 주실 것이 있나요?\",\n className,\n ...rest\n}: FeedbackControlProps) {\n const root = useRef<HTMLElement>(null);\n const labelId = useId();\n const [chosen, setChosen] = useState<string[]>([]);\n const [note, setNote] = useState(\"\");\n const [sent, setSent] = useState(false);\n\n const asking = Boolean(value) && reasons.length > 0 && Boolean(onReasons) && (askOn === \"both\" || value === \"down\");\n\n /* A new verdict is a new answer to the question, so the draft that belonged to the old one\n * goes with it. Carrying it over sends \"사실이 틀렸어요\" attached to a thumbs up. */\n useEffect(() => {\n setChosen([]);\n setNote(\"\");\n setSent(false);\n }, [value]);\n\n const rate = (rating: FeedbackRating) => onRate(value === rating ? null : rating);\n\n /*\n * Sending takes the whole panel away, and the 보내기 button the reader is standing on with\n * it — onto the body, which is where a keyboard reader loses the page. Focus goes to the\n * verdict they cast, which is the nearest control that survives and the one they are most\n * likely to want next.\n */\n const sending = useRef(false);\n\n useEffect(() => {\n if (!sending.current) return;\n sending.current = false;\n /* Only if the button really did go. If the host kept the panel open the focus is still on\n * a live control and moving it would be the rude thing. */\n if (document.activeElement !== document.body) return;\n const next = root.current?.querySelector<HTMLElement>(\n `[data-part=\"${value === \"up\" ? \"up\" : \"down\"}\"]`,\n );\n (next ?? root.current)?.focus();\n }, [sent]);\n\n const send = () => {\n onReasons?.(chosen, note.trim());\n sending.current = true;\n setSent(true);\n };\n\n return (\n /*\n * Named by the question that is already on screen, not by a copy of it. `aria-label` on\n * the section repeated the same sentence the paragraph below carries, so a screen reader\n * read the question twice before reaching the first button.\n */\n <section\n className={`feedback-control ${className ?? \"\"}`.trim()}\n ref={root}\n tabIndex={-1}\n aria-labelledby={labelId}\n {...rest}\n >\n <div className=\"feedback-control__rating\">\n <p className=\"feedback-control__label\" id={labelId}>{label}</p>\n <ToggleButton\n icon={ThumbsUp}\n pressed={value === \"up\"}\n onPressedChange={() => rate(\"up\")}\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n data-part=\"up\"\n data-testid=\"up\"\n >\n 도움이 됐어요\n </ToggleButton>\n <ToggleButton\n icon={ThumbsDown}\n pressed={value === \"down\"}\n onPressedChange={() => rate(\"down\")}\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n data-part=\"down\"\n data-testid=\"down\"\n >\n 도움이 안 됐어요\n </ToggleButton>\n\n {/*\n * Beside the buttons, not under the panel they open.\n *\n * It sat after the reason step and was two hundred pixels away from the control it\n * was describing — a confirmation a reader has to go looking for is one they do not\n * find, and then they press again.\n *\n * A status, not an alert: it confirms something they did on purpose, and interrupting\n * them to say \"yes, that worked\" is how a page teaches people to stop listening.\n */}\n <p className=\"feedback-control__said\" role=\"status\" data-part=\"said\">\n {sent ? \"보냈습니다. 고맙습니다.\" : value === \"up\" ? \"도움이 됐다고 표시했습니다.\" : value === \"down\" ? \"도움이 안 됐다고 표시했습니다.\" : \"\"}\n </p>\n </div>\n\n {asking && !sent ? (\n <div className=\"feedback-control__reasons\" data-part=\"reasons\">\n {/*\n * The question follows the verdict. It was fixed at \"무엇이 문제였나요?\", so\n * `askOn=\"both\"` put a question about what went wrong on top of a list of chips\n * saying 설명이 명확해요 — the reader is asked one thing and offered answers to\n * another.\n */}\n <p className=\"feedback-control__question\">\n {value === \"up\"\n ? \"무엇이 좋았나요? 고르지 않고 넘어가도 됩니다.\"\n : \"무엇이 문제였나요? 고르지 않고 넘어가도 됩니다.\"}\n </p>\n <div className=\"feedback-control__chips\">\n {reasons.map((reason) => (\n <ToggleButton\n key={reason.id}\n pressed={chosen.includes(reason.id)}\n onPressedChange={() =>\n setChosen((was) =>\n was.includes(reason.id) ? was.filter((id) => id !== reason.id) : [...was, reason.id],\n )\n }\n variant=\"outline\"\n tone=\"neutral\"\n size=\"sm\"\n shape=\"pill\"\n data-part=\"reason\"\n >\n {reason.label}\n </ToggleButton>\n ))}\n </div>\n <Textarea\n aria-label={noteLabel}\n placeholder={noteLabel}\n rows={2}\n value={note}\n onChange={(event) => setNote(event.target.value)}\n data-part=\"note\"\n />\n <div className=\"feedback-control__send\">\n <Button size=\"sm\" variant=\"solid\" onClick={send} data-part=\"send\">\n 보내기\n </Button>\n </div>\n </div>\n ) : null}\n\n </section>\n );\n}\n","import { useEffect, useId, useRef } from \"react\";\nimport { X } from \"lucide-react\";\nimport { Button } from \"../../common/Button\";\nimport { IconButton } from \"../../common/IconButton\";\nimport { Input } from \"../../common/Input\";\nimport { Select } from \"../../common/Select\";\nimport \"./FilterBuilder.css\";\n\nexport type FilterFieldType = \"text\" | \"number\" | \"date\" | \"choice\";\n\nexport type FilterField = {\n id: string;\n label: string;\n type: FilterFieldType;\n /** For `choice` only. */\n options?: { value: string; label: string }[];\n};\n\nexport type FilterRule = {\n id: string;\n field: string;\n operator: string;\n value: string;\n};\n\nexport type FilterJoin = \"and\" | \"or\";\n\n/**\n * The fields, and there is at least one.\n *\n * A contract that lives only in prose is a contract nobody keeps: an empty array made\n * `fields[0]` undefined and the first render threw on `field.id`. The tuple says it where the\n * caller reads it, at the call site, before it runs.\n */\nexport type FilterFields = readonly [FilterField, ...FilterField[]];\n\nexport type FilterBuilderProps = {\n fields: FilterFields;\n rules: FilterRule[];\n onRulesChange: (rules: FilterRule[]) => void;\n join: FilterJoin;\n onJoinChange: (join: FilterJoin) => void;\n /** What the whole set of conditions is for. Names the group. */\n label: string;\n addLabel?: string;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * The operators a field type can take.\n *\n * Not a shared list. \"포함\" is meaningless for a date and \"이후\" is meaningless for a name,\n * and offering both to both is how a query ends up reading 생성일 포함 김민수.\n */\nexport const OPERATORS: Record<FilterFieldType, { value: string; label: string }[]> = {\n text: [\n { value: \"contains\", label: \"포함\" },\n { value: \"is\", label: \"같음\" },\n { value: \"starts\", label: \"시작\" },\n { value: \"empty\", label: \"비어 있음\" },\n ],\n number: [\n { value: \"eq\", label: \"=\" },\n { value: \"gt\", label: \">\" },\n { value: \"lt\", label: \"<\" },\n { value: \"between\", label: \"사이\" },\n ],\n date: [\n { value: \"after\", label: \"이후\" },\n { value: \"before\", label: \"이전\" },\n { value: \"on\", label: \"당일\" },\n { value: \"last\", label: \"최근\" },\n ],\n choice: [\n { value: \"is\", label: \"하나임\" },\n { value: \"isnot\", label: \"아님\" },\n ],\n};\n\n/** Operators that stand on their own — \"비어 있음\" takes no value. */\nconst NO_VALUE = new Set([\"empty\"]);\n\nexport function nextRule(fields: FilterFields, id: string): FilterRule {\n const field = fields[0];\n return { id, field: field.id, operator: OPERATORS[field.type][0].value, value: \"\" };\n}\n\n/**\n * 필드 · 연산자 · 값, joined.\n *\n * **Changing the field resets the operator and the value.** They belonged to the old field:\n * an operator list is per type, and a value typed for a name is not a value for a date. Every\n * builder that keeps them produces a rule that reads like a sentence and matches nothing —\n * and it looks completely correct on screen, because both halves are things the reader\n * themselves chose.\n *\n * **The join is one choice for the whole group.** The second row carries the select and every\n * row after it shows the word, because \"A 그리고 B 또는 C\" has two meanings and a builder that\n * lets it be typed has to pick one silently.\n *\n * **Each remove button is named after its rule.** Six buttons called \"제거\" are six buttons a\n * reader cannot tell apart — the rule `Tag` and `NumberInput` already answer to.\n */\nexport function FilterBuilder({\n fields,\n rules,\n onRulesChange,\n join,\n onJoinChange,\n label,\n addLabel = \"조건 추가\",\n className,\n ...rest\n}: FilterBuilderProps) {\n const fieldOf = (id: string) => fields.find((field) => field.id === id) ?? fields[0];\n\n const update = (id: string, patch: Partial<FilterRule>) =>\n onRulesChange(rules.map((rule) => (rule.id === id ? { ...rule, ...patch } : rule)));\n\n const root = useRef<HTMLDivElement>(null);\n\n /*\n * Ids for the rules this builder adds.\n *\n * `rule-${Date.now()}` collides whenever the button is pressed twice inside one millisecond —\n * a held key does it — and two rows then share a React key, which is how one row's edits land\n * in the other. The instance id plus a counter cannot repeat.\n */\n const uid = useId();\n const made = useRef(0);\n\n /*\n * A rule naming a field that is no longer offered.\n *\n * It used to be drawn as the first field while the state kept the missing one, so the screen\n * said 거래처 and the query still asked about a column that is gone. Repair the state rather\n * than the picture — the reader can only correct what they can see.\n */\n useEffect(() => {\n const known = new Set(fields.map((field) => field.id));\n if (rules.every((rule) => known.has(rule.field))) return;\n onRulesChange(\n rules.map((rule) => (known.has(rule.field) ? rule : nextRule(fields, rule.id))),\n );\n }, [fields, rules]);\n\n /*\n * A remove button goes away with the row it removes, and focus with it, onto the body —\n * where a keyboard reader loses their place entirely. `FilterBar` holds the same line.\n */\n const leaving = useRef<number | null>(null);\n\n useEffect(() => {\n const at = leaving.current;\n if (at === null) return;\n leaving.current = null;\n /* Only if the pressed button really did go. If the host ignored the callback the focus is\n * still on a live button and moving it would be the rude thing. */\n if (document.activeElement !== document.body) return;\n const removes = root.current?.querySelectorAll<HTMLElement>('[data-part=\"remove\"]');\n const next =\n removes && removes.length > 0\n ? removes[Math.min(at, removes.length - 1)]\n : root.current?.querySelector<HTMLElement>('[data-part=\"add\"]');\n (next ?? root.current)?.focus();\n }, [rules]);\n\n return (\n <div\n {...rest}\n ref={root}\n tabIndex={-1}\n className={`filter-builder ${className ?? \"\"}`.trim()}\n role=\"group\"\n aria-label={label}\n >\n <ul className=\"filter-builder__rules\">\n {rules.map((rule, index) => {\n const field = fieldOf(rule.field);\n const operators = OPERATORS[field.type];\n const operator = operators.find((one) => one.value === rule.operator) ?? operators[0];\n const said = `${field.label} ${operator.label}${rule.value ? ` ${rule.value}` : \"\"}`;\n\n return (\n <li className=\"filter-builder__rule\" key={rule.id} data-part=\"rule\">\n <span className=\"filter-builder__join\" data-part=\"join\">\n {index === 0 ? (\n <span className=\"filter-builder__where\">조건</span>\n ) : index === 1 ? (\n <Select\n size=\"sm\"\n value={join}\n onChange={(event) => onJoinChange(event.target.value as FilterJoin)}\n aria-label=\"조건을 잇는 방법\"\n data-part=\"join-select\"\n >\n <option value=\"and\">그리고</option>\n <option value=\"or\">또는</option>\n </Select>\n ) : (\n /* Shown, not offered. One join for the group — see the note above. */\n <span className=\"filter-builder__word\">{join === \"and\" ? \"그리고\" : \"또는\"}</span>\n )}\n </span>\n\n <Select\n size=\"sm\"\n value={rule.field}\n aria-label={`${index + 1}번 조건의 필드`}\n data-part=\"field\"\n onChange={(event) => {\n const next = fieldOf(event.target.value);\n /* The operator and the value belonged to the old field. Keeping either is\n * how you get 생성일 포함 김민수. */\n update(rule.id, {\n field: next.id,\n operator: OPERATORS[next.type][0].value,\n value: \"\",\n });\n }}\n >\n {fields.map((one) => (\n <option key={one.id} value={one.id}>\n {one.label}\n </option>\n ))}\n </Select>\n\n <Select\n size=\"sm\"\n value={operator.value}\n onChange={(event) => {\n const next = event.target.value;\n /* An operator that takes no value takes no value in the state either. The\n * value box disappears and the value stayed, so the remove button went on\n * calling the rule \"거래처 비어 있음 소프트\" — a sentence naming a value the\n * rule no longer has. */\n update(rule.id, {\n operator: next,\n ...(NO_VALUE.has(next) ? { value: \"\" } : null),\n });\n }}\n aria-label={`${field.label}에 적용할 연산자`}\n data-part=\"operator\"\n >\n {operators.map((one) => (\n <option key={one.value} value={one.value}>\n {one.label}\n </option>\n ))}\n </Select>\n\n <span className=\"filter-builder__value\">\n {NO_VALUE.has(operator.value) ? (\n <span className=\"filter-builder__none\">값 없음</span>\n ) : field.type === \"choice\" ? (\n <Select\n size=\"sm\"\n value={rule.value}\n onChange={(event) => update(rule.id, { value: event.target.value })}\n aria-label={`${field.label} 값`}\n data-part=\"value\"\n >\n <option value=\"\">고르세요</option>\n {field.options?.map((one) => (\n <option key={one.value} value={one.value}>\n {one.label}\n </option>\n ))}\n </Select>\n ) : (\n <Input\n size=\"sm\"\n /* A date field gets a date control and a number field a numeric keypad —\n * the type is known, so there is no reason to make the reader type. */\n type={field.type === \"date\" ? \"date\" : field.type === \"number\" ? \"number\" : \"text\"}\n value={rule.value}\n onChange={(event) => update(rule.id, { value: event.target.value })}\n aria-label={`${field.label} 값`}\n data-part=\"value\"\n />\n )}\n </span>\n\n <IconButton\n icon={X}\n /* Named after the rule it removes. */\n label={`${said} 조건 지우기`}\n size=\"sm\"\n onClick={() => {\n leaving.current = index;\n onRulesChange(rules.filter((one) => one.id !== rule.id));\n }}\n data-part=\"remove\"\n />\n </li>\n );\n })}\n </ul>\n\n <Button\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n onClick={() => {\n made.current += 1;\n onRulesChange([...rules, nextRule(fields, `rule-${uid}-${made.current}`)]);\n }}\n data-part=\"add\"\n >\n {addLabel}\n </Button>\n </div>\n );\n}\n","import { CornerDownRight } from \"lucide-react\";\nimport { Disclosure } from \"../../composed/Disclosure\";\nimport { Icon } from \"../../common/Icon\";\nimport \"./FollowUpList.css\";\n\nexport type FollowUp = {\n id: string;\n /** The question itself, as the reader would ask it. This is also the button's name. */\n question: string;\n};\n\nexport type FollowUpListProps = {\n items: FollowUp[];\n onAsk: (item: FollowUp) => void;\n /** What the list is. Names the group, and the summary when it folds. */\n label?: string;\n /** Folded behind a summary, the way a long answer's suggestions usually are. */\n collapsible?: boolean;\n defaultOpen?: boolean;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * The questions the answer suggests asking next.\n *\n * Each button's name *is* the question. Not \"물어보기\" five times — the repository already\n * learned this from `Tag`, `SplitButton` and `NumberInput`: five buttons that read the same\n * to a screen reader are five buttons a reader cannot choose between, and a suggestion list\n * is the case where the difference between them is the entire point.\n *\n * They wrap rather than truncate, which is the opposite of what `PageHeader` does with its\n * actions and right for the opposite reason. A clipped action is dangerous because the reader\n * presses it anyway; a clipped question is useless because the reader cannot tell what they\n * would be asking. When a question is long, the room goes to the question.\n *\n * Suggestions, not commands: they sit under the answer in a named group, so a reader moving\n * by landmark or heading passes them rather than reading them as more of the answer.\n */\nexport function FollowUpList({\n items,\n onAsk,\n label = \"이어서 물어볼 것\",\n collapsible,\n defaultOpen = true,\n className,\n ...rest\n}: FollowUpListProps) {\n const list = (\n <ul className=\"follow-up-list__items\">\n {items.map((item) => (\n <li key={item.id}>\n <button type=\"button\" className=\"follow-up-list__item\" onClick={() => onAsk(item)} data-part=\"ask\">\n <Icon icon={CornerDownRight} size=\"sm\" tone=\"muted\" aria-hidden=\"true\" />\n <span>{item.question}</span>\n </button>\n </li>\n ))}\n </ul>\n );\n\n if (collapsible) {\n return (\n <div className={`follow-up-list ${className ?? \"\"}`.trim()} {...rest}>\n <Disclosure summary={label} defaultOpen={defaultOpen} plain aside={`${items.length}개`}>\n {list}\n </Disclosure>\n </div>\n );\n }\n\n return (\n <section className={`follow-up-list ${className ?? \"\"}`.trim()} aria-label={label} {...rest}>\n <p className=\"follow-up-list__label\">{label}</p>\n {list}\n </section>\n );\n}\n","/*\n * 조사를 앞말에 맞춰 고릅니다.\n *\n * 이 라이브러리의 이름표는 값과 이어 붙습니다 — 「가격표 개정 공지을(를) 검토(으)로\n * 옮기기」 같은 것들입니다. 화면에서는 괄호가 눈에 거슬리는 정도지만, 스크린 리더는\n * 그것을 「공지 을 괄호 를 괄호 검토 괄호 으 괄호 로」로 읽습니다. 한국어 조사는\n * 앞 음절의 받침으로 정해지므로 고르지 못할 이유가 없습니다.\n *\n * 이름이 한글로 끝나지 않을 때 — 「PDF」, 「2026」, 「.txt」 — 는 소리 나는 대로가\n * 아니라 글자 그대로 판단할 수 없습니다. 그런 경우에는 받침이 있는 쪽을 씁니다.\n * 「PDF를」이 아니라 「PDF을」이 어색하지만, 두 가지를 다 적어 두는 것보다는 낫고,\n * 로마자·숫자의 발음 사전을 이 라이브러리가 들고 있을 이유는 없습니다.\n */\n\n/** 마지막 글자에 받침이 있는가. 한글 음절이 아니면 `true`로 봅니다. */\nfunction hasFinalConsonant(word: string): boolean {\n const last = word.trimEnd().at(-1);\n if (!last) return true;\n const code = last.charCodeAt(0);\n /* 가(0xAC00)부터 힣(0xD7A3)까지가 조합된 음절이고, 그 안에서 받침은 28로 나눈 나머지다. */\n if (code < 0xac00 || code > 0xd7a3) return true;\n return (code - 0xac00) % 28 !== 0;\n}\n\n/** `이/가`, `을/를`, `은/는`, `과/와`, `으로/로` 중 앞말에 맞는 쪽. */\nexport function josa(word: string, pair: \"이/가\" | \"을/를\" | \"은/는\" | \"과/와\" | \"으로/로\"): string {\n const final = hasFinalConsonant(word);\n switch (pair) {\n case \"이/가\":\n return final ? \"이\" : \"가\";\n case \"을/를\":\n return final ? \"을\" : \"를\";\n case \"은/는\":\n return final ? \"은\" : \"는\";\n case \"과/와\":\n return final ? \"과\" : \"와\";\n case \"으로/로\":\n /* ㄹ 받침은 「으로」가 아니라 「로」를 씁니다 — 「서울로」이지 「서울으로」가 아닙니다. */\n if (!final) return \"로\";\n return (word.trimEnd().charCodeAt(word.trimEnd().length - 1) - 0xac00) % 28 === 8 ? \"로\" : \"으로\";\n }\n}\n\n/** 앞말과 조사를 붙인 한 덩어리. `withJosa(\"검토\", \"으로/로\")` → `\"검토로\"`. */\nexport function withJosa(word: string, pair: Parameters<typeof josa>[1]): string {\n return `${word}${josa(word, pair)}`;\n}\n","import { useEffect, useRef, useState } from \"react\";\nimport type { DragEvent, ReactNode } from \"react\";\nimport { ChevronLeft, ChevronRight, GripVertical, Plus } from \"lucide-react\";\nimport { Icon } from \"../../common/Icon\";\nimport { IconButton } from \"../../common/IconButton\";\nimport { Skeleton } from \"../../common/Skeleton\";\nimport { VisuallyHidden } from \"../../common/VisuallyHidden\";\nimport \"./KanbanColumn.css\";\nimport { withJosa } from \"../../../foundation/josa\";\n\n/*\n * What a card in the air is carrying.\n *\n * `text/plain` alone was the drop's only condition, and every drag on the page carries\n * `text/plain`: a selected sentence, a link from another tab, a file name. Any of them landed\n * on a column and the string went out to `onDropCard` as if it were a card id. A type of this\n * component's own is a claim only this component makes, and `dataTransfer.types` is readable\n * during `dragover` — which is where the column decides whether it will take the drop at all,\n * before it is allowed to read any value.\n */\nconst CARD_MIME = \"application/x-kanban-card\";\n\nexport type KanbanCard = {\n id: string;\n title: string;\n /** A ticket number, a due date — one line, under the title. */\n meta?: ReactNode;\n /** Tags, an avatar, an estimate. */\n footer?: ReactNode;\n};\n\nexport type KanbanColumnProps = {\n title: string;\n cards: KanbanCard[];\n /** Work in progress limit. The count says so when it is passed. */\n limit?: number;\n /**\n * Move a card one column back or forward.\n *\n * Not optional in practice: this is the only path a keyboard has. See the note.\n */\n onMove?: (cardId: string, direction: -1 | 1) => void;\n /** Given, the column accepts a card dropped on it. */\n onDropCard?: (cardId: string) => void;\n onAdd?: () => void;\n /**\n * The column is waiting for its cards.\n *\n * A board draws all its columns at once and they fill at different times, so a column with\n * no waiting state is a board where empty and not-yet-arrived look identical — and a reader\n * decides the column is done when it is not.\n */\n loading?: boolean;\n loadingCards?: number;\n /** What to say instead of \"비어 있습니다\". A column that is empty for a reason can say it. */\n empty?: ReactNode;\n /** What went wrong. Takes precedence over waiting, which takes precedence over empty. */\n error?: ReactNode;\n /** What is on either side, so the move controls can be named after the destination. */\n neighbours?: { back?: string; forward?: string };\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * One column of a board.\n *\n * **Dragging is not reachable by a keyboard, so every move exists twice.** HTML drag and drop\n * fires no events for anyone who is not holding a pointer, and the ARIA drag-and-drop\n * attributes were removed from the spec because nothing ever implemented them usefully. The\n * answer is not a better drag: it is that moving a card is a *command* — a pair of buttons on\n * the card, named after where the card would land — and dragging is the shortcut for the\n * people who can use it. A board that is only draggable is a board a keyboard cannot play.\n *\n * **The limit is a fact about the column, so the column says it.** Not a red border alone:\n * the count reads \"5 / 4\" and the word 초과 is in the name.\n *\n * **The header does not scroll.** A column of thirty cards whose title has scrolled away is a\n * column of thirty cards nobody can name.\n */\nexport function KanbanColumn({\n title,\n cards,\n limit,\n onMove,\n onDropCard,\n onAdd,\n loading,\n loadingCards = 2,\n empty,\n error,\n neighbours,\n className,\n ...rest\n}: KanbanColumnProps) {\n const root = useRef<HTMLElement>(null);\n const [over, setOver] = useState(false);\n /* What the last move did, for a reader who cannot see the card land. Empty until one happens. */\n const [said, setSaid] = useState(\"\");\n /*\n * Which button was pressed, so focus can be put back near it.\n *\n * The card leaves this column and the button the reader pressed is unmounted with it, which\n * drops focus on the document — the reader is at the top of the page holding no context for\n * a move they just made. The slot is remembered here and answered in the effect below,\n * after the new cards have been rendered.\n */\n const returning = useRef<{ at: number; part: \"back\" | \"forward\" } | null>(null);\n /*\n * Which card is in the air.\n *\n * What this paints is the *slot it left*, not the card under the pointer — the floating one\n * is a bitmap the browser snapshotted at `dragstart` and nothing in this stylesheet can\n * reach it. So the card stays where it was, drawn as an outline, and the board reads as \"this\n * is the hole it came out of\" rather than as a card that vanished.\n */\n const [lifted, setLifted] = useState<string | null>(null);\n const past = limit !== undefined && cards.length > limit;\n\n useEffect(() => {\n const spot = returning.current;\n const node = root.current;\n returning.current = null;\n /* Only what the move itself dropped. Focus the reader moved elsewhere stays where they put it. */\n if (!spot || !node || document.activeElement !== document.body) return;\n const buttons = [...node.querySelectorAll<HTMLElement>(`[data-part=\"${spot.part}\"]`)];\n const next =\n buttons[Math.min(spot.at, buttons.length - 1)] ??\n node.querySelector<HTMLElement>('[data-part=\"add\"]');\n next?.focus();\n }, [cards]);\n\n const move = (card: KanbanCard, at: number, direction: -1 | 1) => {\n const where = direction === -1 ? neighbours?.back : neighbours?.forward;\n setSaid(\n where\n ? `${withJosa(card.title, \"을/를\")} ${withJosa(where, \"으로/로\")} 옮겼습니다`\n : `${withJosa(card.title, \"을/를\")} 옮겼습니다`,\n );\n returning.current = { at, part: direction === -1 ? \"back\" : \"forward\" };\n onMove?.(card.id, direction);\n };\n\n /* The value is unreadable until the drop; the list of types is not, and it is enough. */\n const carries = (event: DragEvent) => [...event.dataTransfer.types].includes(CARD_MIME);\n\n const accept = (event: DragEvent) => {\n if (!onDropCard || !carries(event)) return;\n event.preventDefault();\n setOver(true);\n };\n\n return (\n <section\n {...rest}\n className={`kanban-column ${className ?? \"\"}`.trim()}\n data-over={over ? \"\" : undefined}\n data-past={past ? \"\" : undefined}\n ref={root}\n /*\n * The count in the name is the count that is drawn. A column showing its skeleton has no\n * cards yet, and `cards.length` said \"0장\" — a column that is still loading announced\n * itself as an empty one, which is the one thing the waiting state exists to prevent.\n */\n aria-label={`${title} — ${\n error ? \"불러오지 못했습니다\" : loading ? \"불러오는 중\" : `${cards.length}장${past ? `, 한도 ${limit}장 초과` : \"\"}`\n }`}\n onDragOver={accept}\n onDragEnter={accept}\n /*\n * `dragleave` fires on the way into every child as well as on the way out of the column,\n * and clearing on all of them made the highlight blink once per card the pointer crossed.\n * A leave whose `relatedTarget` is still inside is not a leave.\n */\n onDragLeave={(event) => {\n const next = event.relatedTarget as Node | null;\n if (next && event.currentTarget.contains(next)) return;\n setOver(false);\n }}\n onDrop={(event) => {\n setOver(false);\n const id = event.dataTransfer.getData(CARD_MIME);\n if (id && onDropCard) {\n event.preventDefault();\n onDropCard(id);\n }\n }}\n >\n {/*\n * First, and always mounted: a live region added at the same moment as its first\n * sentence is a region nothing was watching, and the sentence is never read.\n */}\n <VisuallyHidden as=\"p\">\n <span role=\"status\" data-part=\"live\">\n {said}\n </span>\n </VisuallyHidden>\n\n <header className=\"kanban-column__head\">\n <h3 className=\"kanban-column__title\">{title}</h3>\n <p className=\"kanban-column__count\" data-part=\"count\">\n {limit === undefined ? cards.length : `${cards.length} / ${limit}`}\n </p>\n {onAdd ? (\n <IconButton icon={Plus} label={`${title}에 카드 추가`} size=\"sm\" onClick={onAdd} data-part=\"add\" />\n ) : null}\n </header>\n\n <ul className=\"kanban-column__cards\" aria-busy={loading || undefined}>\n {loading || error ? null : cards.map((card, at) => (\n <li\n className=\"kanban-column__card\"\n key={card.id}\n data-part=\"card\"\n /* The pointer shortcut. Everything it does is also on the two buttons below. */\n draggable={Boolean(onDropCard)}\n data-lifted={lifted === card.id ? \"\" : undefined}\n onDragStart={(event) => {\n /* The private type is what the column reads; `text/plain` is for everything else\n * that might receive this drag, and is not what any drop is decided on. */\n event.dataTransfer.setData(CARD_MIME, card.id);\n event.dataTransfer.setData(\"text/plain\", card.id);\n event.dataTransfer.effectAllowed = \"move\";\n setLifted(card.id);\n }}\n /* Fires whether the drop was taken or refused, which is the only event that does. */\n onDragEnd={() => setLifted(null)}\n >\n {/*\n * The grip is a mark, not a handle: the whole card is the drag target and this\n * only says so. Decorative, and out of the tab order — a control that does\n * nothing when it is focused is worse than no control, and the keyboard's real\n * path is the two buttons below.\n */}\n {onDropCard ? (\n <span className=\"kanban-column__grip\" aria-hidden=\"true\" data-part=\"grip\">\n <Icon icon={GripVertical} size=\"xs\" />\n </span>\n ) : null}\n\n <p className=\"kanban-column__card-title\">{card.title}</p>\n {card.meta ? <p className=\"kanban-column__card-meta\">{card.meta}</p> : null}\n {card.footer ? <div className=\"kanban-column__card-foot\">{card.footer}</div> : null}\n\n {onMove ? (\n <div className=\"kanban-column__move\" data-part=\"move\">\n <IconButton\n icon={ChevronLeft}\n /* Named after the destination, not the direction: \"이전으로\" eight times is\n * eight buttons a reader cannot tell apart. */\n label={\n neighbours?.back\n ? `${withJosa(card.title, \"을/를\")} ${withJosa(neighbours.back, \"으로/로\")} 옮기기`\n : `${card.title} 앞으로 옮기기`\n }\n size=\"sm\"\n disabled={!neighbours?.back}\n onClick={() => move(card, at, -1)}\n data-part=\"back\"\n />\n <IconButton\n icon={ChevronRight}\n label={\n neighbours?.forward\n ? `${withJosa(card.title, \"을/를\")} ${withJosa(neighbours.forward, \"으로/로\")} 옮기기`\n : `${card.title} 뒤로 옮기기`\n }\n size=\"sm\"\n disabled={!neighbours?.forward}\n onClick={() => move(card, at, 1)}\n data-part=\"forward\"\n />\n </div>\n ) : null}\n </li>\n ))}\n\n {/*\n * One of three, in this order: what failed, what has not arrived, what is not there.\n * A column that failed to load is not an empty column, and saying \"비어 있습니다\"\n * when the request threw is how a reader concludes there is nothing to do.\n */}\n {error ? (\n <li className=\"kanban-column__state\" role=\"alert\" data-part=\"error\">\n {error}\n </li>\n ) : loading ? (\n Array.from({ length: loadingCards }, (_, index) => (\n <li className=\"kanban-column__card\" key={`waiting-${index}`} data-part=\"waiting-card\">\n <Skeleton shape=\"text\" lines={1} />\n <Skeleton shape=\"text\" lines={1} />\n </li>\n ))\n ) : cards.length === 0 ? (\n <li className=\"kanban-column__empty\" data-part=\"empty\">\n <Icon icon={Plus} size=\"sm\" aria-hidden=\"true\" />\n {empty ?? \"비어 있습니다\"}\n </li>\n ) : null}\n </ul>\n\n {/*\n * Where it would land, named. `data-over` already tints the column, and a tint is a\n * colour — it says something is different without saying what, and on a board of five\n * columns the reader has to work out which one changed. The sentence says which.\n *\n * Out of the flow and out of the pointer's way: in the flow it would push every card up\n * the moment a drag entered, which is the board rearranging itself around a move that\n * has not happened.\n */}\n {over ? (\n <p className=\"kanban-column__drop\" data-part=\"drop\" aria-hidden=\"true\">\n {withJosa(title, \"으로/로\")} 옮기기\n </p>\n ) : null}\n </section>\n );\n}\n","import type { ReactNode } from \"react\";\nimport \"./Message.css\";\n\nexport type MessageRole = \"user\" | \"assistant\" | \"system\";\nexport type MessageState = \"sent\" | \"streaming\" | \"failed\";\n\nexport type MessageProps = {\n children: ReactNode;\n role?: MessageRole;\n /** Who said it. Defaults to 나 / 어시스턴트, which is what the accessible name uses too. */\n author?: string;\n avatar?: ReactNode;\n /** `YYYY-MM-DD HH:mm` — a string. See the note on `<time>` below. */\n time?: string;\n /** How it is displayed to a reader who cannot parse the machine form. */\n timeLabel?: string;\n state?: MessageState;\n edited?: boolean;\n /** Copy, retry, feedback. Present in the DOM always; see the stylesheet. */\n actions?: ReactNode;\n /** Files and images sent with the turn, above the text. */\n attachments?: ReactNode;\n /** Sources, tool calls, reasoning — what the turn was built out of, under it. */\n footer?: ReactNode;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\nconst NAME: Record<MessageRole, string> = {\n user: \"나\",\n assistant: \"어시스턴트\",\n system: \"시스템\",\n};\n\n/**\n * One turn.\n *\n * The two roles are not two skins of the same thing, and drawing them as facing bubbles is\n * the mistake that makes long assistant replies unreadable. A person's turn is short, known\n * and finished: it hugs its own text, takes a fill, and sits at the end of the row. The\n * assistant's turn is the page's body copy — it arrives over time, it can be twenty\n * paragraphs, and it gets the full measure, no fill, and the same type as an article.\n *\n * So: `--message-measure` is 46ch for a person and 66ch for the assistant, and only one of\n * the two ever has a ground.\n *\n * The turn's controls are in the DOM whether or not they are on screen. Rendering them on\n * hover means they do not exist for a keyboard, and `visibility: hidden` means they are\n * skipped by the tab order — so they are painted out with `opacity` and brought back by\n * `:hover`, `:focus-within`, and by having no hover at all.\n */\nexport function Message({\n children,\n role = \"assistant\",\n author,\n avatar,\n time,\n timeLabel,\n state = \"sent\",\n edited,\n actions,\n attachments,\n footer,\n className,\n ...rest\n}: MessageProps) {\n const name = author ?? NAME[role];\n\n return (\n <article\n {...rest}\n className={`message ${className ?? \"\"}`.trim()}\n data-role={role}\n data-state={state}\n aria-label={name}\n /* A turn still arriving is not finished being read. `aria-busy` is how a reader is told\n * to wait rather than being handed a sentence that stops mid-word. */\n aria-busy={state === \"streaming\" || undefined}\n >\n {avatar ? (\n <div className=\"message__avatar\" data-part=\"avatar\">\n {avatar}\n </div>\n ) : null}\n\n <div className=\"message__body\">\n <header className=\"message__head\">\n <span className=\"message__author\">{name}</span>\n {time ? (\n /*\n * `dateTime` is the machine form and the text is the human one. A relative label\n * — \"3분 전\" — is what a reader wants and is useless the moment the page has been\n * open for an hour, so the exact time stays in the attribute where it cannot rot.\n */\n <time className=\"message__time\" dateTime={time}>\n {timeLabel ?? time}\n </time>\n ) : null}\n {edited ? <span className=\"message__edited\">편집됨</span> : null}\n </header>\n\n {attachments ? <div className=\"message__attachments\">{attachments}</div> : null}\n\n <div className=\"message__text\" data-part=\"text\">\n {children}\n </div>\n\n {footer ? (\n <div className=\"message__footer\" data-part=\"footer\">\n {footer}\n </div>\n ) : null}\n\n {actions ? (\n <div className=\"message__actions\" data-part=\"actions\">\n {actions}\n </div>\n ) : null}\n </div>\n </article>\n );\n}\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { ArrowDown } from \"lucide-react\";\nimport { Icon } from \"../../common/Icon\";\nimport { Skeleton } from \"../../common/Skeleton\";\nimport \"./MessageList.css\";\n\nexport type MessageListProps = {\n children: ReactNode;\n /**\n * The thread is waiting for its history.\n *\n * A conversation is opened before its messages have been fetched, and an empty scroller\n * reads as \"you have not said anything yet\" — which is a different, wrong, and discouraging\n * fact. The placeholder alternates sides because a thread does, so the shape the reader\n * sees while waiting is the shape they get.\n */\n loading?: boolean;\n loadingMessages?: number;\n /** What to say when the conversation really has not started. */\n empty?: ReactNode;\n /** What went wrong. Error, then waiting, then empty, then messages. */\n error?: ReactNode;\n /**\n * A turn is still arriving.\n *\n * The scroller is the live region, and `aria-busy` only counts on the region's own root:\n * most screen readers do not look at the element inside it that changed. Marked busy here,\n * the whole thread is left alone until the turn settles and is then announced once; left\n * unmarked, every chunk of a streaming answer is a change to a polite live region and the\n * paragraph is read again from the top on each one.\n *\n * Which is why it is a prop rather than something measured: only the caller knows a reply\n * is still coming. `Message`'s own `state=\"streaming\"` marks the turn, not the region.\n */\n streaming?: boolean;\n /** What this thread is. Names the scroll region, which a keyboard has to be able to reach. */\n label: string;\n /** How close to the end still counts as being at the end, in pixels of scroll. */\n threshold?: number;\n jumpLabel?: string;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * The thread.\n *\n * Two facts about a log make this more than a scrolling div, and both are about the reader\n * who is not at the bottom.\n *\n * **It must not pull them back.** Content arriving at the end of a thread scrolls the view\n * only if the reader was already at the end. Someone reading four turns up has chosen where\n * to be, and a thread that yanks them down every time a token arrives is unreadable during\n * exactly the moment it matters. When they are away from the end, a button says so and takes\n * them back on request.\n *\n * **It must not be re-read.** `role=\"log\"` is `aria-live=\"polite\"` with only additions\n * announced, which is the difference between hearing the new turn and hearing the whole\n * conversation again. While a reply is still arriving the caller passes `streaming` and the\n * scroller — the live region's own root, which is the only place a reader looks — carries\n * `aria-busy`, so what is announced is a finished sentence rather than a stream of syllables.\n *\n * **The way back is not a scroll position.** The button's own smooth scroll fires the same\n * events a wheel does, and measuring them turned the press into its own undoing. What tells\n * the two apart is the gesture, not the distance.\n *\n * The growth is watched rather than declared. A streaming reply changes a text node, not the\n * list of children, so a component told \"scroll when the children change\" sits still for the\n * entire answer.\n */\nexport function MessageList({\n children,\n loading,\n loadingMessages = 3,\n empty,\n error,\n streaming,\n label,\n threshold = 32,\n jumpLabel = \"맨 아래로\",\n className,\n ...rest\n}: MessageListProps) {\n const scroller = useRef<HTMLDivElement>(null);\n const content = useRef<HTMLDivElement>(null);\n const pinned = useRef(true);\n /*\n * A scroll this component asked for is still running.\n *\n * A smooth `scrollTo` fires exactly the same `scroll` events a wheel does, one per frame,\n * and every one of them is somewhere in the middle of the box. Measured, they say \"away\n * from the end\" — so pressing 맨 아래로 during a reply unpinned the thread on the button's\n * own animation, the animation finished at the height the list had when it started, and the\n * reader was left ~241px short of an answer that then went on growing without them.\n *\n * So the distance is not what says whether the reader is following. Intent is, and intent\n * arrives as an input event: a wheel, a touch, an arrow key. Between the press and the\n * arrival the measurement is skipped, and any of those gestures ends it early.\n */\n const jumping = useRef(false);\n const [away, setAway] = useState(false);\n\n const measure = useCallback(() => {\n const node = scroller.current;\n if (!node) return;\n const distance = node.scrollHeight - node.scrollTop - node.clientHeight;\n /* 우리 애니메이션이 도는 동안의 스크롤 이벤트는 우리가 낸 것이다. 끝날 때 한 번\n * 재는 것으로 충분하고, 그 사이의 중간 위치로 「독자가 떠났다」를 판단하지 않는다. */\n if (jumping.current) return;\n pinned.current = distance <= threshold;\n setAway(!pinned.current);\n }, [threshold]);\n\n /*\n * 부드러운 이동은 직접 굴린다. `scrollTo({ behavior: \"smooth\" })`가 아니다.\n *\n * 브라우저의 애니메이션은 떠날 때의 목표를 들고 가고, 도는 사이에 답이 자라도 그 목표를\n * 바꾸지 않는다. 즉석 스크롤로 바꿔치려 해도 소용이 없다 — 재 보면 자란 프레임에 즉석으로\n * 바닥에 갔다가 아직 돌던 애니메이션이 자기 옛 목표로 도로 끌어내린다. 그래서 「맨 아래로」가\n * 241px 못 미친 자리에 섰다.\n *\n * 우리가 굴리면 매 프레임 바닥을 다시 읽으므로 자라는 것을 따라가는 것이 구조상 보장된다.\n * 독자가 휠이나 키로 개입하면 `jumping`이 꺼지고 다음 프레임에 멈춘다.\n */\n const frame = useRef(0);\n\n const toEnd = useCallback(\n (smooth: boolean) => {\n const node = scroller.current;\n if (!node) return;\n cancelAnimationFrame(frame.current);\n const bottom = () => node.scrollHeight - node.clientHeight;\n\n const quiet = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n if (!smooth || quiet) {\n jumping.current = false;\n node.scrollTop = bottom();\n return;\n }\n\n jumping.current = true;\n const from = node.scrollTop;\n const began = performance.now();\n const 길이 = 320;\n const step = (now: number) => {\n if (!jumping.current) return;\n const k = Math.min(1, (now - began) / 길이);\n /* ease-out cubic — 끝에서 잦아든다. */\n node.scrollTop = from + (bottom() - from) * (1 - (1 - k) ** 3);\n if (k < 1) {\n frame.current = requestAnimationFrame(step);\n return;\n }\n jumping.current = false;\n node.scrollTop = bottom();\n measure();\n };\n frame.current = requestAnimationFrame(step);\n },\n [measure],\n );\n\n /*\n * The gestures that mean the reader took the wheel back.\n *\n * Listened for on the scroller rather than inferred from `scroll`, because the two kinds of\n * scroll are indistinguishable once they have become scroll events. `pointerdown` is not in\n * the list: pressing a button inside a turn is not a scroll.\n */\n useEffect(() => {\n const node = scroller.current;\n if (!node) return;\n const release = () => {\n jumping.current = false;\n };\n const kinds = [\"wheel\", \"touchstart\", \"keydown\"] as const;\n for (const kind of kinds) node.addEventListener(kind, release, { passive: true });\n return () => {\n for (const kind of kinds) node.removeEventListener(kind, release);\n };\n }, []);\n\n useEffect(() => {\n const node = content.current;\n if (!node) return;\n /*\n * A ResizeObserver, not a MutationObserver on the child list: the height changes for\n * reasons that are not new children — a token arriving, an image loading, a disclosure\n * opening, the window narrowing and a paragraph wrapping to one more line.\n */\n const watcher = new ResizeObserver(() => {\n /*\n * Growth while a jump is in flight is the other half of the same failure: the smooth\n * animation was aimed at the height the list had when the button was pressed. Re-aiming\n * instantly both lands it and cancels the stale animation.\n *\n * `jumping.current` has to be in this condition, and it was not. During a jump the\n * reader is by definition *not* pinned — that is why they pressed the button — so the\n * `pinned` half never covered the case it was written for: the animation finished at the\n * old height, `measure()` refused to accept that position because it was still mid-jump,\n * and the thread sat ~241px short of an answer that went on growing.\n *\n * 도는 중이면 즉석이 아니라 다시 겨냥한다. 즉석 스크롤은 애니메이션을 취소하지\n * 못하고, 애니메이션이 자기 옛 목표로 도로 끌어내린다.\n */\n /* 도는 중이면 아무것도 하지 않는다 — 우리 애니메이션이 매 프레임 바닥을 다시 읽어\n * 자라는 것을 스스로 따라간다. */\n if (jumping.current) return;\n if (pinned.current) return toEnd(false);\n /*\n * And measure again when they are away, because content also gets *shorter* — a\n * disclosure closing, a placeholder giving way to one line. The browser clamps\n * `scrollTop` to the new height without firing a scroll event, so a reader who was a\n * little above the end is now at it while the state still says otherwise: the jump\n * button stays up over a thread that is already at its end, and nothing follows the\n * next turn down.\n */\n measure();\n });\n watcher.observe(node);\n toEnd(false);\n return () => {\n watcher.disconnect();\n /* 굴리던 프레임도 함께 멈춘다. 사라진 목록을 향해 도는 루프는 아무것도 아닌 것을\n * 계속 재는 일이다. */\n cancelAnimationFrame(frame.current);\n jumping.current = false;\n };\n }, [measure, toEnd]);\n\n return (\n <div className={`message-list ${className ?? \"\"}`.trim()} {...rest}>\n <div\n ref={scroller}\n className=\"message-list__scroll\"\n /*\n * A scroll container that cannot take focus cannot be scrolled by a keyboard: there\n * is nothing to press the arrow keys against. Focusable means it needs a name, which\n * is what `label` is for.\n */\n tabIndex={0}\n role=\"log\"\n aria-label={label}\n /* On the region's root, not on the turn inside it: most screen readers read\n * `aria-busy` off the live region itself and ignore the one on the element that\n * changed. See the note on `streaming`. */\n aria-busy={loading || streaming || undefined}\n onScroll={measure}\n data-part=\"scroll\"\n >\n <div ref={content} className=\"message-list__content\">\n {error ? (\n <p className=\"message-list__state\" role=\"alert\" data-part=\"error\">\n {error}\n </p>\n ) : loading ? (\n Array.from({ length: loadingMessages }, (_, index) => (\n <div\n className=\"message-list__waiting\"\n key={`waiting-${index}`}\n data-part=\"waiting-message\"\n data-side={index % 2 === 0 ? \"them\" : \"me\"}\n >\n <Skeleton shape=\"text\" lines={index % 2 === 0 ? 2 : 1} />\n </div>\n ))\n ) : empty ? (\n <p className=\"message-list__state\" data-part=\"empty\">\n {empty}\n </p>\n ) : (\n children\n )}\n </div>\n </div>\n\n {away ? (\n <button\n type=\"button\"\n className=\"message-list__jump\"\n onClick={() => {\n pinned.current = true;\n setAway(false);\n toEnd(true);\n }}\n data-part=\"jump\"\n >\n <Icon icon={ArrowDown} size=\"sm\" aria-hidden=\"true\" />\n {jumpLabel}\n </button>\n ) : null}\n </div>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { ArrowDownRight, ArrowUpRight, Minus } from \"lucide-react\";\nimport { Icon } from \"../../common/Icon\";\nimport { Skeleton } from \"../../common/Skeleton\";\nimport \"./MetricCard.css\";\n\nexport type MetricDirection = \"up\" | \"down\" | \"flat\";\n/** Whether the move was welcome. Not the same question as which way it went. */\nexport type MetricMeaning = \"good\" | \"bad\" | \"neutral\";\n\nexport type MetricDelta = {\n /** The change, already formatted. \"+12.4%\", \"-$320\", \"+2\". */\n value: ReactNode;\n direction: MetricDirection;\n meaning?: MetricMeaning;\n};\n\nexport type MetricCardProps = {\n /** What is being counted. \"총 매출\", \"이탈률\". */\n label: string;\n /** The number, already formatted — currency, unit and locale are the adopter's. */\n value: ReactNode;\n delta?: MetricDelta;\n /** What the delta is against. \"지난 7일 대비\", \"전월 대비\". */\n compare?: ReactNode;\n /**\n * The graph.\n *\n * A slot, and this library does not fill it. Axes, scales, tooltips, legends, resizing and\n * the accessibility of all four are a charting library rather than a part in a design\n * system, and there are mature ones — building it here means maintaining a worse copy of one\n * in a few months. The card owns the number, the delta and the frame; the adopter brings\n * ECharts or whatever else, and the boundary is this prop.\n *\n * `docs/CHARTS.md` is the other half: how an adopter reads this repository's tokens into an\n * ECharts theme, which colours a series may use, and what has to happen when the theme\n * changes under a chart that has already copied its values.\n */\n chart?: ReactNode;\n /** The card is drawn before the number exists. */\n loading?: boolean;\n /** There is no number, and that is an answer. \"아직 주문이 없습니다\". */\n empty?: ReactNode;\n /** The request threw. Takes precedence over waiting, which takes precedence over empty. */\n error?: ReactNode;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\nconst ARROW = { up: ArrowUpRight, down: ArrowDownRight, flat: Minus };\nconst SAID: Record<MetricDirection, string> = { up: \"증가\", down: \"감소\", flat: \"변화 없음\" };\n\n/**\n * One number, how it moved, and room for the picture of how it got there.\n *\n * **Which way it went and whether that is good are two questions, and this takes both.** A\n * delta that colours itself by its sign is a card that paints a rising bounce rate green and a\n * falling one red, and a reader who has learned that green means good now has to un-learn it\n * on this one tile. `direction` draws the arrow and is said in words; `meaning` picks the\n * colour, and it defaults to `neutral` — a card told only that the number went up says only\n * that.\n *\n * **The arrow is not the carrier either.** Up and down are two shapes to a reader who can see\n * them and one to everybody else, so the direction is in the accessible text beside the value.\n * This is the same fact `AvatarGroup.status` learned: a mark that is only a colour or only a\n * shape is a mark half the readers do not get.\n *\n * **`chart` is a slot.** See the note on the prop.\n */\nexport function MetricCard({\n label,\n value,\n delta,\n compare,\n chart,\n loading,\n empty,\n error,\n className,\n ...rest\n}: MetricCardProps) {\n const meaning = delta?.meaning ?? \"neutral\";\n\n return (\n <section\n {...rest}\n className={`metric-card ${className ?? \"\"}`.trim()}\n aria-label={label}\n aria-busy={loading || undefined}\n >\n <p className=\"metric-card__label\">{label}</p>\n\n {/*\n * One of four, in this order: what failed, what has not arrived, what is not there, the\n * number. A tile that failed to load is not a tile reading zero — and zero is a number a\n * reader will act on.\n */}\n {error ? (\n <p className=\"metric-card__state\" role=\"alert\" data-part=\"error\">\n {error}\n </p>\n ) : loading ? (\n <div className=\"metric-card__waiting\" data-part=\"waiting\">\n {/*\n * The card's own shape, to the pixel: a bar the height of the number's line, then a\n * bar the height of the delta's, with the gap the settled card uses between them.\n *\n * Not \"about right\". A tile that stands 112px waiting and 120px settled grows 8px\n * as its number lands, and a dashboard of six tiles arriving one at a time shoves\n * the grid under the reader's cursor six times. Keeping the height is the entire\n * job of a placeholder, and the two `rect`s are sized from the same tokens the\n * settled elements read.\n */}\n <Skeleton shape=\"rect\" data-part=\"waiting-value\" />\n <Skeleton shape=\"rect\" data-part=\"waiting-delta\" />\n </div>\n ) : empty ? (\n <p className=\"metric-card__state\" data-part=\"empty\">\n {empty}\n </p>\n ) : (\n <>\n <p className=\"metric-card__value\" data-part=\"value\">\n {value}\n </p>\n\n {delta ? (\n <p className=\"metric-card__delta\" data-meaning={meaning} data-part=\"delta\">\n <Icon icon={ARROW[delta.direction]} size=\"xs\" aria-hidden=\"true\" />\n <span>{delta.value}</span>\n {/* The direction in words, because an arrow is a shape. */}\n <span className=\"metric-card__said\">{` ${SAID[delta.direction]}`}</span>\n {compare ? <span className=\"metric-card__compare\">{compare}</span> : null}\n </p>\n ) : compare ? (\n <p className=\"metric-card__compare\" data-part=\"compare\">\n {compare}\n </p>\n ) : null}\n </>\n )}\n\n {/*\n * The chart sits under everything, including the states — a tile that is waiting for its\n * number is a tile whose graph has not arrived either, and drawing the old one under a\n * skeleton is the card showing two different moments at once. `empty` is one of those\n * states: a tile that says there are no orders yet must not keep last week's line under\n * the sentence.\n */}\n {chart && !loading && !error && !empty ? (\n <div className=\"metric-card__chart\" data-part=\"chart\">\n {chart}\n </div>\n ) : null}\n </section>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { VisuallyHidden } from \"../../common/VisuallyHidden\";\nimport \"./PriceDisplay.css\";\n\nexport type PriceDisplaySize = \"sm\" | \"md\" | \"lg\";\nexport type PriceDisplayAffix = \"symbol\" | \"word\";\n\nexport type PriceDisplayProps = {\n /** What it costs now, as a number. Never a string with commas already in it. */\n amount: number;\n /** What it cost before. Struck through, and never read out as the price. */\n was?: number;\n currency?: string;\n locale?: string;\n /** `₩29,000` or `29,000원`. See the note. */\n affix?: PriceDisplayAffix;\n size?: PriceDisplaySize;\n /** \"부가세 포함\", \"1개당\", \"월\". One line, under or after the figure. */\n note?: ReactNode;\n /** Show how much was taken off, as a percentage. */\n saving?: boolean;\n /**\n * What this is the price of, when the surrounding text does not already say.\n *\n * Rendered as clipped text at the front of the figure, not as `aria-label` — see the note\n * where it is drawn.\n */\n label?: string;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * The affix, for currencies whose symbol is not how the price is written.\n *\n * `Intl` renders 29000 KRW as `₩29,000`, which is correct and is not what a Korean shop\n * prints. The digits still come from `Intl` — the grouping, and how many decimals the\n * currency has — and only the affix comes from here. A currency that is not in this map falls\n * back to the symbol, which is always right and sometimes unidiomatic.\n */\nconst UNIT: Record<string, string> = {\n KRW: \"원\",\n JPY: \"엔\",\n CNY: \"위안\",\n};\n\nexport function money(\n amount: number,\n { locale = \"ko-KR\", currency = \"KRW\", affix = \"word\" }: { locale?: string; currency?: string; affix?: PriceDisplayAffix } = {},\n) {\n const parts = new Intl.NumberFormat(locale, { style: \"currency\", currency }).formatToParts(amount);\n const unit = UNIT[currency];\n if (affix === \"symbol\" || !unit) return parts.map((part) => part.value).join(\"\");\n /*\n * Everything except the symbol and the space that came with it. `formatToParts` is what\n * makes this safe: stripping a symbol with a regular expression breaks the moment the\n * currency's symbol is a letter, which several of them are.\n */\n const digits = parts\n .filter((part) => part.type !== \"currency\")\n .map((part) => part.value)\n .join(\"\")\n .trim();\n return `${digits}${unit}`;\n}\n\n/**\n * A price, and what it used to be.\n *\n * **The number is formatted, never typed.** `Intl.NumberFormat` knows that KRW has no\n * decimals and USD has two, where the grouping separator goes in every locale, and that some\n * of them are not commas. Every price written by hand is right until the shop opens in a\n * second country.\n *\n * **The old price must not be read out as the price.** `<s>` is a visual line; most screen\n * readers say nothing about it, so a discounted item is announced as two prices in a row and\n * the reader hears the wrong one last. Each figure carries a word saying which it is, clipped\n * off the screen where the strike is doing that job for everybody else.\n *\n * **A saving is rounded down.** 25.8% off is 25% off. Rounding a discount up is the one\n * rounding error that ends up in front of a regulator.\n *\n * The figures are tabular so a column of prices lines up and a price that changes does not\n * shift the text beside it.\n */\nexport function PriceDisplay({\n amount,\n was,\n currency = \"KRW\",\n locale = \"ko-KR\",\n affix = \"word\",\n size = \"md\",\n note,\n saving,\n label,\n className,\n ...rest\n}: PriceDisplayProps) {\n const cheaper = was !== undefined && was > amount;\n /* Down, never up. */\n const off = cheaper ? Math.floor(((was - amount) / was) * 100) : 0;\n\n return (\n <p\n {...rest}\n className={`price-display ${className ?? \"\"}`.trim()}\n data-size={size}\n >\n {/*\n * What this is the price of, as text rather than as `aria-label`.\n *\n * The root is a paragraph, and `paragraph` is one of the roles a name may not be given:\n * an implementation that follows that rule drops the label, and the prop silently names\n * nothing. Clipped text inside the paragraph is read wherever the attribute would have\n * been, and everywhere it would not.\n */}\n {label ? <VisuallyHidden>{label} </VisuallyHidden> : null}\n\n <span className=\"price-display__now\" data-part=\"now\">\n {cheaper ? <VisuallyHidden>할인가 </VisuallyHidden> : null}\n {/* The machine-readable amount, next to the one a person reads. */}\n <data value={amount}>{money(amount, { locale, currency, affix })}</data>\n </span>\n\n {cheaper ? (\n <s className=\"price-display__was\" data-part=\"was\">\n <VisuallyHidden>원래 가격 </VisuallyHidden>\n <data value={was}>{money(was, { locale, currency, affix })}</data>\n </s>\n ) : null}\n\n {cheaper && saving && off > 0 ? (\n <span className=\"price-display__off\" data-part=\"off\">\n {off}%\n <VisuallyHidden> 할인</VisuallyHidden>\n </span>\n ) : null}\n\n {note ? <span className=\"price-display__note\">{note}</span> : null}\n </p>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { money, type PriceDisplayAffix } from \"../PriceDisplay\";\nimport \"./OrderSummary.css\";\n\nexport type OrderLineKind = \"charge\" | \"discount\" | \"free\";\n\nexport type OrderLine = {\n id: string;\n label: ReactNode;\n /** Positive. A discount is made negative by its `kind`, not by its sign. */\n amount: number;\n kind?: OrderLineKind;\n /** \"3만원 이상 무료\", \"제주·도서 추가\" — under the label, quieter. */\n note?: ReactNode;\n};\n\nexport type OrderSummaryProps = {\n lines: OrderLine[];\n total: number;\n /** What the summary is for. Names the region. */\n label: string;\n currency?: string;\n locale?: string;\n affix?: PriceDisplayAffix;\n /**\n * Some of these are guesses.\n *\n * Before an address is known, shipping and tax are estimates, and a total that does not say\n * so is a number the reader will later feel lied to about.\n */\n estimated?: boolean;\n /** \"부가세 포함\" — a statement about the total, and it differs by country. */\n totalNote?: ReactNode;\n /**\n * The name of the last row. \"합계\".\n *\n * The component localises its numbers through `locale` and `currency` and used to print its\n * own words in Korean regardless, which made a summary that counted in dollars and totalled\n * in Korean. The words a reader sees are the caller's.\n */\n totalLabel?: string;\n /** What an estimate says about itself. Shown under the total when `estimated`. */\n estimateNote?: ReactNode;\n /** The word a zero charge is written as, rather than 0. \"무료\". */\n freeLabel?: string;\n actions?: ReactNode;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * 항목 · 소계 · 배송 · 세금 · 합계.\n *\n * **A description list, because that is what it is** — every row is a name and the value that\n * goes with it, and a `<dl>` says so without a table's cost or a div's silence.\n *\n * **The total is the only line with weight.** Six bold rows is six things competing to be the\n * number the reader remembers, and the one they need is the last.\n *\n * **무료 is a word, not 0원.** A zero in a column of money reads as a bug; the word reads as\n * the thing that happened. A discount is shown with its minus, in its own tone, because\n * subtracting is the whole of what it does. Both still carry a `<data value>`, so what a\n * machine reads is a number even where a reader is given a word.\n *\n * **The numbers are localised and so are the words.** `locale` and `currency` decide how a\n * figure is written; `totalLabel`, `estimateNote` and `freeLabel` decide what the summary\n * calls things. A component that formatted USD and then wrote \"합계\" underneath was localised\n * in one half only.\n *\n * **An estimate says it is one.** This is not decoration: shipping and tax before an address\n * are guesses, and the number that changes at the last screen is the most common reason a\n * basket is abandoned.\n */\nexport function OrderSummary({\n lines,\n total,\n label,\n currency = \"KRW\",\n locale = \"ko-KR\",\n affix = \"word\",\n estimated,\n totalNote,\n totalLabel = \"합계\",\n estimateNote = \"주소를 넣기 전이라 예상입니다\",\n freeLabel = \"무료\",\n actions,\n className,\n ...rest\n}: OrderSummaryProps) {\n const show = (amount: number, kind?: OrderLineKind) => {\n if (kind === \"free\") return freeLabel;\n const figure = money(amount, { locale, currency, affix });\n return kind === \"discount\" ? `−${figure}` : figure;\n };\n\n /*\n * The number behind the words, for anything reading the page rather than looking at it.\n *\n * Every row has one, 무료 included: a row whose figure is a word and whose machine value is\n * missing is a row a parser has to guess at, and the guess it makes about \"무료\" is that the\n * line has no amount rather than that it costs nothing.\n */\n const value = (line: OrderLine) => {\n if (line.kind === \"free\") return 0;\n return line.kind === \"discount\" ? -line.amount : line.amount;\n };\n\n return (\n <section {...rest} className={`order-summary ${className ?? \"\"}`.trim()} aria-label={label}>\n <dl className=\"order-summary__lines\">\n {lines.map((line) => (\n <div className=\"order-summary__line\" key={line.id} data-kind={line.kind ?? \"charge\"} data-part=\"line\">\n <dt className=\"order-summary__label\">\n {line.label}\n {line.note ? <span className=\"order-summary__note\">{line.note}</span> : null}\n </dt>\n <dd className=\"order-summary__amount\">\n <data value={value(line)}>{show(line.amount, line.kind)}</data>\n </dd>\n </div>\n ))}\n\n <div className=\"order-summary__line order-summary__line--total\" data-part=\"total\">\n <dt className=\"order-summary__label\">\n {totalLabel}\n {estimated ? <span className=\"order-summary__note\">{estimateNote}</span> : null}\n {totalNote ? <span className=\"order-summary__note\">{totalNote}</span> : null}\n </dt>\n <dd className=\"order-summary__amount\">\n <data value={total}>{money(total, { locale, currency, affix })}</data>\n </dd>\n </div>\n </dl>\n\n {actions ? <div className=\"order-summary__actions\">{actions}</div> : null}\n </section>\n );\n}\n","import type { ReactNode } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport { Icon } from \"../../common/Icon\";\nimport { Radio } from \"../../common/Radio\";\nimport \"./PaymentMethodSelector.css\";\n\nexport type PaymentMethod = {\n id: string;\n label: string;\n /** A card network, a bank, a wallet. Decorative — the label names it. */\n icon?: LucideIcon;\n /** \"무이자 3개월\", \"수수료 없음\" — one line under the label. */\n note?: ReactNode;\n /** What has to be filled in once this one is chosen. */\n fields?: ReactNode;\n disabled?: boolean;\n /** Why it cannot be used. Shown, because a disabled option with no reason is a dead end. */\n unavailable?: string;\n};\n\nexport type PaymentMethodSelectorProps = {\n methods: PaymentMethod[];\n value: string;\n onValueChange: (id: string) => void;\n /** What is being chosen. Names the group. */\n label: string;\n /**\n * The name the chosen method is submitted under. `FormData` reads this key.\n *\n * It used to be `useId()` and it was never exposed, so a checkout posted `_r_c_=card` — a\n * key React mints from where the component happened to sit in the render tree, which\n * changes when anything above it does and means nothing to a server on any render. The\n * radios still need *a* shared name, because that is what makes them one group: without it\n * each radio is its own group, every one takes a tab stop, and the arrow keys stop moving\n * between them.\n *\n * Left out, it falls back to `paymentMethod` — a fixed name a server can read, rather than\n * a generated one it cannot. Two selectors on one page must be named apart, since a shared\n * name is what makes two radios the same group.\n */\n name?: string;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * How to pay, with the chosen one open.\n *\n * **This is not an accordion.** It looks like one and it is a radio group: exactly one panel\n * is open, it is always the selected option's, and it cannot be closed without choosing\n * something else. Built out of `Disclosure` it would allow two open at once and none open at\n * all, and both of those are states a payment form cannot be in.\n *\n * **The fields belong to the option.** They are rendered inside the option's own row, after\n * its radio, so tabbing out of \"새 카드\" lands in the card number rather than on the next\n * payment method — and so a reader moving by group hears the fields as part of the thing they\n * just chose. `aria-controls` on the radio is not a substitute: it describes a relationship\n * and moves nothing.\n *\n * **The group name is the adopter's.** `name` is the key the chosen method arrives under in\n * `FormData`. It was a generated id for a while, so the order reached the server as\n * `_r_c_=card`, and the id changes whenever the render tree above the component does. See the\n * note on the prop.\n *\n * **A card number is text.** `type=\"number\"` strips leading zeros, adds a spinner nobody\n * wants on a card, and refuses the spaces every card is printed with. `inputmode=\"numeric\"`\n * gets the keypad; `autocomplete=\"cc-number\"` gets the browser's stored card, which is the\n * only part of this form anyone enjoys.\n */\nexport function PaymentMethodSelector({\n methods,\n value,\n onValueChange,\n label,\n name = \"paymentMethod\",\n className,\n ...rest\n}: PaymentMethodSelectorProps) {\n\n /*\n * Where Tab enters, when the chosen method cannot hold the stop.\n *\n * A radio group has exactly one tab stop and the browser puts it on the checked radio. A\n * disabled control is not a tab stop, so `value` pointing at a disabled method took the\n * whole group out of the tab order: the reader tabbed from the legend to whatever followed\n * the fieldset and never met a payment method at all. The stop moves to the first method\n * that can take it, which keeps the tab order in document order.\n */\n const chosen = methods.find((method) => method.id === value);\n const stop = chosen?.disabled ? methods.find((method) => !method.disabled)?.id : undefined;\n\n return (\n <fieldset {...rest} className={`payment-method-selector ${className ?? \"\"}`.trim()}>\n <legend className=\"payment-method-selector__legend\">{label}</legend>\n\n <div className=\"payment-method-selector__methods\">\n {methods.map((method) => {\n const picked = method.id === value;\n return (\n <div\n className=\"payment-method-selector__method\"\n key={method.id}\n data-chosen={picked ? \"\" : undefined}\n data-disabled={method.disabled ? \"\" : undefined}\n data-part=\"method\"\n >\n <Radio\n className=\"payment-method-selector__choice\"\n name={name}\n value={method.id}\n checked={picked}\n disabled={method.disabled}\n tabIndex={stop === undefined ? undefined : method.id === stop ? 0 : -1}\n onChange={() => onValueChange(method.id)}\n data-part={`choice-${method.id}`}\n >\n <span className=\"payment-method-selector__text\">\n <span className=\"payment-method-selector__label\">\n {method.icon ? (\n <Icon icon={method.icon} size=\"sm\" tone=\"muted\" aria-hidden=\"true\" />\n ) : null}\n {method.label}\n </span>\n {method.note ? <span className=\"payment-method-selector__note\">{method.note}</span> : null}\n {method.disabled && method.unavailable ? (\n <span className=\"payment-method-selector__why\">{method.unavailable}</span>\n ) : null}\n </span>\n </Radio>\n\n {/*\n * Inside the option, after its radio. Tabbing out of the choice lands in its\n * fields rather than on the next method.\n */}\n {picked && method.fields ? (\n <div className=\"payment-method-selector__fields\" data-part=\"fields\">\n {method.fields}\n </div>\n ) : null}\n </div>\n );\n })}\n </div>\n </fieldset>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { Eye, EyeOff } from \"lucide-react\";\nimport type { AvatarSize } from \"../../common/Avatar\";\nimport { AvatarGroup, type AvatarGroupPerson } from \"../../derived/AvatarGroup\";\nimport { Button } from \"../../common/Button\";\nimport { Menu, MenuItem, MenuRadioGroup, MenuRadioItem, MenuSeparator } from \"../../composed/Menu\";\nimport \"./PresenceBar.css\";\n\nexport type PresenceState = \"active\" | \"idle\";\n\nexport type Person = {\n id: string;\n name: string;\n src?: string;\n state?: PresenceState;\n /** The reader. Marked, and first. */\n you?: boolean;\n};\n\nexport type PresenceBarProps = {\n people: Person[];\n /** What they are all in. \"이 문서를 보고 있는 사람\". */\n label: string;\n /** How many faces before the rest become a count. */\n max?: number;\n size?: AvatarSize;\n /** Whose view is being followed, if any. */\n following?: string;\n /** Given, the bar offers to follow someone. Called with `null` to stop. */\n onFollow?: (id: string | null) => void;\n followLabel?: string;\n /** Something at the end — a share button, a call button. */\n aside?: ReactNode;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * Who else is in this document.\n *\n * **It is deliberately not a live region.** A busy document has people arriving and leaving\n * every few seconds, and announcing each one turns a screen reader into a turnstile — the\n * reader cannot hear the thing they are actually working on. The count is a sentence in the\n * group's own name, there whenever they ask for it and never pushed at them.\n *\n * **The reader is in it, marked and first.** A bar that shows everyone except you makes the\n * reader count faces to work out whether they are the fifth or the sixth, and that is the\n * first question anyone asks of one of these.\n *\n * **The faces are not buttons.** They were, in the first version, and they were a 24px circle\n * overlapped by a quarter — a 19px target, under the 24px WCAG 2.2 asks for, eight of them in\n * a row. Following is a command about a person, so it lives in a menu that names them; the\n * stack goes back to being a picture. It is `AvatarGroup`'s picture, too: the overlap, the\n * ring, the fan order and the counter that has to sit on top of the stack rather than under\n * it were all settled once, in the layer below.\n */\nexport function PresenceBar({\n people,\n label,\n max = 5,\n size = \"sm\",\n following,\n onFollow,\n followLabel = \"따라가기\",\n aside,\n className,\n ...rest\n}: PresenceBarProps) {\n /* The reader first, then everyone else in the order they were given. */\n const ordered = [...people].sort((a, b) => Number(Boolean(b.you)) - Number(Boolean(a.you)));\n const followed = people.find((one) => one.id === following);\n\n const faces: AvatarGroupPerson[] = ordered.map((person) => ({\n /* Keyed by id down in the group as well: two readers called 김민수 is not an edge case. */\n id: person.id,\n name: person.name,\n src: person.src,\n status: person.state === \"idle\" ? \"away\" : \"online\",\n said: [person.you ? \"(나)\" : \"\", person.state === \"idle\" ? \"— 자리 비움\" : \"\"].filter(Boolean).join(\" \"),\n }));\n\n return (\n <div\n {...rest}\n className={`presence-bar ${className ?? \"\"}`.trim()}\n role=\"group\"\n /* The whole fact, in words, in the name — rather than announced on every change. */\n aria-label={`${label} — ${people.length}명`}\n >\n <AvatarGroup people={faces} label={label} max={max} size={size} data-part=\"faces\" />\n\n {onFollow ? (\n <Menu\n items={\n <>\n {/*\n * The menu answers with the same person the button names.\n *\n * `following` is the adopter's string and it can point at somebody who has since\n * left: the button falls back to \"따라가기\" because it looks the person up, and\n * the radio group went on holding the departed id — one control saying nobody is\n * being followed while the other showed a checked name that is no longer in the\n * list. Both read the person, so both say the same thing.\n */}\n <MenuRadioGroup value={followed?.id ?? \"\"} onValueChange={(id) => onFollow(id || null)}>\n {ordered\n .filter((person) => !person.you)\n .map((person) => (\n <MenuRadioItem key={person.id} value={person.id} data-part={`follow-${person.id}`}>\n {person.name}\n {person.state === \"idle\" ? \" — 자리 비움\" : \"\"}\n </MenuRadioItem>\n ))}\n </MenuRadioGroup>\n <MenuSeparator />\n {/* Enabled while `following` holds anything at all, stale or not: it is the one\n * control that can clear a value pointing at somebody who has left. */}\n <MenuItem icon={EyeOff} disabled={!following} onSelect={() => onFollow(null)} data-part=\"unfollow\">\n 따라가지 않기\n </MenuItem>\n </>\n }\n >\n <Button\n size=\"sm\"\n variant={followed ? \"solid\" : \"outline\"}\n tone={followed ? \"accent\" : \"neutral\"}\n iconStart={Eye}\n data-part=\"follow\"\n >\n {/* The control says whose view you are in. A follow you cannot see and cannot\n * cancel is a page that has stopped obeying its own scrollbar. */}\n {followed ? `${followed.name} 따라가는 중` : followLabel}\n </Button>\n </Menu>\n ) : null}\n\n {aside ? <div className=\"presence-bar__aside\">{aside}</div> : null}\n </div>\n );\n}\n","import { useId, type ReactNode } from \"react\";\nimport { ImageOff } from \"lucide-react\";\nimport { Icon } from \"../../common/Icon\";\nimport { Badge } from \"../../common/Badge\";\nimport { PriceDisplay, type PriceDisplayAffix } from \"../PriceDisplay\";\nimport \"./ProductCard.css\";\n\nexport type ProductSwatch = {\n id: string;\n name: string;\n /** The image this colour shows. Choosing a swatch changes the picture, not the page. */\n image?: string;\n};\n\nexport type ProductCardProps = {\n name: string;\n href: string;\n price: number;\n was?: number;\n currency?: string;\n locale?: string;\n affix?: PriceDisplayAffix;\n image?: string;\n /** What the picture shows, for a reader who cannot see it. Never the product name again. */\n imageAlt?: string;\n /** \"신상품\", \"베스트\" — one, at the corner of the picture. */\n flag?: ReactNode;\n /** Out of stock changes what the card offers, not just what it says. */\n soldOut?: boolean;\n swatches?: ProductSwatch[];\n swatch?: string;\n onSwatchChange?: (id: string) => void;\n /** The name of the swatch group. Required when there are swatches. */\n swatchLabel?: string;\n /** A rating, a review count, a delivery promise. */\n meta?: ReactNode;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * One product in a grid of them.\n *\n * **The picture has a fixed ratio.** Not a fixed height — a ratio, so the card is the same\n * shape at every column width. Images that arrive at their own sizes make a grid jump as each\n * one loads, and the reader's thumb lands on the wrong product.\n *\n * **The colours are radios, not buttons.** Choosing one changes which picture is shown and\n * nothing else; it is a choice with one answer, and the browser has a control for that which\n * arrows through the options and announces \"3 중 2번째\". A row of buttons announces nothing.\n *\n * **Sold out changes what the card offers.** A badge on its own leaves a card that still looks\n * buyable — the price stays, because the reader is deciding whether to wait for it, and the\n * swatches go, because there is nothing to choose between.\n *\n * **The swatch group is named after the instance.** Two cards for the same product in one\n * document share an `href` and would share a radio group with it, so choosing a colour on one\n * would silently unselect the other. `useId` is per render instance.\n *\n * The card is not a link. One link stretches over it (the pattern `Card` settled), so the\n * accessible name is the product's name rather than the card's entire contents read aloud,\n * and the swatches inside stay reachable.\n */\nexport function ProductCard({\n name,\n href,\n price,\n was,\n currency = \"KRW\",\n locale = \"ko-KR\",\n affix = \"word\",\n image,\n imageAlt,\n flag,\n soldOut,\n swatches,\n swatch,\n onSwatchChange,\n swatchLabel,\n meta,\n className,\n ...rest\n}: ProductCardProps) {\n const shown = swatches?.find((one) => one.id === swatch);\n const picture = shown?.image ?? image;\n /*\n * The radio group's name, from the instance rather than from the product.\n *\n * It was `${href}-swatch`, and two cards for the same product in one document — a \"recently\n * viewed\" strip beside a grid, a comparison page, a carousel that clones its slides — share\n * an `href`, so their swatches joined into one group and choosing a colour on one card\n * unselected the other. `useId` is per instance and cannot collide.\n */\n const group = useId();\n\n return (\n <article\n {...rest}\n className={`product-card ${className ?? \"\"}`.trim()}\n data-sold-out={soldOut ? \"\" : undefined}\n >\n <div className=\"product-card__picture\">\n {picture ? (\n <img\n className=\"product-card__image\"\n src={picture}\n /* Empty when the alt would repeat the name in the link right underneath it —\n * \"파란 셔츠 파란 셔츠\" is what a reader hears otherwise. */\n alt={imageAlt ?? \"\"}\n loading=\"lazy\"\n />\n ) : (\n <span className=\"product-card__blank\" aria-hidden=\"true\">\n <Icon icon={ImageOff} size=\"md\" />\n </span>\n )}\n {flag ? <span className=\"product-card__flag\">{flag}</span> : null}\n {soldOut ? (\n <span className=\"product-card__out\">\n <Badge tone=\"neutral\" variant=\"solid\" size=\"sm\">품절</Badge>\n </span>\n ) : null}\n </div>\n\n <div className=\"product-card__body\">\n <h3 className=\"product-card__name\">\n {/* The one link. Its `::after` covers the card; everything else interactive is\n * lifted above it in the stylesheet. */}\n <a className=\"product-card__link\" href={href}>\n {name}\n </a>\n </h3>\n\n <PriceDisplay\n amount={price}\n was={was}\n currency={currency}\n locale={locale}\n affix={affix}\n saving\n size=\"sm\"\n data-part=\"price\"\n />\n\n {meta ? <p className=\"product-card__meta\">{meta}</p> : null}\n\n {swatches?.length && !soldOut ? (\n <fieldset className=\"product-card__swatches\" data-part=\"swatches\">\n <legend className=\"product-card__swatch-legend\">{swatchLabel ?? `${name} 색상`}</legend>\n {swatches.map((one) => (\n <label className=\"product-card__swatch\" key={one.id}>\n <input\n type=\"radio\"\n className=\"product-card__swatch-input\"\n name={`${group}-swatch`}\n value={one.id}\n checked={swatch === one.id}\n onChange={() => onSwatchChange?.(one.id)}\n />\n <span className=\"product-card__swatch-mark\" aria-hidden=\"true\">\n {one.image ? <img src={one.image} alt=\"\" loading=\"lazy\" /> : null}\n </span>\n <span className=\"product-card__swatch-name\">{one.name}</span>\n </label>\n ))}\n </fieldset>\n ) : null}\n </div>\n </article>\n );\n}\n","import { useRef } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { Trash2 } from \"lucide-react\";\nimport { NumberInput } from \"../../derived/NumberInput\";\nimport { Spinner } from \"../../common/Spinner\";\nimport { handOffFocus } from \"../../../foundation/focus\";\nimport \"./QuantityStepper.css\";\n\nexport type QuantityStepperProps = {\n value: number;\n onValueChange: (value: number) => void;\n /** What is being counted, for the field and both buttons. Usually the product's name. */\n label: string;\n /** How many there are. The ceiling, and the sentence under it. */\n stock?: number;\n /** One below the floor removes the line. Without it the minus is simply disabled at 1. */\n onRemove?: () => void;\n removeLabel?: string;\n /** A change in flight. The figure is the reader's, the spinner says it is not settled yet. */\n pending?: boolean;\n /** The floor. One in a basket, zero in a form that allows none of something. */\n min?: number;\n size?: \"sm\" | \"md\";\n disabled?: boolean;\n /** Overrides the sentence the stock would have written. */\n note?: ReactNode;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * How many of this one.\n *\n * `NumberInput` with three facts about a basket on top of it.\n *\n * **One below one is not zero.** It is removing the line, and every shop in the world draws\n * that as the minus turning into a bin. A stepper that simply disables the minus at 1 makes\n * the reader go and find some other control to take the item out with — and there usually\n * isn't one, because the designer assumed this was it.\n *\n * **The ceiling is stock, and it says so.** A `max` that stops the plus without a word looks\n * broken; \"재고 3개\" is the same limit with a reason attached.\n *\n * **Changing it is a write.** The figure moves at once — the reader chose it and should see\n * it — and a spinner says it has not landed yet. Waiting for the server before showing the\n * new number makes a basket feel broken on a train.\n */\nexport function QuantityStepper({\n value,\n onValueChange,\n label,\n stock,\n onRemove,\n removeLabel,\n pending,\n min = 1,\n size = \"md\",\n disabled,\n note,\n className,\n ...rest\n}: QuantityStepperProps) {\n /*\n * Low stock, and the ceiling being reached, are two different reasons to say the number.\n *\n * `stock` always becomes `max`, so the plus locks at 8 of 8 — and with the sentence tied to\n * `stock <= 5` the reader met a button that had stopped working with nothing on screen\n * saying why. The warning colour stays for \"almost none left\"; reaching the ceiling gets\n * the same words in the ordinary tone, because the reason there is not scarcity.\n */\n const low = note === undefined && stock !== undefined && stock <= 5;\n const capped = note === undefined && stock !== undefined && value >= stock;\n const said = note ?? (low || capped ? `재고 ${stock}개` : undefined);\n\n const root = useRef<HTMLDivElement>(null);\n\n /*\n * 바닥에서 누른 휴지통은 이 줄 안에 있으므로, 줄이 빠지면 눌린 버튼도 함께 사라지고\n * 초점이 `<body>`로 떨어집니다. 목록에서 한 줄을 뺐으니 읽던 자리는 다음 줄로 이어지는\n * 것이 맞고, 마지막 줄이었으면 앞으로 돌아갑니다 — 그 자리를 여기서 찾아 둡니다.\n *\n * 호출부가 `onRemove`를 무시해 줄이 그대로 남으면 아무것도 하지 않습니다. 자세한 것은\n * `foundation/focus`에 적었습니다.\n */\n const remove = onRemove\n ? () => {\n const hand = handOffFocus(root.current);\n onRemove();\n hand();\n }\n : undefined;\n\n return (\n <div\n {...rest}\n ref={root}\n className={`quantity-stepper ${className ?? \"\"}`.trim()}\n data-pending={pending ? \"\" : undefined}\n >\n <div className=\"quantity-stepper__control\">\n <NumberInput\n value={value}\n onValueChange={onValueChange}\n label={label}\n min={min}\n max={stock}\n unit=\"개\"\n size={size}\n disabled={disabled}\n atFloor={\n remove\n ? {\n icon: Trash2,\n label: removeLabel ?? `${label} 빼기`,\n onPress: remove,\n tone: \"danger\",\n }\n : undefined\n }\n data-part=\"field\"\n />\n {pending ? (\n <span className=\"quantity-stepper__pending\" data-part=\"pending\">\n <Spinner size=\"sm\" label={`${label} 수량 저장 중`} />\n </span>\n ) : null}\n </div>\n\n {said ? (\n <p className=\"quantity-stepper__note\" data-low={low ? \"\" : undefined} data-part=\"note\">\n {said}\n </p>\n ) : null}\n </div>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { Brain } from \"lucide-react\";\nimport { Disclosure } from \"../../composed/Disclosure\";\nimport \"./ReasoningDisclosure.css\";\n\nexport type ReasoningState = \"thinking\" | \"done\";\n\nexport type ReasoningDisclosureProps = {\n children: ReactNode;\n state?: ReasoningState;\n /** \"12초\". A string — the component does not own a clock. */\n duration?: string;\n /** Overrides the sentence the state and the duration would have written. */\n summary?: ReactNode;\n /** Open to begin with. Almost never what you want; see the note below. */\n defaultOpen?: boolean;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * 생각 보기 — the working-out, folded away.\n *\n * Closed by default, and it stays closed. The temptation is to open it while the model is\n * thinking so the reader has something to watch and then close it when the answer starts —\n * which means the page reflows twice under someone who is reading, and the one reader who\n * deliberately opened it has it shut in their face. `<details>` keeps its own state, so a\n * panel the reader opened while it was thinking is still open when it finishes, with no\n * effect anywhere deciding that for them.\n *\n * What changes is the sentence on the summary: \"생각하는 중\" while it runs, and how long it\n * took once it is over. The duration is the honest part — it is a fact after the event,\n * where an estimate before it would have been a guess.\n *\n * The content is not the answer and is not set like it: one step down in size, in the muted\n * ink. A reasoning panel that looks like body copy is read as body copy.\n */\nexport function ReasoningDisclosure({\n children,\n state = \"done\",\n duration,\n summary,\n defaultOpen,\n className,\n ...rest\n}: ReasoningDisclosureProps) {\n const said =\n summary ??\n (state === \"thinking\"\n ? `생각하는 중${duration ? ` · ${duration}` : \"…\"}`\n : duration\n ? `${duration} 동안 생각했습니다`\n : \"생각 보기\");\n\n return (\n <Disclosure\n {...rest}\n className={`reasoning-disclosure ${className ?? \"\"}`.trim()}\n data-state={state}\n icon={Brain}\n plain\n defaultOpen={defaultOpen}\n summary={<span className=\"reasoning-disclosure__summary\">{said}</span>}\n >\n <div className=\"reasoning-disclosure__body\" data-part=\"body\">\n {children}\n </div>\n </Disclosure>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { Keyboard, RotateCcw, Trash2 } from \"lucide-react\";\nimport { Button } from \"../../common/Button\";\nimport { Icon } from \"../../common/Icon\";\nimport \"./RecognitionFallback.css\";\n\n/**\n * Which of the two things happened, or neither.\n *\n * `null` is not a third state — it is the absence of one, and the component draws nothing.\n */\nexport type RecognitionReason = \"carried\" | \"lost\";\n\nexport type RecognitionFallbackProps = {\n reason: RecognitionReason | null;\n /**\n * The half-sentence that was recovered. Only meaningful with `carried`.\n *\n * It may be wrong — that is the nature of a partial result — so handing it on is one action\n * and throwing it away is another, and neither is hidden behind the other.\n */\n carried?: string;\n /** Why it stopped, in the reader's words. \"소리가 잡히지 않았습니다\", not an error code. */\n detail?: ReactNode;\n /**\n * Try the microphone again.\n *\n * **Only pass this where a retry can work.** A permission that was refused, a device that is\n * not there and a browser that does not do speech are all failures a second attempt repeats\n * exactly; offering one is asking the reader to fail again on purpose.\n */\n onRetry?: () => void;\n /** Hand what there is over to typing. Always here — it is the way out that always works. */\n onType: (text: string) => void;\n /** Throw the recovered text away. Only meaningful with `carried`. */\n onDiscard?: () => void;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\nconst TITLE: Record<RecognitionReason, string> = {\n carried: \"여기까지 들었습니다\",\n lost: \"듣지 못했습니다\",\n};\n\n/**\n * The handover from speaking to typing, without losing the sentence already spoken.\n *\n * **Two states, not one.** `carried` means half a sentence was recovered; `lost` means the\n * failure arrived with nothing attached. Telling somebody to start over is a different message\n * from handing them half of what they said, and folding the two together makes the good case\n * look like the bad one. The reader who sees their own words on screen knows the microphone\n * worked and something else did not.\n *\n * **`reason === null` shows nothing.** It is dormant, not decorative — a box that sits there\n * saying \"no problems\" is a box that trains the reader to stop looking at that corner. What\n * stays behind is an empty live region with no box of its own, because a region announced only\n * once it is inserted is a region some screen readers never read.\n *\n * **The recovered text can be wrong, and getting rid of it is one action.** A partial result is\n * a guess. Making the reader select and delete somebody else's guess before they can type is\n * making them pay for the failure twice.\n *\n * **Typing is always offered; retrying is not.** A refused permission, a missing device and a\n * browser with no speech engine all fail the same way the second time, and a retry button in\n * front of them is an invitation to fail again on purpose.\n */\nexport function RecognitionFallback({\n reason,\n carried,\n detail,\n onRetry,\n onType,\n onDiscard,\n className,\n ...rest\n}: RecognitionFallbackProps) {\n /*\n * What there actually is to hand over.\n *\n * `reason=\"carried\"` with an empty `carried` is a caller saying \"half a sentence\" and\n * bringing none of it. The actions follow what is on the screen rather than what the prop\n * claims: an \"이어서 입력하기\" that carries an empty string on is a button that promises to\n * keep the reader's words and then throws them away, and a \"버리기\" for nothing at all is a\n * control with no subject.\n */\n const text = reason === \"carried\" ? (carried ?? \"\") : \"\";\n\n return (\n /*\n * The live region is here before there is anything to say.\n *\n * A `role=\"status\"` that arrives together with its own text is a region some screen\n * readers never announce — they watch regions that existed when the page settled. So the\n * region is mounted at all times and the note is inserted into it, which is also why\n * `reason === null` empties this element rather than removing it.\n *\n * `status`, not `alert`. Nothing here is urgent and the reader is already looking at the\n * place they were speaking into — an assertive announcement would cut across whatever they\n * were being read at the time, to say something they can see.\n */\n <div\n {...rest}\n className={`recognition-fallback ${className ?? \"\"}`.trim()}\n data-reason={reason ?? undefined}\n role=\"status\"\n >\n {reason === null ? null : (\n <div className=\"recognition-fallback__box\" data-part=\"box\">\n <p className=\"recognition-fallback__title\" data-part=\"title\">\n {TITLE[reason]}\n </p>\n\n {/*\n * The recovered words, shown rather than only handed over. A reader who cannot see\n * what was heard cannot tell whether continuing is worth more than starting again.\n */}\n {text ? (\n <p className=\"recognition-fallback__carried\" data-part=\"carried\">\n {text}\n </p>\n ) : null}\n\n {detail ? (\n <p className=\"recognition-fallback__detail\" data-part=\"detail\">\n {detail}\n </p>\n ) : null}\n\n <div className=\"recognition-fallback__actions\">\n {/* The one that always works, and the one that keeps the sentence. */}\n <Button variant=\"solid\" size=\"sm\" onClick={() => onType(text)} data-part=\"type\">\n <Icon icon={Keyboard} size=\"sm\" aria-hidden=\"true\" />\n {text ? \"이어서 입력하기\" : \"입력으로 하기\"}\n </Button>\n\n {onRetry ? (\n <Button variant=\"outline\" size=\"sm\" tone=\"neutral\" onClick={onRetry} data-part=\"retry\">\n <Icon icon={RotateCcw} size=\"sm\" aria-hidden=\"true\" />\n 다시 말하기\n </Button>\n ) : null}\n\n {text && onDiscard ? (\n <Button variant=\"plain\" size=\"sm\" tone=\"neutral\" onClick={onDiscard} data-part=\"discard\">\n <Icon icon={Trash2} size=\"sm\" aria-hidden=\"true\" />\n 버리기\n </Button>\n ) : null}\n </div>\n </div>\n )}\n </div>\n );\n}\n","import { useEffect, useId, useRef, useState, type ReactNode } from \"react\";\nimport { Check, CircleSlash, XCircle } from \"lucide-react\";\nimport { Button } from \"../../common/Button\";\nimport { Progress } from \"../../common/Progress\";\nimport { Spinner } from \"../../common/Spinner\";\nimport { VisuallyHidden } from \"../../common/VisuallyHidden\";\nimport { MorphIcon } from \"../../derived/MorphIcon\";\nimport { TextCycle } from \"../../derived/TextCycle\";\nimport \"./RunStatusCard.css\";\n\nexport type RunState = \"queued\" | \"running\" | \"done\" | \"failed\" | \"cancelled\";\n\nexport type RunStatusCardProps = {\n /** What is running, in the reader's words. */\n title: string;\n state: RunState;\n /** How long it has been going. \"1분 24초\". See the note on estimates. */\n elapsed?: string;\n /**\n * Only when there is something real to count.\n *\n * `value` of `max` steps that actually exist. A bar invented to look like progress is a\n * lie that gets found out at 90%.\n *\n * **`done` fills the bar, whatever `value` says.** \"완료\" beside a bar stopped at seven of\n * twelve is the card contradicting itself in the same line, and the reader has to decide\n * which half to believe. The other two ends do not fill: a run that failed or was\n * cancelled really did stop where it stopped, and that is the fact worth keeping.\n */\n progress?: { value: number; max: number; label: string };\n /** The step it is on now, or why it stopped. */\n detail?: ReactNode;\n onCancel?: () => void;\n cancelLabel?: string;\n /** What to do about a run that has finished — open it, retry it, undo it. */\n actions?: ReactNode;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\nconst SAID: Record<RunState, string> = {\n queued: \"대기 중\",\n running: \"실행 중\",\n done: \"완료\",\n failed: \"실패\",\n cancelled: \"취소됨\",\n};\n\n/**\n * A long job, while it runs and after it stops.\n *\n * **There is no estimate here, and that is the design.** \"약 2분 남음\" is a guess printed in\n * the same type as a fact, and it is wrong often enough that a reader learns to distrust\n * everything next to it. Elapsed time is a fact. A step count is a fact when the steps\n * exist. Neither of them promises anything.\n *\n * **Cancel is available the whole time it is running**, in one place, and it does not move\n * when the detail line under it changes length. A stop control that is only reachable after\n * the reader has found the right menu is a stop control for a job that has already finished.\n *\n * **It does not disappear when it ends.** A card that vanishes on completion leaves a reader\n * who looked away with no way to find out whether the thing they started actually happened —\n * so it stays, says which of the four ends it reached, and carries whatever comes next.\n */\nexport function RunStatusCard({\n title,\n state,\n elapsed,\n progress,\n detail,\n onCancel,\n cancelLabel = \"중지\",\n actions,\n className,\n ...rest\n}: RunStatusCardProps) {\n const live = state === \"running\" || state === \"queued\";\n const nameId = useId();\n /* `done` finished every step it counted; see the note on `progress`. */\n const counted = progress ? (state === \"done\" ? progress.max : progress.value) : undefined;\n\n /*\n * The end of the run, said once.\n *\n * Nothing else here says it out loud: the mark is `aria-hidden` because a spinner that\n * announces itself repeats what the meta line already prints, and `TextCycle` is silent on\n * purpose so a step line changing every few seconds does not trap a reader in it. That\n * leaves the one moment that matters — running to finished — reaching nobody who looked\n * away. The regions are mounted from the first render and empty; a region created in the\n * same render as its words is a region several screen readers never announce.\n *\n * Failure gets `role=\"alert\"` and the rest `role=\"status\"`. Announcing a failure politely\n * puts it behind whatever the reader is doing, and a reader who has been told politely\n * that something failed has been told nothing.\n */\n const [said, setSaid] = useState<{ status: string; alert: string }>({ status: \"\", alert: \"\" });\n const was = useRef(state);\n useEffect(() => {\n const before = was.current;\n was.current = state;\n const settled = state !== \"running\" && state !== \"queued\";\n if (!settled || before === state) return;\n const line = `${title} ${SAID[state]}`;\n setSaid(state === \"failed\" ? { status: \"\", alert: line } : { status: line, alert: \"\" });\n }, [state, title]);\n\n /*\n * Cancel takes focus out of the document with it.\n *\n * The stop button unmounts in the same render the run leaves `running`, so a reader who\n * pressed it with a keyboard lands on `<body>` — the top of the page, several tabs from\n * the card they were working in. Focus goes to the outcome, which is the answer to what\n * they just did; `tabIndex={-1}` makes it a place focus can be put without adding a stop\n * to the tab order. Only when the focus actually fell: a run that ends while the reader is\n * elsewhere must not pull them back.\n */\n const outcome = useRef<HTMLDivElement>(null);\n const wasLive = useRef(live);\n useEffect(() => {\n const left = wasLive.current && !live;\n wasLive.current = live;\n if (!left || document.activeElement !== document.body) return;\n outcome.current?.focus();\n }, [live]);\n\n return (\n <section\n {...rest}\n className={`run-status-card ${className ?? \"\"}`.trim()}\n data-state={state}\n /*\n * Named by the heading it already draws rather than by a copy of it. `aria-label` here\n * made the region's name and the visible line the same string, and a reader entering\n * the card heard the title, then heard the title.\n */\n aria-labelledby={nameId}\n >\n {/* First, and always: a region has to have been watched before it has anything to say. */}\n <VisuallyHidden as=\"p\">\n <span role=\"status\" data-part=\"live\">\n {said.status}\n </span>\n <span role=\"alert\" data-part=\"alert\">\n {said.alert}\n </span>\n </VisuallyHidden>\n\n <div className=\"run-status-card__head\">\n <span className=\"run-status-card__mark\" aria-hidden=\"true\">\n {live ? <Spinner size=\"sm\" /> : null}\n {/*\n * The slot holds its square whether or not there is a glyph in it, so the end of a\n * run is a mark arriving in place rather than a title stepping sideways. `success`\n * settles and `failed` lands without a bounce — a failure that bounced in would\n * read as a completion that happened to be red.\n */}\n <MorphIcon\n icon={live ? undefined : state === \"done\" ? Check : state === \"failed\" ? XCircle : CircleSlash}\n tone={state === \"done\" ? \"success\" : state === \"failed\" ? \"danger\" : \"neutral\"}\n size=\"sm\"\n data-part=\"glyph\"\n />\n </span>\n <div className=\"run-status-card__title\" ref={outcome} tabIndex={-1} data-part=\"outcome\">\n <p className=\"run-status-card__name\" id={nameId}>\n {title}\n </p>\n <p className=\"run-status-card__meta\">\n <span data-part=\"state\">{SAID[state]}</span>\n {elapsed ? (\n <>\n <span aria-hidden=\"true\"> · </span>\n {/* Elapsed, not remaining. The one is measured; the other is guessed. */}\n <span data-part=\"elapsed\">{elapsed} 경과</span>\n </>\n ) : null}\n {progress ? (\n <>\n <span aria-hidden=\"true\"> · </span>\n <span data-part=\"count\">\n {progress.max}개 중 {counted}개\n </span>\n </>\n ) : null}\n </p>\n </div>\n {live && onCancel ? (\n <Button\n variant=\"outline\"\n tone=\"neutral\"\n size=\"sm\"\n onClick={onCancel}\n data-part=\"cancel\"\n >\n {cancelLabel}\n </Button>\n ) : null}\n </div>\n\n {progress ? (\n <Progress\n value={counted}\n max={progress.max}\n label={progress.label}\n size=\"sm\"\n tone={state === \"failed\" ? \"danger\" : \"accent\"}\n data-part=\"progress\"\n />\n ) : null}\n\n {detail ? (\n <p className=\"run-status-card__detail\" data-part=\"detail\">\n {/*\n * A step line that changes while the run is going is a step being reached, and\n * that is worth drawing. One that changes after it has stopped is a different\n * message rather than the next step, so it simply appears.\n *\n * `TextCycle` takes a string; a `detail` carrying markup is rendered as it is.\n * There is no timer anywhere in this — the line moves when the host says the step\n * changed, which is the only thing that makes the movement mean anything.\n */}\n {live && typeof detail === \"string\" ? <TextCycle value={detail} /> : detail}\n </p>\n ) : null}\n\n {actions && !live ? <div className=\"run-status-card__actions\">{actions}</div> : null}\n </section>\n );\n}\n","import { useEffect, useRef } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport { Plus } from \"lucide-react\";\nimport { Icon } from \"../../common/Icon\";\nimport \"./SavedViewTabs.css\";\n\nexport type SavedView = {\n id: string;\n label: string;\n /** Changed since it was saved. The dot, and whatever the adopter puts in the menu. */\n dirty?: boolean;\n /** How many rows the query returns. Omitted while it is unknown. */\n count?: number;\n};\n\nexport type SavedViewTabsProps = {\n views: SavedView[];\n value: string;\n onValueChange: (id: string) => void;\n /** What the set of views is. \"저장한 보기\". */\n label: string;\n /**\n * The id of the region the views change.\n *\n * Required, because a tab that controls nothing is not a tab. The adopter marks their\n * results region `role=\"tabpanel\"` with this id and it becomes one panel whose content\n * changes — which is exactly what a saved view is.\n */\n panelId: string;\n /** Rename, duplicate, delete. Rendered beside the active view; see the note. */\n menu?: (view: SavedView) => ReactNode;\n onAdd?: () => void;\n addLabel?: string;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * Saved queries, along the top.\n *\n * **A tab cannot contain a button.** Interactive content inside interactive content is\n * invalid HTML, and browsers resolve it by dropping one of the two — usually the inner one,\n * which is the one the reader was aiming at. So the per-view menu is the tab's *neighbour*\n * inside the same chip rather than its child: the arrows move between tabs, and Tab from the\n * active view reaches its menu. The chip is drawn as one thing because to a reader it is one\n * thing; in the document it is two controls, which is what it has to be.\n *\n * **Only the active view carries a menu.** Renaming a view you are not looking at is a\n * command from somewhere else; six menu buttons in a row is six tab stops between the reader\n * and the view they wanted.\n *\n * **They scroll rather than wrap.** A row of views that reflows to two lines moves everything\n * under it every time one is added, and the count of saved views only ever goes up.\n */\nexport function SavedViewTabs({\n views,\n value,\n onValueChange,\n label,\n panelId,\n menu,\n onAdd,\n addLabel = \"보기 추가\",\n className,\n ...rest\n}: SavedViewTabsProps) {\n const list = useRef<HTMLDivElement>(null);\n\n const tabFor = (id: string) =>\n list.current?.querySelector<HTMLButtonElement>(`[data-value=\"${CSS.escape(id)}\"]`) ?? null;\n\n /* The active view is scrolled to rather than searched for — with twenty saved views the one\n * that is selected is regularly off the end of the rail. */\n useEffect(() => {\n tabFor(value)?.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n }, [value]);\n\n /*\n * The focus goes with the value.\n *\n * Changing the value alone left the focus ring on the tab the reader arrowed away from\n * while the selection sat on another one, so the two marks a reader navigates by disagreed.\n * The tab is focused as well, which is also what makes the roving `tabIndex` hold: the one\n * tab that is in the Tab order is the one the reader is standing on.\n */\n const go = (view: SavedView | undefined) => {\n if (!view) return;\n /* Focus first, then the value — the order `Tabs` uses. Focusing after the state change put\n * the call in front of React's re-render of `tabIndex`, and the focus did not always\n * survive it. */\n tabFor(view.id)?.focus();\n onValueChange(view.id);\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n /*\n * Only keys pressed on a tab.\n *\n * The per-view menu trigger is the tab's neighbour inside the same rail, so this handler\n * saw its arrow keys too: the view changed, the menu unmounted with the view it belonged\n * to, and the focus fell to `<body>`. `data-value` is on the tabs and nothing else.\n */\n const from = (event.target as HTMLElement).dataset.value;\n if (from === undefined) return;\n\n const at = views.findIndex((view) => view.id === from);\n const step: Record<string, number | undefined> = { ArrowRight: 1, ArrowLeft: -1 };\n const delta = step[event.key];\n if (delta !== undefined) {\n event.preventDefault();\n go(views[(at + delta + views.length) % views.length]);\n return;\n }\n if (event.key === \"Home\") {\n event.preventDefault();\n go(views[0]);\n }\n if (event.key === \"End\") {\n event.preventDefault();\n go(views.at(-1));\n }\n };\n\n /*\n * A rail with no chosen view still has one tab stop.\n *\n * If `value` matches nothing — a view was deleted and the adopter has not picked the next\n * one yet — every tab would be `tabIndex={-1}` and the whole row would drop out of the Tab\n * order, unreachable by keyboard. The first tab is the stop until a real one exists.\n */\n const chosen = views.some((view) => view.id === value);\n\n return (\n <div className={`saved-view-tabs ${className ?? \"\"}`.trim()} {...rest}>\n <div\n ref={list}\n className=\"saved-view-tabs__rail\"\n role=\"tablist\"\n aria-label={label}\n onKeyDown={onKeyDown}\n data-part=\"rail\"\n >\n {views.map((view, index) => {\n const active = view.id === value;\n return (\n <div className=\"saved-view-tabs__slot\" role=\"presentation\" key={view.id} data-active={active ? \"\" : undefined}>\n <button\n type=\"button\"\n role=\"tab\"\n className=\"saved-view-tabs__tab\"\n id={`${panelId}-tab-${view.id}`}\n data-value={view.id}\n aria-selected={active}\n aria-controls={panelId}\n /* One tab stop for the rail. The arrows do the moving. */\n tabIndex={active || (!chosen && index === 0) ? 0 : -1}\n onClick={() => onValueChange(view.id)}\n data-part=\"tab\"\n >\n {view.label}\n {view.count !== undefined ? (\n <span className=\"saved-view-tabs__count\">{view.count}</span>\n ) : null}\n {view.dirty ? (\n <span className=\"saved-view-tabs__dot\" data-part=\"dirty\">\n {/* The dot is a picture of a fact the words have to carry too. */}\n <span className=\"saved-view-tabs__said\">저장하지 않은 변경</span>\n </span>\n ) : null}\n </button>\n {active && menu ? (\n <span className=\"saved-view-tabs__menu\" data-part=\"menu\">\n {menu(view)}\n </span>\n ) : null}\n </div>\n );\n })}\n </div>\n\n {onAdd ? (\n <button type=\"button\" className=\"saved-view-tabs__add\" onClick={onAdd} data-part=\"add\">\n <Icon icon={Plus} size=\"sm\" aria-hidden=\"true\" />\n {addLabel}\n </button>\n ) : null}\n </div>\n );\n}\n","import { useState } from \"react\";\nimport { VisuallyHidden } from \"../../common/VisuallyHidden\";\nimport \"./SourceChip.css\";\n\nexport type SourceChipSize = \"sm\" | \"md\";\n\nexport type SourceChipProps = {\n /** The page's own title. */\n title: string;\n /** Where it came from — `nts.go.kr`, not `https://www.nts.go.kr/nts/na/...`. */\n domain: string;\n href: string;\n /** The number in the text this chip answers to. Omitted, the chip stands alone. */\n index?: number;\n /** A favicon URL. Decorative; the domain is what names the source. */\n favicon?: string;\n /** Title only, for a dense row under a paragraph. */\n compact?: boolean;\n size?: SourceChipSize;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * One source, as a thing you can click.\n *\n * The **domain** identifies a source, not the URL and not the title. Two pages on the same\n * site have different titles and are the same source to a reader deciding whether to trust\n * it; a URL with a session token in it identifies nothing at all. So the domain is always\n * shown, and it is the part that never truncates.\n *\n * The **favicon is decorative** and gets an empty `alt`. It also fails — a blocked request, a\n * site with none, an offline reader — and a favicon that fails is a broken-image glyph in the\n * middle of the answer. So it falls back to the domain's first letter, on a neutral ground.\n *\n * Deliberately not a colour derived from the domain: every colour in this library means\n * something, and a source tinted green would be saying \"success\" about a web page.\n *\n * The **number ties it to the sentence**. A list of sources with no numbers cannot be matched\n * to the claims it supports, which is the only reason the list is there.\n */\nexport function SourceChip({\n title,\n domain,\n href,\n index,\n favicon,\n compact,\n size = \"md\",\n className,\n ...rest\n}: SourceChipProps) {\n /*\n * Which favicon failed, not whether one did.\n *\n * A boolean survives the source changing underneath it: a chip in a virtualised list is\n * reused for the next result, `favicon` becomes a URL that works, and the flag from the\n * previous source keeps the letter in place forever. Comparing the recorded URL with the\n * current one resets itself.\n */\n const [failed, setFailed] = useState<string>();\n const broken = failed !== undefined && failed === favicon;\n const letter = [...domain.replace(/^www\\./, \"\")][0]?.toUpperCase() ?? \"?\";\n\n return (\n <a\n {...rest}\n className={`source-chip ${className ?? \"\"}`.trim()}\n data-size={size}\n data-compact={compact ? \"\" : undefined}\n href={href}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {index !== undefined ? (\n <span className=\"source-chip__index\" aria-hidden=\"true\">\n {index}\n </span>\n ) : null}\n\n <span className=\"source-chip__glyph\" aria-hidden=\"true\">\n {favicon && !broken ? (\n <img\n className=\"source-chip__favicon\"\n src={favicon}\n alt=\"\"\n loading=\"lazy\"\n onError={() => setFailed(favicon)}\n />\n ) : (\n <span className=\"source-chip__letter\">{letter}</span>\n )}\n </span>\n\n <span className=\"source-chip__text\">\n <span className=\"source-chip__title\">{title}</span>\n {compact ? null : <span className=\"source-chip__domain\">{domain}</span>}\n </span>\n\n {/* The chip's own text does not say where the number came from or that following it\n * leaves the page. Both belong in the name a reader hears. */}\n <VisuallyHidden>\n {index !== undefined ? ` 출처 ${index}번 · ` : \" 출처 · \"}\n {domain} · 새 창에서 열림\n </VisuallyHidden>\n </a>\n );\n}\n","import { useCallback, useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { SourceChip, type SourceChipSize } from \"../SourceChip\";\nimport \"./SourceChipRow.css\";\n\nexport type SourceChipRowSource = {\n id: string;\n title: string;\n domain: string;\n href: string;\n /** The number this source carries in the answer. */\n index?: number;\n favicon?: string;\n};\n\n/** The most chips the stylesheet enumerates. Past this the row stops counting and folds. */\nexport const SOURCE_CHIP_ROW_MAX = 12;\n\nexport type SourceChipRowProps = {\n sources: SourceChipRowSource[];\n /** What the row is. \"이 답의 출처\". Names the group. */\n label: string;\n /**\n * Pressed when the reader asks for the ones that did not fit — usually opens the panel.\n *\n * Without it there is no counter to press: the row still measures one, because the fold has\n * to know how wide it is, but it is drawn as text rather than as a control. A `+3` that\n * takes focus and answers nothing is the one way out of the fold not working.\n */\n onOverflow?: () => void;\n compact?: boolean;\n /** Passed to every chip in the row. A dense row under a paragraph is usually `sm`. */\n size?: SourceChipSize;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * Every source for an answer, on one line, with the rest folded into `+N`.\n *\n * `SourceChip` has existed since the agent layer and there has never been a row to put chips\n * in — so every adopter wrapped them in their own flex box, and every one of those wrapped to\n * a second line the moment there were four sources. A second line of sources under a two-line\n * answer is a page where the citation apparatus is larger than the claim.\n *\n * **How many fit is a measurement, and a measurement may not become a style.**\n *\n * The usual answer writes `style=\"display:none\"` on the overflow, which is a value in the one\n * place no stylesheet can reach and the rule this library doubles every root selector to\n * avoid. So the row measures and writes down *how many* — `data-visible=\"3\"` — and the\n * stylesheet, which enumerates the counts, hides the rest. The number crossing that boundary\n * is a count, not a length.\n *\n * The folded chips are taken out of the flow rather than out of the document, because they\n * still have to be measurable: a chip removed with `display: none` has no width, and a row\n * that cannot see the widths cannot work out how many fit the next time the window moves.\n * `visibility: hidden` also takes them out of the tab order, which is the other half — a\n * reader must not tab into a chip nobody can see.\n */\nexport function SourceChipRow({\n sources,\n label,\n onOverflow,\n compact,\n size = \"md\",\n className,\n ...rest\n}: SourceChipRowProps) {\n const row = useRef<HTMLDivElement>(null);\n const [visible, setVisible] = useState(sources.length);\n\n const measure = useCallback(() => {\n const node = row.current;\n if (!node) return;\n const chips = [...node.querySelectorAll<HTMLElement>('[data-part=\"chip\"]')];\n if (!chips.length) return;\n\n const available = node.clientWidth;\n /* Room for the `+N` kept back from the start. Working out that the last chip fits and\n * then discovering the counter does not is how these rows end up one chip too long. */\n const counter = node.querySelector<HTMLElement>('[data-part=\"more\"]');\n const gap = Number.parseFloat(getComputedStyle(node).columnGap) || 0;\n\n let used = 0;\n let fits = 0;\n for (const chip of chips) {\n const next = used + (fits ? gap : 0) + chip.offsetWidth;\n if (next > available) break;\n used = next;\n fits += 1;\n }\n if (fits < chips.length && counter) {\n /* Give back chips until the counter has room too. */\n while (fits > 0 && used + gap + counter.offsetWidth > available) {\n used -= chips[fits - 1].offsetWidth + (fits > 1 ? gap : 0);\n fits -= 1;\n }\n }\n\n const capped = Math.min(fits, SOURCE_CHIP_ROW_MAX);\n /* Only when it changed: a `setState` on every observation is a resize observer that\n * re-renders the thing it is observing, forever. */\n setVisible((was) => (was === capped ? was : capped));\n }, []);\n\n /*\n * What the chips are, not which array they arrived in.\n *\n * `sources` as a dependency is reference identity: an adopter writing the array inline\n * re-measures on every render, and one mutating it in place never measures again. Neither\n * of those is what \"the sources changed\" means, and both are the ordinary way to pass a\n * list. The signature carries every field that decides a chip's width.\n */\n const signature = sources\n .map((source) => [source.id, source.title, source.domain, source.index ?? \"\", source.favicon ?? \"\"].join(\"\\u001f\"))\n .join(\"\\u001e\");\n\n /* Before paint, so the row is never seen with every chip on it before folding. */\n useLayoutEffect(measure, [measure, signature, compact, size]);\n\n useEffect(() => {\n const node = row.current;\n if (!node) return;\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n return () => observer.disconnect();\n }, [measure]);\n\n const hidden = Math.max(0, sources.length - visible);\n\n return (\n <div\n {...rest}\n ref={row}\n className={`source-chip-row ${className ?? \"\"}`.trim()}\n role=\"group\"\n aria-label={label}\n data-visible={Math.min(visible, SOURCE_CHIP_ROW_MAX)}\n >\n {sources.map((source) => (\n <span className=\"source-chip-row__chip\" key={source.id} data-part=\"chip\">\n <SourceChip\n title={source.title}\n domain={source.domain}\n href={source.href}\n index={source.index}\n favicon={source.favicon}\n compact={compact}\n size={size}\n />\n </span>\n ))}\n\n {/*\n * Always rendered, never conditionally: the counter has to be measurable while the row\n * decides whether there is room for it, and a counter that only exists once the answer\n * is known cannot take part in working the answer out.\n *\n * A `<button>` only when there is something for pressing it to do. Given no\n * `onOverflow` the count is still the truth about what is missing and is still drawn\n * and read — as a `<span>`, so no reader tabs to a control that answers nothing.\n */}\n {onOverflow ? (\n <button\n type=\"button\"\n className=\"source-chip-row__more\"\n data-part=\"more\"\n data-hidden={hidden === 0 ? \"\" : undefined}\n aria-hidden={hidden === 0 ? \"true\" : undefined}\n tabIndex={hidden === 0 ? -1 : undefined}\n onClick={onOverflow}\n >\n +{hidden}\n <span className=\"source-chip-row__more-name\">개 더</span>\n </button>\n ) : (\n <span\n className=\"source-chip-row__more\"\n data-part=\"more\"\n data-static=\"\"\n data-hidden={hidden === 0 ? \"\" : undefined}\n aria-hidden={hidden === 0 ? \"true\" : undefined}\n >\n +{hidden}\n <span className=\"source-chip-row__more-name\">개 더</span>\n </span>\n )}\n </div>\n );\n}\n","import { useId, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport \"./SourcePanel.css\";\n\nexport type Source = {\n id: string;\n /** The number this source carries in the answer. Not its position in this list. */\n index: number;\n title: string;\n domain: string;\n href: string;\n favicon?: string;\n /** The sentence the claim came from. One or two lines. */\n snippet?: ReactNode;\n};\n\nexport type SourcePanelProps = {\n sources: Source[];\n /** What the list is. \"근거\", \"참고한 문서\". */\n label: string;\n /**\n * How many were read to produce the ones listed.\n *\n * Worth saying when it is more: an answer built from five of twelve pages is a different\n * claim from one built from the only five that existed.\n */\n found?: number;\n /** Several results from one site are one site. */\n group?: boolean;\n empty?: ReactNode;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/*\n * `www.` is not a site.\n *\n * One normalisation, used by the grouping, by the heading, and by the letter drawn when there\n * is no favicon. Two of them disagreeing is how `www.example.com` and `example.com` became two\n * groups that both drew the letter E — the panel claiming two sites and then showing one.\n */\nfunction site(domain: string) {\n return domain.replace(/^www\\./, \"\");\n}\n\nfunction byDomain(sources: Source[]) {\n const order: string[] = [];\n const groups = new Map<string, Source[]>();\n for (const source of sources) {\n const domain = site(source.domain);\n if (!groups.has(domain)) {\n groups.set(domain, []);\n order.push(domain);\n }\n groups.get(domain)!.push(source);\n }\n return order.map((domain) => ({ domain, items: groups.get(domain)! }));\n}\n\n/**\n * What the answer was built from.\n *\n * **Grouped by site**, because five results from one blog are one blog. A flat list of twelve\n * links reads as twelve independent confirmations of the same claim, which is exactly the\n * impression a reader should not be given.\n *\n * **Numbered from the answer, not from the list.** The number is the citation the paragraph\n * carries, so it is rendered rather than left to an `<ol>` marker — the moment the list is\n * grouped or filtered, a marker and a citation stop agreeing and every reference in the text\n * points at the wrong page.\n *\n * **It says what it did not use.** \"12개 중 5개\" is the difference between a search that found\n * agreement and one that found one page.\n */\nexport function SourcePanel({\n sources,\n label,\n found,\n group = true,\n empty = \"인용한 근거가 없습니다.\",\n className,\n ...rest\n}: SourcePanelProps) {\n const [broken, setBroken] = useState<Record<string, boolean>>({});\n const groups = byDomain(sources);\n const titleId = useId();\n\n return (\n /*\n * Named by its own heading, not by a label repeating it. `aria-label` next to an `<h3>`\n * carrying the same string is one region announced twice — once as the region's name and\n * once as the heading a reader lands on.\n */\n <section\n {...rest}\n className={`source-panel ${className ?? \"\"}`.trim()}\n aria-labelledby={titleId}\n >\n <header className=\"source-panel__head\">\n <h3 className=\"source-panel__title\" id={titleId}>{label}</h3>\n <p className=\"source-panel__count\">\n {found !== undefined && found > sources.length\n ? `${found}개 중 ${sources.length}개 사용`\n : `${sources.length}개`}\n {group && groups.length !== sources.length ? ` · ${groups.length}개 사이트` : \"\"}\n </p>\n </header>\n\n {sources.length === 0 ? (\n <p className=\"source-panel__empty\">{empty}</p>\n ) : !group ? (\n /*\n * Flat: the domain travels with each entry instead of standing over a group of one.\n * Repeating a heading above every single item is the grouped layout pretending, and\n * it reads as four sites where there are two.\n */\n <ul className=\"source-panel__items source-panel__items--flat\">\n {sources.map((source) => (\n <li key={source.id} className=\"source-panel__item\" data-part=\"source\">\n <span className=\"source-panel__index\" aria-hidden=\"true\">\n {source.index}\n </span>\n <span className=\"source-panel__body\">\n <a className=\"source-panel__link\" href={source.href} target=\"_blank\" rel=\"noreferrer\">\n {source.title}\n <span className=\"source-panel__note\"> · 출처 {source.index}번, {source.domain}, 새 창에서 열림</span>\n </a>\n <span className=\"source-panel__where\">{source.domain}</span>\n {source.snippet ? <span className=\"source-panel__snippet\">{source.snippet}</span> : null}\n </span>\n </li>\n ))}\n </ul>\n ) : (\n <ul className=\"source-panel__groups\">\n {groups.map(({ domain, items }) => (\n <li key={domain} className=\"source-panel__group\">\n <p className=\"source-panel__domain\">\n <span className=\"source-panel__glyph\" aria-hidden=\"true\">\n {/*\n * Any item in the group, not the first one. A favicon belongs to the site,\n * so the group had one whenever any of its sources did — and reading only\n * `items[0]` drew the letter for a site whose icon was sitting in the\n * second row.\n */}\n {items.find((item) => item.favicon)?.favicon && !broken[domain] ? (\n <img\n src={items.find((item) => item.favicon)!.favicon}\n alt=\"\"\n loading=\"lazy\"\n onError={() => setBroken((was) => ({ ...was, [domain]: true }))}\n />\n ) : (\n <span className=\"source-panel__letter\">\n {[...domain][0]?.toUpperCase() ?? \"?\"}\n </span>\n )}\n </span>\n {domain}\n {items.length > 1 ? (\n <span className=\"source-panel__more\">{items.length}건</span>\n ) : null}\n </p>\n\n {/*\n * A `<ul>` with the number written out, not an `<ol>`. The number belongs to the\n * sentence in the answer; a marker belongs to this list, and the two stop\n * agreeing the moment anything is grouped or filtered.\n */}\n <ul className=\"source-panel__items\">\n {items.map((source) => (\n <li key={source.id} className=\"source-panel__item\" data-part=\"source\">\n <span className=\"source-panel__index\" aria-hidden=\"true\">\n {source.index}\n </span>\n <span className=\"source-panel__body\">\n <a\n className=\"source-panel__link\"\n href={source.href}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {source.title}\n {/*\n * The domain is in the name here too. It is a separate `<p>` over the\n * group, so it is not part of any link — and a reader moving link by\n * link through a grouped panel never heard which site they were on.\n */}\n <span className=\"source-panel__note\"> · 출처 {source.index}번, {domain}, 새 창에서 열림</span>\n </a>\n {source.snippet ? (\n <span className=\"source-panel__snippet\">{source.snippet}</span>\n ) : null}\n </span>\n </li>\n ))}\n </ul>\n </li>\n ))}\n </ul>\n )}\n </section>\n );\n}\n","import type { ReactNode } from \"react\";\nimport \"./StreamingText.css\";\n\nexport type StreamingTextProps = {\n /** Everything that has arrived so far. Not the whole answer — what is on screen. */\n text: string;\n /** The stream has ended. Turns off the caret and lifts `aria-busy`. */\n done?: boolean;\n /** Shown instead of the caret while nothing has arrived yet. */\n placeholder?: ReactNode;\n caret?: boolean;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * Text that is still arriving.\n *\n * It takes what has arrived rather than the whole answer and a speed, because that is what a\n * stream is: a component that animates a finished string is a typewriter effect, and the two\n * fail in opposite directions — the typewriter is still typing after the answer is complete.\n *\n * `aria-busy` is the whole accessibility of this component. A thread is a live region, and a\n * live region whose text node changes forty times a second reads the answer aloud one\n * syllable at a time, restarting on every token. Marked busy, the subtree is left alone until\n * it settles, and then the finished sentence is announced once. Rendering the chunks into a\n * live region without it is the single most common way this component is got wrong.\n *\n * The caret is an infinite animation, so under `prefers-reduced-motion` it is switched off\n * rather than shortened — a blink collapsed to 0.01ms is a strobe, not a stillness.\n */\nexport function StreamingText({\n text,\n done,\n placeholder,\n caret = true,\n className,\n ...rest\n}: StreamingTextProps) {\n return (\n <p\n {...rest}\n className={`streaming-text ${className ?? \"\"}`.trim()}\n data-state={done ? \"done\" : \"streaming\"}\n aria-busy={!done || undefined}\n >\n {text}\n {!text && !done && placeholder ? (\n <span className=\"streaming-text__placeholder\">{placeholder}</span>\n ) : null}\n {!done && caret ? (\n /*\n * Inside the paragraph and after the last character, so it sits at the end of the\n * last line rather than wrapping alone onto a new one. Hidden from assistive\n * technology: there is nothing to say about a rectangle.\n */\n <span className=\"streaming-text__caret\" aria-hidden=\"true\" data-part=\"caret\" />\n ) : null}\n </p>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { AlertCircle, Check, Terminal } from \"lucide-react\";\nimport { Icon } from \"../../common/Icon\";\nimport { Spinner } from \"../../common/Spinner\";\nimport { Disclosure } from \"../../composed/Disclosure\";\nimport \"./ToolCallCard.css\";\n\nexport type ToolCallState = \"pending\" | \"running\" | \"success\" | \"error\";\n\nexport type ToolCallCardProps = {\n /** The tool's name as the system knows it — `search_web`, not \"웹을 검색합니다\". */\n name: string;\n state: ToolCallState;\n /** What it was called with. Code: shown in the mono face, wrapped, never truncated. */\n args?: string;\n /** What came back. */\n result?: ReactNode;\n /**\n * Why it failed, in the words the failure used.\n *\n * \"실패했습니다\" tells the reader nothing they did not already see from the red mark. The\n * message is the only part of a failed call that is worth anything.\n */\n error?: string;\n /** \"1.2초\". A fact after the event. */\n duration?: string;\n /** One line under the name, for a reader who does not know what the tool is. */\n summary?: ReactNode;\n /** Retry, open the result elsewhere — under the body, never in the summary row. */\n actions?: ReactNode;\n defaultOpen?: boolean;\n /**\n * Controlled, for a list where only one call is open at a time.\n *\n * Handed straight to `Disclosure`, which is what makes the controlled mode reachable at\n * all: without these the card could only ever keep its own state, and a run of eight of\n * them had no way to close the one the reader just left.\n */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\nconst SAID: Record<ToolCallState, string> = {\n pending: \"대기 중\",\n running: \"실행 중\",\n success: \"성공\",\n error: \"실패\",\n};\n\n/**\n * One call to one tool: what it was, what it was given, what came back.\n *\n * Folded by default. A run makes eight of these and the reader wants none of them open until\n * something goes wrong — but they must all be *there*, because the moment the answer is\n * surprising the first question is what it was built from.\n *\n * The arguments are code and are set as code: the mono face, wrapping at any character, and\n * never truncated with an ellipsis. A path cut off at the interesting end is worse than no\n * path, and JSON with no break opportunity pushes the whole thread sideways.\n *\n * A failed call keeps its own error text. The state is also in words in the header, not only\n * in the colour of the mark.\n */\nexport function ToolCallCard({\n name,\n state,\n args,\n result,\n error,\n duration,\n summary,\n actions,\n defaultOpen,\n open,\n onOpenChange,\n className,\n ...rest\n}: ToolCallCardProps) {\n /*\n * Handed in at all, rather than truthy.\n *\n * `result=\"\"` is a fact — the call came back with nothing — and `Boolean(result)` read it\n * as no result, so the card lost its panel. `summary` was missing from the test entirely,\n * which sent a card that had only a summary down the flat branch, where the body is not\n * drawn: the one line under the name disappeared from the screen.\n */\n const given = (part: ReactNode) => part !== undefined && part !== null && part !== false;\n const openable = given(summary) || given(args) || given(result) || given(error) || given(actions);\n\n const head = (\n <span className=\"tool-call-card__head\">\n <span className=\"tool-call-card__mark\" aria-hidden=\"true\">\n {state === \"running\" ? (\n <Spinner size=\"sm\" />\n ) : state === \"success\" ? (\n <Icon icon={Check} size=\"xs\" />\n ) : state === \"error\" ? (\n <Icon icon={AlertCircle} size=\"xs\" />\n ) : (\n <Icon icon={Terminal} size=\"xs\" />\n )}\n </span>\n <span className=\"tool-call-card__name\">{name}</span>\n <span className=\"tool-call-card__state\">{SAID[state]}</span>\n {duration ? <span className=\"tool-call-card__duration\">{duration}</span> : null}\n </span>\n );\n\n const body = (\n <div className=\"tool-call-card__body\">\n {given(summary) ? <p className=\"tool-call-card__summary\">{summary}</p> : null}\n {given(args) ? (\n <div className=\"tool-call-card__part\">\n <p className=\"tool-call-card__caption\">인자</p>\n <pre className=\"tool-call-card__code\" data-part=\"args\">\n {args}\n </pre>\n </div>\n ) : null}\n {given(error) ? (\n <div className=\"tool-call-card__part\">\n <p className=\"tool-call-card__caption\">오류</p>\n <pre className=\"tool-call-card__code\" data-part=\"error\" data-tone=\"danger\">\n {error}\n </pre>\n </div>\n ) : null}\n {given(result) ? (\n <div className=\"tool-call-card__part\">\n <p className=\"tool-call-card__caption\">결과</p>\n <div className=\"tool-call-card__result\" data-part=\"result\">\n {result}\n </div>\n </div>\n ) : null}\n {given(actions) ? <div className=\"tool-call-card__actions\">{actions}</div> : null}\n </div>\n );\n\n /*\n * A call with nothing to show is not a disclosure. A summary that opens onto an empty panel\n * is a control that lies about having something behind it.\n */\n if (!openable) {\n return (\n <div\n {...rest}\n className={`tool-call-card tool-call-card--flat ${className ?? \"\"}`.trim()}\n data-state={state}\n >\n {head}\n </div>\n );\n }\n\n return (\n <Disclosure\n {...rest}\n className={`tool-call-card ${className ?? \"\"}`.trim()}\n data-state={state}\n defaultOpen={defaultOpen ?? state === \"error\"}\n open={open}\n onOpenChange={onOpenChange}\n summary={head}\n >\n {body}\n </Disclosure>\n );\n}\n","import { useEffect, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { ArrowDownToLine } from \"lucide-react\";\nimport { Icon } from \"../../common/Icon\";\nimport { Button } from \"../../common/Button\";\nimport { Skeleton } from \"../../common/Skeleton\";\nimport \"./TranscriptSync.css\";\n\nexport type TranscriptSegment = {\n id: string;\n text: string;\n /**\n * Seconds. **Omitted is the common case, not the error case.**\n *\n * Live transcription arrives in chunks whose timing the model has not settled yet, and a\n * component that treated an untimed segment as broken would refuse to draw most of a live\n * transcript. What a segment without a time loses is only the ability to be jumped to.\n */\n start?: number;\n end?: number;\n /** Who said it. Repeated only when it changes — a name on every line is a name nobody reads. */\n speaker?: string;\n};\n\nexport type TranscriptSyncProps = {\n segments: TranscriptSegment[];\n /**\n * Where the media is, in seconds.\n *\n * The component owns no media element. `currentTime` comes in and a time to seek to goes\n * out; play, pause, rate and buffering all belong to whatever is actually playing. A\n * transcript that held an `<audio>` would be a transcript that could only ever be used with\n * the one player it built.\n */\n currentTime: number;\n /** Given, a timed segment can be jumped to. Without it the transcript is a transcript. */\n onSeek?: (time: number) => void;\n /** What this is a record of. \"통화 기록\". Names the region. */\n label: string;\n loading?: boolean;\n empty?: ReactNode;\n error?: ReactNode;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * What was said, with the part being said now marked.\n *\n * **The current segment is the one that contains the time, not the one nearest it.** A\n * transcript with gaps — silences, music, a passage nobody transcribed — has moments that\n * belong to no segment, and \"nearest\" turns those into a highlight sitting on a line that is\n * not being read. Nothing is current during a silence, which is the truth and also what it\n * looks like.\n *\n * **Following yields to the reader.** The list scrolls itself to the current line until\n * somebody scrolls it themselves, and then it stops and offers to resume. A transcript that\n * kept yanking itself back is a transcript nobody can read two lines above the playhead — and\n * reading two lines above the playhead is most of what a transcript is for.\n *\n * **It does not announce.** The current segment changes every few seconds; a live region on it\n * would read the whole conversation twice, once from the speaker and once from the screen\n * reader, and neither would be followable. The marked line is `aria-current` and the reader\n * moves at their own pace.\n */\nexport function TranscriptSync({\n segments,\n currentTime,\n onSeek,\n label,\n loading,\n empty,\n error,\n className,\n ...rest\n}: TranscriptSyncProps) {\n const list = useRef<HTMLOListElement>(null);\n const [following, setFollowing] = useState(true);\n /*\n * The last line that was current, kept across gaps.\n *\n * Silence is not a state in which the reader stops being a reader. `current` is `-1` there,\n * and a scroll handler that had nothing to measure against let a gap swallow the reader's\n * scroll — following stayed on and the next segment yanked the list back under them. The\n * line they were last shown is still the line the component put them on, so it is what a\n * scroll during a gap is measured against.\n */\n const anchor = useRef(-1);\n\n /*\n * Containing, not nearest. A time inside a gap belongs to nothing, and `-1` is that answer\n * rather than the index of whichever line happens to be closest.\n */\n const current = segments.findIndex(\n (segment) =>\n segment.start !== undefined &&\n segment.end !== undefined &&\n currentTime >= segment.start &&\n currentTime < segment.end,\n );\n\n useEffect(() => {\n if (current < 0) return;\n anchor.current = current;\n if (!following) return;\n const node = list.current?.querySelector<HTMLElement>(`[data-index=\"${current}\"]`);\n node?.scrollIntoView({ block: \"nearest\", behavior: \"auto\" });\n }, [current, following]);\n\n return (\n <section\n {...rest}\n className={`transcript-sync ${className ?? \"\"}`.trim()}\n aria-label={label}\n aria-busy={loading || undefined}\n >\n {error ? (\n <p className=\"transcript-sync__state\" role=\"alert\" data-part=\"error\">\n {error}\n </p>\n ) : loading ? (\n <div className=\"transcript-sync__waiting\" data-part=\"waiting\">\n {/* The transcript's own shape: lines of speech, uneven, with a name above them. */}\n {Array.from({ length: 3 }, (_, index) => (\n <div className=\"transcript-sync__waiting-turn\" key={index}>\n <Skeleton shape=\"text\" lines={1} />\n <Skeleton shape=\"text\" lines={2} />\n </div>\n ))}\n </div>\n ) : segments.length === 0 ? (\n <p className=\"transcript-sync__state\" data-part=\"empty\">\n {empty ?? \"아직 기록이 없습니다\"}\n </p>\n ) : (\n <ol\n className=\"transcript-sync__list\"\n ref={list}\n data-part=\"list\"\n /*\n * Following stops the moment the reader takes over, and nothing puts it back except\n * the button. `onScroll` fires for the component's own `scrollIntoView` too, so the\n * check is whether the line the component put them on is still on screen — a scroll\n * that kept it there was the component's, and one that did not was a person's.\n *\n * During a gap there is no current line, and the line measured against is the last\n * one there was. Returning early instead is how a scroll made during silence used to\n * be lost. With no line ever shown there is nothing the component could have\n * scrolled, so the scroll was the reader's.\n */\n onScroll={(event) => {\n const marked = current >= 0 ? current : anchor.current;\n if (marked < 0) {\n setFollowing(false);\n return;\n }\n const node = event.currentTarget.querySelector<HTMLElement>(`[data-index=\"${marked}\"]`);\n if (!node) return;\n const view = event.currentTarget.getBoundingClientRect();\n const line = node.getBoundingClientRect();\n const inside = line.bottom > view.top && line.top < view.bottom;\n if (!inside) setFollowing(false);\n }}\n >\n {segments.map((segment, index) => {\n const timed = segment.start !== undefined;\n const named = segment.speaker && segment.speaker !== segments[index - 1]?.speaker;\n return (\n <li\n className=\"transcript-sync__turn\"\n key={segment.id}\n data-index={index}\n data-current={index === current ? \"\" : undefined}\n /*\n * The id goes on an attribute of its own. `data-part` is a role name here as\n * everywhere else — a segment called `list` or `follow` used to answer the\n * selector that was meant for the scroller or the button.\n */\n data-part=\"turn\"\n data-segment={segment.id}\n /* The mark is a state, not a heading: `aria-current` and nothing louder. */\n aria-current={index === current ? \"true\" : undefined}\n >\n {named ? <p className=\"transcript-sync__speaker\">{segment.speaker}</p> : null}\n {/*\n * A timed segment is a button and an untimed one is text — and that is the\n * whole difference. A button that cannot go anywhere is worse than a\n * paragraph: it takes a Tab stop and answers nothing.\n */}\n {timed && onSeek ? (\n <button\n type=\"button\"\n className=\"transcript-sync__text\"\n onClick={() => onSeek(segment.start!)}\n data-part=\"seek\"\n >\n {segment.text}\n </button>\n ) : (\n <p className=\"transcript-sync__text\" data-untimed={timed ? undefined : \"\"}>\n {segment.text}\n </p>\n )}\n </li>\n );\n })}\n </ol>\n )}\n\n {/*\n * The way back. It stands as long as following is off, gap or no gap — tying it to\n * `current` took the way back away exactly when playback crossed a silence, and left\n * the reader with following off and nothing offering to put it back.\n *\n * Rendered above the list rather than inside it, so it does not move when the list\n * scrolls.\n */}\n {!following && !error && !loading && segments.length > 0 ? (\n <Button\n variant=\"soft\"\n size=\"sm\"\n className=\"transcript-sync__follow\"\n onClick={() => setFollowing(true)}\n data-part=\"follow\"\n >\n <Icon icon={ArrowDownToLine} size=\"sm\" aria-hidden=\"true\" />\n 지금 말하는 곳으로\n </Button>\n ) : null}\n </section>\n );\n}\n","import type { ReactNode } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport { Icon } from \"../../common/Icon\";\nimport \"./TrustBlock.css\";\n\nexport type TrustPoint = {\n id: string;\n icon: LucideIcon;\n title: string;\n /** One sentence. Two is a paragraph and this is not the place for one. */\n body?: ReactNode;\n};\n\nexport type TrustBlockProps = {\n points: TrustPoint[];\n /** What the block is. Names the list; omitted, it is decoration in the accessibility tree. */\n label: string;\n /** Icon over the words, for a wide strip; icon beside them, for a narrow column. */\n layout?: \"stack\" | \"row\";\n size?: \"sm\" | \"md\";\n align?: \"start\" | \"center\";\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * 무료 반품 · 안전 결제 · 빠른 배송 — the reassurances, in a strip.\n *\n * **It is not a Callout, and looks nothing like one on purpose.** A callout is a notice: it\n * arrived, it is about something that happened, and it may be urgent. This is furniture. It\n * was there before the reader and will be there after, and giving it a tint and a live region\n * would make every page announce its own return policy.\n *\n * So: no ground, no tone, no glyph that means anything on its own. The icons are decorative\n * and every one of them is repeated in words directly underneath, because a padlock means\n * \"secure\" only to someone who has been taught that it does.\n *\n * **Three or four, never eight.** A list of reassurances long enough to scroll is a list that\n * reads as a defence.\n */\nexport function TrustBlock({\n points,\n label,\n layout = \"stack\",\n size = \"md\",\n align = \"start\",\n className,\n ...rest\n}: TrustBlockProps) {\n return (\n <ul\n {...rest}\n className={`trust-block ${className ?? \"\"}`.trim()}\n data-layout={layout}\n data-size={size}\n data-align={align}\n aria-label={label}\n >\n {points.map((point) => (\n <li className=\"trust-block__point\" key={point.id} data-part=\"point\">\n <Icon icon={point.icon} size={size === \"sm\" ? \"sm\" : \"md\"} tone=\"muted\" aria-hidden=\"true\" />\n <div className=\"trust-block__text\">\n <p className=\"trust-block__title\">{point.title}</p>\n {point.body ? <p className=\"trust-block__body\">{point.body}</p> : null}\n </div>\n </li>\n ))}\n </ul>\n );\n}\n","import { Mic, MicOff, PhoneOff } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport { Button } from \"../../common/Button\";\nimport { Icon } from \"../../common/Icon\";\nimport { IconButton } from \"../../common/IconButton\";\nimport { Waveform } from \"../../common/Waveform\";\nimport type { WaveformState } from \"../../common/Waveform\";\nimport \"./VoiceControlBar.css\";\n\nexport type VoiceControlBarPlacement = \"inline\" | \"full\";\n\ntype VoiceControlBarBase = {\n /** What the session is. \"음성 대화\". Names the group. */\n label: string;\n state: WaveformState;\n /** Amplitudes for the meter. Read only where there is a signal — see `Waveform`. */\n levels?: number[];\n /** How long the call has been going. \"0:04\". */\n elapsed?: string;\n /** Leaving. The one control that is always here. */\n onEnd: () => void;\n /**\n * The microphone, already resolved by the host. \"MacBook Pro 마이크\".\n *\n * A name, not a device object. Nothing here calls `enumerateDevices`, asks for a permission\n * or holds a session — a control bar that queried the platform would be a control bar tied\n * to whichever transport it was written against.\n */\n device?: string;\n /** Something wrong with the device, in words. \"마이크가 시스템에서 음소거되어 있습니다\". */\n deviceProblem?: ReactNode;\n /**\n * A row in a composer, or the whole screen.\n *\n * The two shapes the reference set has. It is a density, not a position — see the note.\n */\n placement?: VoiceControlBarPlacement;\n /** Host controls this does not claim: camera, screen share, a voice picker. */\n children?: ReactNode;\n className?: string;\n [key: `data-${string}`]: unknown;\n};\n\n/**\n * Mute is a pair of props or it is neither of them.\n *\n * `onMuteChange` on its own renders a toggle whose `aria-pressed` is `undefined`, and a\n * toggle with no pressed state is announced as an ordinary button — for a control whose\n * whole job is to be pressed. The state was in the host all along; the type is what makes\n * the host hand it over.\n */\ntype VoiceControlBarMute =\n | { muted: boolean; onMuteChange: (muted: boolean) => void }\n | { muted?: never; onMuteChange?: never };\n\nexport type VoiceControlBarProps = VoiceControlBarBase & VoiceControlBarMute;\n\n/**\n * Mute, the meter, and the way out.\n *\n * **It positions itself nowhere.** No `position`, no `inset`, no `z-index` — the source\n * document defines this component partly by where it sits (\"fixed to the bottom of the\n * screen\"), and a component that takes that decision is app chrome rather than a part. The\n * host puts it where it goes, and `tests/components/voice-control-bar.spec.ts` scrolls the\n * document to prove the bar goes with it. The previous line of work recorded a review that\n * rejected this component on exactly that ground; this is the answer to it rather than a\n * reversal of it.\n *\n * **It enumerates nothing and is tied to no transport.** `device` is a name the host already\n * resolved. There is no `enumerateDevices`, no permission query, no session object and no\n * picker — a device dropdown is explicitly out of scope, and a bar that grew one would be a\n * bar that only works with the library it was written against.\n *\n * **It reports rather than diagnoses.** `deviceProblem` is a sentence the host writes, because\n * the host is the only thing that can know whether the silence is a muted system, a missing\n * permission or a room with nobody in it.\n *\n * **Ending a call is not confirmed here.** A dialog inside this bar would be a dialog every\n * adopter has to fight when their flow already has one. `onEnd` fires and the host decides\n * whether that needs asking about — the same division `ApprovalGate` draws.\n */\nexport function VoiceControlBar({\n label,\n state,\n levels,\n elapsed,\n muted,\n onMuteChange,\n onEnd,\n device,\n deviceProblem,\n placement = \"inline\",\n children,\n className,\n ...rest\n}: VoiceControlBarProps) {\n return (\n <div\n {...rest}\n className={`voice-control-bar ${className ?? \"\"}`.trim()}\n data-placement={placement}\n role=\"group\"\n aria-label={label}\n >\n <div className=\"voice-control-bar__meter\">\n {/*\n * Muted is not a quiet meter — it is a meter with nothing to show, and drawing the\n * last levels it had would be drawing sound the microphone is not sending.\n */}\n <Waveform\n state={muted ? \"idle\" : state}\n levels={muted ? undefined : levels}\n label={label}\n /*\n * `elapsed` is how long the *state* has lasted, and while muted the state the meter\n * shows is `idle`. Handing the call's clock to it prints \"대기 중 0:42\" over a call\n * that has been running for forty-two seconds and was never idle for any of them, so\n * the clock moves out of the meter and back beside the thing it measures.\n */\n elapsed={muted ? undefined : elapsed}\n size={placement === \"full\" ? \"lg\" : \"md\"}\n data-part=\"meter\"\n />\n\n {muted ? (\n <p className=\"voice-control-bar__muted\" data-part=\"muted\">\n 음소거 중\n {elapsed ? <span className=\"voice-control-bar__elapsed\">{elapsed}</span> : null}\n </p>\n ) : null}\n </div>\n\n {device || deviceProblem ? (\n <p className=\"voice-control-bar__device\" data-part=\"device\">\n {/*\n * A problem interrupts; the device name does not. Both are here at once — a problem\n * that replaced the name left the reader with a complaint about a microphone the\n * screen no longer names, which is the one fact they need to act on it.\n */}\n {deviceProblem ? (\n <span className=\"voice-control-bar__problem\" role=\"alert\" data-part=\"problem\">\n {deviceProblem}\n </span>\n ) : null}\n {device ? (\n <span className=\"voice-control-bar__name\" data-part=\"name\">\n {device}\n </span>\n ) : null}\n </p>\n ) : null}\n\n <div className=\"voice-control-bar__controls\">\n {children}\n\n {onMuteChange ? (\n <IconButton\n icon={muted ? MicOff : Mic}\n /*\n * One carrier of state, and it is `aria-pressed`.\n *\n * The label used to change with it — 「마이크 끄기」 becoming 「마이크 켜기」 — while\n * `aria-pressed` flipped as well, so a reader heard 「마이크 켜기, 눌림」 and had two\n * halves saying opposite things. `ToggleButton` states the rule this follows: the\n * name says what the control is for and the attribute says whether it is on. The\n * icon still changes, because the icon is for the reader who can see it and is\n * announced to nobody.\n */\n label=\"마이크 음소거\"\n variant={muted ? \"solid\" : \"outline\"}\n tone={muted ? \"danger\" : \"neutral\"}\n size={placement === \"full\" ? \"lg\" : \"md\"}\n aria-pressed={muted}\n onClick={() => onMuteChange(!muted)}\n data-part=\"mute\"\n />\n ) : null}\n\n {/*\n * Always here, and never behind a menu. A stop control a reader has to find is a stop\n * control for a call that has already gone on too long.\n */}\n <Button\n variant=\"solid\"\n tone=\"danger\"\n size={placement === \"full\" ? \"lg\" : \"md\"}\n onClick={onEnd}\n data-part=\"end\"\n >\n <Icon icon={PhoneOff} size=\"sm\" aria-hidden=\"true\" />\n 통화 끝내기\n </Button>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA8BA,IAAM,KAAsC;CAC1C,SAAS;CACT,SAAS;CACT,MAAM;CACN,QAAQ;CACR,SAAS;AACX;AAiBA,SAAgB,GAAa,EAC3B,UACA,UACA,aACA,UAAO,MACP,cACA,GAAG,KACiB;CACpB,IAAM,IAAU,EAAM,MAAM,MAAS,EAAK,UAAU,SAAS;CAE7D,OAIE,kBAAC,O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