remember Country Picker State
Creates and remembers a CountryPickerState, wiring data loading, restoration, country detection and the recents store.
Restoration
The sheet's transient state — query, region, pending selection, open/closed — survives rotation and process death via rememberSaveable. Only ISO codes are saved, never Country objects, so the saved bundle stays tiny and cannot go stale against a changed dataset.
The confirmed selection is not saved here: it belongs to the caller, and the caller should hold it in its own rememberSaveable or ViewModel. That is what makes reopening the sheet after a process death show the right selection rather than an empty one.
Detection
When detector is supplied, detection runs once per composition of this state and is applied according to detectionBehavior. It can never override an explicit user selection — see CountryPickerState.applyDetection.
Parameters
Picker behaviour. Changes are applied to the existing state rather than recreating it, so toggling config mid-session does not wipe the user's search.
The caller's confirmed selection, mirrored into the state each recomposition.
Country source. Defaults to the bundled dataset.
Recents persistence. Defaults to NoOpRecentCountryStore — the library writes nothing to disk unless the host opts in.
Country detection, or null to disable it.
What to do with a detection result.
Invoked when detection produces a country the caller should adopt. Not called when the user has already chosen, or when detectionBehavior is CountryDetectionBehavior.AskFirst.