{"$schema":"https:\/\/ui.particle.academy\/schema\/registry-item.json","name":"phone-input","type":"registry:ui","title":"PhoneInput","description":"Country picker and number producing E.164 or null, with a length plausibility check; the number stays left-to-right in RTL. Validate on the server.","package":"react-fancy","dependencies":["tailwind-merge"],"registryDependencies":["portal","input","field","paste-pills","popover","image-pill"],"files":[{"path":"components\/fancy\/phone-input\/PhoneInput.tsx","content":"import { forwardRef, useEffect, useId, useMemo, useRef, useState, type KeyboardEvent } from \"react\";\nimport { cn } from \"..\/lib\/utils\/cn\";\nimport { isImeComposing } from \"..\/lib\/utils\/ime\";\nimport { directionOf, type Direction } from \"..\/lib\/utils\/direction\";\nimport { useControllableState } from \"..\/lib\/hooks\/use-controllable-state\";\nimport { useFloatingPosition } from \"..\/lib\/hooks\/use-floating-position\";\nimport { useOutsideClick } from \"..\/lib\/hooks\/use-outside-click\";\nimport { useEscapeKey } from \"..\/lib\/hooks\/use-escape-key\";\nimport { Portal } from \"..\/portal\";\nimport { Input } from \"..\/input\";\nimport { errorClasses, inputBaseClasses } from \"..\/lib\/components\/inputs\/inputs.utils\";\nimport {\n  PHONE_COUNTRIES,\n  findCountry,\n  flagOf,\n  foldForSearch,\n  nationalNumberOf,\n  parsePhone,\n} from \".\/phone\";\nimport type {\n  PhoneCountry,\n  PhoneInputDetail,\n  PhoneInputMessages,\n  PhoneInputProps,\n  PhoneInputReason,\n} from \".\/PhoneInput.types\";\n\nconst DEFAULT_MESSAGES: Required<PhoneInputMessages> = {\n  too_short: \"This number is too short for {country}.\",\n  too_long: \"This number is too long for {country}.\",\n  invalid_chars: \"Use digits only. Spaces, dashes, brackets and a leading + are fine.\",\n  unknown_country: \"Choose a country, or start the number with + and its country code.\",\n  country: \"Country\",\n  chooseCountry: \"Choose a country\",\n  search: \"Search countries\",\n  noResults: \"No matching countries\",\n};\n\n\/** Messages that cannot be fixed by typing more are shown at once; the rest on blur. *\/\nconst IMMEDIATE: ReadonlySet<PhoneInputReason> = new Set([\"invalid_chars\", \"too_long\"]);\n\nfunction fill(template: string, country: string): string {\n  return template.split(\"{country}\").join(country);\n}\n\nfunction regionNamer(locale: string | undefined): (code: string) => string {\n  try {\n    const names = new Intl.DisplayNames(locale ? [locale] : undefined, { type: \"region\" });\n    return (code) => {\n      try {\n        return names.of(code) ?? code;\n      } catch {\n        return code;\n      }\n    };\n  } catch {\n    return (code) => code;\n  }\n}\n\ninterface Listed extends PhoneCountry {\n  name: string;\n  folded: string;\n}\n\nfunction rank(c: Listed, query: string, dialQuery: string | null): number {\n  if (c.code.toLowerCase() === query) return 0;\n  if (dialQuery !== null && c.dialCode === dialQuery) return 1;\n  if (c.folded.startsWith(query)) return 2;\n  return 3;\n}\n\nfunction matches(c: Listed, query: string, dialQuery: string | null): boolean {\n  if (dialQuery !== null) return dialQuery.length > 0 && c.dialCode.startsWith(dialQuery);\n  return c.folded.includes(query) || c.code.toLowerCase() === query;\n}\n\n\/** \"+95\", \"0095\" and \"95\" are dial-code searches; anything else searches names. *\/\nfunction dialQueryOf(query: string): string | null {\n  let rest = query;\n  if (rest.startsWith(\"+\")) rest = rest.slice(1);\n  else if (rest.startsWith(\"00\")) rest = rest.slice(2);\n  if (rest.length === 0) return query.startsWith(\"+\") ? \"\" : null;\n  for (const ch of rest) {\n    if (ch < \"0\" || ch > \"9\") return null;\n  }\n  return rest;\n}\n\nexport const PhoneInput = forwardRef<HTMLInputElement, PhoneInputProps>(function PhoneInput(\n  {\n    value,\n    defaultValue = null,\n    onValueChange,\n    defaultCountry,\n    countries,\n    locale,\n    label,\n    description,\n    error,\n    required,\n    disabled,\n    name,\n    form,\n    id,\n    placeholder,\n    autoFocus,\n    className,\n    messages,\n    onBlur,\n  },\n  ref,\n) {\n  const autoId = useId();\n  const inputId = id ?? `${autoId}-number`;\n  const labelId = `${inputId}-label`;\n  const descriptionId = `${inputId}-description`;\n  const errorId = `${inputId}-error`;\n  const listId = `${inputId}-countries`;\n  const msg = { ...DEFAULT_MESSAGES, ...messages };\n\n  const [held, setValue] = useControllableState<string | null>(value, defaultValue);\n  const current = typeof held === \"string\" && held !== \"\" ? held : null;\n  const options = useMemo(() => ({ countries }), [countries]);\n\n  const [country, setCountry] = useState<string | null>(() => {\n    const fromValue = nationalNumberOf(current, { ...options, country: defaultCountry }).country;\n    return fromValue ?? (defaultCountry ? defaultCountry.toUpperCase() : null);\n  });\n\n  \/*\n   * The text is held apart from the value, as in NumberField: \"+95 9\" has no\n   * E.164 that displays it. It only moves on its own when the value moved to\n   * something the text does not say: a change from outside, or a parent\n   * refusing this one. Then it shows the national number, and the picker the\n   * country, because the dial code is already on the picker.\n   *\/\n  const [text, setText] = useState(() => nationalNumberOf(current, { ...options, country }).nationalNumber);\n  const parsed = parsePhone(text, { ...options, country });\n  if (parsed.value !== current) {\n    const target = nationalNumberOf(current, { ...options, country });\n    const nextCountry = target.country ?? country;\n    if (text !== target.nationalNumber || nextCountry !== country) {\n      setText(target.nationalNumber);\n      setCountry(nextCountry);\n    }\n  }\n\n  const [touched, setTouched] = useState(false);\n  const lastEmitted = useRef<string | null>(null);\n\n  const names = useMemo(() => regionNamer(locale), [locale]);\n  const listed = useMemo<Listed[]>(() => {\n    const rows = countries\n      ? countries.map((c) => findCountry(c)).filter((c): c is PhoneCountry => c !== undefined)\n      : [...PHONE_COUNTRIES];\n    const out = rows.map((c) => {\n      const n = names(c.code);\n      return { ...c, name: n, folded: foldForSearch(n) };\n    });\n    if (!countries) {\n      let collator: Intl.Collator;\n      try {\n        collator = new Intl.Collator(locale);\n      } catch {\n        collator = new Intl.Collator();\n      }\n      out.sort((a, b) => collator.compare(a.name, b.name));\n    }\n    return out;\n  }, [countries, names, locale]);\n\n  const selected = findCountry(parsed.country ?? country);\n  const selectedName = selected ? names(selected.code) : \"\";\n\n  const emit = (nextText: string, nextCountry: string | null) => {\n    const p = parsePhone(nextText, { ...options, country: nextCountry });\n    setText(nextText);\n    setCountry(p.country ?? nextCountry);\n\n    const detail: PhoneInputDetail = {\n      country: p.country,\n      dialCode: p.dialCode,\n      nationalNumber: p.nationalNumber,\n      valid: p.valid,\n      reason: p.reason,\n      approximate: p.approximate,\n    };\n    const key = JSON.stringify([p.value, detail]);\n    if (key === lastEmitted.current) return;\n    lastEmitted.current = key;\n    if (p.value !== current) setValue(p.value);\n    onValueChange?.(p.value, detail);\n  };\n\n  \/\/ \u2500\u2500 Validation message \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n  const reason = parsed.reason;\n  const reasonMessage = reason ? fill(msg[reason], selectedName || \"this country\") : \"\";\n  const shown = error ?? (reason && (IMMEDIATE.has(reason) || touched) ? reasonMessage : undefined);\n  const describedBy = [description ? descriptionId : null, shown ? errorId : null]\n    .filter(Boolean)\n    .join(\" \");\n\n  \/\/ A form learns of it through native validity, as with NumberField.\n  const inputRef = useRef<HTMLInputElement | null>(null);\n  useEffect(() => {\n    inputRef.current?.setCustomValidity(reasonMessage);\n  });\n\n  \/\/ \u2500\u2500 Picker \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n  const [open, setOpen] = useState(false);\n  const [query, setQuery] = useState(\"\");\n  const [activeIndex, setActiveIndex] = useState(-1);\n  \/\/ Read when opening, so the first frame is already on the right side.\n  const [popupDir, setPopupDir] = useState<Direction>(\"ltr\");\n  const triggerRef = useRef<HTMLButtonElement>(null);\n  const rowRef = useRef<HTMLDivElement>(null);\n  const popupRef = useRef<HTMLDivElement>(null);\n  const position = useFloatingPosition(rowRef, popupRef, {\n    placement: \"bottom-start\",\n    offset: 4,\n    enabled: open,\n  });\n\n  const folded = foldForSearch(query.trim());\n  const dialQuery = dialQueryOf(folded);\n  const filtered = useMemo(() => {\n    if (!folded) return listed;\n    const hits = listed.filter((c) => matches(c, folded, dialQuery));\n    return hits\n      .map((c, i) => ({ c, i, r: rank(c, folded, dialQuery) }))\n      .sort((a, b) => a.r - b.r || a.i - b.i)\n      .map((x) => x.c);\n  }, [listed, folded, dialQuery]);\n\n  const openPicker = () => {\n    if (disabled) return;\n    setQuery(\"\");\n    setActiveIndex(listed.findIndex((c) => c.code === selected?.code));\n    setPopupDir(directionOf(rowRef.current));\n    setOpen(true);\n  };\n\n  const close = (focus: \"trigger\" | \"number\" | null) => {\n    setOpen(false);\n    setQuery(\"\");\n    setActiveIndex(-1);\n    if (focus === \"trigger\") triggerRef.current?.focus();\n    if (focus === \"number\") inputRef.current?.focus();\n  };\n\n  const pick = (code: string) => {\n    \/\/ The picked country wins over a dial code typed in the text, so the text\n    \/\/ is re-read as a national number.\n    const nextText = parsed.dialCode !== null && isInternational(text) ? parsed.nationalNumber : text;\n    emit(nextText, code);\n    close(\"number\");\n  };\n\n  useEscapeKey(() => close(\"trigger\"), open);\n  useOutsideClick(popupRef, () => close(null), open, triggerRef);\n\n  const onSearchKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n    if (e.key === \"ArrowDown\") {\n      e.preventDefault();\n      setActiveIndex((i) => Math.min(i + 1, filtered.length - 1));\n    } else if (e.key === \"ArrowUp\") {\n      e.preventDefault();\n      setActiveIndex((i) => Math.max(i - 1, 0));\n    } else if (e.key === \"PageDown\" || e.key === \"PageUp\") {\n      e.preventDefault();\n      const step = e.key === \"PageDown\" ? 10 : -10;\n      setActiveIndex((i) => Math.min(Math.max(i + step, 0), filtered.length - 1));\n    } else if (e.key === \"Enter\") {\n      if (isImeComposing(e)) return;\n      e.preventDefault();\n      const item = filtered[activeIndex] ?? (folded ? filtered[0] : undefined);\n      if (item) pick(item.code);\n    } else if (e.key === \"Tab\") {\n      \/\/ The list lives in a portal at the end of <body>; Tab would leave the\n      \/\/ field for whatever follows it there. Return to the field instead.\n      e.preventDefault();\n      close(e.shiftKey ? \"trigger\" : \"number\");\n    }\n  };\n\n  const active = filtered[activeIndex];\n  const optionId = (code: string) => `${listId}-${code}`;\n\n  return (\n    <div\n      data-react-fancy-phone-input=\"\"\n      data-country={selected?.code ?? \"\"}\n      data-valid={parsed.valid ? \"true\" : \"false\"}\n      data-reason={reason ?? \"\"}\n      className={cn(\"flex flex-col gap-2\", className)}\n    >\n      <label\n        id={labelId}\n        htmlFor={inputId}\n        className=\"text-sm font-medium text-zinc-900 dark:text-zinc-100\"\n      >\n        {label}\n        {required && (\n          <span aria-hidden=\"true\" className=\"ms-0.5 text-red-800 dark:text-red-300\">\n            *\n          <\/span>\n        )}\n      <\/label>\n\n      <div ref={rowRef} role=\"group\" aria-labelledby={labelId} className=\"flex items-stretch gap-2\">\n        <button\n          ref={triggerRef}\n          type=\"button\"\n          data-react-fancy-phone-input-country=\"\"\n          disabled={disabled}\n          aria-haspopup=\"listbox\"\n          aria-expanded={open}\n          aria-controls={open ? listId : undefined}\n          \/\/ The dial code is the button's visible text, so it must be in the\n          \/\/ name (WCAG 2.5.3 Label in Name). Not in parentheses: speech input\n          \/\/ and axe's `label-content-name-mismatch` both drop bracketed text,\n          \/\/ so \"(+1)\" left the visible \"+1\" out of the name.\n          aria-label={\n            selected\n              ? `${msg.country}: ${selectedName}, +${selected.dialCode}`\n              : msg.chooseCountry\n          }\n          onClick={() => (open ? close(null) : openPicker())}\n          onKeyDown={(e) => {\n            if (!open && (e.key === \"ArrowDown\" || e.key === \"ArrowUp\")) {\n              e.preventDefault();\n              openPicker();\n            }\n          }}\n          className={cn(\n            inputBaseClasses,\n            \"inline-flex min-h-11 min-w-11 shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-lg px-3 text-sm\",\n          )}\n        >\n          {selected ? (\n            <>\n              <span data-react-fancy-phone-input-flag=\"\" aria-hidden=\"true\" className=\"text-base leading-none\">\n                {flagOf(selected.code)}\n              <\/span>\n              <span dir=\"ltr\" className=\"tabular-nums\">{`+${selected.dialCode}`}<\/span>\n            <\/>\n          ) : (\n            <span aria-hidden=\"true\">+<\/span>\n          )}\n          <svg aria-hidden=\"true\" className=\"h-4 w-4 shrink-0 opacity-70\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n            <path\n              fillRule=\"evenodd\"\n              d=\"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z\"\n              clipRule=\"evenodd\"\n            \/>\n          <\/svg>\n        <\/button>\n\n        <div className=\"min-w-0 flex-1\">\n          <Input\n            ref={(el) => {\n              inputRef.current = el;\n              if (typeof ref === \"function\") ref(el);\n              else if (ref) ref.current = el;\n            }}\n            data-react-fancy-phone-input-number=\"\"\n            id={inputId}\n            mode=\"edit\"\n            type=\"tel\"\n            inputMode=\"tel\"\n            autoComplete=\"tel\"\n            \/\/ A phone number reads left-to-right in every script. `dir` on the\n            \/\/ input isolates it, so the + and the digits keep their order inside\n            \/\/ a right-to-left page; it still sits at the page's inline start.\n            dir=\"ltr\"\n            value={text}\n            placeholder={placeholder}\n            disabled={disabled}\n            required={required}\n            autoFocus={autoFocus}\n            aria-invalid={shown ? true : undefined}\n            aria-describedby={describedBy || undefined}\n            onValueChange={(next) => {\n              setTouched(false);\n              emit(next, country);\n            }}\n            onBlur={(e) => {\n              setTouched(true);\n              onBlur?.(e);\n            }}\n            className={cn(\"min-h-11 rtl:text-end\", errorClasses(shown))}\n          \/>\n        <\/div>\n      <\/div>\n\n      {description && (\n        <p id={descriptionId} className=\"text-xs text-zinc-700 dark:text-zinc-300\">\n          {description}\n        <\/p>\n      )}\n      {shown && (\n        <p\n          id={errorId}\n          data-react-fancy-phone-input-error=\"\"\n          data-reason={error ? \"\" : (reason ?? \"\")}\n          aria-live=\"polite\"\n          className=\"text-xs font-medium text-red-800 dark:text-red-300\"\n        >\n          {shown}\n        <\/p>\n      )}\n\n      {\/* What a native submit posts: the E.164, never the half-typed text. *\/}\n      {name ? (\n        <input type=\"hidden\" name={name} form={form} disabled={disabled} value={current ?? \"\"} \/>\n      ) : null}\n\n      {open && (\n        <Portal>\n          <div\n            ref={popupRef}\n            dir={popupDir}\n            \/\/ A labelled dialog holding the search box and the country list: it\n            \/\/ is the element in <body>, so it carries its own popup role.\n            role=\"dialog\"\n            aria-label={msg.chooseCountry}\n            data-react-fancy-phone-input-popup=\"\"\n            className=\"fixed z-50 flex min-w-[16rem] flex-col gap-1 rounded-xl border border-[color:var(--fancy-border,var(--color-zinc-200))] bg-[color:var(--fancy-surface,var(--color-white))] p-1 shadow-lg dark:border-[color:var(--fancy-border-dark,var(--color-zinc-700))] dark:bg-[color:var(--fancy-surface-dark,var(--color-zinc-900))] dark:shadow-zinc-950\/50 fancy-scale-in\"\n            style={{ left: position.x, top: position.y, width: rowRef.current?.offsetWidth }}\n          >\n            <input\n              data-react-fancy-phone-input-search=\"\"\n              type=\"text\"\n              role=\"combobox\"\n              autoFocus\n              autoComplete=\"off\"\n              spellCheck={false}\n              aria-label={msg.search}\n              aria-expanded=\"true\"\n              aria-autocomplete=\"list\"\n              aria-controls={listId}\n              aria-activedescendant={active ? optionId(active.code) : undefined}\n              value={query}\n              onChange={(e) => {\n                setQuery(e.target.value);\n                setActiveIndex(-1);\n              }}\n              onKeyDown={onSearchKeyDown}\n              className={cn(inputBaseClasses, \"min-h-11 w-full rounded-lg px-3 text-sm\")}\n            \/>\n            <ul\n              id={listId}\n              role=\"listbox\"\n              aria-label={msg.country}\n              data-react-fancy-phone-input-listbox=\"\"\n              className=\"max-h-72 overflow-y-auto\"\n            >\n              {filtered.map((c, i) => (\n                <li\n                  key={c.code}\n                  id={optionId(c.code)}\n                  role=\"option\"\n                  aria-selected={c.code === selected?.code}\n                  data-react-fancy-phone-input-option={c.code}\n                  data-active={i === activeIndex ? \"true\" : undefined}\n                  ref={i === activeIndex ? (el) => el?.scrollIntoView?.({ block: \"nearest\" }) : undefined}\n                  \/\/ Keep focus in the search box, so the list stays one tab stop.\n                  onMouseDown={(e) => e.preventDefault()}\n                  onClick={() => pick(c.code)}\n                  className={cn(\n                    \"flex min-h-11 cursor-pointer items-center gap-2 rounded-lg px-3 text-start text-sm text-zinc-900 dark:text-zinc-100\",\n                    i === activeIndex\n                      ? \"bg-[color:var(--fancy-surface-muted,var(--color-zinc-100))] dark:bg-[color:var(--fancy-surface-muted-dark,var(--color-zinc-800))]\"\n                      : \"hover:bg-[color:var(--fancy-surface-hover,var(--color-zinc-50))] dark:hover:bg-[color:var(--fancy-surface-hover-dark,color-mix(in_oklab,var(--color-zinc-800)_50%,transparent))]\",\n                    c.code === selected?.code && \"font-semibold\",\n                  )}\n                >\n                  <span aria-hidden=\"true\" className=\"text-base leading-none\">\n                    {flagOf(c.code)}\n                  <\/span>\n                  <span className=\"min-w-0 flex-1 truncate\">{c.name}<\/span>\n                  <span dir=\"ltr\" className=\"shrink-0 tabular-nums text-zinc-700 dark:text-zinc-300\">\n                    {`+${c.dialCode}`}\n                  <\/span>\n                <\/li>\n              ))}\n            <\/ul>\n            {filtered.length === 0 && (\n              <p role=\"status\" className=\"px-3 py-2 text-sm text-zinc-700 dark:text-zinc-300\">\n                {msg.noResults}\n              <\/p>\n            )}\n          <\/div>\n        <\/Portal>\n      )}\n    <\/div>\n  );\n});\n\nPhoneInput.displayName = \"PhoneInput\";\n\n\/** Whether the text starts an international number (`+` or `00`), ignoring separators. *\/\nfunction isInternational(text: string): boolean {\n  let zeros = 0;\n  for (const ch of text) {\n    if (ch === \"+\" || ch === \"\uff0b\") return zeros === 0;\n    if (ch === \"0\") {\n      zeros++;\n      if (zeros === 2) return true;\n      continue;\n    }\n    if (ch === \" \" || ch === \"(\" || ch === \"-\" || ch === \".\") continue;\n    return false;\n  }\n  return false;\n}\n","type":"registry:ui","target":"components\/fancy\/phone-input\/PhoneInput.tsx"},{"path":"components\/fancy\/phone-input\/PhoneInput.types.ts","content":"import type { FocusEvent } from \"react\";\n\n\/** Why a number is not (yet) a valid E.164. *\/\nexport type PhoneInputReason = \"too_short\" | \"too_long\" | \"invalid_chars\" | \"unknown_country\";\n\n\/** One row of the first-party country table. *\/\nexport interface PhoneCountry {\n  \/** ISO 3166-1 alpha-2, upper case. *\/\n  code: string;\n  \/** The ITU-T E.164 country code, digits only: `\"95\"`. *\/\n  dialCode: string;\n  \/** Shortest national significant number, in digits. A sanity check, not validation. *\/\n  minLength: number;\n  \/** Longest national significant number, in digits. A sanity check, not validation. *\/\n  maxLength: number;\n  \/** What is typed before the number within the country (`\"0\"`). Empty: none. *\/\n  trunkPrefixes: readonly string[];\n  \/**\n   * Whether `minLength` \/ `maxLength` were checked against a cited plan. When\n   * `false` the range is the widest E.164 allows (4 to 15 minus the dial code),\n   * so only the digits and the overall length are checked.\n   *\/\n  lengthVerified: boolean;\n}\n\n\/** What the component read, reported with every value. JSON-serialisable. *\/\nexport interface PhoneInputDetail {\n  \/** ISO 3166-1 alpha-2 of the country the number was read in, or `null`. *\/\n  country: string | null;\n  \/** Its dial code, digits only, or `null`. *\/\n  dialCode: string | null;\n  \/** The national significant number: digits only, no trunk prefix. *\/\n  nationalNumber: string;\n  \/**\n   * Whether the number is PLAUSIBLE: digits only, a known dial code, and a length\n   * inside the country's range. Real per-country ranges apply only where the\n   * table's row is verified; elsewhere the range is the E.164 maximum. Never a\n   * claim that the number exists: validate on a server.\n   *\/\n  valid: boolean;\n  \/** Why it is not valid. `null` when valid, and when blank. *\/\n  reason: PhoneInputReason | null;\n  \/**\n   * The dial code is shared (`+1`, `+7`, `+44`, \u2026) and `country` is a guess from\n   * the number's leading digits or the selected country. The E.164 is exact\n   * either way; only `country` may be wrong.\n   *\/\n  approximate: boolean;\n}\n\nexport interface PhoneParse extends PhoneInputDetail {\n  \/** The E.164 number (`+959\u2026`), or `null` unless the number is whole. *\/\n  value: string | null;\n}\n\nexport interface ParsePhoneOptions {\n  \/** The selected country, for a national number and as a tie-break for shared dial codes. *\/\n  country?: string | null;\n  \/** Restrict to these countries. A dial code none of them owns is `unknown_country`. *\/\n  countries?: readonly string[];\n}\n\n\/**\n * Text the component shows, for a host working in another language. `{country}`\n * in a reason message is replaced with the country's name in `locale`.\n *\/\nexport interface PhoneInputMessages {\n  \/** Default: \"This number is too short for {country}.\" *\/\n  too_short?: string;\n  \/** Default: \"This number is too long for {country}.\" *\/\n  too_long?: string;\n  \/** Default: \"Use digits only. Spaces, dashes, brackets and a leading + are fine.\" *\/\n  invalid_chars?: string;\n  \/** Default: \"Choose a country, or start the number with + and its country code.\" *\/\n  unknown_country?: string;\n  \/** Accessible name of the picker, before the chosen country. Default: \"Country\". *\/\n  country?: string;\n  \/** Accessible name of the picker when no country is chosen. Default: \"Choose a country\". *\/\n  chooseCountry?: string;\n  \/** Accessible name of the search box. Default: \"Search countries\". *\/\n  search?: string;\n  \/** Shown when the search matches nothing. Default: \"No matching countries\". *\/\n  noResults?: string;\n}\n\nexport interface PhoneInputProps {\n  \/** The number in E.164 (`+959451234567`), or `null` when there is none. *\/\n  value?: string | null;\n  \/** Starting value when uncontrolled. *\/\n  defaultValue?: string | null;\n  \/**\n   * Called when the value or the reading of it changes. `value` is `null` for\n   * blank and for anything that is not yet a whole number; `detail` says why.\n   *\/\n  onValueChange?: (value: string | null, detail: PhoneInputDetail) => void;\n  \/** ISO 3166-1 alpha-2 selected at first, and the tie-break for a shared dial code. *\/\n  defaultCountry?: string;\n  \/** Restrict the picker to these ISO codes, in this order. Default: every country, by name. *\/\n  countries?: string[];\n  \/** BCP 47 locale for country names (`Intl.DisplayNames`). Default: the browser's. *\/\n  locale?: string;\n  \/** Visible label. Required: an unlabelled phone field fails WCAG. *\/\n  label: string;\n  description?: string;\n  \/** A host's message. Shown instead of the built-in one. *\/\n  error?: string;\n  required?: boolean;\n  disabled?: boolean;\n  \/** Posts the E.164 (or `\"\"`) through a hidden input. *\/\n  name?: string;\n  form?: string;\n  id?: string;\n  placeholder?: string;\n  autoFocus?: boolean;\n  className?: string;\n  messages?: PhoneInputMessages;\n  onBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n}\n","type":"registry:ui","target":"components\/fancy\/phone-input\/PhoneInput.types.ts"},{"path":"components\/fancy\/phone-input\/index.ts","content":"export { PhoneInput } from \".\/PhoneInput\";\nexport { parsePhone, PHONE_COUNTRIES } from \".\/phone\";\nexport type {\n  PhoneInputProps,\n  PhoneInputDetail,\n  PhoneInputMessages,\n  PhoneInputReason,\n  PhoneCountry,\n  PhoneParse,\n  ParsePhoneOptions,\n} from \".\/PhoneInput.types\";\n","type":"registry:ui","target":"components\/fancy\/phone-input\/index.ts"},{"path":"components\/fancy\/phone-input\/phone-countries.ts","content":"\/**\n * Country to dial code and national-number length, first party.\n *\n * LENGTHS ARE A SANITY CHECK, NOT VALIDATION. They catch a number that is\n * plainly too short or too long for its country. They do not know which ranges\n * are allocated, whether a number is mobile or fixed, or whether it is in\n * service. Exact validation belongs on a server (Twilio Lookup, for example).\n *\n * Each row: [ISO 3166-1 alpha-2, dial code, min, max, trunk prefixes, status]\n *\n * - min \/ max count the NATIONAL SIGNIFICANT NUMBER (NSN): the digits after the\n *   country code, without a trunk prefix.\n * - trunk prefixes are what a person types before the NSN when dialling within\n *   the country. An empty list means the plan has none AND a leading 0 is part\n *   of the number (Italy), so it must not be dropped.\n * - status is VERIFIED only where the length was checked against a source this\n *   table cites (the WIKI rows). Every other row is UNVERIFIED, and its range is\n *   the widest E.164 allows: 4 to (15 - dial-code digits). A range written from\n *   memory that is too tight would refuse a real person's valid number, block\n *   their form, and say `too_long` at once; accepting a wrong number is the\n *   lesser harm, because the server validates. Each UNVERIFIED comment keeps the\n *   range that was transcribed, so verifying a row is: check it against the\n *   plan, put the range back, mark it VERIFIED and cite the source.\n *\n * Sources, recorded per row in its comment:\n *\n *   E164  the dial code, from \"List of ITU-T Recommendation E.164 assigned\n *         country codes\" (ITU-T, complement to E.164) and the index of national\n *         numbering plans at https:\/\/www.itu.int\/oth\/T0202\n *   NNP   the length, from the national numbering plan the country has\n *         notified to the ITU (same index)\n *   NANPA the North American Numbering Plan: a 10-digit NSN everywhere\n *   WIKI  checked on 2026-11-05 against the \"Telephone numbers in <country>\"\n *         article, which cites the plan, because the ITU document itself was\n *         not readable as text\n *   wide  the plan is variable-length or the exact range was not confirmed,\n *         so the range is deliberately wide. Wide ranges let more wrong numbers\n *         through and refuse fewer right ones, which is the right way to be wrong\n *         for a sanity check.\n *\n * Dial codes and trunk prefixes in UNVERIFIED rows were also transcribed, not\n * re-checked line by line; only their LENGTHS were widened. Treat a row as a\n * claim to correct, and correct it here with its source.\n *\n * Not listed, because they have no dial code of their own: AQ, BV, GS, HM,\n * PN, TF, UM. XK (Kosovo) is a user-assigned code, not ISO 3166-1, and is\n * listed because +383 is assigned to it and `Intl.DisplayNames` names it.\n *\/\nexport type LengthStatus = \"verified\" | \"unverified\";\n\nexport type CountryRow = readonly [\n  code: string,\n  dialCode: string,\n  minLength: number,\n  maxLength: number,\n  trunkPrefixes: readonly string[],\n  status: LengthStatus,\n];\n\nconst ZERO: readonly string[] = [\"0\"];\nconst NONE: readonly string[] = [];\nconst NANP_TRUNK: readonly string[] = [\"1\"];\nconst VERIFIED: LengthStatus = \"verified\";\nconst UNVERIFIED: LengthStatus = \"unverified\";\n\nexport const COUNTRY_ROWS: readonly CountryRow[] = [\n  [\"AD\", \"376\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-9 from memory of NNP wide)\n  [\"AE\", \"971\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"AF\", \"93\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"AG\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 268))\n  [\"AI\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 264))\n  [\"AL\", \"355\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-9 from memory of NNP wide)\n  [\"AM\", \"374\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"AO\", \"244\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"AR\", \"54\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-11 from memory of NNP (mobile adds a 9 internationally))\n  [\"AS\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 684))\n  [\"AT\", \"43\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 4-13 from memory of NNP wide: open numbering plan)\n  [\"AU\", \"61\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"AW\", \"297\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"AX\", \"358\", 4, 12, ZERO, UNVERIFIED], \/\/ E164 (shared with FI, 358 18); length UNVERIFIED, widened to the E.164 maximum (was 5-12 from memory of NNP wide, as FI)\n  [\"AZ\", \"994\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"BA\", \"387\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"BB\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 246))\n  [\"BD\", \"880\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-10 from memory of NNP wide: fixed lines vary)\n  [\"BE\", \"32\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"BF\", \"226\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"BG\", \"359\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-9 from memory of NNP wide)\n  [\"BH\", \"973\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"BI\", \"257\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"BJ\", \"229\", 8, 10, NONE, VERIFIED], \/\/ E164; WIKI: \"01\" prefixed to every number on 2024-11-30; wide, 8 kept for the old form\n  [\"BL\", \"590\", 4, 12, ZERO, UNVERIFIED], \/\/ E164 (shared with GP, MF); length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"BM\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 441))\n  [\"BN\", \"673\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"BO\", \"591\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"BQ\", \"599\", 4, 12, NONE, UNVERIFIED], \/\/ E164 (shared with CW: 599 3, 4, 7); length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"BR\", \"55\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-11 from memory of NNP)\n  [\"BS\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 242))\n  [\"BT\", \"975\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-8 from memory of NNP)\n  [\"BW\", \"267\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-8 from memory of NNP)\n  [\"BY\", \"375\", 4, 12, [\"80\", \"8\"], UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP (dialled 8 0XX nationally))\n  [\"BZ\", \"501\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"CA\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA)\n  [\"CC\", \"61\", 4, 13, ZERO, UNVERIFIED], \/\/ E164 (shared with AU, 61 89162); length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP, as AU)\n  [\"CD\", \"243\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"CF\", \"236\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"CG\", \"242\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP (the leading 0 is part of the number))\n  [\"CH\", \"41\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"CI\", \"225\", 10, 10, NONE, VERIFIED], \/\/ E164; WIKI: 10 digits since 2021-01-31, leading 0 is part of the number\n  [\"CK\", \"682\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 5-5 from memory of NNP)\n  [\"CL\", \"56\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"CM\", \"237\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"CN\", \"86\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 5-12 from memory of NNP wide: fixed lines vary by area code)\n  [\"CO\", \"57\", 10, 10, ZERO, VERIFIED], \/\/ E164; WIKI: fixed and mobile 10 digits since 2021\n  [\"CR\", \"506\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"CU\", \"53\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-8 from memory of NNP wide)\n  [\"CV\", \"238\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"CW\", \"599\", 4, 12, NONE, UNVERIFIED], \/\/ E164 (shared with BQ: 599 9); length UNVERIFIED, widened to the E.164 maximum (was 7-8 from memory of NNP)\n  [\"CX\", \"61\", 4, 13, ZERO, UNVERIFIED], \/\/ E164 (shared with AU, 61 89164); length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP, as AU)\n  [\"CY\", \"357\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"CZ\", \"420\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"DE\", \"49\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-13 from memory of NNP wide: open numbering plan)\n  [\"DJ\", \"253\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"DK\", \"45\", 4, 13, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"DM\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 767))\n  [\"DO\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 809, 829, 849))\n  [\"DZ\", \"213\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"EC\", \"593\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"EE\", \"372\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-8 from memory of NNP)\n  [\"EG\", \"20\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-10 from memory of NNP wide)\n  [\"EH\", \"212\", 4, 12, ZERO, UNVERIFIED], \/\/ E164 (shared with MA); length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP, as MA)\n  [\"ER\", \"291\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"ES\", \"34\", 4, 13, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"ET\", \"251\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"FI\", \"358\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 5-12 from memory of NNP wide: variable-length plan)\n  [\"FJ\", \"679\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"FK\", \"500\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 5-5 from memory of NNP)\n  [\"FM\", \"691\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"FO\", \"298\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-6 from memory of NNP)\n  [\"FR\", \"33\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"GA\", \"241\", 7, 8, NONE, VERIFIED], \/\/ E164; WIKI: 7 digits, 8 for mobiles renumbered in 2019; the 0 is part of the number\n  [\"GB\", \"44\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-10 from memory of NNP (10 for almost all; a few 9 and 7))\n  [\"GD\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 473))\n  [\"GE\", \"995\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"GF\", \"594\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"GG\", \"44\", 4, 13, ZERO, UNVERIFIED], \/\/ E164 (shared with GB, 44 1481); length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NNP, as GB)\n  [\"GH\", \"233\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"GI\", \"350\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"GL\", \"299\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-6 from memory of NNP)\n  [\"GM\", \"220\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"GN\", \"224\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP wide)\n  [\"GP\", \"590\", 4, 12, ZERO, UNVERIFIED], \/\/ E164 (shared with BL, MF); length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"GQ\", \"240\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"GR\", \"30\", 4, 13, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NNP)\n  [\"GT\", \"502\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"GU\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 671))\n  [\"GW\", \"245\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-9 from memory of NNP wide)\n  [\"GY\", \"592\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"HK\", \"852\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"HN\", \"504\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"HR\", \"385\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-9 from memory of NNP wide)\n  [\"HT\", \"509\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"HU\", \"36\", 4, 13, [\"06\"], UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP (trunk prefix 06))\n  [\"ID\", \"62\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-12 from memory of NNP wide)\n  [\"IE\", \"353\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-9 from memory of NNP)\n  [\"IL\", \"972\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"IM\", \"44\", 4, 13, ZERO, UNVERIFIED], \/\/ E164 (shared with GB, 44 1624); length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NNP, as GB)\n  [\"IN\", \"91\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NNP)\n  [\"IO\", \"246\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"IQ\", \"964\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-10 from memory of NNP wide)\n  [\"IR\", \"98\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NNP)\n  [\"IS\", \"354\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-9 from memory of NNP)\n  [\"IT\", \"39\", 4, 13, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-11 from memory of NNP wide (the leading 0 of a fixed line is part of the number))\n  [\"JE\", \"44\", 4, 13, ZERO, UNVERIFIED], \/\/ E164 (shared with GB, 44 1534); length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NNP, as GB)\n  [\"JM\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 876, 658))\n  [\"JO\", \"962\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"JP\", \"81\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-10 from memory of NNP)\n  [\"KE\", \"254\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-10 from memory of NNP wide)\n  [\"KG\", \"996\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"KH\", \"855\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"KI\", \"686\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 5-8 from memory of NNP wide)\n  [\"KM\", \"269\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"KN\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 869))\n  [\"KP\", \"850\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-12 from memory of NNP wide: not confirmed)\n  [\"KR\", \"82\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-11 from memory of NNP wide)\n  [\"KW\", \"965\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"KY\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 345))\n  [\"KZ\", \"7\", 10, 10, [\"8\"], VERIFIED], \/\/ E164 (shared with RU: 7 6, 7 7); WIKI: zones 6xx and 7xx\n  [\"LA\", \"856\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-10 from memory of NNP wide)\n  [\"LB\", \"961\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-8 from memory of NNP)\n  [\"LC\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 758))\n  [\"LI\", \"423\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-9 from memory of NNP)\n  [\"LK\", \"94\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"LR\", \"231\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-9 from memory of NNP wide)\n  [\"LS\", \"266\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"LT\", \"370\", 8, 8, [\"0\", \"8\"], VERIFIED], \/\/ E164; WIKI: trunk 0 since 2024-03-01, the old 8 still read\n  [\"LU\", \"352\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 4-11 from memory of NNP wide: open numbering plan)\n  [\"LV\", \"371\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"LY\", \"218\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"MA\", \"212\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"MC\", \"377\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"MD\", \"373\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"ME\", \"382\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"MF\", \"590\", 4, 12, ZERO, UNVERIFIED], \/\/ E164 (shared with GP, BL); length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"MG\", \"261\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"MH\", \"692\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"MK\", \"389\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"ML\", \"223\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"MM\", \"95\", 7, 10, ZERO, VERIFIED], \/\/ E164; WIKI: 8 to 11 digits with the trunk 0, so 7 to 10; mobiles 8 to 10\n  [\"MN\", \"976\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"MO\", \"853\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"MP\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 670))\n  [\"MQ\", \"596\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"MR\", \"222\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"MS\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 664))\n  [\"MT\", \"356\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"MU\", \"230\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-8 from memory of NNP)\n  [\"MV\", \"960\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"MW\", \"265\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-9 from memory of NNP wide)\n  [\"MX\", \"52\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NNP (10 digits since 2019))\n  [\"MY\", \"60\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-10 from memory of NNP)\n  [\"MZ\", \"258\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"NA\", \"264\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-9 from memory of NNP wide)\n  [\"NC\", \"687\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-6 from memory of NNP)\n  [\"NE\", \"227\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"NF\", \"672\", 4, 12, NONE, UNVERIFIED], \/\/ E164 (672 3); length UNVERIFIED, widened to the E.164 maximum (was 6-6 from memory of NNP)\n  [\"NG\", \"234\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-10 from memory of NNP wide)\n  [\"NI\", \"505\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"NL\", \"31\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"NO\", \"47\", 4, 13, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 5-8 from memory of NNP (8, with a few 5-digit service numbers))\n  [\"NP\", \"977\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-10 from memory of NNP wide)\n  [\"NR\", \"674\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"NU\", \"683\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 4-7 from memory of NNP wide)\n  [\"NZ\", \"64\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-10 from memory of NNP)\n  [\"OM\", \"968\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"PA\", \"507\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-8 from memory of NNP)\n  [\"PE\", \"51\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"PF\", \"689\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-8 from memory of NNP wide (8 since 2017))\n  [\"PG\", \"675\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-8 from memory of NNP)\n  [\"PH\", \"63\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-10 from memory of NNP)\n  [\"PK\", \"92\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-10 from memory of NNP wide)\n  [\"PL\", \"48\", 4, 13, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"PM\", \"508\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-6 from memory of NNP)\n  [\"PR\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 787, 939))\n  [\"PS\", \"970\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"PT\", \"351\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"PW\", \"680\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"PY\", \"595\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-9 from memory of NNP wide)\n  [\"QA\", \"974\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-8 from memory of NNP)\n  [\"RE\", \"262\", 4, 12, ZERO, UNVERIFIED], \/\/ E164 (shared with YT); length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"RO\", \"40\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"RS\", \"381\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-9 from memory of NNP wide)\n  [\"RU\", \"7\", 4, 14, [\"8\"], UNVERIFIED], \/\/ E164 (shared with KZ); length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NNP (trunk prefix 8))\n  [\"RW\", \"250\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"SA\", \"966\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"SB\", \"677\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 5-7 from memory of NNP wide)\n  [\"SC\", \"248\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"SD\", \"249\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"SE\", \"46\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-10 from memory of NNP wide: variable-length plan)\n  [\"SG\", \"65\", 4, 13, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"SH\", \"290\", 5, 5, NONE, VERIFIED], \/\/ E164; WIKI: fixed five-digit plan since 2013-10-01\n  [\"SI\", \"386\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"SJ\", \"47\", 4, 13, NONE, UNVERIFIED], \/\/ E164 (shared with NO, 47 79); length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP, as NO)\n  [\"SK\", \"421\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"SL\", \"232\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"SM\", \"378\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-10 from memory of NNP wide)\n  [\"SN\", \"221\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"SO\", \"252\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-9 from memory of NNP wide)\n  [\"SR\", \"597\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-7 from memory of NNP)\n  [\"SS\", \"211\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"ST\", \"239\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-7 from memory of NNP)\n  [\"SV\", \"503\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"SX\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 721))\n  [\"SY\", \"963\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-9 from memory of NNP wide)\n  [\"SZ\", \"268\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"TC\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 649))\n  [\"TD\", \"235\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"TG\", \"228\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"TH\", \"66\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"TJ\", \"992\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"TK\", \"690\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 4-7 from memory of NNP wide)\n  [\"TL\", \"670\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-8 from memory of NNP)\n  [\"TM\", \"993\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"TN\", \"216\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"TO\", \"676\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 5-7 from memory of NNP wide)\n  [\"TR\", \"90\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NNP)\n  [\"TT\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 868))\n  [\"TV\", \"688\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 5-6 from memory of NNP)\n  [\"TW\", \"886\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-9 from memory of NNP wide)\n  [\"TZ\", \"255\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"UA\", \"380\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"UG\", \"256\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"US\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA)\n  [\"UY\", \"598\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-8 from memory of NNP)\n  [\"UZ\", \"998\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"VA\", \"39\", 4, 13, NONE, UNVERIFIED], \/\/ E164 (shared with IT, 39 06698); length UNVERIFIED, widened to the E.164 maximum (was 6-11 from memory of NNP, as IT)\n  [\"VC\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 784))\n  [\"VE\", \"58\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NNP)\n  [\"VG\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 284))\n  [\"VI\", \"1\", 4, 14, NANP_TRUNK, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 10-10 from memory of NANPA (NPA 340))\n  [\"VN\", \"84\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-10 from memory of NNP wide)\n  [\"VU\", \"678\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 5-7 from memory of NNP wide)\n  [\"WF\", \"681\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 6-6 from memory of NNP)\n  [\"WS\", \"685\", 4, 12, NONE, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 5-7 from memory of NNP wide)\n  [\"XK\", \"383\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 8-9 from memory of NNP)\n  [\"YE\", \"967\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 7-9 from memory of NNP wide)\n  [\"YT\", \"262\", 9, 9, ZERO, VERIFIED], \/\/ E164 (shared with RE: 262 269, 639); WIKI\n  [\"ZA\", \"27\", 4, 13, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"ZM\", \"260\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 9-9 from memory of NNP)\n  [\"ZW\", \"263\", 4, 12, ZERO, UNVERIFIED], \/\/ E164; length UNVERIFIED, widened to the E.164 maximum (was 5-10 from memory of NNP wide: fixed lines vary)\n];\n\n\/**\n * Which country a shared dial code means when nothing else decides. This is a\n * convention (the country that holds most of the numbers), not a fact about\n * any one number.\n *\/\nexport const MAIN_COUNTRY: Readonly<Record<string, string>> = {\n  \"1\": \"US\",\n  \"7\": \"RU\",\n  \"39\": \"IT\",\n  \"44\": \"GB\",\n  \"47\": \"NO\",\n  \"61\": \"AU\",\n  \"212\": \"MA\",\n  \"262\": \"RE\",\n  \"358\": \"FI\",\n  \"590\": \"GP\",\n  \"599\": \"CW\",\n};\n\n\/**\n * Leading digits of the NSN that point at one country of a shared dial code.\n * APPROXIMATE, and documented as such: these name the country a number was\n * allocated to, and a ported or roaming number can say otherwise. The E.164\n * the component emits does not depend on them, only `detail.country` does.\n *\n * - +1: area codes (NPAs). Canada's list is the one in WIKI (\"Telephone numbers\n *   in Canada\", last edited 2026-01-27; NANPA itself was not reached), the\n *   others are NANPA's Caribbean and territory NPAs. A new Canadian NPA reads\n *   as US until it is added here.\n * - +7: Kazakhstan holds zones 6xx and 7xx (WIKI).\n * - +44: the Crown Dependencies' fixed-line area codes only. Their mobile ranges\n *   sit among UK mobiles and are not listed.\n * - +47 79 Svalbard, +61 89162 \/ 89164 Cocos and Christmas Islands, +262 269 \/\n *   639 Mayotte (WIKI), +358 18 Aland, +39 06698 Vatican City, +599 3 \/ 4 \/ 7\n *   Caribbean Netherlands.\n * - +212 (Western Sahara) and +590 (Saint Barthelemy, Saint Martin) have no\n *   hint: their ranges were not confirmed, so they fall to the main country.\n *\/\nexport const LEADING_DIGIT_HINTS: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>> = {\n  \"1\": {\n    CA: [\n      \"204\", \"226\", \"236\", \"249\", \"250\", \"257\", \"263\", \"289\", \"306\", \"343\", \"354\", \"365\", \"367\",\n      \"368\", \"382\", \"403\", \"416\", \"418\", \"428\", \"431\", \"437\", \"438\", \"450\", \"468\", \"474\", \"506\",\n      \"514\", \"519\", \"548\", \"579\", \"581\", \"584\", \"587\", \"604\", \"613\", \"639\", \"647\", \"672\", \"683\",\n      \"705\", \"709\", \"742\", \"753\", \"778\", \"780\", \"782\", \"807\", \"819\", \"825\", \"867\", \"873\", \"879\",\n      \"902\", \"905\", \"942\",\n    ],\n    AG: [\"268\"],\n    AI: [\"264\"],\n    AS: [\"684\"],\n    BB: [\"246\"],\n    BM: [\"441\"],\n    BS: [\"242\"],\n    DM: [\"767\"],\n    DO: [\"809\", \"829\", \"849\"],\n    GD: [\"473\"],\n    GU: [\"671\"],\n    JM: [\"876\", \"658\"],\n    KN: [\"869\"],\n    KY: [\"345\"],\n    LC: [\"758\"],\n    MP: [\"670\"],\n    MS: [\"664\"],\n    PR: [\"787\", \"939\"],\n    SX: [\"721\"],\n    TC: [\"649\"],\n    TT: [\"868\"],\n    VC: [\"784\"],\n    VG: [\"284\"],\n    VI: [\"340\"],\n  },\n  \"7\": { KZ: [\"6\", \"7\"] },\n  \"39\": { VA: [\"06698\"] },\n  \"44\": { GG: [\"1481\"], JE: [\"1534\"], IM: [\"1624\"] },\n  \"47\": { SJ: [\"79\"] },\n  \"61\": { CC: [\"89162\"], CX: [\"89164\"] },\n  \"262\": { YT: [\"269\", \"639\"] },\n  \"358\": { AX: [\"18\"] },\n  \"599\": { BQ: [\"3\", \"4\", \"7\"] },\n};\n","type":"registry:ui","target":"components\/fancy\/phone-input\/phone-countries.ts"},{"path":"components\/fancy\/phone-input\/phone.ts","content":"import { COUNTRY_ROWS, LEADING_DIGIT_HINTS, MAIN_COUNTRY } from \".\/phone-countries\";\nimport type { PhoneCountry, PhoneInputReason, PhoneParse, ParsePhoneOptions } from \".\/PhoneInput.types\";\n\n\/**\n * Reading a phone number, by hand.\n *\n * Every step is a single pass over the characters, with no regular expression:\n * the text comes from a person or a paste, and a backtracking pattern over it is\n * a ReDoS waiting for the right input. Linear time is pinned by a test.\n *\/\n\nexport const PHONE_COUNTRIES: readonly PhoneCountry[] = COUNTRY_ROWS.map(\n  ([code, dialCode, minLength, maxLength, trunkPrefixes, status]) => ({\n    code,\n    dialCode,\n    minLength,\n    maxLength,\n    trunkPrefixes,\n    lengthVerified: status === \"verified\",\n  }),\n);\n\nconst BY_CODE = new Map(PHONE_COUNTRIES.map((c) => [c.code, c]));\n\nexport function findCountry(code: string | null | undefined): PhoneCountry | undefined {\n  return code ? BY_CODE.get(code.toUpperCase()) : undefined;\n}\n\n\/** The first code point of \"0\" in each script whose digits are read. *\/\nconst DIGIT_ZEROS = [\n  0x30, \/\/ ASCII\n  0x660, \/\/ Arabic-Indic\n  0x6f0, \/\/ Extended Arabic-Indic (Persian, Urdu)\n  0x966, \/\/ Devanagari\n  0x9e6, \/\/ Bengali\n  0xe50, \/\/ Thai\n  0x1040, \/\/ Myanmar\n  0xff10, \/\/ fullwidth\n];\n\nfunction digitOf(cp: number): number {\n  for (const zero of DIGIT_ZEROS) {\n    if (cp >= zero && cp <= zero + 9) return cp - zero;\n  }\n  return -1;\n}\n\n\/** What people put between digits. Skipped. *\/\nfunction isSeparator(cp: number): boolean {\n  return (\n    cp === 0x20 || \/\/ space\n    cp === 0x09 || \/\/ tab\n    cp === 0xa0 || \/\/ no-break space\n    cp === 0x2007 || \/\/ figure space\n    cp === 0x2009 || \/\/ thin space\n    cp === 0x202f || \/\/ narrow no-break space\n    cp === 0x3000 || \/\/ ideographic space\n    cp === 0x2d || \/\/ hyphen-minus\n    (cp >= 0x2010 && cp <= 0x2015) || \/\/ hyphens and dashes\n    cp === 0x2212 || \/\/ minus sign\n    cp === 0xff0d || \/\/ fullwidth hyphen-minus\n    cp === 0x2e || \/\/ full stop\n    cp === 0x2f || \/\/ solidus\n    cp === 0x28 || \/\/ (\n    cp === 0x29 || \/\/ )\n    cp === 0xff08 || \/\/ fullwidth (\n    cp === 0xff09 \/\/ fullwidth )\n  );\n}\n\n\/**\n * Invisible direction controls. Text copied from a right-to-left page often\n * wraps a number in these, and they are not part of it.\n *\/\nfunction isDirectionMark(cp: number): boolean {\n  return (\n    cp === 0x200e ||\n    cp === 0x200f ||\n    cp === 0x061c ||\n    cp === 0xfeff ||\n    (cp >= 0x202a && cp <= 0x202e) ||\n    (cp >= 0x2066 && cp <= 0x2069)\n  );\n}\n\nfunction isPlus(cp: number): boolean {\n  return cp === 0x2b || cp === 0xff0b;\n}\n\ninterface Scan {\n  digits: string;\n  plus: boolean;\n  invalid: boolean;\n}\n\n\/** One pass. Stops at the first character that cannot be in a phone number. *\/\nfunction scan(text: string): Scan {\n  let digits = \"\";\n  let plus = false;\n\n  for (const ch of text) {\n    const cp = ch.codePointAt(0)!;\n    const d = digitOf(cp);\n    if (d >= 0) {\n      digits += String(d);\n    } else if (isPlus(cp)) {\n      \/\/ Only as the first thing typed: \"95+9\" is not a number.\n      if (plus || digits.length > 0) return { digits, plus, invalid: true };\n      plus = true;\n    } else if (!isSeparator(cp) && !isDirectionMark(cp)) {\n      return { digits, plus, invalid: true };\n    }\n  }\n\n  return { digits, plus, invalid: false };\n}\n\nfunction lengthReason(nsn: string, country: PhoneCountry): PhoneInputReason | null {\n  if (nsn.length < country.minLength) return \"too_short\";\n  \/\/ E.164 caps the whole number at 15 digits, country code included.\n  if (nsn.length > country.maxLength || nsn.length + country.dialCode.length > 15) return \"too_long\";\n  return null;\n}\n\n\/**\n * Drop the trunk prefix if the person typed one. Always: keeping it whenever the\n * longer reading happens to fit the length range would turn a half-typed\n * \"06 12 34 56 7\" into a \"valid\" +33 0612 34567, which is exactly the wrong\n * E.164 a partial number must never produce. The cost is one case: a national\n * number that genuinely starts with the trunk digit, typed WITHOUT the trunk\n * prefix (Russia's 800 numbers, dialled \"8 800\" at home), reads as too short.\n * That is null with a reason, never a wrong number.\n *\/\nfunction stripTrunk(digits: string, country: PhoneCountry): string {\n  for (const trunk of country.trunkPrefixes) {\n    if (trunk && digits.startsWith(trunk)) return digits.slice(trunk.length);\n  }\n  return digits;\n}\n\nfunction allowedSet(countries: readonly string[] | undefined): Set<string> | null {\n  if (!countries) return null;\n  const set = new Set<string>();\n  for (const c of countries) set.add(c.toUpperCase());\n  return set;\n}\n\n\/** Countries that share a dial code, in table order. *\/\nfunction countriesFor(dialCode: string, allowed: Set<string> | null): PhoneCountry[] {\n  const out: PhoneCountry[] = [];\n  for (const c of PHONE_COUNTRIES) {\n    if (c.dialCode === dialCode && (!allowed || allowed.has(c.code))) out.push(c);\n  }\n  return out;\n}\n\n\/**\n * Which of several countries sharing a dial code a number belongs to. The\n * leading-digit hint first, then the selected country, then the main one.\n * Approximate by construction; see LEADING_DIGIT_HINTS.\n *\/\nfunction pickShared(\n  candidates: PhoneCountry[],\n  nsn: string,\n  selected: string | null,\n): PhoneCountry {\n  const dial = candidates[0].dialCode;\n  const hints = LEADING_DIGIT_HINTS[dial];\n  if (hints) {\n    let best: PhoneCountry | undefined;\n    let bestLength = 0;\n    for (const c of candidates) {\n      for (const prefix of hints[c.code] ?? []) {\n        if (prefix.length > bestLength && nsn.startsWith(prefix)) {\n          best = c;\n          bestLength = prefix.length;\n        }\n      }\n    }\n    if (best) return best;\n  }\n  const chosen = candidates.find((c) => c.code === selected);\n  if (chosen) return chosen;\n  return candidates.find((c) => c.code === MAIN_COUNTRY[dial]) ?? candidates[0];\n}\n\nfunction result(\n  country: PhoneCountry | undefined,\n  nsn: string,\n  reason: PhoneInputReason | null,\n  approximate = false,\n): PhoneParse {\n  const valid = reason === null && country !== undefined && nsn.length > 0;\n  return {\n    value: valid ? `+${country!.dialCode}${nsn}` : null,\n    country: country?.code ?? null,\n    dialCode: country?.dialCode ?? null,\n    nationalNumber: nsn,\n    valid,\n    reason,\n    approximate,\n  };\n}\n\n\/**\n * Read what a person typed or pasted into an E.164 number and a reason.\n *\n * - `+` or `00` starts an international number; the country comes from its dial\n *   code. Other international prefixes (011 in North America, 010 in Japan) are\n *   not recognised: type `+`.\n * - Anything else is a national number in `options.country`, with its trunk\n *   prefix dropped.\n * - Blank (or separators only) is no value and no reason.\n * - The value is `null` unless the number is whole. Lengths are a sanity check:\n *   a valid result can still be a number nobody holds.\n *\/\nexport function parsePhone(text: string, options: ParsePhoneOptions = {}): PhoneParse {\n  const allowed = allowedSet(options.countries);\n  const selectedCode = options.country ? options.country.toUpperCase() : null;\n  const selected =\n    selectedCode && (!allowed || allowed.has(selectedCode)) ? findCountry(selectedCode) : undefined;\n\n  const { digits, plus, invalid } = scan(text);\n\n  if (invalid) return result(selected, digits, \"invalid_chars\");\n  if (!plus && digits.length === 0) return result(selected, \"\", null);\n\n  const international = plus || digits.startsWith(\"00\");\n  if (!international) {\n    if (!selected) return result(undefined, digits, \"unknown_country\");\n    const nsn = stripTrunk(digits, selected);\n    return result(selected, nsn, lengthReason(nsn, selected));\n  }\n\n  const rest = plus ? digits : digits.slice(2);\n\n  \/\/ Country codes are prefix-free, so the first that matches is the only one.\n  for (let length = 1; length <= 3 && length <= rest.length; length++) {\n    const dial = rest.slice(0, length);\n    const anywhere = countriesFor(dial, null);\n    if (anywhere.length === 0) continue;\n\n    const candidates = allowed ? anywhere.filter((c) => allowed.has(c.code)) : anywhere;\n    let nsn = rest.slice(length);\n    if (candidates.length === 0) return result(undefined, nsn, \"unknown_country\");\n\n    const country =\n      candidates.length === 1 ? candidates[0] : pickShared(candidates, nsn, selectedCode);\n    \/\/ \"+44 (0)20 ...\" : the national trunk 0, written inside an international number.\n    if (country.trunkPrefixes.includes(\"0\") && nsn.startsWith(\"0\")) nsn = nsn.slice(1);\n\n    return result(country, nsn, lengthReason(nsn, country), anywhere.length > 1);\n  }\n\n  \/\/ No dial code yet. Short of three digits, it may still become one.\n  if (rest.length < 3) {\n    for (const c of PHONE_COUNTRIES) {\n      if (c.dialCode.startsWith(rest) && (!allowed || allowed.has(c.code))) {\n        return result(undefined, \"\", \"too_short\");\n      }\n    }\n  }\n  return result(undefined, \"\", \"unknown_country\");\n}\n\n\/** The national number an E.164 value holds, for display. \"\" if it holds none. *\/\nexport function nationalNumberOf(\n  value: string | null,\n  options: ParsePhoneOptions = {},\n): { nationalNumber: string; country: string | null } {\n  if (!value) return { nationalNumber: \"\", country: null };\n  const parsed = parsePhone(value.startsWith(\"+\") ? value : `+${value}`, options);\n  return { nationalNumber: parsed.nationalNumber, country: parsed.country };\n}\n\n\/** A flag from two regional-indicator letters. No image, so nothing to load. *\/\nexport function flagOf(code: string): string {\n  if (code.length !== 2) return \"\";\n  let out = \"\";\n  for (let i = 0; i < 2; i++) {\n    const c = code.toUpperCase().charCodeAt(i);\n    if (c < 65 || c > 90) return \"\";\n    out += String.fromCodePoint(0x1f1e6 + (c - 65));\n  }\n  return out;\n}\n\n\/** Lower-case and without accents, so \"aland\" finds \"\u00c5land\". *\/\nexport function foldForSearch(text: string): string {\n  let out = \"\";\n  for (const ch of text.normalize(\"NFD\").toLowerCase()) {\n    const cp = ch.codePointAt(0)!;\n    if (cp >= 0x300 && cp <= 0x36f) continue;\n    out += ch;\n  }\n  return out;\n}\n","type":"registry:ui","target":"components\/fancy\/phone-input\/phone.ts"},{"path":"components\/fancy\/lib\/utils\/cn.ts","content":"import { twMerge } from \"tailwind-merge\";\n\n\/**\n * A class value: a string, a number, a conditional map, an array of any of\n * those, or nothing. Mirrors what `clsx` accepted, because every component in\n * this package already passes these shapes.\n *\/\nexport type ClassValue =\n  | string\n  | number\n  | bigint\n  | null\n  | undefined\n  | false\n  | ClassDictionary\n  | ClassValue[];\n\ntype ClassDictionary = Record<string, unknown>;\n\n\/**\n * Flatten class values into a space-separated string.\n *\n * This was `clsx` until 2026-08-19. It is roughly twenty lines of logic, it\n * shipped as a RUNTIME dependency to every consumer of this package, and its\n * last commit was 801 days old \u2014 so it fell to the rule that third-party code\n * must be both approved and actively maintained. Owning it costs less than\n * carrying it.\n *\n * `tailwind-merge` deliberately stays: deciding which of two conflicting\n * Tailwind utilities wins requires modelling the entire utility space, which is\n * emphatically not twenty lines, and it is actively maintained.\n *\n * Falsy values are dropped \u2014 including `0` and `\"\"`, which is what `clsx` did\n * and what `tests\/cn.test.ts` pins. A truthy number is kept, because digits are\n * legal class names. `bigint` is admitted because clsx's signature did and\n * the compiler proved it reachable from two call sites here.\n *\/\nfunction flatten(value: ClassValue): string {\n  if (!value) return \"\";\n\n  if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"bigint\") {\n    return String(value);\n  }\n\n  if (Array.isArray(value)) {\n    let out = \"\";\n    for (const item of value) {\n      const part = flatten(item);\n      if (part) out = out ? `${out} ${part}` : part;\n    }\n    return out;\n  }\n\n  let out = \"\";\n  for (const key in value) {\n    if (value[key]) out = out ? `${out} ${key}` : key;\n  }\n  return out;\n}\n\nexport function cn(...inputs: ClassValue[]): string {\n  return twMerge(flatten(inputs));\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/utils\/cn.ts"},{"path":"components\/fancy\/lib\/utils\/ime.ts","content":"type KeyLike = Pick<KeyboardEvent, \"isComposing\" | \"keyCode\">;\n\n\/**\n * True while this keydown belongs to an IME composition.\n *\n * A Japanese, Chinese or Korean typist presses Enter to ACCEPT the candidate\n * they are composing. A field that sends, adds or picks on Enter must ignore\n * that keypress, or the person who meant to finish a word sends half a\n * sentence instead.\n *\n * `isComposing` is the standard signal. Safari fires the confirming keydown\n * after `compositionend`, with `isComposing` already false but `keyCode` 229,\n * and older engines only ever set the keyCode, so both are read.\n *\n * Takes a native `KeyboardEvent` or a React synthetic one (via `nativeEvent`).\n *\/\nexport function isImeComposing(event: KeyLike | { nativeEvent: KeyLike }): boolean {\n  const e = \"nativeEvent\" in event ? event.nativeEvent : event;\n  return e.isComposing === true || e.keyCode === 229;\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/utils\/ime.ts"},{"path":"components\/fancy\/lib\/utils\/direction.ts","content":"\/**\n * Writing direction, read from the DOM rather than passed as a prop.\n *\n * Components follow the `dir` the browser already resolved for them, inherited\n * from the nearest ancestor that sets one (usually `<html dir=\"rtl\">`). Reading\n * the computed `direction` means a `dir` on any wrapper works, with nothing to\n * thread through props or context, and SSR renders the same markup for both\n * directions: layout is logical CSS, and only code that measures or maps keys\n * asks this question, always in an effect or an event handler.\n *\/\nexport type Direction = \"ltr\" | \"rtl\";\n\nexport function directionOf(el: Element | null | undefined): Direction {\n  if (!el || typeof window === \"undefined\" || typeof getComputedStyle !== \"function\") return \"ltr\";\n  return getComputedStyle(el).direction === \"rtl\" ? \"rtl\" : \"ltr\";\n}\n\nexport function isRtl(el: Element | null | undefined): boolean {\n  return directionOf(el) === \"rtl\";\n}\n\n\/**\n * The LOGICAL step a horizontal arrow key means: +1 toward the inline end\n * (\"next\"), -1 toward the inline start (\"previous\"), 0 for any other key.\n *\n * ArrowRight moves visually right in both directions, and visually right is\n * the inline END in LTR but the inline START in RTL.\n *\/\nexport function inlineStep(key: string, el: Element | null | undefined): -1 | 0 | 1 {\n  if (key !== \"ArrowRight\" && key !== \"ArrowLeft\") return 0;\n  const forward = key === \"ArrowRight\" ? 1 : -1;\n  return (isRtl(el) ? -forward : forward) as -1 | 1;\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/utils\/direction.ts"},{"path":"components\/fancy\/lib\/hooks\/use-controllable-state.ts","content":"import { useCallback, useRef, useState } from \"react\";\n\n\/**\n * One state slot that works controlled or uncontrolled.\n *\n * ---------------------------------------------------------------------------\n * Why the value is tracked in a ref (fixed 5.32.0)\n * ---------------------------------------------------------------------------\n *\n * This resolved a functional update against the RENDER CLOSURE's `value` and then\n * handed React an already-computed value:\n *\n *     const nextValue = typeof next === \"function\" ? next(value) : next;\n *     setUncontrolledValue(nextValue);\n *\n * So `setValue(fn)` twice in one batch had both calls compute from the same stale\n * `value`, and **the first update was silently lost.** React's own `setState`\n * updater form does not have that problem precisely because React resolves it\n * against the latest state; passing a pre-computed value gives that up.\n *\n * Found by a hook test that paste-held two items inside one `act()` and got one.\n * It is not an exotic case \u2014 any caller that loops, or handles two events in a\n * batch, hits it, and the symptom is a dropped update with nothing to indicate one\n * happened.\n *\n * The fix cannot be \"pass the updater to React\", because `onChange` has to be\n * called with the resulting value and an updater must stay pure \u2014 React may invoke\n * it twice (StrictMode), which would fire `onChange` twice. So the previous value\n * comes from a ref that is re-synced from the authoritative `value` on every render\n * and advanced on every set. Within a batch the ref carries intent; after a render\n * the real value wins.\n *\n * A side effect worth having: `setValue` no longer depends on `value`, so it is\n * stable for the life of the component.\n *\/\nexport function useControllableState<T>(\n  controlledValue: T | undefined,\n  defaultValue: T,\n  onChange?: (value: T) => void,\n): [T, (value: T | ((prev: T) => T)) => void] {\n  const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n  const isControlled = controlledValue !== undefined;\n  const value = isControlled ? controlledValue : uncontrolledValue;\n\n  const onChangeRef = useRef(onChange);\n  onChangeRef.current = onChange;\n\n  \/\/ Re-synced every render from whichever side owns the value. A controlled parent\n  \/\/ that ignores `onChange` therefore wins on the next render rather than being\n  \/\/ overridden by what this hook optimistically recorded.\n  const valueRef = useRef(value);\n  valueRef.current = value;\n\n  const isControlledRef = useRef(isControlled);\n  isControlledRef.current = isControlled;\n\n  const setValue = useCallback((next: T | ((prev: T) => T)) => {\n    const nextValue =\n      typeof next === \"function\"\n        ? (next as (prev: T) => T)(valueRef.current)\n        : next;\n\n    \/\/ Advance the ref BEFORE notifying, so a second call in the same batch builds\n    \/\/ on this one instead of on what the last render saw.\n    valueRef.current = nextValue;\n\n    if (!isControlledRef.current) {\n      setUncontrolledValue(nextValue);\n    }\n\n    onChangeRef.current?.(nextValue);\n  }, []);\n\n  return [value, setValue];\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/hooks\/use-controllable-state.ts"},{"path":"components\/fancy\/lib\/hooks\/use-floating-position.ts","content":"import { useCallback, useEffect, useState, type RefObject } from \"react\";\nimport type { Placement } from \"..\/utils\/types\";\nimport { directionOf, type Direction } from \"..\/utils\/direction\";\n\ninterface FloatingPosition {\n  x: number;\n  y: number;\n  placement: Placement;\n  \/**\n   * The anchor's writing direction. Put it on the floating element as `dir`:\n   * a floating element is portalled to `<body>`, so without it a `dir` set on\n   * a wrapper (rather than on `<html>`) would not reach the popup.\n   *\/\n  dir: Direction;\n}\n\ninterface UseFloatingPositionOptions {\n  placement?: Placement;\n  offset?: number;\n  enabled?: boolean;\n}\n\nfunction getPosition(\n  anchor: DOMRect,\n  floating: DOMRect,\n  placement: Placement,\n  offset: number,\n  dir: Direction = \"ltr\",\n): FloatingPosition {\n  let x = 0;\n  let y = 0;\n  const base = placement.split(\"-\")[0] as \"top\" | \"bottom\" | \"left\" | \"right\";\n  const align = placement.split(\"-\")[1] as \"start\" | \"end\" | undefined;\n\n  switch (base) {\n    case \"top\":\n      x = anchor.left + anchor.width \/ 2 - floating.width \/ 2;\n      y = anchor.top - floating.height - offset;\n      break;\n    case \"bottom\":\n      x = anchor.left + anchor.width \/ 2 - floating.width \/ 2;\n      y = anchor.bottom + offset;\n      break;\n    case \"left\":\n      x = anchor.left - floating.width - offset;\n      y = anchor.top + anchor.height \/ 2 - floating.height \/ 2;\n      break;\n    case \"right\":\n      x = anchor.right + offset;\n      y = anchor.top + anchor.height \/ 2 - floating.height \/ 2;\n      break;\n  }\n\n  \/\/ `start` \/ `end` are LOGICAL: `bottom-start` lines the popup up with the\n  \/\/ anchor's inline-start edge, which is its RIGHT edge in RTL. The base side\n  \/\/ (`left` \/ `right`) stays physical, as the names say.\n  if (base === \"top\" || base === \"bottom\") {\n    const startEdge = dir === \"rtl\" ? anchor.right - floating.width : anchor.left;\n    const endEdge = dir === \"rtl\" ? anchor.left : anchor.right - floating.width;\n    if (align === \"start\") x = startEdge;\n    else if (align === \"end\") x = endEdge;\n  }\n\n  if (base === \"left\" || base === \"right\") {\n    if (align === \"start\") y = anchor.top;\n    else if (align === \"end\") y = anchor.bottom - floating.height;\n  }\n\n  \/\/ Viewport clamping\n  let finalPlacement = placement;\n  const vw = window.innerWidth;\n  const vh = window.innerHeight;\n\n  if (base === \"bottom\" && y + floating.height > vh) {\n    y = anchor.top - floating.height - offset;\n    finalPlacement = placement.replace(\"bottom\", \"top\") as Placement;\n  } else if (base === \"top\" && y < 0) {\n    y = anchor.bottom + offset;\n    finalPlacement = placement.replace(\"top\", \"bottom\") as Placement;\n  } else if (base === \"left\" && x < 0) {\n    \/\/ The sides flip too, so a `left` \/ `right` popup is not clamped back on\n    \/\/ top of its own anchor when the viewport edge is close.\n    x = anchor.right + offset;\n    finalPlacement = placement.replace(\"left\", \"right\") as Placement;\n  } else if (base === \"right\" && x + floating.width > vw) {\n    x = anchor.left - floating.width - offset;\n    finalPlacement = placement.replace(\"right\", \"left\") as Placement;\n  }\n\n  x = Math.max(4, Math.min(x, vw - floating.width - 4));\n  y = Math.max(4, Math.min(y, vh - floating.height - 4));\n\n  return { x, y, placement: finalPlacement, dir };\n}\n\nexport function useFloatingPosition(\n  anchorRef: RefObject<HTMLElement | null>,\n  floatingRef: RefObject<HTMLElement | null>,\n  options: UseFloatingPositionOptions = {},\n): FloatingPosition {\n  const { placement = \"bottom\", offset = 8, enabled = true } = options;\n  const [position, setPosition] = useState<FloatingPosition>({\n    x: -9999,\n    y: -9999,\n    placement,\n    dir: \"ltr\",\n  });\n\n  const update = useCallback(() => {\n    const anchor = anchorRef.current;\n    const floating = floatingRef.current;\n    if (!anchor || !floating) return;\n\n    const anchorRect = anchor.getBoundingClientRect();\n    \/\/ The popup's SIZE comes from layout, not from its transformed box: popups\n    \/\/ open with `fancy-scale-in` (scale 0.95 to 1) and are measured during it, so\n    \/\/ the box is 5% small, and nothing re-measures when the animation ends. That\n    \/\/ left an RTL `bottom-start` (and an LTR `bottom-end`) popup off the anchor's\n    \/\/ edge for good. Layout size is 0 where nothing lays out (jsdom), so the box\n    \/\/ is the fallback.\n    const box = floating.getBoundingClientRect();\n    const floatingRect = {\n      width: floating.offsetWidth || box.width,\n      height: floating.offsetHeight || box.height,\n    } as DOMRect;\n    const next = getPosition(anchorRect, floatingRect, placement, offset, directionOf(anchor));\n    \/\/ Bail out when nothing changed so this can run after every commit\n    \/\/ (below) without causing an infinite render loop.\n    setPosition((prev) =>\n      prev.x === next.x && prev.y === next.y && prev.placement === next.placement && prev.dir === next.dir\n        ? prev\n        : next,\n    );\n  }, [anchorRef, floatingRef, placement, offset]);\n\n  \/\/ Re-measure after every commit while open.\n  \/\/\n  \/\/ The floating element mounts a frame or two AFTER `enabled` flips \u2014 its\n  \/\/ render is gated behind a state flip (e.g. useAnimation's `mounted`), so at\n  \/\/ the moment `enabled` turns true the floating ref is still null and a single\n  \/\/ measurement no-ops, leaving the popover parked at its off-screen sentinel.\n  \/\/\n  \/\/ A passive effect with no deps runs after *every* commit \u2014 including the one\n  \/\/ that finally mounts the floating element \u2014 and, crucially, keeps running in\n  \/\/ hidden\/background tabs where `requestAnimationFrame` is paused. The bail-out\n  \/\/ in `update` makes the steady-state calls free, so this both fixes the\n  \/\/ late-mount race and survives tab-visibility throttling.\n  useEffect(() => {\n    if (enabled) update();\n  });\n\n  \/\/ \u2026but the per-commit effect ISN'T enough when the floating element mounts\n  \/\/ through a <Portal> whose own mount gate (SSR-safe; renders nothing until its\n  \/\/ useEffect runs) attaches the node WITHOUT re-rendering this hook's component.\n  \/\/ Then no commit happens here, the measurement never runs, and the popover\n  \/\/ stays parked at its off-screen sentinel until an unrelated scroll\/resize\n  \/\/ fires `update()` \u2014 the \"menu only appears after I scroll\" bug. Poll with rAF\n  \/\/ until the node is actually in the DOM, measure it, then keep it observed for\n  \/\/ size changes (async content \/ lazily-loaded icons).\n  useEffect(() => {\n    if (!enabled) return;\n    let raf = 0;\n    let ro: ResizeObserver | null = null;\n    const tick = () => {\n      const el = floatingRef.current;\n      if (el) {\n        update();\n        if (typeof ResizeObserver !== \"undefined\") {\n          ro = new ResizeObserver(() => update());\n          ro.observe(el);\n        }\n      } else {\n        raf = requestAnimationFrame(tick);\n      }\n    };\n    raf = requestAnimationFrame(tick);\n    return () => {\n      cancelAnimationFrame(raf);\n      ro?.disconnect();\n    };\n  }, [enabled, update, floatingRef]);\n\n  \/\/ Park off-screen when closed so the next open re-measures from scratch.\n  useEffect(() => {\n    if (!enabled) {\n      setPosition((prev) =>\n        prev.x === -9999 ? prev : { x: -9999, y: -9999, placement, dir: prev.dir },\n      );\n    }\n  }, [enabled, placement]);\n\n  \/\/ Reposition on scroll\/resize while open.\n  useEffect(() => {\n    if (!enabled) return;\n\n    window.addEventListener(\"scroll\", update, true);\n    window.addEventListener(\"resize\", update);\n\n    return () => {\n      window.removeEventListener(\"scroll\", update, true);\n      window.removeEventListener(\"resize\", update);\n    };\n  }, [update, enabled]);\n\n  return position;\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/hooks\/use-floating-position.ts"},{"path":"components\/fancy\/lib\/hooks\/use-outside-click.ts","content":"import { useEffect, type RefObject } from \"react\";\n\nexport function useOutsideClick(\n  ref: RefObject<HTMLElement | null>,\n  handler: (event: MouseEvent | TouchEvent) => void,\n  enabled: boolean = true,\n  ignoreRef?: RefObject<HTMLElement | null>,\n): void {\n  useEffect(() => {\n    if (!enabled) return;\n\n    const listener = (event: MouseEvent | TouchEvent) => {\n      const el = ref.current;\n      if (!el || el.contains(event.target as Node)) return;\n      \/\/ Ignore clicks on the trigger\/anchor element \u2014 the trigger's\n      \/\/ own onClick handler manages toggling.\n      if (ignoreRef?.current?.contains(event.target as Node)) return;\n      handler(event);\n    };\n\n    document.addEventListener(\"mousedown\", listener);\n    document.addEventListener(\"touchstart\", listener);\n\n    return () => {\n      document.removeEventListener(\"mousedown\", listener);\n      document.removeEventListener(\"touchstart\", listener);\n    };\n  }, [ref, handler, enabled, ignoreRef]);\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/hooks\/use-outside-click.ts"},{"path":"components\/fancy\/lib\/hooks\/use-escape-key.ts","content":"import { createContext, useContext, useEffect, useRef } from \"react\";\n\n\/**\n * Escape belongs to the innermost open layer.\n *\n * Every `useEscapeKey(handler, enabled)` call is a LAYER while `enabled`: a\n * Dropdown's menu, a Select's listbox, a Popover, a Modal, a Drawer, a Tooltip,\n * a full-screen surface. They all join one stack, one document listener reads\n * each Escape, and only one layer gets it.\n *\n * Why not one document listener per layer, as this hook used to do: every\n * open layer then received the same Escape. A Dropdown inside a Modal closed\n * the menu AND the dialog. Inside a full-screen surface it was worse: the\n * surface's own key handler runs during the event's trip through the surface,\n * before any document listener, so it could not tell that a menu wanted the\n * key. DeckEditor exited full screen with its Shape menu still open. Fixing\n * that by ordering listeners would only last until someone registers one in a\n * different place. So the decision is made from the stack instead.\n *\n * \"Innermost\" is decided in two steps:\n *\n * 1. The most recently opened layer is the candidate. Opening a menu from a\n *    dialog is the normal order of things.\n * 2. A full-screen surface knows its own descendants: layers rendered inside\n *    it register under it through `EscapeLayerContext`, and that context flows\n *    through portals. If the candidate is a surface with open layers inside,\n *    the most recent of those wins instead. Without this step, a menu opened\n *    BEFORE an agent put its surface full screen would lose the Escape to the\n *    surface.\n *\n * An Escape that something already handled (`event.defaultPrevented`, for\n * example a text field clearing itself) is left alone.\n *\/\n\ninterface LayerEntry {\n  handler: { current: () => void };\n  \/** The surface this layer was rendered inside, if any. *\/\n  parent: EscapeScope | null;\n  \/** Set when the layer IS a surface: layers inside it point here. *\/\n  scope: EscapeScope | null;\n}\n\n\/** Identity of a full-screen surface for the layers rendered inside it. *\/\nexport type EscapeScope = object;\n\nconst stack: LayerEntry[] = [];\n\n\/** The surface (if any) that layers rendered here belong to. *\/\nexport const EscapeLayerContext = createContext<EscapeScope | null>(null);\n\nfunction innermost(): LayerEntry | undefined {\n  let candidate = stack[stack.length - 1];\n  while (candidate?.scope) {\n    const scope = candidate.scope;\n    let inner: LayerEntry | undefined;\n    for (let i = stack.length - 1; i >= 0; i--) {\n      if (stack[i].parent === scope) {\n        inner = stack[i];\n        break;\n      }\n    }\n    if (!inner) break;\n    candidate = inner;\n  }\n  return candidate;\n}\n\nfunction onDocumentKeyDown(event: KeyboardEvent) {\n  if (event.key !== \"Escape\" || event.defaultPrevented) return;\n  const target = innermost();\n  if (!target) return;\n  event.preventDefault();\n  target.handler.current();\n}\n\nfunction push(entry: LayerEntry): () => void {\n  if (stack.length === 0) document.addEventListener(\"keydown\", onDocumentKeyDown);\n  stack.push(entry);\n  return () => {\n    const i = stack.indexOf(entry);\n    if (i >= 0) stack.splice(i, 1);\n    if (stack.length === 0) document.removeEventListener(\"keydown\", onDocumentKeyDown);\n  };\n}\n\n\/**\n * Register a layer that closes on Escape while `enabled`. Pass `scope` only for\n * a surface that other layers can open inside (a full-screen surface).\n *\n * Returns `isInnermost()`, for a layer that also handles Escape in its own key\n * handler and must not act when a layer above it owns the key.\n *\n * @internal Exported for full-screen surfaces in sibling packages; ordinary\n * layers call `useEscapeKey`.\n *\/\nexport function useEscapeLayer(\n  handler: () => void,\n  enabled: boolean,\n  scope: EscapeScope | null = null,\n): { isInnermost: () => boolean } {\n  const parent = useContext(EscapeLayerContext);\n  const handlerRef = useRef(handler);\n  handlerRef.current = handler;\n  const entryRef = useRef<LayerEntry | null>(null);\n\n  \/\/ Depends on `enabled` (and identity), NOT on `handler`: callers pass inline\n  \/\/ callbacks, and re-registering on every render would move a dialog above\n  \/\/ the menu it had just opened.\n  useEffect(() => {\n    if (!enabled) return;\n    const entry: LayerEntry = { handler: handlerRef, parent, scope };\n    entryRef.current = entry;\n    const pop = push(entry);\n    return () => {\n      pop();\n      if (entryRef.current === entry) entryRef.current = null;\n    };\n  }, [enabled, parent, scope]);\n\n  const isInnermostRef = useRef(() => entryRef.current !== null && innermost() === entryRef.current);\n  return { isInnermost: isInnermostRef.current };\n}\n\nexport function useEscapeKey(handler: () => void, enabled: boolean = true): void {\n  useEscapeLayer(handler, enabled);\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/hooks\/use-escape-key.ts"},{"path":"components\/fancy\/lib\/components\/inputs\/inputs.utils.ts","content":"import { createElement, Fragment, type AriaAttributes, type ReactNode } from \"react\";\nimport type { Size } from \"..\/..\/utils\/types\";\nimport type { InputOption, OptionDir } from \".\/inputs.types\";\n\nexport const inputSizeClasses: Record<Size, string> = {\n  xs: \"px-2 py-1 text-xs rounded\",\n  sm: \"px-2.5 py-1.5 text-sm rounded-md\",\n  md: \"px-3 py-2 text-sm rounded-lg\",\n  lg: \"px-4 py-2.5 text-base rounded-lg\",\n  xl: \"px-5 py-3 text-lg rounded-xl\",\n};\n\nexport const labelSizeClasses: Record<Size, string> = {\n  xs: \"text-xs\",\n  sm: \"text-xs\",\n  md: \"text-sm\",\n  lg: \"text-sm\",\n  xl: \"text-base\",\n};\n\nexport function dirtyClasses(dirty?: boolean): string {\n  return dirty ? \"border-s-[3px] border-s-amber-400\" : \"\";\n}\n\nexport function dirtyRingClasses(dirty?: boolean): string {\n  return dirty ? \"ring-2 ring-amber-400\/50\" : \"\";\n}\n\n\/**\n * Validation text: the error message and the required asterisk of Field,\n * Checkbox and Switch. Reads the `error` theme token (CC-fancy-0018, 6.19.0);\n * its defaults clear WCAG 1.4.3's 4.5:1 for small text. red-600 is 4.77:1 on\n * white; red-400 is 5.74:1 on #1e1e24, 6.13:1 on zinc-900, 5.16:1 on zinc-800.\n * The old `text-red-500` was 3.81:1 on white and 3.91:1 on zinc-800.\n *\/\nexport const ERROR_TEXT =\n  \"text-[color:var(--fancy-error,var(--color-red-600))] dark:text-[color:var(--fancy-error-dark,var(--color-red-400))]\";\n\nexport function errorClasses(error?: string): string {\n  return error ? \"border-red-500 focus:ring-red-500\" : \"\";\n}\n\n\/**\n * What a control needs to expose its error and description to assistive\n * technology (6.20.0, K1 of the full-kit benchmark). Every form control had\n * rendered its `error` as a plain paragraph: no `aria-invalid`, no\n * `aria-describedby`, nothing announced.\n *\n * `errorId` \/ `descriptionId` go to `Field` (which renders the message with\n * those ids, the error as `role=\"alert\"`); `aria` goes on the control. The\n * description is only rendered while there is no error, so the control is\n * described by whichever of the two is on screen, after any id the host passed.\n *\/\nexport function fieldAria(\n  id: string,\n  {\n    error,\n    description,\n    describedBy,\n    invalid,\n  }: {\n    error?: unknown;\n    description?: unknown;\n    \/** The host's own `aria-describedby`, kept ahead of the message id. *\/\n    describedBy?: string;\n    \/** The host's own `aria-invalid` (NumberField, PhoneInput), kept when there is no `error`. *\/\n    invalid?: unknown;\n  },\n): {\n  errorId: string;\n  descriptionId: string;\n  aria: { \"aria-invalid\": AriaAttributes[\"aria-invalid\"]; \"aria-describedby\": string | undefined };\n} {\n  const errorId = `${id}-error`;\n  const descriptionId = `${id}-description`;\n  const own = error ? errorId : description ? descriptionId : undefined;\n  const ids = [describedBy, own].filter(Boolean).join(\" \");\n  return {\n    errorId,\n    descriptionId,\n    aria: {\n      \"aria-invalid\": error ? true : (invalid as AriaAttributes[\"aria-invalid\"]),\n      \"aria-describedby\": ids || undefined,\n    },\n  };\n}\n\nexport const inputBaseClasses =\n  \"border border-[color:var(--fancy-border-strong,var(--color-zinc-500))] bg-[color:var(--fancy-input,var(--color-white))] text-[color:var(--fancy-text,var(--color-zinc-900))] placeholder:text-[color:var(--fancy-text-muted,var(--color-zinc-500))] transition-[border-color,box-shadow] duration-150 focus:outline-none focus:ring-2 focus:ring-[color:var(--fancy-focus,var(--color-blue-500))]\/40 focus:border-[color:var(--fancy-focus,var(--color-blue-500))] disabled:opacity-50 disabled:cursor-not-allowed dark:border-[color:var(--fancy-border-strong-dark,var(--color-zinc-500))] dark:bg-[color:var(--fancy-input-dark,#1e1e24)] dark:text-[color:var(--fancy-text-dark,var(--color-zinc-100))] dark:placeholder:text-[color:var(--fancy-text-muted-dark,var(--color-zinc-400))] dark:focus:border-[color:var(--fancy-focus-dark,var(--color-blue-400))] dark:focus:ring-[color:var(--fancy-focus-dark,var(--color-blue-400))]\/20\";\n\nexport function resolveOption<V = string>(\n  option: InputOption<V>,\n): Exclude<InputOption<V>, string> {\n  if (typeof option === \"string\") {\n    return { value: option as unknown as V, label: option };\n  }\n  return option;\n}\n\n\/**\n * The `lang` \/ `dir` attributes for the element holding an option's label.\n * Only the keys that are set, so an option without them renders exactly as it\n * did before 6.13.0.\n *\/\nexport function optionLangProps(option: { lang?: string; dir?: OptionDir } | null | undefined): {\n  lang?: string;\n  dir?: OptionDir;\n} {\n  const out: { lang?: string; dir?: OptionDir } = {};\n  if (option?.lang) out.lang = option.lang;\n  if (option?.dir) out.dir = option.dir;\n  return out;\n}\n\n\/**\n * An option's label as a view-mode value: wrapped in a span carrying its\n * `lang` \/ `dir` when it has them, the bare string otherwise.\n *\/\nexport function optionLabelNode(\n  option: { label: string; lang?: string; dir?: OptionDir } | null | undefined,\n  fallback?: ReactNode,\n): ReactNode {\n  if (!option) return fallback;\n  const attrs = optionLangProps(option);\n  return attrs.lang || attrs.dir ? createElement(\"span\", attrs, option.label) : option.label;\n}\n\n\/**\n * Several labels joined with \", \". Stays one plain string unless an option\n * carries `lang` \/ `dir`, so existing output does not change.\n *\/\nexport function optionLabelList(\n  options: Array<{ label: string; lang?: string; dir?: OptionDir } | string>,\n): ReactNode {\n  const tagged = options.some((o) => typeof o !== \"string\" && (o.lang || o.dir));\n  if (!tagged) return options.map((o) => (typeof o === \"string\" ? o : o.label)).join(\", \");\n  return options.map((o, i) =>\n    createElement(Fragment, { key: i }, i > 0 ? \", \" : null, typeof o === \"string\" ? o : optionLabelNode(o)),\n  );\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/components\/inputs\/inputs.utils.ts"},{"path":"components\/fancy\/lib\/utils\/types.ts","content":"import type { ElementType } from \"react\";\n\nexport type Size = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\n\/**\n * What a navigation primitive owes a router.\n *\n * Every nav surface here \u2014 `Navbar.Item`, `Sidebar.Item`, `Menu.Item`,\n * `MobileMenu.Item`, `Breadcrumbs.Item` \u2014 used to hardcode a plain `<a href>`.\n * That is a FULL PAGE LOAD in every client-routed app, and the only way around\n * it was to nest a router `<Link>` inside the item: an anchor inside an anchor,\n * which is invalid HTML and the same nested-anchor shape that already cost this\n * suite an SSR hydration bug.\n *\n * `as` is the seam {@link ButtonProps.as} already had. It is router-agnostic on\n * purpose \u2014 one prop serves Inertia, TanStack Router, React Router and Next\n * rather than a package per router:\n *\n * ```tsx\n * \/\/ href-based routers (Inertia, Next)\n * <Navbar.Item as={Link} href=\"\/dashboard\">Dashboard<\/Navbar.Item>\n *\n * \/\/ to-based routers (TanStack Router, React Router) \u2014 `to` reaches the Link\n * \/\/ through the forwarded rest props\n * <Navbar.Item as={Link} to=\"\/dashboard\">Dashboard<\/Navbar.Item>\n * ```\n *\n * Link mode engages on `href` OR `as`, because a `to`-based router never passes\n * an `href` and would otherwise silently render the non-interactive fallback.\n *\/\nexport interface NavigableProps {\n  \/** Target URL. Renders link mode with a plain `<a>` unless `as` is given. *\/\n  href?: string;\n  \/**\n   * Link-mode element override \u2014 the component to render INSTEAD of the plain\n   * `<a>`, e.g. a router's `<Link>` so navigation happens client-side. Receives\n   * `className`, the item's `data-*` handles, and every unrecognized prop, so\n   * router-specific props (`to`, `params`, `preload`, `search`) pass straight\n   * through. Ignored in button mode.\n   *\/\n  as?: ElementType;\n}\n\n\/**\n * The full Tailwind v4 named color palette \u2014 every default hue, including all\n * five gray families \u2014 plus `brand`, the host's own colour. Components that\n * accept a `color` should type it as this so the whole palette is available.\n *\n * `brand` is not a hue. It resolves through three CSS variables the host sets\n * once, rather than through a Tailwind scale:\n *\n *   `--color-brand`, `--color-brand-contrast`, `--color-brand-hover`\n *\n * Three rather than one because a generated hover assumes \"same hue, darker\",\n * and a brand palette need not work that way \u2014 navy whose hover is gold cannot\n * be derived from navy by any amount of arithmetic. The host states it.\n *\/\nexport type Color =\n  \/\/ the host's own colour, resolved from CSS variables (see styles.css)\n  | \"brand\"\n  \/\/ grays\n  | \"slate\"\n  | \"gray\"\n  | \"zinc\"\n  | \"neutral\"\n  | \"stone\"\n  \/\/ hues\n  | \"red\"\n  | \"orange\"\n  | \"amber\"\n  | \"yellow\"\n  | \"lime\"\n  | \"green\"\n  | \"emerald\"\n  | \"teal\"\n  | \"cyan\"\n  | \"sky\"\n  | \"blue\"\n  | \"indigo\"\n  | \"violet\"\n  | \"purple\"\n  | \"fuchsia\"\n  | \"pink\"\n  | \"rose\";\n\n\/** Every value of {@link Color}, for building exhaustive class maps. *\/\nexport const COLORS = [\n  \"brand\",\n  \"slate\", \"gray\", \"zinc\", \"neutral\", \"stone\",\n  \"red\", \"orange\", \"amber\", \"yellow\", \"lime\", \"green\", \"emerald\", \"teal\",\n  \"cyan\", \"sky\", \"blue\", \"indigo\", \"violet\", \"purple\", \"fuchsia\", \"pink\", \"rose\",\n] as const satisfies readonly Color[];\n\nexport type Variant = \"solid\" | \"outline\" | \"ghost\" | \"soft\";\n\n\/** Button accepts the full Tailwind v4 palette (alias of {@link Color}). *\/\nexport type ButtonColor = Color;\n\n\/**\n * @deprecated Renamed to {@link ButtonColor}. `ActionColor` remains as an alias\n * for backward compatibility and will be removed in a future major version.\n *\/\nexport type ActionColor = ButtonColor;\n\nexport type Placement =\n  | \"top\"\n  | \"bottom\"\n  | \"left\"\n  | \"right\"\n  | \"top-start\"\n  | \"top-end\"\n  | \"bottom-start\"\n  | \"bottom-end\";\n","type":"registry:lib","target":"components\/fancy\/lib\/utils\/types.ts"},{"path":"components\/fancy\/lib\/components\/inputs\/inputs.types.ts","content":"import type { ReactNode } from \"react\";\nimport type { Size } from \"..\/..\/utils\/types\";\n\n\/** Text direction of one option's label. *\/\nexport type OptionDir = \"ltr\" | \"rtl\" | \"auto\";\n\nexport type InputOption<V = string> =\n  | string\n  | {\n      value: V;\n      label: string;\n      disabled?: boolean;\n      description?: string;\n      \/**\n       * BCP 47 language of `label`, when it differs from the page's: a language\n       * switcher that names each language in itself (WCAG 3.1.2, language of\n       * parts). Rendered as `lang` on the element holding the label, including\n       * the selected-value display. Unset renders no attribute.\n       *\/\n      lang?: string;\n      \/**\n       * Direction of `label`: `\"rtl\"` for a right-to-left script inside a\n       * left-to-right control. `\"auto\"` is available; nothing is added when\n       * unset.\n       *\/\n      dir?: OptionDir;\n    };\n\nexport type InputOptionGroup<V = string> = {\n  label: string;\n  options: InputOption<V>[];\n};\n\n\/**\n * Edit vs. read-only display. In `\"view\"` mode an input renders the bound value\n * as static text instead of an interactive control \u2014 the React\/Inertia analog of\n * Livewire's public\/bindable properties. Declared here (rather than in `mode\/`)\n * to keep `InputBaseProps` free of an import cycle. Resolved per input via\n * {@link useFieldMode}: explicit prop \u2192 `<Form>`\/`<FormProvider>` context \u2192 `\"edit\"`.\n *\/\nexport type FieldMode = \"edit\" | \"view\";\n\nexport interface InputBaseProps {\n  size?: Size;\n  dirty?: boolean;\n  error?: string;\n  label?: string;\n  \/**\n   * Keep the label for assistive tech, but do not draw it.\n   *\n   * For a control whose options already say what it does \u2014 a filter toolbar's\n   * segmented switches, say \u2014 where a visible label is noise but an unnamed\n   * control is a bug. Without this the only choices were an unnamed control or\n   * a label the design does not have, and the silent one is the one that ships.\n   *\/\n  labelHidden?: boolean;\n  description?: string;\n  required?: boolean;\n  disabled?: boolean;\n  className?: string;\n  id?: string;\n  name?: string;\n  \/** `\"edit\"` (default) renders the control; `\"view\"` renders the value as text. Overrides the `<Form mode>` context. *\/\n  mode?: FieldMode;\n}\n\nexport type AffixPosition = \"inside\" | \"outside\";\n\nexport interface InputAffixProps {\n  prefix?: ReactNode;\n  suffix?: ReactNode;\n  prefixPosition?: AffixPosition;\n  suffixPosition?: AffixPosition;\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/components\/inputs\/inputs.types.ts"},{"path":"components\/fancy\/lib\/hooks\/use-adornment-width.ts","content":"import { useCallback, useEffect, useState } from \"react\";\n\n\/**\n * Measure an inline adornment so the input can reserve exactly its width.\n *\n * ## Why this exists\n *\n * `leading` \/ `trailing` render ABSOLUTELY over the input, so they take no\n * space in flow and the input must be padded by hand to keep text clear of\n * them. That padding used to be a fixed `pl-9` \/ `pr-9` (now `ps-9` \/ `pe-9`) \u2014 36px, sized for a\n * single icon. Any wider adornment ran straight under the value: `leading =\n * \"https:\/\/\"` is roughly 50px, so `https:\/\/` and `fancy.app` rendered on top of\n * one another.\n *\n * A fixed padding cannot be right for arbitrary content, and these props accept\n * arbitrary content \u2014 a currency code, a unit, a protocol, a short label. So\n * the width is measured rather than assumed.\n *\n * Returns `0` until measured (and on the server), which is the signal to keep\n * the old fixed padding as a fallback: an unmeasured render is then no worse\n * than it was before, rather than unpadded.\n *\n * `ResizeObserver` rather than a one-shot read, because the width changes after\n * first paint for reasons the first paint cannot see \u2014 a webfont swapping in,\n * the adornment's own content changing, a container query resizing the text.\n *\/\nexport function useAdornmentWidth(): [(node: HTMLElement | null) => void, number] {\n  const [width, setWidth] = useState(0);\n  const [node, setNode] = useState<HTMLElement | null>(null);\n\n  const ref = useCallback((n: HTMLElement | null) => setNode(n), []);\n\n  useEffect(() => {\n    if (!node) {\n      setWidth(0);\n\n      return;\n    }\n\n    const read = () => setWidth(node.getBoundingClientRect().width);\n    read();\n\n    if (typeof ResizeObserver === \"undefined\") return;\n\n    const observer = new ResizeObserver(read);\n    observer.observe(node);\n\n    return () => observer.disconnect();\n  }, [node]);\n\n  return [ref, width];\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/hooks\/use-adornment-width.ts"},{"path":"components\/fancy\/lib\/components\/inputs\/InputWrapper.tsx","content":"import type { ReactNode } from \"react\";\nimport { cn } from \"..\/..\/utils\/cn\";\nimport type { AffixPosition } from \".\/inputs.types\";\nimport type { Size } from \"..\/..\/utils\/types\";\n\ninterface InputWrapperProps {\n  children: ReactNode;\n  prefix?: ReactNode;\n  suffix?: ReactNode;\n  prefixPosition?: AffixPosition;\n  suffixPosition?: AffixPosition;\n  size?: Size;\n  \/** Extra padding className to apply to the input when affixes are \"inside\" *\/\n  insidePrefixPadding?: string;\n  insideSuffixPadding?: string;\n}\n\n\/\/ NOTE: these must be COMPLETE, static class strings. Tailwind only detects\n\/\/ utilities it can see verbatim in the source \u2014 building the arbitrary variant\n\/\/ at runtime (e.g. `[&_input]:${\"pl-9\"}`) means `[&_input]:ps-9` is never\n\/\/ emitted to CSS, so the inside affix gets no padding and overlaps the text\n\/\/ (issue #6). Keep input\/select\/textarea spelled out here.\nconst insidePaddingLeft: Record<Size, string> = {\n  xs: \"[&_input]:ps-7 [&_select]:ps-7 [&_textarea]:ps-7\",\n  sm: \"[&_input]:ps-8 [&_select]:ps-8 [&_textarea]:ps-8\",\n  md: \"[&_input]:ps-9 [&_select]:ps-9 [&_textarea]:ps-9\",\n  lg: \"[&_input]:ps-10 [&_select]:ps-10 [&_textarea]:ps-10\",\n  xl: \"[&_input]:ps-11 [&_select]:ps-11 [&_textarea]:ps-11\",\n};\n\nconst insidePaddingRight: Record<Size, string> = {\n  xs: \"[&_input]:pe-7 [&_select]:pe-7 [&_textarea]:pe-7\",\n  sm: \"[&_input]:pe-8 [&_select]:pe-8 [&_textarea]:pe-8\",\n  md: \"[&_input]:pe-9 [&_select]:pe-9 [&_textarea]:pe-9\",\n  lg: \"[&_input]:pe-10 [&_select]:pe-10 [&_textarea]:pe-10\",\n  xl: \"[&_input]:pe-11 [&_select]:pe-11 [&_textarea]:pe-11\",\n};\n\nconst affixOutsideClasses =\n  \"inline-flex items-center border border-[color:var(--fancy-border-strong,var(--color-zinc-500))] bg-zinc-50 px-3 text-sm text-[color:var(--fancy-text-muted,var(--color-zinc-500))] dark:border-[color:var(--fancy-border-strong-dark,var(--color-zinc-500))] dark:bg-zinc-800 dark:text-[color:var(--fancy-text-muted-dark,var(--color-zinc-400))]\";\n\nexport function InputWrapper({\n  children,\n  prefix,\n  suffix,\n  prefixPosition = \"inside\",\n  suffixPosition = \"inside\",\n  size = \"md\",\n}: InputWrapperProps) {\n  const hasInsidePrefix = prefix && prefixPosition === \"inside\";\n  const hasInsideSuffix = suffix && suffixPosition === \"inside\";\n  const hasOutsidePrefix = prefix && prefixPosition === \"outside\";\n  const hasOutsideSuffix = suffix && suffixPosition === \"outside\";\n  const hasOutside = hasOutsidePrefix || hasOutsideSuffix;\n\n  if (!prefix && !suffix) {\n    return <>{children}<\/>;\n  }\n\n  if (hasOutside) {\n    return (\n      <div data-react-fancy-input-wrapper=\"\" className=\"flex\">\n        {hasOutsidePrefix && (\n          <span className={cn(affixOutsideClasses, \"rounded-s-lg border-e-0\")}>\n            {prefix}\n          <\/span>\n        )}\n        <div\n          className={cn(\n            \"relative flex flex-1 items-center\",\n            hasInsidePrefix && \"relative\",\n          )}\n        >\n          {hasInsidePrefix && (\n            <span className=\"pointer-events-none absolute start-3 z-10 text-[color:var(--fancy-text-muted,var(--color-zinc-500))] dark:text-[color:var(--fancy-text-muted-dark,var(--color-zinc-400))]\">\n              {prefix}\n            <\/span>\n          )}\n          <div\n            className={cn(\n              \"w-full [&>*]:w-full\",\n              hasOutsidePrefix && !hasOutsideSuffix && \"[&_input]:rounded-s-none [&_select]:rounded-s-none [&_textarea]:rounded-s-none\",\n              !hasOutsidePrefix && hasOutsideSuffix && \"[&_input]:rounded-e-none [&_select]:rounded-e-none [&_textarea]:rounded-e-none\",\n              hasOutsidePrefix && hasOutsideSuffix && \"[&_input]:rounded-none [&_select]:rounded-none [&_textarea]:rounded-none\",\n              hasInsidePrefix && insidePaddingLeft[size],\n            )}\n          >\n            {children}\n          <\/div>\n          {hasInsideSuffix && (\n            <span className=\"pointer-events-none absolute end-3 z-10 text-[color:var(--fancy-text-muted,var(--color-zinc-500))] dark:text-[color:var(--fancy-text-muted-dark,var(--color-zinc-400))]\">\n              {suffix}\n            <\/span>\n          )}\n        <\/div>\n        {hasOutsideSuffix && (\n          <span className={cn(affixOutsideClasses, \"rounded-e-lg border-s-0\")}>\n            {suffix}\n          <\/span>\n        )}\n      <\/div>\n    );\n  }\n\n  \/\/ Both inside\n  return (\n    <div data-react-fancy-input-wrapper=\"\" className=\"relative flex items-center\">\n      {hasInsidePrefix && (\n        <span className=\"pointer-events-none absolute start-3 z-10 text-[color:var(--fancy-text-muted,var(--color-zinc-500))] dark:text-[color:var(--fancy-text-muted-dark,var(--color-zinc-400))]\">\n          {prefix}\n        <\/span>\n      )}\n      <div\n        className={cn(\n          \"w-full\",\n          hasInsidePrefix && insidePaddingLeft[size],\n          hasInsideSuffix && insidePaddingRight[size],\n        )}\n      >\n        {children}\n      <\/div>\n      {hasInsideSuffix && (\n        <span className=\"pointer-events-none absolute end-3 z-10 text-[color:var(--fancy-text-muted,var(--color-zinc-500))] dark:text-[color:var(--fancy-text-muted-dark,var(--color-zinc-400))]\">\n          {suffix}\n        <\/span>\n      )}\n    <\/div>\n  );\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/components\/inputs\/InputWrapper.tsx"},{"path":"components\/fancy\/lib\/components\/inputs\/mode\/FieldMode.context.ts","content":"import { createContext, useContext } from \"react\";\nimport type { FieldMode } from \"..\/inputs.types\";\n\nexport interface FieldModeContextValue {\n  mode: FieldMode;\n}\n\nexport const FieldModeContext = createContext<FieldModeContextValue | null>(null);\n\n\/**\n * Resolve the effective mode for an input. Precedence: an explicit prop wins,\n * then the nearest `<Form>` \/ `<FormProvider>` context, then `\"edit\"`.\n *\n * Deliberately tolerant (returns `\"edit\"` outside any provider) \u2014 unlike a slot\n * guard \u2014 so every input works standalone with zero context and existing call\n * sites behave identically.\n *\/\nexport function useFieldMode(explicit?: FieldMode): FieldMode {\n  const ctx = useContext(FieldModeContext);\n  return explicit ?? ctx?.mode ?? \"edit\";\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/components\/inputs\/mode\/FieldMode.context.ts"},{"path":"components\/fancy\/lib\/components\/inputs\/mode\/DisplayValue.tsx","content":"import type { KeyboardEvent, ReactNode } from \"react\";\nimport { cn } from \"..\/..\/..\/utils\/cn\";\nimport type { Size } from \"..\/..\/..\/utils\/types\";\nimport { inputSizeClasses } from \"..\/inputs.utils\";\n\nexport interface DisplayValueProps {\n  \/** The formatted value to show. Empty \/ null \/ undefined renders `empty`. *\/\n  children?: ReactNode;\n  size?: Size;\n  \/** Static adornment rendered before the value (mirrors an input's `leading`\/`prefix`). *\/\n  leading?: ReactNode;\n  \/** Static adornment rendered after the value (mirrors an input's `trailing`\/`suffix`). *\/\n  trailing?: ReactNode;\n  \/** Shown when the value is empty. Default `\u2014`. *\/\n  empty?: ReactNode;\n  \/** When true the value is clickable to enter edit mode (inline click-to-edit). *\/\n  interactive?: boolean;\n  \/** Called when an interactive value is activated (click \/ Enter \/ Space). *\/\n  onActivate?: () => void;\n  className?: string;\n}\n\nfunction isEmpty(value: ReactNode): boolean {\n  return value === null || value === undefined || value === \"\";\n}\n\n\/**\n * The read-only counterpart to an `<input>`. Renders a non-interactive value\n * with the same size rhythm as the editable control (reusing\n * {@link inputSizeClasses}) but without the border \/ background \/ focus ring.\n *\n * When `interactive` (inline click-to-edit), the value becomes a focusable,\n * hoverable target that calls `onActivate` on click \/ Enter \/ Space to swap in\n * the real control. Dropped into the SAME `Field` wrapper the editable control\n * uses, so label \/ description \/ error chrome stays byte-identical between the\n * display and the editor.\n *\n * Carries `data-react-fancy-display` \/ `data-mode=\"view\"` stable handles for\n * agents and tests (Human+ contract).\n *\/\nexport function DisplayValue({\n  children,\n  size = \"md\",\n  leading,\n  trailing,\n  empty = \"\u2014\",\n  interactive,\n  onActivate,\n  className,\n}: DisplayValueProps) {\n  const empties = isEmpty(children);\n\n  const onKeyDown = interactive\n    ? (e: KeyboardEvent<HTMLDivElement>) => {\n        if (e.key === \"Enter\" || e.key === \" \") {\n          e.preventDefault();\n          onActivate?.();\n        }\n      }\n    : undefined;\n\n  return (\n    <div\n      data-react-fancy-display=\"\"\n      data-mode=\"view\"\n      role={interactive ? \"button\" : undefined}\n      tabIndex={interactive ? 0 : undefined}\n      title={interactive ? \"Click to edit\" : undefined}\n      onClick={interactive ? onActivate : undefined}\n      onKeyDown={onKeyDown}\n      className={cn(\n        \"flex w-full items-center gap-2 text-[color:var(--fancy-text,var(--color-zinc-900))] dark:text-[color:var(--fancy-text-dark,var(--color-zinc-100))]\",\n        inputSizeClasses[size],\n        \/\/ Strip the editable box look \u2014 keep only the size\/padding rhythm.\n        \"border-0 bg-transparent px-0\",\n        interactive &&\n          \"-mx-2 cursor-text rounded-md px-2 outline-none transition-colors hover:bg-[color:var(--fancy-surface-muted,var(--color-zinc-100))] focus-visible:ring-2 focus-visible:ring-blue-500\/40 dark:hover:bg-[color:var(--fancy-surface-muted-dark,var(--color-zinc-800))]\",\n        empties && \"text-[color:var(--fancy-text-muted,var(--color-zinc-500))] dark:text-[color:var(--fancy-text-muted-dark,var(--color-zinc-400))]\",\n        className,\n      )}\n    >\n      {leading && <span className=\"text-[color:var(--fancy-text-muted,var(--color-zinc-500))] dark:text-[color:var(--fancy-text-muted-dark,var(--color-zinc-400))]\">{leading}<\/span>}\n      <span className=\"min-w-0 truncate\">{empties ? empty : children}<\/span>\n      {trailing && <span className=\"text-[color:var(--fancy-text-muted,var(--color-zinc-500))] dark:text-[color:var(--fancy-text-muted-dark,var(--color-zinc-400))]\">{trailing}<\/span>}\n    <\/div>\n  );\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/components\/inputs\/mode\/DisplayValue.tsx"},{"path":"components\/fancy\/lib\/components\/inputs\/mode\/useInlineEdit.ts","content":"import { useCallback, useState } from \"react\";\nimport type { FieldMode } from \"..\/inputs.types\";\n\nexport interface InlineEdit {\n  \/** Render the editable control (`true`) vs. the read-only value display (`false`). *\/\n  showControl: boolean;\n  \/** Whether view mode is interactive (click-to-edit) \u2014 i.e. `view` and not disabled. *\/\n  interactive: boolean;\n  \/** Enter edit mode (no-op unless interactive). *\/\n  enterEdit: () => void;\n  \/** Leave edit mode, back to the value display. *\/\n  exitEdit: () => void;\n}\n\n\/**\n * Inline click-to-edit for `mode=\"view\"`. The bound value shows as clean static\n * text; clicking it swaps in the focused control; blur returns to the display\n * (the control's `onChange` \/ `onBlur` fire as usual, so a host can persist on\n * commit). `mode=\"edit\"` is always the control; a **disabled** view stays static\n * text (no click-to-edit).\n *\n * This is the value of \"view mode\": tidy read-only surfaces where each field\n * becomes editable only when the user reaches for it.\n *\/\nexport function useInlineEdit(mode: FieldMode, disabled?: boolean): InlineEdit {\n  const [editing, setEditing] = useState(false);\n  const interactive = mode === \"view\" && !disabled;\n  const showControl = mode !== \"view\" || (interactive && editing);\n  const enterEdit = useCallback(() => {\n    if (interactive) setEditing(true);\n  }, [interactive]);\n  const exitEdit = useCallback(() => setEditing(false), []);\n  return { showControl, interactive, enterEdit, exitEdit };\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/components\/inputs\/mode\/useInlineEdit.ts"},{"path":"components\/fancy\/lib\/utils\/label-template.ts","content":"\/**\n * Fill a label template's `{name}` slots: `\"Digit {n} of {total}\"`,\n * `\"Open {host}\"`. Single braces, for translatable labels only; a slot with no\n * value stays as written. Literal replacement, never evaluated.\n *\/\nexport function fillLabel(template: string, values: Record<string, string | number>): string {\n  return template.replace(\/\\{(\\w+)\\}\/g, (whole: string, name: string) =>\n    Object.prototype.hasOwnProperty.call(values, name) ? String(values[name]) : whole,\n  );\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/utils\/label-template.ts"},{"path":"components\/fancy\/lib\/utils\/trigger-child.ts","content":"import {\n  cloneElement,\n  Fragment,\n  isValidElement,\n  useEffect,\n  useRef,\n  type ReactElement,\n  type ReactNode,\n  type Ref,\n  type RefObject,\n} from \"react\";\nimport { cn } from \".\/cn\";\nimport { composeRefs } from \".\/compose-refs\";\n\n\/**\n * How a popup trigger (Dropdown.Trigger, Popover.Trigger) treats its child.\n *\n * The ARIA that says \"this opens a popup\" (`aria-haspopup`, `aria-expanded`,\n * `aria-controls`) belongs on the element a screen reader focuses. Before\n * 6.22.2 both triggers put it on a role-less wrapper `<span>`, where axe flags\n * it (`aria-allowed-attr`, critical) and no screen reader announces it.\n *\n * - `clone`: the child is one element that is, or renders, the focusable\n *   control. The trigger merges its props onto it (the asChild pattern) and\n *   renders no wrapper. `aria` is false when the child's explicit role cannot\n *   carry popup ARIA (a `role=\"img\"` preview pill); `role` is set when a\n *   focusable host element has no role of its own (`<span tabIndex={0}>`), so\n *   the ARIA lands on a `button` rather than on another role-less element.\n * - `wrap`: the child is text, several nodes, a fragment, or a host element\n *   nothing can focus. The trigger renders its own element around it.\n *\/\nexport type TriggerChild =\n  | { mode: \"clone\"; element: ReactElement<Record<string, unknown>>; aria: boolean; role?: \"button\" }\n  | { mode: \"wrap\" };\n\n\/** The `aria-haspopup` values that name a kind of popup (WAI-ARIA 1.2). *\/\nexport type PopupKind = \"menu\" | \"listbox\" | \"tree\" | \"grid\" | \"dialog\";\n\n\/**\n * The ARIA a popup trigger carries: what it opens, whether it is open, and,\n * while it is, the id of the popup (which exists in the DOM only then).\n *\/\nexport function popupTriggerAria(kind: PopupKind, open: boolean, popupId: string) {\n  return {\n    \"aria-haspopup\": kind,\n    ...disclosureAria(open, popupId),\n  };\n}\n\n\/**\n * The ARIA of a disclosure button: whether the region it shows is open and,\n * while it is, that region's id. No `aria-haspopup`, which would promise a\n * menu, listbox or dialog the region is not (a plain panel of links).\n *\/\nexport function disclosureAria(open: boolean, regionId: string) {\n  return {\n    \"aria-expanded\": open,\n    \"aria-controls\": open ? regionId : undefined,\n  };\n}\n\n\/** Roles that allow both `aria-expanded` and `aria-haspopup` (WAI-ARIA 1.2). *\/\nconst POPUP_ROLES = new Set([\n  \"button\",\n  \"combobox\",\n  \"gridcell\",\n  \"link\",\n  \"menuitem\",\n  \"menuitemcheckbox\",\n  \"menuitemradio\",\n  \"tab\",\n  \"treeitem\",\n]);\n\nconst BUTTON_INPUTS = new Set([\"button\", \"submit\", \"reset\", \"image\"]);\n\nexport function classifyTriggerChild(children: ReactNode): TriggerChild {\n  if (!isValidElement(children) || children.type === Fragment) return { mode: \"wrap\" };\n  const element = children as ReactElement<Record<string, unknown>>;\n  const props = element.props;\n  const role = typeof props.role === \"string\" ? props.role : undefined;\n\n  \/\/ A component (Button, a consumer's own): it renders the focusable control\n  \/\/ and is expected to forward its props and ref onto it.\n  if (typeof element.type !== \"string\") {\n    return { mode: \"clone\", element, aria: role === undefined || POPUP_ROLES.has(role) };\n  }\n\n  const tag = element.type;\n  const tabIndex = props.tabIndex === undefined ? undefined : Number(props.tabIndex);\n  let native: \"popup\" | \"other\" | null = null;\n  if (tag === \"button\" || tag === \"summary\" || tag === \"select\") native = \"popup\";\n  else if (tag === \"a\" && props.href !== undefined) native = \"popup\";\n  else if (tag === \"input\" && props.type !== \"hidden\") {\n    native = BUTTON_INPUTS.has(String(props.type)) ? \"popup\" : \"other\";\n  } else if (tag === \"textarea\") native = \"other\";\n\n  const focusable = native !== null || (tabIndex !== undefined && tabIndex >= 0);\n  if (!focusable) return { mode: \"wrap\" };\n\n  if (role !== undefined) return { mode: \"clone\", element, aria: POPUP_ROLES.has(role) };\n  if (native === \"popup\") return { mode: \"clone\", element, aria: true };\n  if (native === \"other\") return { mode: \"clone\", element, aria: false };\n  return { mode: \"clone\", element, aria: true, role: \"button\" };\n}\n\n\/** The child's own ref (React 19 passes it as a prop). *\/\nexport function triggerChildRef(target: TriggerChild): Ref<HTMLElement> | undefined {\n  return target.mode === \"clone\" ? (target.element.props.ref as Ref<HTMLElement> | undefined) : undefined;\n}\n\n\/**\n * Merge a trigger's props onto its child.\n *\n * `owned` always applies: the popup's ARIA, its stable handle, its handlers.\n * A handler the child already has runs first, then the trigger's, so a child\n * that calls `preventDefault()` still opts out. `fallback` (props forwarded to\n * the trigger by its caller) fills only what the child leaves unset, except\n * `className`, which is joined. `ref` should already include the child's own.\n *\/\nexport function cloneTriggerChild(\n  element: ReactElement<Record<string, unknown>>,\n  {\n    owned,\n    fallback = {},\n    ref,\n  }: { owned: Record<string, unknown>; fallback?: Record<string, unknown>; ref: Ref<HTMLElement> },\n): ReactElement {\n  const own = element.props;\n  const merged: Record<string, unknown> = {};\n\n  for (const [k, v] of Object.entries(fallback)) {\n    if (k === \"className\") continue;\n    if (own[k] === undefined) merged[k] = v;\n  }\n  if (fallback.className !== undefined) {\n    \/\/ A child whose `className` styles something other than the element it\n    \/\/ renders (Tooltip: the bubble) names the prop that reaches that element.\n    const key = triggerClassNameProp(element.type) ?? \"className\";\n    merged[key] = cn(fallback.className as string, own[key] as string | undefined);\n  }\n\n  for (const [k, v] of Object.entries(owned)) {\n    const mine = own[k] ?? merged[k];\n    if (\/^on[A-Z]\/.test(k) && typeof v === \"function\" && typeof mine === \"function\") {\n      merged[k] = (...args: unknown[]) => {\n        (mine as (...a: unknown[]) => void)(...args);\n        (v as (...a: unknown[]) => void)(...args);\n      };\n    } else {\n      merged[k] = v;\n    }\n  }\n\n  merged.ref = ref;\n  return cloneElement(element, merged);\n}\n\n\/**\n * Static a component sets when its `className` does NOT style the element it\n * renders, naming the prop that does. Tooltip sets it to `\"triggerClassName\"`:\n * its `className` styles the bubble, so a trigger's classes go to its child.\n *\/\nexport const TRIGGER_CLASS_NAME_PROP = Symbol.for(\"react-fancy.triggerClassNameProp\");\n\nfunction triggerClassNameProp(type: unknown): string | undefined {\n  if ((typeof type !== \"function\" && typeof type !== \"object\") || type === null) return undefined;\n  const value = (type as Record<symbol, unknown>)[TRIGGER_CLASS_NAME_PROP];\n  return typeof value === \"string\" ? value : undefined;\n}\n\n\/\/ Bundlers replace `process.env.NODE_ENV` textually; without one, the\n\/\/ reference throws and we read that as production.\ndeclare const process: { env: Record<string, string | undefined> };\n\nfunction isDev(): boolean {\n  try {\n    return process.env.NODE_ENV !== \"production\";\n  } catch {\n    return false;\n  }\n}\n\n\/**\n * Development only: warn once when a trigger's `className` did not reach the\n * element the trigger anchors to. The trigger merges `className` onto its\n * child, and a child component decides where that goes; one that styles an\n * inner or portalled element with it (a bubble, a label) leaves the control\n * without the class, which fails silently. \"None of the classes are on the\n * element\" is the test, so a class that tailwind-merge drops in favour of the\n * child's own conflicting one does not trip it.\n *\/\nexport function useTriggerClassNameCheck(\n  anchorRef: RefObject<HTMLElement | null>,\n  className: string | undefined,\n  name: string,\n): void {\n  const warned = useRef(false);\n  useEffect(() => {\n    if (warned.current || !className || !isDev()) return;\n    const el = anchorRef.current;\n    if (!el) return;\n    const tokens = className.split(\/\\s+\/).filter(Boolean);\n    if (tokens.length === 0 || tokens.some((t) => el.classList.contains(t))) return;\n    warned.current = true;\n    console.warn(\n      `[react-fancy] ${name} className=\"${className}\" did not reach the element it anchors to ` +\n        `(<${el.tagName.toLowerCase()}>). The trigger merges className onto its child, and this child ` +\n        \"styles something else with it. Put the classes on the child's own element instead.\",\n    );\n  });\n}\n\nexport { composeRefs };\n","type":"registry:lib","target":"components\/fancy\/lib\/utils\/trigger-child.ts"},{"path":"components\/fancy\/lib\/utils\/compose-refs.ts","content":"import type { Ref, RefCallback } from \"react\";\n\n\/**\n * One ref callback that feeds every ref it is given.\n *\n * For a component that needs its own handle on an element AND has to honour a\n * ref someone else put there \u2014 a Tooltip anchoring to its trigger, a control\n * measuring itself while a caller holds a ref to it. Assigning one ref over the\n * other silently breaks whichever side lost.\n *\/\nexport function composeRefs<T>(...refs: Array<Ref<T> | undefined | null>): RefCallback<T> {\n  return (node: T | null) => {\n    for (const ref of refs) {\n      if (typeof ref === \"function\") ref(node);\n      else if (ref) (ref as { current: T | null }).current = node;\n    }\n  };\n}\n","type":"registry:lib","target":"components\/fancy\/lib\/utils\/compose-refs.ts"}]}