{"version":3,"file":"InternalRegionSelector.mjs","names":[],"sources":["../../../src/components/helpers/InternalRegionSelector.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport type { RegionData } from '../../hooks/useInternalRegionSelector';\n\n/**\n * A dropdown component that allows users to select a region.\n * @param {string | undefined} region - The currently selected region.\n * @param {string[]} regions - The ordered list of available region codes.\n * @param {Map<string, RegionData>} regionData - Map of region codes to their display data (name, emoji, locale).\n * @param {function} setRegion - Function to update the current region.\n * @param {React.ReactNode} [placeholder] - Optional placeholder node to display as the first option when no region is selected.\n * @returns {React.ReactElement | null} The rendered region dropdown component or null to prevent rendering.\n *\n * @internal\n */\nexport function InternalRegionSelector({\n  region,\n  regions,\n  regionData,\n  setRegion,\n  placeholder,\n  ...props\n}: {\n  region: string | undefined;\n  regions: string[];\n  regionData: Map<string, RegionData>;\n  setRegion: (region: string) => void;\n  placeholder?: ReactNode;\n  [key: string]: any;\n}): React.JSX.Element | null {\n  // If no regions are returned, just render nothing or handle gracefully\n  if (!regions || regions.length === 0 || !setRegion) {\n    return null;\n  }\n\n  return (\n    <select\n      name='generaltranslation-region'\n      aria-label='General Translation region selector'\n      {...props}\n      // Fallback to an empty string if no region is set\n      value={region || ''}\n      onChange={(e) => setRegion(e.target.value)}\n    >\n      {/* Optional placeholder for when no region is set */}\n      {!region && (\n        <option key='placeholder' value='' suppressHydrationWarning>\n          {placeholder || ''}\n        </option>\n      )}\n\n      {regions.map((r) => (\n        <option key={r} value={r} suppressHydrationWarning>\n          {regionData.get(r)?.name ?? r}\n        </option>\n      ))}\n    </select>\n  );\n}\n"],"mappings":"gEAcA,SAAgB,EAAuB,CACrC,SACA,UACA,aACA,YACA,cACA,GAAG,GAQwB,CAM3B,MAJI,CAAC,GAAW,EAAQ,SAAW,GAAK,CAAC,EAChC,KAIP,EAAC,SAAD,CACE,KAAK,4BACL,aAAW,sCACX,GAAI,EAEJ,MAAO,GAAU,GACjB,SAAW,GAAM,EAAU,EAAE,OAAO,MAAM,UAN5C,CASG,CAAC,GACA,EAAC,SAAD,CAA0B,MAAM,GAAG,yBAAA,YAChC,GAAe,GACT,CAFG,cAEH,CAGV,EAAQ,IAAK,GACZ,EAAC,SAAD,CAAgB,MAAO,EAAG,yBAAA,YACvB,EAAW,IAAI,EAAE,EAAE,MAAQ,EACrB,CAFI,EAEJ,CACT,CACK"}