#include "components/autofill/core/browser/data_model/autofill_i18n_api.h"
#include <memory>
#include <string>
#include "base/containers/contains.h"
#include "base/containers/flat_map.h"
#include "base/feature_list.h"
#include "base/notreached.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/country_type.h"
#include "components/autofill/core/browser/data_model/autofill_i18n_formatting_expressions.h"
#include "components/autofill/core/browser/data_model/autofill_i18n_hierarchies.h"
#include "components/autofill/core/browser/data_model/autofill_i18n_parsing_expressions.h"
#include "components/autofill/core/browser/data_model/autofill_i18n_stopwords.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address_component.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address_format_provider.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address_name.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address_utils.h"
#include "components/autofill/core/browser/data_model/autofill_synthesized_address_component.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/common/autofill_features.h"
namespace autofill::i18n_model_definition {
namespace {
kAutofillFormattingRulesMap;
kAutofillModelRules;
kAutofillModelStopwords;
kAutofillParsingRulesMap;
TreeDefinition;
TreeEdgesList;
constexpr FieldTypeSet kAddressComputedTypes = …;
std::u16string GetFormattingExpressionOverrides(
FieldType field_type,
AddressCountryCode country_code) { … }
std::unique_ptr<AddressComponent> BuildTreeNode(
autofill::FieldType type,
std::vector<AddressComponent*> children) { … }
std::unique_ptr<SynthesizedAddressComponent> BuildSynthesizedNode(
FieldType type,
const TreeDefinition& tree_def,
const base::flat_map<FieldType, std::unique_ptr<AddressComponent>>&
nodes_registry) { … }
AddressComponent* BuildSubTree(
const TreeDefinition& tree_def,
FieldType root,
AddressCountryCode country_code,
base::flat_map<FieldType, std::unique_ptr<AddressComponent>>&
nodes_registry) { … }
TreeEdgesList GetTreeEdges(AddressCountryCode country_code) { … }
}
AddressComponentsStore CreateAddressComponentModel(
AddressCountryCode country_code) { … }
bool IsSynthesizedType(FieldType field_type, AddressCountryCode country_code) { … }
std::u16string GetFormattingExpression(FieldType field_type,
AddressCountryCode country_code) { … }
i18n_model_definition::ValueParsingResults ParseValueByI18nRegularExpression(
std::string_view value,
FieldType field_type,
AddressCountryCode country_code) { … }
std::optional<std::u16string_view> GetStopwordsExpression(
FieldType field_type,
AddressCountryCode country_code) { … }
bool IsTypeEnabledForCountry(FieldType field_type,
AddressCountryCode country_code) { … }
bool IsCustomHierarchyAvailableForCountry(AddressCountryCode country_code) { … }
}