{ "version": 3, "sources": ["../build/dashboard/Dashboard.js", "../build/realm/add/NewRealmForm.js", "../build/authentication/FlowDetails.js", "../build/authentication/form/CreateFlow.js", "../build/authentication/AuthenticationSection.js", "../build/client-scopes/ClientScopesSection.js", "../build/client-scopes/details/MappingDetails.js", "../build/client-scopes/form/ClientScopeForm.js", "../build/realm-settings/key-providers/aes-generated/AESGeneratedForm.js", "../build/realm-settings/key-providers/java-keystore/JavaKeystoreForm.js", "../build/realm-settings/key-providers/hmac-generated/HMACGeneratedForm.js", "../build/realm-settings/key-providers/ecdsa-generated/ECDSAGeneratedForm.js", "../build/realm-settings/key-providers/rsa-generated/RSAGeneratedForm.js", "../build/realm-settings/ExecutorForm.js", "../build/realm-settings/ClientProfileForm.js", "../build/realm-settings/ProfilesTab.js", "../build/realm-settings/NewClientPolicyCondition.js", "../build/realm-settings/NewClientPolicyForm.js", "../build/realm-settings/RealmSettingsSection.js", "../build/realm-roles/RealmRoleTabs.js", "../build/_snowpack/pkg/moment.js", "../build/clients/initial-access/CreateInitialAccessToken.js", "../build/clients/import/ImportForm.js", "../build/clients/ClientsSection.js", "../build/clients/authorization/ResourceDetails.js", "../build/clients/ClientDetails.js", "../build/clients/add/NewClientForm.js", "../build/identity-providers/add/AddMapper.js", "../build/identity-providers/add/AddIdentityProvider.js", "../build/identity-providers/IdentityProvidersSection.js", "../build/identity-providers/add/DetailSettings.js", "../build/user/UsersSection.js", "../build/user/UsersTabs.js", "../build/events/EventsSection.js", "../build/groups/SearchGroups.js", "../build/groups/GroupsSection.js", "../build/identity-providers/add/AddOpenIdConnect.js", "../build/identity-providers/add/AddSamlConnect.js", "../build/realm-roles/RealmRolesSection.js", "../build/realm-settings/key-providers/rsa/RSAForm.js", "../build/sessions/SessionsSection.js", "../build/user-federation/UserFederationKerberosSettings.js", "../build/user-federation/UserFederationLdapSettings.js", "../build/user-federation/UserFederationSection.js", "../build/user-federation/ldap/mappers/LdapMapperDetails.js", "../build/_snowpack/pkg/@keycloak/keycloak-admin-client.js", "../build/_snowpack/env.js", "../build/_snowpack/pkg/common/_commonjsHelpers-4f955397.js", "../build/_snowpack/pkg/common/index-7cda8b13.js", "../build/_snowpack/pkg/react.js", "../build/_snowpack/pkg/common/index-916de6ed.js", "../build/_snowpack/pkg/common/createIcon-1a4b25a9.js", "../build/_snowpack/pkg/common/EmptyState-cea4cc03.js", "../build/_snowpack/pkg/common/check-icon-e536b517.js", "../build/_snowpack/pkg/common/inline-edit-595ec989.js", "../build/_snowpack/pkg/common/plus-icon-7ed026dd.js", "../build/_snowpack/pkg/common/data-list-0711ea37.js", "../build/_snowpack/pkg/common/index-ad697a84.js", "../build/_snowpack/pkg/common/index-9f254119.js", "../build/_snowpack/pkg/@patternfly/react-core.js", "../build/_snowpack/pkg/common/setPrototypeOf-adc775f4.js", "../build/_snowpack/pkg/common/inheritsLoose-978d85dc.js", "../build/_snowpack/pkg/common/react-router-ea29949b.js", "../build/_snowpack/pkg/react-router-dom.js", "../build/_snowpack/pkg/react-error-boundary.js", "../build/_snowpack/pkg/common/pencil-alt-icon-49c71830.js", "../build/_snowpack/pkg/@patternfly/react-icons.js", "../build/_snowpack/pkg/common/unsupportedIterableToArray-5dd32933.js", "../build/_snowpack/pkg/common/typeof-acae9cd0.js", "../build/_snowpack/pkg/react-i18next.js", "../build/utils/useRequiredContext.js", "../build/components/help-enabler/HelpHeader.js", "../build/_snowpack/pkg/common/process-2545f00a.js", "../build/_snowpack/pkg/common/index-6c6617bd.js", "../build/context/auth/AdminClient.js", "../build/components/realm-selector/recent-used.js", "../build/_snowpack/pkg/common/lodash-63f0b2ce.js", "../build/_snowpack/pkg/lodash.js", "../build/components/keycloak-spinner/KeycloakSpinner.js", "../build/components/data-loader/DataLoader.js", "../build/_snowpack/pkg/file-saver.js", "../build/_snowpack/pkg/flat.js", "../build/components/attribute-form/attribute-convert.js", "../build/components/multi-line-input/multi-line-convert.js", "../build/util.js", "../build/context/server-info/ServerInfoProvider.js", "../build/components/help-enabler/HelpItem.js", "../build/environment.js", "../build/dashboard/routes/Dashboard.js", "../build/context/realm-context/RealmContext.js", "../build/_snowpack/pkg/i18next.js", "../build/common-messages.js", "../build/common-help.js", "../build/dashboard/messages.js", "../build/clients/messages.js", "../build/clients/help.js", "../build/client-scopes/messages.js", "../build/client-scopes/help.js", "../build/groups/messages.js", "../build/realm/messages.js", "../build/realm-roles/messages.js", "../build/user/messages.js", "../build/user/help.js", "../build/sessions/messages.js", "../build/events/messages.js", "../build/realm-settings/messages.js", "../build/realm-settings/help.js", "../build/authentication/messages.js", "../build/authentication/help.js", "../build/user-federation/messages.js", "../build/user-federation/help.js", "../build/identity-providers/messages.js", "../build/identity-providers/help.js", "../build/components/dynamic/labels.js", "../build/i18n.js", "../build/context/whoami/WhoAmI.js", "../build/PageHeader.js", "../build/context/RealmsContext.js", "../build/_snowpack/pkg/react-hook-form.js", "../build/components/alert/AlertPanel.js", "../build/components/alert/Alerts.js", "../build/context/access/Access.js", "../build/components/form-access/FormAccess.js", "../build/_snowpack/pkg/@patternfly/react-code-editor.js", "../build/components/json-file-upload/FileUploadForm.js", "../build/components/json-file-upload/JsonFileUpload.js", "../build/components/external-link/FormattedLink.js", "../build/components/view-header/ViewHeader.js", "../build/realm/routes/AddRealm.js", "../build/components/realm-selector/RealmSelector.js", "../build/_snowpack/pkg/common/_baseIsEqual-c84a3118.js", "../build/_snowpack/pkg/@patternfly/react-table.js", "../build/components/table-toolbar/TableToolbar.js", "../build/components/table-toolbar/PaginatingTableToolbar.js", "../build/components/list-empty-state/ListEmptyState.js", "../build/components/table-toolbar/KeycloakDataTable.js", "../build/components/confirm-dialog/ConfirmDialog.js", "../build/components/keycloak-tabs/KeycloakTabs.js", "../build/utils/useToggle.js", "../build/authentication/form/NameDescription.js", "../build/authentication/DuplicateFlowModal.js", "../build/authentication/form/FlowType.js", "../build/authentication/components/modals/AddStepModal.js", "../build/authentication/components/modals/AddSubFlowModal.js", "../build/authentication/EmptyExecutionState.js", "../build/authentication/components/FlowHeader.js", "../build/authentication/components/FlowTitle.js", "../build/authentication/components/FlowRequirementDropdown.js", "../build/authentication/components/ExecutionConfigModal.js", "../build/authentication/components/EditFlowDropdown.js", "../build/authentication/components/FlowRow.js", "../build/authentication/execution-model.js", "../build/_snowpack/pkg/react-flow-renderer.js", "../build/authentication/components/diagram/SubFlowNode.js", "../build/authentication/components/diagram/ConditionalNode.js", "../build/authentication/components/diagram/ButtonEdge.js", "../build/_snowpack/pkg/dagre.js", "../build/authentication/components/diagram/auto-layout.js", "../build/authentication/components/FlowDiagram.js", "../build/authentication/EditFlowModal.js", "../build/authentication/routes/Flow.js", "../build/authentication/routes/CreateFlow.js", "../build/authentication/components/DraggableTable.js", "../build/authentication/RequiredActions.js", "../build/authentication/policies/util.js", "../build/authentication/policies/PolicyRow.js", "../build/authentication/policies/PasswordPolicy.js", "../build/components/time-selector/TimeSelector.js", "../build/authentication/policies/OtpPolicy.js", "../build/authentication/policies/Policies.js", "../build/authentication/routes/Authentication.js", "../build/authentication/routes.js", "../build/client-scopes/add/MapperDialog.js", "../build/client-scopes/details/MapperList.js", "../build/components/client-scope/ClientScopeTypes.js", "../build/clients/utils.js", "../build/client-scopes/ChangeTypeDropdown.js", "../build/client-scopes/routes/NewClientScope.js", "../build/client-scopes/details/SearchFilter.js", "../build/client-scopes/routes/ClientScopes.js", "../build/client-scopes/details/ScopeForm.js", "../build/components/role-mapping/AddRoleMappingModal.js", "../build/components/role-mapping/RoleMapping.js", "../build/components/dynamic/StringComponent.js", "../build/components/dynamic/BooleanComponent.js", "../build/components/dynamic/ListComponent.js", "../build/components/dynamic/RoleComponent.js", "../build/components/attribute-input/AttributeInput.js", "../build/components/dynamic/MapComponent.js", "../build/components/dynamic/ScriptComponent.js", "../build/components/dynamic/ClientSelectComponent.js", "../build/components/multi-line-input/MultiLineInput.js", "../build/components/dynamic/MultivaluedStringComponent.js", "../build/components/dynamic/MultivaluedListComponent.js", "../build/components/group/GroupPath.js", "../build/components/group/GroupPickerDialog.js", "../build/components/dynamic/GroupComponent.js", "../build/components/dynamic/components.js", "../build/components/dynamic/DynamicComponents.js", "../build/client-scopes/routes/Mapper.js", "../build/client-scopes/routes/ClientScope.js", "../build/client-scopes/routes.js", "../build/components/download-dialog/DownloadDialog.js", "../build/components/attribute-form/AttributeForm.js", "../build/realm-roles/RealmRoleForm.js", "../build/realm-roles/AssociatedRolesModal.js", "../build/components/scroll-form/FormPanel.js", "../build/realm-settings/AddUserEmailModal.js", "../build/realm-settings/EmailTab.js", "../build/realm-settings/event-config/EventConfigForm.js", "../build/realm-settings/event-config/EventsTypeTable.js", "../build/realm-settings/event-config/AddEventTypesDialog.js", "../build/realm-settings/event-config/EventListenersForm.js", "../build/realm-settings/event-config/EventsTab.js", "../build/realm-settings/GeneralTab.js", "../build/realm-settings/KeysListTab.js", "../build/realm-settings/key-providers/aes-generated/AESGeneratedModal.js", "../build/realm-settings/key-providers/java-keystore/JavaKeystoreModal.js", "../build/realm-settings/key-providers/hmac-generated/HMACGeneratedModal.js", "../build/realm-settings/key-providers/ecdsa-generated/ECDSAGeneratedModal.js", "../build/realm-settings/RSAModal.js", "../build/realm-settings/key-providers/rsa-generated/RSAGeneratedModal.js", "../build/realm-settings/KeysProvidersTab.js", "../build/realm-settings/LoginTab.js", "../build/realm-settings/security-defences/HelpLinkTextInput.js", "../build/realm-settings/security-defences/HeadersForm.js", "../build/realm-settings/security-defences/Time.js", "../build/realm-settings/security-defences/BruteForceDetection.js", "../build/realm-settings/security-defences/SecurityDefences.js", "../build/realm-settings/SessionsTab.js", "../build/realm-settings/ThemesTab.js", "../build/realm-settings/TokensTab.js", "../build/realm-settings/routes/ClientProfile.js", "../build/realm-settings/routes/AddExecutor.js", "../build/realm-settings/routes/Executor.js", "../build/realm-settings/routes/ClientPolicies.js", "../build/realm-settings/routes/AddClientProfile.js", "../build/realm-settings/RealmSettingsTabs.js", "../build/realm-settings/routes/AddClientPolicy.js", "../build/realm-settings/routes/EditClientPolicy.js", "../build/clients/scopes/AddScopeDialog.js", "../build/components/dynamic/MultivaluedChipsComponent.js", "../build/components/dynamic/MultivaluedRoleComponent.js", "../build/realm-settings/routes/AddCondition.js", "../build/realm-settings/routes/EditCondition.js", "../build/realm-settings/AddClientProfileModal.js", "../build/realm-settings/PoliciesTab.js", "../build/realm-settings/PartialImport.js", "../build/realm-settings/PartialExport.js", "../build/realm-settings/AddMessageBundleModal.js", "../build/realm-settings/LocalizationTab.js", "../build/realm-settings/UserRegistration.js", "../build/realm-settings/UserProfileTab.js", "../build/realm-settings/routes/RealmSettings.js", "../build/realm-roles/routes/RealmRole.js", "../build/realm-roles/AssociatedRolesTab.js", "../build/realm-roles/UsersInRoleTab.js", "../build/realm-roles/routes/ClientRole.js", "../build/realm-roles/RolesList.js", "../build/clients/AdvancedTab.js", "../build/components/scroll-form/ScrollPanel.js", "../build/components/scroll-form/ScrollForm.js", "../build/clients/advanced/AddHostDialog.js", "../build/clients/advanced/TokenLifespan.js", "../build/clients/advanced/AdvancedSettings.js", "../build/clients/advanced/AuthenticationOverrides.js", "../build/clients/advanced/FineGrainOpenIdConnect.js", "../build/clients/advanced/FineGrainSamlEndpointConfig.js", "../build/clients/advanced/OpenIdConnectCompatibilityModes.js", "../build/clients/ClientDescription.js", "../build/clients/add/CapabilityConfig.js", "../build/clients/advanced/SaveReset.js", "../build/clients/add/SamlConfig.js", "../build/clients/add/SamlSignature.js", "../build/clients/ClientSettings.js", "../build/clients/credentials/ClientSecret.js", "../build/clients/credentials/SignedJWT.js", "../build/clients/credentials/X509.js", "../build/clients/credentials/Credentials.js", "../build/components/password-input/PasswordInput.js", "../build/clients/keys/StoreSettings.js", "../build/clients/keys/GenerateKeyDialog.js", "../build/clients/keys/ImportKeyDialog.js", "../build/clients/keys/Certificate.js", "../build/clients/keys/Keys.js", "../build/clients/initial-access/InitialAccessTokenList.js", "../build/clients/initial-access/AccessTokenDialog.js", "../build/clients/routes/CreateInitialAccessToken.js", "../build/clients/routes/ImportClient.js", "../build/clients/routes/Clients.js", "../build/clients/scopes/ClientScopes.js", "../build/clients/scopes/EvaluateScopes.js", "../build/clients/service-account/ServiceAccount.js", "../build/clients/keys/SamlKeysDialog.js", "../build/clients/keys/SamlImportKeyDialog.js", "../build/clients/keys/SamlKeys.js", "../build/clients/routes/Mapper.js", "../build/clients/authorization/ImportDialog.js", "../build/clients/authorization/Settings.js", "../build/clients/authorization/DetailCell.js", "../build/clients/routes/Resource.js", "../build/clients/authorization/ScopePicker.js", "../build/clients/routes/NewResource.js", "../build/clients/authorization/Resources.js", "../build/clients/routes/Client.js", "../build/clients/add/GeneralSettings.js", "../build/clients/routes/AddClient.js", "../build/clients/routes.js", "../build/dashboard/routes.js", "../build/user/UserForm.js", "../build/user/UserGroups.js", "../build/user/UserConsents.js", "../build/user/UserIdPModal.js", "../build/identity-providers/component/RedirectUrl.js", "../build/identity-providers/component/ClientIdSecret.js", "../build/identity-providers/component/DisplayOrder.js", "../build/identity-providers/add/GeneralSettings.js", "../build/identity-providers/component/FormGroupField.js", "../build/identity-providers/component/SwitchField.js", "../build/identity-providers/component/TextField.js", "../build/identity-providers/add/AdvancedSettings.js", "../build/identity-providers/add/ExtendedNonDiscoverySettings.js", "../build/identity-providers/add/DiscoverySettings.js", "../build/identity-providers/add/DescriptorSettings.js", "../build/identity-providers/add/OIDCGeneralSettings.js", "../build/identity-providers/add/SamlGeneralSettings.js", "../build/identity-providers/add/OIDCAuthentication.js", "../build/identity-providers/add/ReqAuthnConstraintsSettings.js", "../build/identity-providers/routes/EditMapper.js", "../build/identity-providers/add/AddMapperForm.js", "../build/identity-providers/routes/AddMapper.js", "../build/identity-providers/icons/FontAwesomeIcon.js", "../build/identity-providers/ProviderIconMapper.js", "../build/identity-providers/ManageOrderDialog.js", "../build/identity-providers/routes/IdentityProviderCreate.js", "../build/identity-providers/routes/IdentityProviders.js", "../build/identity-providers/routes/IdentityProvider.js", "../build/user/UserIdentityProviderLinks.js", "../build/user/routes/AddUser.js", "../build/user/routes/Users.js", "../build/user/UserRoleMapping.js", "../build/user/UserAttributes.js", "../build/user/UserCredentials.js", "../build/user/routes/User.js", "../build/events/AdminEvents.js", "../build/events/routes/Events.js", "../build/events/routes.js", "../build/groups/SubGroupsContext.js", "../build/groups/GroupsModal.js", "../build/groups/groupIdUtils.js", "../build/groups/GroupTable.js", "../build/groups/MembersModal.js", "../build/groups/Members.js", "../build/groups/GroupAttributes.js", "../build/groups/routes/GroupsSearch.js", "../build/groups/GroupRoleMapping.js", "../build/groups/routes/Groups.js", "../build/groups/routes.js", "../build/identity-providers/component/DiscoveryEndpointField.js", "../build/identity-providers/add/OpenIdConnectSettings.js", "../build/identity-providers/routes/IdentityProviderKeycloakOidc.js", "../build/identity-providers/routes/IdentityProviderOidc.js", "../build/identity-providers/add/SamlConnectSettings.js", "../build/identity-providers/routes/IdentityProviderSaml.js", "../build/identity-providers/routes.js", "../build/PageNotFoundSection.js", "../build/realm-roles/routes/AddRole.js", "../build/realm-roles/routes/AddRoleToClient.js", "../build/realm-roles/routes/RealmRoles.js", "../build/realm-roles/routes.js", "../build/realm-settings/routes/AesGeneratedSettings.js", "../build/realm-settings/routes/EcdsaGeneratedSettings.js", "../build/realm-settings/routes/HmacGeneratedSettings.js", "../build/realm-settings/routes/JavaKeystoreSettings.js", "../build/realm-settings/routes/RsaGeneratedSettings.js", "../build/realm-settings/routes/RsaSettings.js", "../build/realm-settings/routes.js", "../build/realm/routes.js", "../build/sessions/RevocationModal.js", "../build/sessions/LogoutAllSessionsModal.js", "../build/sessions/routes/Sessions.js", "../build/sessions/routes.js", "../build/components/wizard-section-header/WizardSectionHeader.js", "../build/user-federation/kerberos/KerberosSettingsRequired.js", "../build/user-federation/shared/SettingsCache.js", "../build/user-federation/routes/NewKerberosUserFederation.js", "../build/user-federation/ldap/LdapSettingsAdvanced.js", "../build/user-federation/ldap/LdapSettingsKerberosIntegration.js", "../build/user-federation/ldap/LdapSettingsSynchronization.js", "../build/user-federation/ldap/LdapSettingsGeneral.js", "../build/user-federation/ldap/LdapSettingsConnection.js", "../build/user-federation/ldap/LdapSettingsSearching.js", "../build/user-federation/ldap/mappers/LdapMapperList.js", "../build/user-federation/routes/NewLdapUserFederation.js", "../build/components/keycloak-card/KeycloakCard.js", "../build/user-federation/routes/UserFederation.js", "../build/user-federation/routes/UserFederationKerberos.js", "../build/user-federation/routes/UserFederationLdap.js", "../build/user-federation/routes/UserFederationLdapMapper.js", "../build/user-federation/routes/UserFederationsKerberos.js", "../build/user-federation/routes/UserFederationsLdap.js", "../build/user-federation/routes.js", "../build/user/routes.js", "../build/route-config.js", "../build/PageNav.js", "../build/_snowpack/pkg/use-react-router-breadcrumbs.js", "../build/components/bread-crumb/GroupBreadCrumbs.js", "../build/components/bread-crumb/PageBreadCrumbs.js", "../build/ForbiddenSection.js", "../build/components/error/ErrorRenderer.js", "../build/App.js", "../build/context/auth/keycloak.js", "../build/index.js"], "sourcesContent": ["import {\n Brand,\n Card,\n CardBody,\n CardTitle,\n DescriptionList,\n DescriptionListDescription,\n DescriptionListGroup,\n DescriptionListTerm,\n EmptyState,\n EmptyStateBody,\n Grid,\n GridItem,\n Label,\n List,\n ListItem,\n ListVariant,\n PageSection,\n Text,\n TextContent,\n Title\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport React from \"../_snowpack/pkg/react.js\";\nimport {Trans, useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {xor} from \"../_snowpack/pkg/lodash.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {useServerInfo} from \"../context/server-info/ServerInfoProvider.js\";\nimport \"./dashboard.css\";\nimport {toUpperCase} from \"../util.js\";\nimport {HelpItem} from \"../components/help-enabler/HelpItem.js\";\nimport environment from \"../environment.js\";\nconst EmptyDashboard = () => {\n const {t} = useTranslation(\"dashboard\");\n const {realm} = useRealm();\n return /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(EmptyState, {\n variant: \"large\"\n }, /* @__PURE__ */ React.createElement(Brand, {\n src: environment.resourceUrl + \"/icon.svg\",\n alt: \"Keycloak icon\",\n className: \"keycloak__dashboard_icon\"\n }), /* @__PURE__ */ React.createElement(Title, {\n headingLevel: \"h4\",\n size: \"3xl\"\n }, t(\"welcome\")), /* @__PURE__ */ React.createElement(Title, {\n headingLevel: \"h4\",\n size: \"4xl\"\n }, realm), /* @__PURE__ */ React.createElement(EmptyStateBody, null, t(\"introduction\"))));\n};\nconst Dashboard = () => {\n const {t} = useTranslation(\"dashboard\");\n const {realm} = useRealm();\n const serverInfo = useServerInfo();\n const enabledFeatures = xor(serverInfo.profileInfo?.disabledFeatures, serverInfo.profileInfo?.experimentalFeatures, serverInfo.profileInfo?.previewFeatures);\n const isExperimentalFeature = (feature) => {\n return serverInfo.profileInfo?.experimentalFeatures?.includes(feature);\n };\n const isPreviewFeature = (feature) => {\n return serverInfo.profileInfo?.previewFeatures?.includes(feature);\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(TextContent, {\n className: \"pf-u-mr-sm\"\n }, /* @__PURE__ */ React.createElement(Text, {\n component: \"h1\"\n }, t(\"realmName\", {name: toUpperCase(realm)})), /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Trans, {\n t,\n i18nKey: \"adminUiVersion\"\n }, /* @__PURE__ */ React.createElement(\"strong\", null, \"Admin UI version\"), {version: environment.commitHash})))), /* @__PURE__ */ React.createElement(PageSection, null, /* @__PURE__ */ React.createElement(Grid, {\n hasGutter: true\n }, /* @__PURE__ */ React.createElement(GridItem, {\n lg: 2,\n sm: 12\n }, /* @__PURE__ */ React.createElement(Card, {\n className: \"keycloak__dashboard_card\"\n }, /* @__PURE__ */ React.createElement(CardTitle, null, t(\"serverInfo\")), /* @__PURE__ */ React.createElement(CardBody, null, /* @__PURE__ */ React.createElement(DescriptionList, null, /* @__PURE__ */ React.createElement(DescriptionListGroup, null, /* @__PURE__ */ React.createElement(DescriptionListTerm, null, t(\"version\")), /* @__PURE__ */ React.createElement(DescriptionListDescription, null, serverInfo.systemInfo?.version), /* @__PURE__ */ React.createElement(DescriptionListTerm, null, t(\"product\")), /* @__PURE__ */ React.createElement(DescriptionListDescription, null, toUpperCase(serverInfo.profileInfo?.name))))))), /* @__PURE__ */ React.createElement(GridItem, {\n lg: 10,\n sm: 12\n }, /* @__PURE__ */ React.createElement(Card, {\n className: \"keycloak__dashboard_card\"\n }, /* @__PURE__ */ React.createElement(CardTitle, null, t(\"profile\")), /* @__PURE__ */ React.createElement(CardBody, null, /* @__PURE__ */ React.createElement(DescriptionList, null, /* @__PURE__ */ React.createElement(DescriptionListGroup, null, /* @__PURE__ */ React.createElement(DescriptionListTerm, null, t(\"enabledFeatures\"), \" \", /* @__PURE__ */ React.createElement(HelpItem, {\n fieldLabelId: \"dashboard:enabledFeatures\",\n helpText: \"dashboard:infoEnabledFeatures\"\n })), /* @__PURE__ */ React.createElement(DescriptionListDescription, null, /* @__PURE__ */ React.createElement(List, {\n variant: ListVariant.inline\n }, enabledFeatures.map((feature) => /* @__PURE__ */ React.createElement(ListItem, {\n key: feature\n }, feature, \" \", isExperimentalFeature(feature) ? /* @__PURE__ */ React.createElement(Label, {\n color: \"orange\"\n }, t(\"experimental\")) : null, isPreviewFeature(feature) ? /* @__PURE__ */ React.createElement(Label, {\n color: \"blue\"\n }, t(\"preview\")) : null))))), /* @__PURE__ */ React.createElement(DescriptionListGroup, null, /* @__PURE__ */ React.createElement(DescriptionListTerm, null, t(\"disabledFeatures\"), \" \", /* @__PURE__ */ React.createElement(HelpItem, {\n fieldLabelId: \"dashboard:disabledFeatures\",\n helpText: \"dashboard:infoDisabledFeatures\"\n })), /* @__PURE__ */ React.createElement(DescriptionListDescription, null, /* @__PURE__ */ React.createElement(List, {\n variant: ListVariant.inline\n }, serverInfo.profileInfo?.disabledFeatures?.map((feature) => /* @__PURE__ */ React.createElement(ListItem, {\n key: feature\n }, feature))))))))))));\n};\nexport default function DashboardSection() {\n const {realm} = useRealm();\n const isMasterRealm = realm === \"master\";\n return /* @__PURE__ */ React.createElement(React.Fragment, null, !isMasterRealm && /* @__PURE__ */ React.createElement(EmptyDashboard, null), isMasterRealm && /* @__PURE__ */ React.createElement(Dashboard, null));\n}\n", "import {\n ActionGroup,\n AlertVariant,\n Button,\n FormGroup,\n PageSection,\n Switch,\n TextInput\n} from \"../../_snowpack/pkg/@patternfly/react-core.js\";\nimport React from \"../../_snowpack/pkg/react.js\";\nimport {Controller, useForm} from \"../../_snowpack/pkg/react-hook-form.js\";\nimport {useTranslation} from \"../../_snowpack/pkg/react-i18next.js\";\nimport {useHistory} from \"../../_snowpack/pkg/react-router-dom.js\";\nimport {useAlerts} from \"../../components/alert/Alerts.js\";\nimport {FormAccess} from \"../../components/form-access/FormAccess.js\";\nimport {JsonFileUpload} from \"../../components/json-file-upload/JsonFileUpload.js\";\nimport {ViewHeader} from \"../../components/view-header/ViewHeader.js\";\nimport {useAdminClient} from \"../../context/auth/AdminClient.js\";\nimport {useRealms} from \"../../context/RealmsContext.js\";\nimport {useWhoAmI} from \"../../context/whoami/WhoAmI.js\";\nimport {toDashboard} from \"../../dashboard/routes/Dashboard.js\";\nexport default function NewRealmForm() {\n const {t} = useTranslation(\"realm\");\n const history = useHistory();\n const {refresh} = useWhoAmI();\n const {refresh: refreshRealms} = useRealms();\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const {register, handleSubmit, control, errors, setValue} = useForm({mode: \"onChange\"});\n const handleFileChange = (obj) => {\n const defaultRealm = {id: \"\", realm: \"\", enabled: true};\n Object.entries(obj || defaultRealm).map((entry) => setValue(entry[0], entry[1]));\n };\n const save = async (realm) => {\n try {\n await adminClient.realms.create(realm);\n addAlert(t(\"saveRealmSuccess\"), AlertVariant.success);\n refresh();\n await refreshRealms();\n history.push(toDashboard({realm: realm.realm}));\n } catch (error) {\n addError(\"realm:saveRealmError\", error);\n }\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"realm:createRealm\",\n subKey: \"realm:realmExplain\"\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n onSubmit: handleSubmit(save),\n role: \"manage-realm\"\n }, /* @__PURE__ */ React.createElement(JsonFileUpload, {\n id: \"kc-realm-filename\",\n allowEditingUploadedText: true,\n onChange: handleFileChange\n }), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"realmName\"),\n isRequired: true,\n fieldId: \"kc-realm-name\",\n validated: errors.realm ? \"error\" : \"default\",\n helperTextInvalid: t(\"common:required\")\n }, /* @__PURE__ */ React.createElement(TextInput, {\n isRequired: true,\n type: \"text\",\n id: \"kc-realm-name\",\n name: \"realm\",\n validated: errors.realm ? \"error\" : \"default\",\n ref: register({required: true})\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"enabled\"),\n fieldId: \"kc-realm-enabled-switch\"\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"enabled\",\n defaultValue: true,\n control,\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Switch, {\n id: \"kc-realm-enabled-switch\",\n name: \"enabled\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value,\n onChange\n })\n })), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n variant: \"primary\",\n type: \"submit\"\n }, t(\"common:create\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n onClick: () => history.goBack()\n }, t(\"common:cancel\"))))));\n}\n", "import React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {useHistory, useParams} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {Trans, useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {\n DataList,\n Label,\n PageSection,\n Toolbar,\n ToolbarContent,\n ToggleGroup,\n ToggleGroupItem,\n AlertVariant,\n ActionGroup,\n Button,\n ButtonVariant,\n DropdownItem\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {CheckCircleIcon, PlusIcon, TableIcon} from \"../_snowpack/pkg/@patternfly/react-icons.js\";\nimport {toFlow} from \"./routes/Flow.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {EmptyExecutionState} from \"./EmptyExecutionState.js\";\nimport {toUpperCase} from \"../util.js\";\nimport {FlowHeader} from \"./components/FlowHeader.js\";\nimport {FlowRow} from \"./components/FlowRow.js\";\nimport {\n ExecutionList\n} from \"./execution-model.js\";\nimport {FlowDiagram} from \"./components/FlowDiagram.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {AddStepModal} from \"./components/modals/AddStepModal.js\";\nimport {AddSubFlowModal} from \"./components/modals/AddSubFlowModal.js\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {DuplicateFlowModal} from \"./DuplicateFlowModal.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport useToggle from \"../utils/useToggle.js\";\nimport {toAuthentication} from \"./routes/Authentication.js\";\nimport {EditFlowModal} from \"./EditFlowModal.js\";\nexport const providerConditionFilter = (value) => value.displayName?.startsWith(\"Condition \");\nexport default function FlowDetails() {\n const {t} = useTranslation(\"authentication\");\n const adminClient = useAdminClient();\n const {realm} = useRealm();\n const {addAlert, addError} = useAlerts();\n const {id, usedBy, builtIn} = useParams();\n const history = useHistory();\n const [key, setKey] = useState(0);\n const refresh = () => setKey(new Date().getTime());\n const [tableView, setTableView] = useState(true);\n const [flow, setFlow] = useState();\n const [executionList, setExecutionList] = useState();\n const [dragged, setDragged] = useState();\n const [liveText, setLiveText] = useState(\"\");\n const [showAddExecutionDialog, setShowAddExecutionDialog] = useState();\n const [showAddSubFlowDialog, setShowSubFlowDialog] = useState();\n const [selectedExecution, setSelectedExecution] = useState();\n const [open, toggleOpen, setOpen] = useToggle();\n const [edit, setEdit] = useState(false);\n useFetch(async () => {\n const flows = await adminClient.authenticationManagement.getFlows();\n const flow2 = flows.find((f) => f.id === id);\n if (!flow2) {\n throw new Error(t(\"common:notFound\"));\n }\n const executions = await adminClient.authenticationManagement.getExecutions({\n flow: flow2.alias\n });\n return {flow: flow2, executions};\n }, ({flow: flow2, executions}) => {\n setFlow(flow2);\n setExecutionList(new ExecutionList(executions));\n }, [key]);\n const executeChange = async (ex, change) => {\n try {\n let id2 = ex.id;\n if (\"parent\" in change) {\n await adminClient.authenticationManagement.delExecution({id: id2});\n const result = await adminClient.authenticationManagement.addExecutionToFlow({\n flow: change.parent?.displayName || flow?.alias,\n provider: ex.providerId\n });\n id2 = result.id;\n }\n const times = change.newIndex - change.oldIndex;\n for (let index = 0; index < Math.abs(times); index++) {\n if (times > 0) {\n await adminClient.authenticationManagement.lowerPriorityExecution({\n id: id2\n });\n } else {\n await adminClient.authenticationManagement.raisePriorityExecution({\n id: id2\n });\n }\n }\n refresh();\n addAlert(t(\"updateFlowSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"authentication:updateFlowError\", error);\n }\n };\n const update = async (execution) => {\n try {\n await adminClient.authenticationManagement.updateExecution({flow: flow?.alias}, execution);\n refresh();\n addAlert(t(\"updateFlowSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"authentication:updateFlowError\", error);\n }\n };\n const addExecution = async (name, type) => {\n try {\n await adminClient.authenticationManagement.addExecutionToFlow({\n flow: name,\n provider: type.id\n });\n refresh();\n addAlert(t(\"updateFlowSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"authentication:updateFlowError\", error);\n }\n };\n const addFlow = async (flow2, {name, description = \"\", type, provider}) => {\n try {\n await adminClient.authenticationManagement.addFlowToFlow({\n flow: flow2,\n alias: name,\n description,\n provider,\n type\n });\n refresh();\n addAlert(t(\"updateFlowSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"authentication:updateFlowError\", error);\n }\n };\n const setAsDefault = async () => {\n try {\n const r = await adminClient.realms.findOne({realm});\n await adminClient.realms.update({realm}, {...r, browserFlow: flow?.alias});\n addAlert(t(\"updateFlowSuccess\"), AlertVariant.success);\n history.push(toFlow({id, realm, usedBy: \"default\", builtIn}));\n } catch (error) {\n addError(\"authentication:updateFlowError\", error);\n }\n };\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"authentication:deleteConfirmExecution\",\n children: /* @__PURE__ */ React.createElement(Trans, {\n i18nKey: \"authentication:deleteConfirmExecutionMessage\"\n }, \" \", /* @__PURE__ */ React.createElement(\"strong\", null, {name: selectedExecution?.displayName}), \".\"),\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.authenticationManagement.delExecution({\n id: selectedExecution?.id\n });\n addAlert(t(\"deleteExecutionSuccess\"), AlertVariant.success);\n refresh();\n } catch (error) {\n addError(\"authentication:deleteExecutionError\", error);\n }\n }\n });\n const [toggleDeleteFlow, DeleteFlowConfirm] = useConfirmDialog({\n titleKey: \"authentication:deleteConfirmFlow\",\n children: /* @__PURE__ */ React.createElement(Trans, {\n i18nKey: \"authentication:deleteConfirmFlowMessage\"\n }, \" \", /* @__PURE__ */ React.createElement(\"strong\", null, {flow: flow?.alias || \"\"}), \".\"),\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.authenticationManagement.deleteFlow({\n flowId: flow.id\n });\n history.push(toAuthentication({realm}));\n addAlert(t(\"deleteFlowSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"authentication:deleteFlowError\", error);\n }\n }\n });\n const hasExecutions = executionList?.expandableList.length !== 0;\n const dropdownItems = [\n ...usedBy !== \"default\" ? [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n \"data-testid\": \"set-as-default\",\n key: \"default\",\n onClick: () => setAsDefault()\n }, t(\"setAsDefault\"))\n ] : [],\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"duplicate\",\n onClick: () => setOpen(true)\n }, t(\"duplicate\")),\n ...!builtIn ? [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n \"data-testid\": \"edit-flow\",\n key: \"edit\",\n onClick: () => setEdit(true)\n }, t(\"editInfo\")),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n \"data-testid\": \"delete-flow\",\n key: \"delete\",\n onClick: () => toggleDeleteFlow()\n }, t(\"common:delete\"))\n ] : []\n ];\n return /* @__PURE__ */ React.createElement(React.Fragment, null, open && /* @__PURE__ */ React.createElement(DuplicateFlowModal, {\n name: flow?.alias,\n description: flow?.description,\n toggleDialog: toggleOpen,\n onComplete: () => {\n refresh();\n setOpen(false);\n }\n }), edit && /* @__PURE__ */ React.createElement(EditFlowModal, {\n flow,\n toggleDialog: () => {\n setEdit(!edit);\n refresh();\n }\n }), /* @__PURE__ */ React.createElement(DeleteFlowConfirm, null), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: toUpperCase(flow?.alias || \"\"),\n badges: [\n {text: /* @__PURE__ */ React.createElement(Label, null, t(usedBy))},\n builtIn ? {\n text: /* @__PURE__ */ React.createElement(Label, {\n className: \"keycloak_authentication-section__usedby_label\",\n icon: /* @__PURE__ */ React.createElement(CheckCircleIcon, null)\n }, t(\"buildIn\")),\n id: \"builtIn\"\n } : {}\n ],\n dropdownItems\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, hasExecutions && /* @__PURE__ */ React.createElement(Toolbar, {\n id: \"toolbar\"\n }, /* @__PURE__ */ React.createElement(ToolbarContent, null, /* @__PURE__ */ React.createElement(ToggleGroup, null, /* @__PURE__ */ React.createElement(ToggleGroupItem, {\n icon: /* @__PURE__ */ React.createElement(TableIcon, null),\n \"aria-label\": t(\"tableView\"),\n buttonId: \"tableView\",\n isSelected: tableView,\n onChange: () => setTableView(true)\n }), /* @__PURE__ */ React.createElement(ToggleGroupItem, {\n icon: /* @__PURE__ */ React.createElement(\"i\", {\n className: \"fas fa-project-diagram\"\n }),\n \"aria-label\": t(\"diagramView\"),\n buttonId: \"diagramView\",\n isSelected: !tableView,\n onChange: () => setTableView(false)\n })))), tableView && executionList && hasExecutions && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(DataList, {\n \"aria-label\": \"flows\",\n onDragFinish: (order) => {\n const withoutHeaderId = order.slice(1);\n setLiveText(t(\"common:onDragFinish\", {list: dragged?.displayName}));\n const change = executionList.getChange(dragged, withoutHeaderId);\n executeChange(dragged, change);\n },\n onDragStart: (id2) => {\n const item = executionList.findExecution(id2);\n setLiveText(t(\"common:onDragStart\", {item: item.displayName}));\n setDragged(item);\n if (!item.isCollapsed) {\n item.isCollapsed = true;\n setExecutionList(executionList.clone());\n }\n },\n onDragMove: () => setLiveText(t(\"common:onDragMove\", {item: dragged?.displayName})),\n onDragCancel: () => setLiveText(t(\"common:onDragCancel\")),\n itemOrder: [\n \"header\",\n ...executionList.order().map((ex) => ex.id)\n ]\n }, /* @__PURE__ */ React.createElement(FlowHeader, null), /* @__PURE__ */ React.createElement(React.Fragment, null, executionList.expandableList.map((execution) => /* @__PURE__ */ React.createElement(FlowRow, {\n builtIn: !!builtIn,\n key: execution.id,\n execution,\n onRowClick: (execution2) => {\n execution2.isCollapsed = !execution2.isCollapsed;\n setExecutionList(executionList.clone());\n },\n onRowChange: update,\n onAddExecution: (execution2, type) => addExecution(execution2.displayName, type),\n onAddFlow: (flow2) => addFlow(execution.displayName, flow2),\n onDelete: () => {\n setSelectedExecution(execution);\n toggleDeleteDialog();\n }\n })))), flow && /* @__PURE__ */ React.createElement(React.Fragment, null, showAddExecutionDialog && /* @__PURE__ */ React.createElement(AddStepModal, {\n name: flow.alias,\n type: flow.providerId === \"client-flow\" ? \"client\" : \"basic\",\n onSelect: (type) => {\n if (type) {\n addExecution(flow.alias, type);\n }\n setShowAddExecutionDialog(false);\n }\n }), showAddSubFlowDialog && /* @__PURE__ */ React.createElement(AddSubFlowModal, {\n name: flow.alias,\n onCancel: () => setShowSubFlowDialog(false),\n onConfirm: (newFlow) => {\n addFlow(flow.alias, newFlow);\n setShowSubFlowDialog(false);\n }\n }), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n \"data-testid\": \"addStep\",\n variant: \"link\",\n onClick: () => setShowAddExecutionDialog(true)\n }, /* @__PURE__ */ React.createElement(PlusIcon, null), \" \", t(\"addStep\")), /* @__PURE__ */ React.createElement(Button, {\n \"data-testid\": \"addSubFlow\",\n variant: \"link\",\n onClick: () => setShowSubFlowDialog(true)\n }, /* @__PURE__ */ React.createElement(PlusIcon, null), \" \", t(\"addSubFlow\")))), /* @__PURE__ */ React.createElement(\"div\", {\n className: \"pf-screen-reader\",\n \"aria-live\": \"assertive\"\n }, liveText)), !tableView && executionList?.expandableList && /* @__PURE__ */ React.createElement(FlowDiagram, {\n executionList\n }), !executionList?.expandableList || flow && !hasExecutions && /* @__PURE__ */ React.createElement(EmptyExecutionState, {\n flow,\n onAddExecution: (type) => addExecution(flow.alias, type),\n onAddFlow: (newFlow) => addFlow(flow.alias, newFlow)\n })));\n}\n", "import React from \"../../_snowpack/pkg/react.js\";\nimport {Link, useHistory} from \"../../_snowpack/pkg/react-router-dom.js\";\nimport {useTranslation} from \"../../_snowpack/pkg/react-i18next.js\";\nimport {FormProvider, useForm} from \"../../_snowpack/pkg/react-hook-form.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n PageSection\n} from \"../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {ViewHeader} from \"../../components/view-header/ViewHeader.js\";\nimport {FormAccess} from \"../../components/form-access/FormAccess.js\";\nimport {useRealm} from \"../../context/realm-context/RealmContext.js\";\nimport {useAdminClient} from \"../../context/auth/AdminClient.js\";\nimport {useAlerts} from \"../../components/alert/Alerts.js\";\nimport {NameDescription} from \"./NameDescription.js\";\nimport {FlowType} from \"./FlowType.js\";\nimport {toFlow} from \"../routes/Flow.js\";\nimport {toAuthentication} from \"../routes/Authentication.js\";\nexport default function CreateFlow() {\n const {t} = useTranslation(\"authentication\");\n const history = useHistory();\n const {realm} = useRealm();\n const form = useForm({\n defaultValues: {builtIn: false, topLevel: true}\n });\n const {handleSubmit, register} = form;\n const adminClient = useAdminClient();\n const {addAlert} = useAlerts();\n const save = async (flow) => {\n try {\n const {id} = await adminClient.authenticationManagement.createFlow(flow);\n addAlert(t(\"flowCreatedSuccess\"), AlertVariant.success);\n history.push(toFlow({\n realm,\n id,\n usedBy: \"notInUse\"\n }));\n } catch (error) {\n addAlert(t(\"flowCreateError\", {\n error: error.response?.data?.errorMessage || error\n }), AlertVariant.danger);\n }\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"authentication:createFlow\",\n subKey: \"authentication-help:createFlow\"\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormProvider, {\n ...form\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n role: \"manage-authorization\",\n onSubmit: handleSubmit(save)\n }, /* @__PURE__ */ React.createElement(\"input\", {\n name: \"builtIn\",\n type: \"hidden\",\n ref: register\n }), /* @__PURE__ */ React.createElement(\"input\", {\n name: \"topLevel\",\n type: \"hidden\",\n ref: register\n }), /* @__PURE__ */ React.createElement(NameDescription, null), /* @__PURE__ */ React.createElement(FlowType, null), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n \"data-testid\": \"create\",\n type: \"submit\"\n }, t(\"common:create\")), /* @__PURE__ */ React.createElement(Button, {\n \"data-testid\": \"cancel\",\n variant: \"link\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toAuthentication({realm})\n })\n }, t(\"common:cancel\")))))));\n}\n", "import React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {Link} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {Trans, useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {\n AlertVariant,\n Button,\n ButtonVariant,\n Label,\n PageSection,\n Popover,\n Tab,\n TabTitleText,\n ToolbarItem\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {CheckCircleIcon} from \"../_snowpack/pkg/@patternfly/react-icons.js\";\nimport {useAdminClient} from \"../context/auth/AdminClient.js\";\nimport {KeycloakDataTable} from \"../components/table-toolbar/KeycloakDataTable.js\";\nimport {KeycloakTabs} from \"../components/keycloak-tabs/KeycloakTabs.js\";\nimport {ListEmptyState} from \"../components/list-empty-state/ListEmptyState.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {toUpperCase} from \"../util.js\";\nimport useToggle from \"../utils/useToggle.js\";\nimport {DuplicateFlowModal} from \"./DuplicateFlowModal.js\";\nimport {toCreateFlow} from \"./routes/CreateFlow.js\";\nimport {toFlow} from \"./routes/Flow.js\";\nimport {RequiredActions} from \"./RequiredActions.js\";\nimport {Policies} from \"./policies/Policies.js\";\nimport \"./authentication-section.css\";\nconst realmFlows = [\n \"browserFlow\",\n \"registrationFlow\",\n \"directGrantFlow\",\n \"resetCredentialsFlow\",\n \"clientAuthenticationFlow\",\n \"dockerAuthenticationFlow\"\n];\nexport default function AuthenticationSection() {\n const {t} = useTranslation(\"authentication\");\n const adminClient = useAdminClient();\n const {realm} = useRealm();\n const [key, setKey] = useState(0);\n const refresh = () => setKey(new Date().getTime());\n const {addAlert, addError} = useAlerts();\n const [selectedFlow, setSelectedFlow] = useState();\n const [open, toggleOpen, setOpen] = useToggle();\n const loader = async () => {\n const clients = await adminClient.clients.find();\n const idps = await adminClient.identityProviders.find();\n const realmRep = await adminClient.realms.findOne({realm});\n if (!realmRep) {\n throw new Error(t(\"common:notFound\"));\n }\n const defaultFlows = Object.entries(realmRep).filter((entry) => realmFlows.includes(entry[0])).map((entry) => entry[1]);\n const flows = await adminClient.authenticationManagement.getFlows();\n for (const flow of flows) {\n flow.usedBy = {values: []};\n const client = clients.find((client2) => client2.authenticationFlowBindingOverrides && (client2.authenticationFlowBindingOverrides[\"direct_grant\"] === flow.id || client2.authenticationFlowBindingOverrides[\"browser\"] === flow.id));\n if (client) {\n flow.usedBy.type = \"specificClients\";\n flow.usedBy.values.push(client.clientId);\n }\n const idp = idps.find((idp2) => idp2.firstBrokerLoginFlowAlias === flow.alias || idp2.postBrokerLoginFlowAlias === flow.alias);\n if (idp) {\n flow.usedBy.type = \"specificProviders\";\n flow.usedBy.values.push(idp.alias);\n }\n const isDefault = defaultFlows.includes(flow.alias);\n if (isDefault) {\n flow.usedBy.type = \"default\";\n }\n }\n return flows;\n };\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"authentication:deleteConfirmFlow\",\n children: /* @__PURE__ */ React.createElement(Trans, {\n i18nKey: \"authentication:deleteConfirmFlowMessage\"\n }, \" \", /* @__PURE__ */ React.createElement(\"strong\", null, {flow: selectedFlow ? selectedFlow.alias : \"\"}), \".\"),\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.authenticationManagement.deleteFlow({\n flowId: selectedFlow.id\n });\n refresh();\n addAlert(t(\"deleteFlowSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"authentication:deleteFlowError\", error);\n }\n }\n });\n const UsedBy = ({id, usedBy: {type, values}}) => /* @__PURE__ */ React.createElement(React.Fragment, null, (type === \"specificProviders\" || type === \"specificClients\") && /* @__PURE__ */ React.createElement(Popover, {\n key: id,\n \"aria-label\": t(\"usedBy\"),\n bodyContent: /* @__PURE__ */ React.createElement(\"div\", {\n key: `usedBy-${id}-${values}`\n }, t(\"appliedBy\" + (type === \"specificClients\" ? \"Clients\" : \"Providers\")), \" \", values.map((used, index) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(\"strong\", null, used), index < values.length - 1 ? \", \" : \"\")))\n }, /* @__PURE__ */ React.createElement(Button, {\n variant: ButtonVariant.link,\n key: `button-${id}`\n }, /* @__PURE__ */ React.createElement(CheckCircleIcon, {\n className: \"keycloak_authentication-section__usedby\",\n key: `icon-${id}`\n }), \" \", t(type))), type === \"default\" && /* @__PURE__ */ React.createElement(Button, {\n key: id,\n variant: ButtonVariant.link,\n isDisabled: true\n }, /* @__PURE__ */ React.createElement(CheckCircleIcon, {\n className: \"keycloak_authentication-section__usedby\",\n key: `icon-${id}`\n }), \" \", t(\"default\")), !type && /* @__PURE__ */ React.createElement(Button, {\n key: id,\n variant: ButtonVariant.link,\n isDisabled: true\n }, t(\"notInUse\")));\n const AliasRenderer = ({\n id,\n alias,\n usedBy,\n builtIn\n }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Link, {\n to: toFlow({\n realm,\n id,\n usedBy: usedBy.type || \"notInUse\",\n builtIn: builtIn ? \"builtIn\" : void 0\n }),\n key: `link-${id}`\n }, toUpperCase(alias)), \" \", builtIn && /* @__PURE__ */ React.createElement(Label, {\n key: `label-${id}`\n }, t(\"buildIn\")));\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), open && /* @__PURE__ */ React.createElement(DuplicateFlowModal, {\n name: selectedFlow ? selectedFlow.alias : \"\",\n description: selectedFlow?.description,\n toggleDialog: toggleOpen,\n onComplete: () => {\n refresh();\n setOpen(false);\n }\n }), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"authentication:title\",\n divider: false\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n className: \"pf-u-p-0\"\n }, /* @__PURE__ */ React.createElement(KeycloakTabs, {\n isBox: true\n }, /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"flows\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"flows\"))\n }, /* @__PURE__ */ React.createElement(KeycloakDataTable, {\n key,\n loader,\n ariaLabelKey: \"authentication:title\",\n searchPlaceholderKey: \"authentication:searchForFlow\",\n toolbarItem: /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(Button, {\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toCreateFlow({realm})\n })\n }, t(\"createFlow\"))),\n actionResolver: ({data}) => {\n const defaultActions = [\n {\n title: t(\"duplicate\"),\n onClick: () => {\n setOpen(true);\n setSelectedFlow(data);\n }\n }\n ];\n if (data.builtIn || data.usedBy.values.length > 0) {\n return defaultActions;\n } else {\n return [\n {\n title: t(\"common:delete\"),\n onClick: () => {\n setSelectedFlow(data);\n toggleDeleteDialog();\n }\n },\n ...defaultActions\n ];\n }\n },\n columns: [\n {\n name: \"alias\",\n displayKey: \"authentication:flowName\",\n cellRenderer: AliasRenderer\n },\n {\n name: \"usedBy\",\n displayKey: \"authentication:usedBy\",\n cellRenderer: UsedBy\n },\n {\n name: \"description\",\n displayKey: \"common:description\"\n }\n ],\n emptyState: /* @__PURE__ */ React.createElement(ListEmptyState, {\n message: t(\"emptyEvents\"),\n instructions: t(\"emptyEventsInstructions\")\n })\n })), /* @__PURE__ */ React.createElement(Tab, {\n id: \"requiredActions\",\n eventKey: \"requiredActions\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"requiredActions\"))\n }, /* @__PURE__ */ React.createElement(RequiredActions, null)), /* @__PURE__ */ React.createElement(Tab, {\n id: \"policies\",\n eventKey: \"policies\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"policies\"))\n }, /* @__PURE__ */ React.createElement(Policies, null)))));\n}\n", "import React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {Link} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {\n AlertVariant,\n Button,\n ButtonVariant,\n Dropdown,\n DropdownItem,\n KebabToggle,\n PageSection,\n ToolbarItem\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {cellWidth} from \"../_snowpack/pkg/@patternfly/react-table.js\";\nimport {useAdminClient} from \"../context/auth/AdminClient.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {KeycloakDataTable} from \"../components/table-toolbar/KeycloakDataTable.js\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {emptyFormatter} from \"../util.js\";\nimport {\n CellDropdown,\n ClientScope,\n AllClientScopes,\n changeScope,\n removeScope\n} from \"../components/client-scope/ClientScopeTypes.js\";\nimport {ChangeTypeDropdown} from \"./ChangeTypeDropdown.js\";\nimport {toNewClientScope} from \"./routes/NewClientScope.js\";\nimport \"./client-scope.css\";\nimport {toClientScope} from \"./routes/ClientScope.js\";\nimport {useWhoAmI} from \"../context/whoami/WhoAmI.js\";\nimport {\n nameFilter,\n protocolFilter,\n SearchDropdown,\n SearchToolbar,\n typeFilter\n} from \"./details/SearchFilter.js\";\nimport {getProtocolName} from \"../clients/utils.js\";\nexport default function ClientScopesSection() {\n const {realm} = useRealm();\n const {whoAmI} = useWhoAmI();\n const {t} = useTranslation(\"client-scopes\");\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const [key, setKey] = useState(0);\n const refresh = () => setKey(new Date().getTime());\n const [kebabOpen, setKebabOpen] = useState(false);\n const [selectedScopes, setSelectedScopes] = useState([]);\n const [searchType, setSearchType] = useState(\"name\");\n const [searchTypeType, setSearchTypeType] = useState(AllClientScopes.none);\n const [searchProtocol, setSearchProtocol] = useState(\"all\");\n const loader = async (first, max, search) => {\n const defaultScopes = await adminClient.clientScopes.listDefaultClientScopes();\n const optionalScopes = await adminClient.clientScopes.listDefaultOptionalClientScopes();\n const clientScopes = await adminClient.clientScopes.find();\n const filter = searchType === \"name\" ? nameFilter(search) : searchType === \"type\" ? typeFilter(searchTypeType) : protocolFilter(searchProtocol);\n return clientScopes.map((scope) => {\n const row = {\n ...scope,\n type: defaultScopes.find((defaultScope) => defaultScope.name === scope.name) ? ClientScope.default : optionalScopes.find((optionalScope) => optionalScope.name === scope.name) ? ClientScope.optional : AllClientScopes.none\n };\n return row;\n }).filter(filter).sort((a, b) => a.name.localeCompare(b.name, whoAmI.getLocale())).slice(first, Number(first) + Number(max));\n };\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: t(\"deleteClientScope\", {\n count: selectedScopes.length,\n name: selectedScopes[0]?.name\n }),\n messageKey: \"client-scopes:deleteConfirm\",\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n for (const scope of selectedScopes) {\n try {\n await removeScope(adminClient, scope);\n } catch (error) {\n console.warn(\"could not remove scope\", error.response?.data?.errorMessage || error);\n }\n await adminClient.clientScopes.del({id: scope.id});\n }\n addAlert(t(\"deletedSuccess\"), AlertVariant.success);\n refresh();\n } catch (error) {\n addError(\"client-scopes:deleteError\", error);\n }\n }\n });\n const TypeSelector = (scope) => /* @__PURE__ */ React.createElement(CellDropdown, {\n clientScope: scope,\n type: scope.type,\n all: true,\n onSelect: async (value) => {\n try {\n await changeScope(adminClient, scope, value);\n addAlert(t(\"clientScopeSuccess\"), AlertVariant.success);\n refresh();\n } catch (error) {\n addError(\"client-scopes:clientScopeError\", error);\n }\n }\n });\n const ClientScopeDetailLink = ({\n id,\n type,\n name\n }) => /* @__PURE__ */ React.createElement(Link, {\n key: id,\n to: toClientScope({realm, id, type, tab: \"settings\"})\n }, name);\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"clientScopes\",\n subKey: \"client-scopes:clientScopeExplain\"\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n className: \"pf-u-p-0\"\n }, /* @__PURE__ */ React.createElement(KeycloakDataTable, {\n key,\n loader,\n ariaLabelKey: \"client-scopes:clientScopeList\",\n searchPlaceholderKey: searchType === \"name\" ? \"client-scopes:searchFor\" : void 0,\n isSearching: searchType !== \"name\",\n searchTypeComponent: /* @__PURE__ */ React.createElement(SearchDropdown, {\n searchType,\n onSelect: (searchType2) => setSearchType(searchType2),\n withProtocol: true\n }),\n isPaginated: true,\n onSelect: (clientScopes) => setSelectedScopes([...clientScopes]),\n canSelectAll: true,\n toolbarItem: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SearchToolbar, {\n searchType,\n type: searchTypeType,\n onSelect: (searchType2) => setSearchType(searchType2),\n onType: (value) => {\n setSearchTypeType(value);\n refresh();\n },\n protocol: searchProtocol,\n onProtocol: (protocol) => {\n setSearchProtocol(protocol);\n refresh();\n }\n }), /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(Button, {\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toNewClientScope({realm})\n })\n }, t(\"createClientScope\"))), /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(ChangeTypeDropdown, {\n selectedRows: selectedScopes,\n refresh\n })), /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(Dropdown, {\n toggle: /* @__PURE__ */ React.createElement(KebabToggle, {\n onToggle: setKebabOpen\n }),\n isOpen: kebabOpen,\n isPlain: true,\n dropdownItems: [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"action\",\n component: \"button\",\n isDisabled: selectedScopes.length === 0,\n onClick: () => {\n toggleDeleteDialog();\n setKebabOpen(false);\n }\n }, t(\"common:delete\"))\n ]\n }))),\n actions: [\n {\n title: t(\"common:export\")\n },\n {\n title: t(\"common:delete\"),\n onRowClick: (clientScope) => {\n setSelectedScopes([clientScope]);\n toggleDeleteDialog();\n }\n }\n ],\n columns: [\n {\n name: \"name\",\n cellRenderer: ClientScopeDetailLink\n },\n {\n name: \"type\",\n displayKey: \"client-scopes:assignedType\",\n cellRenderer: TypeSelector\n },\n {\n name: \"protocol\",\n displayKey: \"client-scopes:protocol\",\n cellRenderer: (client) => getProtocolName(t, client.protocol ?? \"openid-connect\"),\n transforms: [cellWidth(15)]\n },\n {\n name: \"attributes['gui.order']\",\n displayKey: \"client-scopes:displayOrder\",\n cellFormatters: [emptyFormatter()],\n transforms: [cellWidth(15)]\n },\n {name: \"description\", cellFormatters: [emptyFormatter()]}\n ]\n })));\n}\n", "import React, {useState} from \"../../_snowpack/pkg/react.js\";\nimport {Link, useHistory, useParams, useRouteMatch} from \"../../_snowpack/pkg/react-router-dom.js\";\nimport {useTranslation} from \"../../_snowpack/pkg/react-i18next.js\";\nimport {FormProvider, useForm} from \"../../_snowpack/pkg/react-hook-form.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n ButtonVariant,\n DropdownItem,\n FormGroup,\n PageSection,\n TextInput,\n ValidatedOptions\n} from \"../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {ViewHeader} from \"../../components/view-header/ViewHeader.js\";\nimport {useAdminClient, useFetch} from \"../../context/auth/AdminClient.js\";\nimport {useConfirmDialog} from \"../../components/confirm-dialog/ConfirmDialog.js\";\nimport {useAlerts} from \"../../components/alert/Alerts.js\";\nimport {HelpItem} from \"../../components/help-enabler/HelpItem.js\";\nimport {useServerInfo} from \"../../context/server-info/ServerInfoProvider.js\";\nimport {convertFormValuesToObject, convertToFormValues} from \"../../util.js\";\nimport {FormAccess} from \"../../components/form-access/FormAccess.js\";\nimport {useRealm} from \"../../context/realm-context/RealmContext.js\";\nimport {MapperRoute} from \"../routes/Mapper.js\";\nimport {toClientScope} from \"../routes/ClientScope.js\";\nimport {DynamicComponents} from \"../../components/dynamic/DynamicComponents.js\";\nimport \"./mapping-details.css\";\nexport default function MappingDetails() {\n const {t} = useTranslation(\"client-scopes\");\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const {id, mapperId, type} = useParams();\n const form = useForm();\n const {register, setValue, errors, handleSubmit} = form;\n const [mapping, setMapping] = useState();\n const [config, setConfig] = useState();\n const history = useHistory();\n const {realm} = useRealm();\n const serverInfo = useServerInfo();\n const isGuid = /^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$/;\n const isUpdating = !!mapperId.match(isGuid);\n const isOnClientScope = !!useRouteMatch(MapperRoute.path);\n const toDetails = () => isOnClientScope ? toClientScope({realm, id, type, tab: \"mappers\"}) : `/${realm}/clients/${id}/mappers`;\n useFetch(async () => {\n let data;\n if (isUpdating) {\n if (isOnClientScope) {\n data = await adminClient.clientScopes.findProtocolMapper({\n id,\n mapperId\n });\n } else {\n data = await adminClient.clients.findProtocolMapperById({\n id,\n mapperId\n });\n }\n if (!data) {\n throw new Error(t(\"common:notFound\"));\n }\n const mapperTypes = serverInfo.protocolMapperTypes[data.protocol];\n const mapping2 = mapperTypes.find((type2) => type2.id === data.protocolMapper);\n return {\n config: {\n protocol: data.protocol,\n protocolMapper: data.protocolMapper\n },\n mapping: mapping2,\n data\n };\n } else {\n const model = type ? await adminClient.clientScopes.findOne({id}) : await adminClient.clients.findOne({id});\n if (!model) {\n throw new Error(t(\"common:notFound\"));\n }\n const protocolMappers = serverInfo.protocolMapperTypes[model.protocol];\n const mapping2 = protocolMappers.find((mapper) => mapper.id === mapperId);\n if (!mapping2) {\n throw new Error(t(\"common:notFound\"));\n }\n return {\n mapping: mapping2,\n config: {\n protocol: model.protocol,\n protocolMapper: mapperId\n }\n };\n }\n }, ({config: config2, mapping: mapping2, data}) => {\n setConfig(config2);\n setMapping(mapping2);\n if (data) {\n convertToFormValues(data, setValue);\n }\n }, []);\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"common:deleteMappingTitle\",\n messageKey: \"common:deleteMappingConfirm\",\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n if (isOnClientScope) {\n await adminClient.clientScopes.delProtocolMapper({\n id,\n mapperId\n });\n } else {\n await adminClient.clients.delProtocolMapper({\n id,\n mapperId\n });\n }\n addAlert(t(\"common:mappingDeletedSuccess\"), AlertVariant.success);\n history.push(toDetails());\n } catch (error) {\n addError(\"common:mappingDeletedError\", error);\n }\n }\n });\n const save = async (formMapping) => {\n const key = isUpdating ? \"Updated\" : \"Created\";\n try {\n const mapping2 = {...config, ...convertFormValuesToObject(formMapping)};\n if (isUpdating) {\n isOnClientScope ? await adminClient.clientScopes.updateProtocolMapper({id, mapperId}, {id: mapperId, ...mapping2}) : await adminClient.clients.updateProtocolMapper({id, mapperId}, {id: mapperId, ...mapping2});\n } else {\n isOnClientScope ? await adminClient.clientScopes.addProtocolMapper({id}, mapping2) : await adminClient.clients.addProtocolMapper({id}, mapping2);\n }\n addAlert(t(`common:mapping${key}Success`), AlertVariant.success);\n } catch (error) {\n addError(`common:mapping${key}Error`, error);\n }\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: isUpdating ? mapping?.name : t(\"common:addMapper\"),\n subKey: isUpdating ? mapperId : \"client-scopes:addMapperExplain\",\n dropdownItems: isUpdating ? [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"delete\",\n value: \"delete\",\n onClick: toggleDeleteDialog\n }, t(\"common:delete\"))\n ] : void 0\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n onSubmit: handleSubmit(save),\n role: \"manage-clients\",\n className: \"keycloak__client-scope-mapping-details__form\"\n }, /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:mapperType\"),\n fieldId: \"mapperType\"\n }, /* @__PURE__ */ React.createElement(TextInput, {\n type: \"text\",\n id: \"mapperType\",\n name: \"mapperType\",\n isReadOnly: true,\n value: mapping?.name\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:name\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"client-scopes-help:mapperName\",\n fieldLabelId: \"name\"\n }),\n fieldId: \"name\",\n isRequired: true,\n validated: errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: register({required: true}),\n type: \"text\",\n id: \"name\",\n name: \"name\",\n isReadOnly: isUpdating,\n validated: errors.name ? ValidatedOptions.error : ValidatedOptions.default\n })), /* @__PURE__ */ React.createElement(FormProvider, {\n ...form\n }, /* @__PURE__ */ React.createElement(DynamicComponents, {\n properties: mapping?.properties || []\n })), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n variant: \"primary\",\n type: \"submit\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toDetails()\n })\n }, t(\"common:cancel\"))))));\n}\n", "import React, {useState} from \"../../_snowpack/pkg/react.js\";\nimport {useHistory, useParams} from \"../../_snowpack/pkg/react-router-dom.js\";\nimport {useTranslation} from \"../../_snowpack/pkg/react-i18next.js\";\nimport {\n AlertVariant,\n ButtonVariant,\n DropdownItem,\n PageSection,\n Tab,\n TabTitleText\n} from \"../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {useAdminClient, useFetch} from \"../../context/auth/AdminClient.js\";\nimport {KeycloakTabs} from \"../../components/keycloak-tabs/KeycloakTabs.js\";\nimport {useAlerts} from \"../../components/alert/Alerts.js\";\nimport {ViewHeader} from \"../../components/view-header/ViewHeader.js\";\nimport {KeycloakSpinner} from \"../../components/keycloak-spinner/KeycloakSpinner.js\";\nimport {convertFormValuesToObject} from \"../../util.js\";\nimport {MapperList} from \"../details/MapperList.js\";\nimport {ScopeForm} from \"../details/ScopeForm.js\";\nimport {useConfirmDialog} from \"../../components/confirm-dialog/ConfirmDialog.js\";\nimport {\n mapRoles,\n RoleMapping\n} from \"../../components/role-mapping/RoleMapping.js\";\nimport {\n changeScope\n} from \"../../components/client-scope/ClientScopeTypes.js\";\nimport {useRealm} from \"../../context/realm-context/RealmContext.js\";\nimport useToggle from \"../../utils/useToggle.js\";\nimport {toMapper} from \"../routes/Mapper.js\";\nimport {toClientScope} from \"../routes/ClientScope.js\";\nexport default function ClientScopeForm() {\n const {t} = useTranslation(\"client-scopes\");\n const [clientScope, setClientScope] = useState();\n const history = useHistory();\n const {realm} = useRealm();\n const [hide, toggleHide] = useToggle();\n const adminClient = useAdminClient();\n const {id, type} = useParams();\n const {addAlert, addError} = useAlerts();\n const [key, setKey] = useState(0);\n const refresh = () => setKey(new Date().getTime());\n useFetch(async () => {\n if (id) {\n const clientScope2 = await adminClient.clientScopes.findOne({id});\n if (!clientScope2) {\n throw new Error(t(\"common:notFound\"));\n }\n return {\n ...clientScope2,\n type\n };\n }\n }, (clientScope2) => {\n setClientScope(clientScope2);\n }, [key, id]);\n const loader = async () => {\n const assignedRoles = (await adminClient.clientScopes.listRealmScopeMappings({id})).map((role) => ({role}));\n const effectiveRoles = (await adminClient.clientScopes.listCompositeRealmScopeMappings({id})).map((role) => ({role}));\n const clients = await adminClient.clients.find();\n const clientRoles = (await Promise.all(clients.map(async (client) => {\n const clientAssignedRoles = (await adminClient.clientScopes.listClientScopeMappings({\n id,\n client: client.id\n })).map((role) => ({role, client}));\n const clientEffectiveRoles = (await adminClient.clientScopes.listCompositeClientScopeMappings({\n id,\n client: client.id\n })).map((role) => ({role, client}));\n return mapRoles(clientAssignedRoles, clientEffectiveRoles, hide);\n }))).flat();\n return [...mapRoles(assignedRoles, effectiveRoles, hide), ...clientRoles];\n };\n const save = async (clientScopes) => {\n try {\n clientScopes.name = clientScopes.name?.trim();\n clientScopes = convertFormValuesToObject(clientScopes);\n if (id) {\n await adminClient.clientScopes.update({id}, clientScopes);\n changeScope(adminClient, {...clientScopes, id, type}, clientScopes.type);\n } else {\n await adminClient.clientScopes.create(clientScopes);\n const scope = await adminClient.clientScopes.findOneByName({\n name: clientScopes.name\n });\n if (!scope) {\n throw new Error(t(\"common:notFound\"));\n }\n changeScope(adminClient, {...clientScopes, id: scope.id}, clientScopes.type);\n history.push(toClientScope({\n realm,\n id: scope.id,\n type: clientScopes.type || \"none\",\n tab: \"settings\"\n }));\n }\n addAlert(t((id ? \"update\" : \"create\") + \"Success\"), AlertVariant.success);\n } catch (error) {\n addError(`client-scopes:${id ? \"update\" : \"create\"}Error`, error);\n }\n };\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: t(\"deleteClientScope\", {\n count: 1,\n name: clientScope?.name\n }),\n messageKey: \"client-scopes:deleteConfirm\",\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.clientScopes.del({id});\n addAlert(t(\"deletedSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"client-scopes:deleteError\", error);\n }\n }\n });\n const assignRoles = async (rows) => {\n try {\n const realmRoles = rows.filter((row) => row.client === void 0).map((row) => row.role).flat();\n await adminClient.clientScopes.addRealmScopeMappings({\n id\n }, realmRoles);\n await Promise.all(rows.filter((row) => row.client !== void 0).map((row) => adminClient.clientScopes.addClientScopeMappings({\n id,\n client: row.client.id\n }, [row.role])));\n addAlert(t(\"roleMappingUpdatedSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"client-scopes:roleMappingUpdatedError\", error);\n }\n };\n const addMappers = async (mappers) => {\n if (!Array.isArray(mappers)) {\n const mapper = mappers;\n history.push(toMapper({\n realm,\n id: clientScope.id,\n type,\n mapperId: mapper.id\n }));\n } else {\n try {\n await adminClient.clientScopes.addMultipleProtocolMappers({id: clientScope.id}, mappers);\n refresh();\n addAlert(t(\"common:mappingCreatedSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"common:mappingCreatedError\", error);\n }\n }\n };\n const onDelete = async (mapper) => {\n try {\n await adminClient.clientScopes.delProtocolMapper({\n id: clientScope.id,\n mapperId: mapper.id\n });\n addAlert(t(\"common:mappingDeletedSuccess\"), AlertVariant.success);\n refresh();\n } catch (error) {\n addError(\"common:mappingDeletedError\", error);\n }\n return true;\n };\n if (id && !clientScope) {\n return /* @__PURE__ */ React.createElement(KeycloakSpinner, null);\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: clientScope ? clientScope.name : \"client-scopes:createClientScope\",\n dropdownItems: clientScope ? [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"delete\",\n onClick: toggleDeleteDialog\n }, t(\"common:delete\"))\n ] : void 0,\n badges: [{text: clientScope ? clientScope.protocol : void 0}],\n divider: !id\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n className: \"pf-u-p-0\"\n }, !id && /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(ScopeForm, {\n save,\n clientScope: {}\n })), id && clientScope && /* @__PURE__ */ React.createElement(KeycloakTabs, {\n isBox: true\n }, /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"settings\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:settings\"))\n }, /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(ScopeForm, {\n save,\n clientScope\n }))), /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"mappers\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:mappers\"))\n }, /* @__PURE__ */ React.createElement(MapperList, {\n model: clientScope,\n onAdd: addMappers,\n onDelete,\n detailLink: (id2) => toMapper({realm, id: clientScope.id, type, mapperId: id2})\n })), /* @__PURE__ */ React.createElement(Tab, {\n \"data-testid\": \"scopeTab\",\n eventKey: \"scope\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"scope\"))\n }, /* @__PURE__ */ React.createElement(RoleMapping, {\n id,\n name: clientScope.name,\n type: \"client-scope\",\n loader,\n save: assignRoles,\n onHideRolesToggle: toggleHide\n })))));\n}\n", "import React, {useState} from \"../../../_snowpack/pkg/react.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n FormGroup,\n PageSection,\n Select,\n SelectOption,\n SelectVariant,\n Switch,\n TextInput,\n ValidatedOptions\n} from \"../../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {useTranslation} from \"../../../_snowpack/pkg/react-i18next.js\";\nimport {Controller, useForm} from \"../../../_snowpack/pkg/react-hook-form.js\";\nimport {HelpItem} from \"../../../components/help-enabler/HelpItem.js\";\nimport {useServerInfo} from \"../../../context/server-info/ServerInfoProvider.js\";\nimport {useAdminClient, useFetch} from \"../../../context/auth/AdminClient.js\";\nimport {useParams, useRouteMatch} from \"../../../_snowpack/pkg/react-router-dom.js\";\nimport {FormAccess} from \"../../../components/form-access/FormAccess.js\";\nimport {ViewHeader} from \"../../../components/view-header/ViewHeader.js\";\nimport {convertToFormValues, KEY_PROVIDER_TYPE} from \"../../../util.js\";\nimport {useAlerts} from \"../../../components/alert/Alerts.js\";\nexport const AESGeneratedForm = ({\n editMode,\n providerType,\n handleModalToggle,\n refresh\n}) => {\n const {t} = useTranslation(\"realm-settings\");\n const serverInfo = useServerInfo();\n const [isKeySizeDropdownOpen, setIsKeySizeDropdownOpen] = useState(false);\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const {id} = useParams();\n const providerId = useRouteMatch(\"/:providerType?\")?.params.providerType;\n const save = async (component) => {\n try {\n if (id) {\n await adminClient.components.update({id}, {\n ...component,\n parentId: component.parentId,\n providerId: providerType,\n providerType: KEY_PROVIDER_TYPE\n });\n addAlert(t(\"saveProviderSuccess\"), AlertVariant.success);\n } else {\n await adminClient.components.create({\n ...component,\n parentId: component.parentId,\n providerId: providerType,\n providerType: KEY_PROVIDER_TYPE,\n config: {priority: [\"0\"]}\n });\n handleModalToggle?.();\n addAlert(t(\"saveProviderSuccess\"), AlertVariant.success);\n refresh?.();\n }\n } catch (error) {\n addError(\"realm-settings:saveProviderError\", error);\n }\n };\n const form = useForm({mode: \"onChange\"});\n const setupForm = (component) => {\n form.reset();\n convertToFormValues(component, form.setValue);\n };\n useFetch(async () => {\n if (editMode)\n return await adminClient.components.findOne({id});\n }, (result) => {\n if (result) {\n setupForm(result);\n }\n }, []);\n const allComponentTypes = serverInfo.componentTypes?.[KEY_PROVIDER_TYPE] ?? [];\n const aesSecretSizeOptions = allComponentTypes[0].properties[3].options;\n return /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n id: \"add-provider\",\n className: \"pf-u-mt-lg\",\n role: \"manage-realm\",\n onSubmit: form.handleSubmit(save)\n }, editMode && /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"providerId\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"client-scopes-help:mapperName\",\n fieldLabelId: \"name\"\n }),\n fieldId: \"id\",\n isRequired: true,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: form.register(),\n id: \"id\",\n type: \"text\",\n name: \"id\",\n isReadOnly: editMode,\n \"aria-label\": t(\"consoleDisplayName\"),\n defaultValue: id,\n \"data-testid\": \"display-name-input\"\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:name\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"client-scopes-help:mapperName\",\n fieldLabelId: \"name\"\n }),\n fieldId: \"name\",\n isRequired: true,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, !editMode && /* @__PURE__ */ React.createElement(Controller, {\n name: \"name\",\n control: form.control,\n defaultValue: providerType,\n render: ({onChange, value}) => {\n return /* @__PURE__ */ React.createElement(TextInput, {\n id: \"name\",\n type: \"text\",\n \"aria-label\": t(\"consoleDisplayName\"),\n defaultValue: providerType,\n value,\n onChange: (value2) => onChange(value2),\n \"data-testid\": \"display-name-input\"\n });\n }\n }), editMode && /* @__PURE__ */ React.createElement(TextInput, {\n ref: form.register(),\n type: \"text\",\n id: \"name\",\n name: \"name\",\n defaultValue: providerId,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:enabled\"),\n fieldId: \"kc-enabled\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: t(\"realm-settings-help:enabled\"),\n fieldLabelId: \"enabled\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.enabled\",\n control: form.control,\n defaultValue: [\"true\"],\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Switch, {\n id: \"kc-enabled\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value[0] === \"true\",\n \"data-testid\": value[0] === \"true\" ? \"internationalization-enabled\" : \"internationalization-disabled\",\n onChange: (value2) => {\n onChange([value2.toString()]);\n }\n })\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"active\"),\n fieldId: \"kc-active\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:active\",\n fieldLabelId: \"realm-settings:active\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.active\",\n control: form.control,\n defaultValue: [\"true\"],\n render: ({onChange, value}) => {\n return /* @__PURE__ */ React.createElement(Switch, {\n id: \"kc-active\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value[0] === \"true\",\n \"data-testid\": value[0] === \"true\" ? \"internationalization-enabled\" : \"internationalization-disabled\",\n onChange: (value2) => {\n onChange([value2.toString()]);\n }\n });\n }\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"AESKeySize\"),\n fieldId: \"kc-aes-keysize\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:AESKeySize\",\n fieldLabelId: \"realm-settings:AESKeySize\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.secretSize\",\n control: form.control,\n defaultValue: [\"16\"],\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Select, {\n toggleId: \"kc-aes-keysize\",\n onToggle: () => setIsKeySizeDropdownOpen(!isKeySizeDropdownOpen),\n onSelect: (_, value2) => {\n onChange([value2.toString()]);\n setIsKeySizeDropdownOpen(false);\n },\n selections: [value.toString()],\n isOpen: isKeySizeDropdownOpen,\n variant: SelectVariant.single,\n \"aria-label\": t(\"aesKeySize\"),\n \"data-testid\": \"select-secret-size\"\n }, aesSecretSizeOptions?.map((item) => /* @__PURE__ */ React.createElement(SelectOption, {\n selected: item === value,\n key: item,\n value: item\n })))\n })), /* @__PURE__ */ React.createElement(ActionGroup, {\n className: \"kc-AESform-buttons\"\n }, /* @__PURE__ */ React.createElement(Button, {\n className: \"kc-AESform-save-button\",\n \"data-testid\": \"add-provider-button\",\n variant: \"primary\",\n type: \"submit\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n className: \"kc-AESform-cancel-button\",\n onClick: !editMode && handleModalToggle || void 0,\n variant: \"link\"\n }, t(\"common:cancel\"))));\n};\nexport default function AESGeneratedSettings() {\n const {t} = useTranslation(\"realm-settings\");\n const providerId = useRouteMatch(\"/:realm/realm-settings/keys/:id?/:providerType?/settings\")?.params.providerType;\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: t(\"editProvider\"),\n subKey: providerId\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(AESGeneratedForm, {\n providerType: providerId,\n editMode: true\n })));\n}\n", "import React, {useState} from \"../../../_snowpack/pkg/react.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n FormGroup,\n PageSection,\n Select,\n SelectOption,\n SelectVariant,\n Switch,\n TextInput,\n ValidatedOptions\n} from \"../../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {useTranslation} from \"../../../_snowpack/pkg/react-i18next.js\";\nimport {Controller, useForm} from \"../../../_snowpack/pkg/react-hook-form.js\";\nimport {HelpItem} from \"../../../components/help-enabler/HelpItem.js\";\nimport {useServerInfo} from \"../../../context/server-info/ServerInfoProvider.js\";\nimport {useAdminClient, useFetch} from \"../../../context/auth/AdminClient.js\";\nimport {useParams, useRouteMatch} from \"../../../_snowpack/pkg/react-router-dom.js\";\nimport {FormAccess} from \"../../../components/form-access/FormAccess.js\";\nimport {ViewHeader} from \"../../../components/view-header/ViewHeader.js\";\nimport {convertToFormValues, KEY_PROVIDER_TYPE} from \"../../../util.js\";\nimport {useAlerts} from \"../../../components/alert/Alerts.js\";\nexport const JavaKeystoreForm = ({\n editMode,\n providerType,\n handleModalToggle,\n refresh\n}) => {\n const {t} = useTranslation(\"realm-settings\");\n const serverInfo = useServerInfo();\n const [isAlgorithmDropdownOpen, setIsAlgorithmDropdownOpen] = useState(false);\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const {id} = useParams();\n const providerId = useRouteMatch(\"/:providerType?\")?.params.providerType;\n const save = async (component) => {\n try {\n if (id) {\n await adminClient.components.update({id}, {\n ...component,\n parentId: component.parentId,\n providerId: providerType,\n providerType: KEY_PROVIDER_TYPE\n });\n addAlert(t(\"saveProviderSuccess\"), AlertVariant.success);\n } else {\n await adminClient.components.create({\n ...component,\n parentId: component.parentId,\n providerId: providerType,\n providerType: KEY_PROVIDER_TYPE,\n config: {priority: [\"0\"]}\n });\n handleModalToggle?.();\n addAlert(t(\"saveProviderSuccess\"), AlertVariant.success);\n refresh?.();\n }\n } catch (error) {\n addError(\"realm-settings:saveProviderError\", error);\n }\n };\n const form = useForm({mode: \"onChange\"});\n const setupForm = (component) => {\n form.reset();\n convertToFormValues(component, form.setValue);\n };\n useFetch(async () => {\n if (editMode)\n return await adminClient.components.findOne({id});\n }, (result) => {\n if (result) {\n setupForm(result);\n }\n }, []);\n const allComponentTypes = serverInfo.componentTypes?.[KEY_PROVIDER_TYPE] ?? [];\n const javaKeystoreAlgorithmOptions = allComponentTypes[3].properties[3].options;\n return /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n id: \"add-provider\",\n className: \"pf-u-mt-lg\",\n role: \"manage-realm\",\n onSubmit: form.handleSubmit(save)\n }, editMode && /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"providerId\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"client-scopes-help:mapperName\",\n fieldLabelId: \"realm-settings:providerId\"\n }),\n fieldId: \"id\",\n isRequired: true,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: form.register(),\n id: \"id\",\n type: \"text\",\n name: \"id\",\n isReadOnly: editMode,\n \"aria-label\": t(\"consoleDisplayName\"),\n defaultValue: id,\n \"data-testid\": \"display-name-input\"\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:name\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"client-scopes-help:mapperName\",\n fieldLabelId: \"name\"\n }),\n fieldId: \"name\",\n isRequired: true,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, !editMode && /* @__PURE__ */ React.createElement(Controller, {\n name: \"name\",\n control: form.control,\n defaultValue: providerType,\n render: ({onChange, value}) => {\n return /* @__PURE__ */ React.createElement(TextInput, {\n id: \"name\",\n type: \"text\",\n \"aria-label\": t(\"consoleDisplayName\"),\n defaultValue: providerType,\n value,\n onChange: (value2) => onChange(value2),\n \"data-testid\": \"display-name-input\"\n });\n }\n }), editMode && /* @__PURE__ */ React.createElement(TextInput, {\n ref: form.register(),\n type: \"text\",\n id: \"name\",\n name: \"name\",\n defaultValue: providerId,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:enabled\"),\n fieldId: \"kc-enabled\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: t(\"realm-settings-help:enabled\"),\n fieldLabelId: \"realm-settings:enabled\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.enabled\",\n control: form.control,\n defaultValue: [\"true\"],\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Switch, {\n id: \"kc-enabled-switch\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value[0] === \"true\",\n \"data-testid\": value[0] === \"true\" ? \"enabled\" : \"disabled\",\n onChange: (value2) => {\n onChange([value2.toString()]);\n }\n })\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"active\"),\n fieldId: \"kc-active\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:active\",\n fieldLabelId: \"realm-settings:active\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.active\",\n control: form.control,\n defaultValue: [\"true\"],\n render: ({onChange, value}) => {\n return /* @__PURE__ */ React.createElement(Switch, {\n id: \"kc-active-switch\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value[0] === \"true\",\n \"data-testid\": value[0] === \"true\" ? \"active\" : \"passive\",\n onChange: (value2) => {\n onChange([value2.toString()]);\n }\n });\n }\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"algorithm\"),\n fieldId: \"kc-algorithm\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:algorithm\",\n fieldLabelId: \"realm-settings:algorithm\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.algorithm\",\n control: form.control,\n defaultValue: [\"RS256\"],\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Select, {\n toggleId: \"kc-elliptic\",\n onToggle: (isExpanded) => setIsAlgorithmDropdownOpen(isExpanded),\n onSelect: (_, value2) => {\n onChange([value2.toString()]);\n setIsAlgorithmDropdownOpen(false);\n },\n selections: [value.toString()],\n variant: SelectVariant.single,\n \"aria-label\": t(\"algorithm\"),\n isOpen: isAlgorithmDropdownOpen,\n placeholderText: \"Select one...\",\n \"data-testid\": \"select-algorithm\"\n }, javaKeystoreAlgorithmOptions.map((p, idx) => /* @__PURE__ */ React.createElement(SelectOption, {\n selected: p === value,\n key: `algorithm-${idx}`,\n value: p\n })))\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"keystore\"),\n fieldId: \"kc-keystore\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:keystore\",\n fieldLabelId: \"realm-settings:keystore\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.keystore\",\n control: form.control,\n defaultValue: [],\n render: ({onChange}) => /* @__PURE__ */ React.createElement(TextInput, {\n \"aria-label\": t(\"keystore\"),\n onChange: (value) => {\n onChange([value.toString()]);\n },\n \"data-testid\": \"select-display-name\"\n })\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"keystorePassword\"),\n fieldId: \"kc-keystore-password\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:keystorePassword\",\n fieldLabelId: \"realm-settings:keystorePassword\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.keystorePassword\",\n control: form.control,\n defaultValue: [],\n render: ({onChange}) => /* @__PURE__ */ React.createElement(TextInput, {\n \"aria-label\": t(\"consoleDisplayName\"),\n onChange: (value) => {\n onChange([value.toString()]);\n },\n \"data-testid\": \"select-display-name\"\n })\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"keyAlias\"),\n fieldId: \"kc-key-alias\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:keyAlias\",\n fieldLabelId: \"realm-settings:keyAlias\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.keyAlias\",\n control: form.control,\n defaultValue: [],\n render: ({onChange}) => /* @__PURE__ */ React.createElement(TextInput, {\n \"aria-label\": t(\"keyAlias\"),\n onChange: (value) => {\n onChange([value.toString()]);\n },\n \"data-testid\": \"key-alias\"\n })\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"keyPassword\"),\n fieldId: \"kc-key-password\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:keyPassword\",\n fieldLabelId: \"realm-settings:keyPassword\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.keyPassword\",\n control: form.control,\n defaultValue: [],\n render: ({onChange}) => /* @__PURE__ */ React.createElement(TextInput, {\n \"aria-label\": t(\"keyPassword\"),\n onChange: (value) => {\n onChange([value.toString()]);\n },\n \"data-testid\": \"key-password\"\n })\n })), /* @__PURE__ */ React.createElement(ActionGroup, {\n className: \"kc-java-keystore-form-buttons\"\n }, /* @__PURE__ */ React.createElement(Button, {\n className: \"kc-java-keystore-form-save-button\",\n \"data-testid\": \"add-provider-button\",\n variant: \"primary\",\n type: \"submit\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n className: \"kc-java-keystore-form-cancel-button\",\n onClick: !editMode && handleModalToggle || void 0,\n variant: \"link\"\n }, t(\"common:cancel\"))));\n};\nexport default function JavaKeystoreSettings() {\n const {t} = useTranslation(\"realm-settings\");\n const providerId = useRouteMatch(\"/:realm/realm-settings/keys/:id?/:providerType?/settings\")?.params.providerType;\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: t(\"editProvider\"),\n subKey: providerId\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(JavaKeystoreForm, {\n providerType: providerId,\n editMode: true\n })));\n}\n", "import React, {useState} from \"../../../_snowpack/pkg/react.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n FormGroup,\n PageSection,\n Select,\n SelectOption,\n SelectVariant,\n Switch,\n TextInput,\n ValidatedOptions\n} from \"../../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {useTranslation} from \"../../../_snowpack/pkg/react-i18next.js\";\nimport {Controller, useForm} from \"../../../_snowpack/pkg/react-hook-form.js\";\nimport {HelpItem} from \"../../../components/help-enabler/HelpItem.js\";\nimport {useServerInfo} from \"../../../context/server-info/ServerInfoProvider.js\";\nimport {useAdminClient, useFetch} from \"../../../context/auth/AdminClient.js\";\nimport {useParams, useRouteMatch} from \"../../../_snowpack/pkg/react-router-dom.js\";\nimport {FormAccess} from \"../../../components/form-access/FormAccess.js\";\nimport {ViewHeader} from \"../../../components/view-header/ViewHeader.js\";\nimport {convertToFormValues, KEY_PROVIDER_TYPE} from \"../../../util.js\";\nimport {useAlerts} from \"../../../components/alert/Alerts.js\";\nexport const HMACGeneratedForm = ({\n editMode,\n providerType,\n handleModalToggle,\n refresh\n}) => {\n const {t} = useTranslation(\"realm-settings\");\n const serverInfo = useServerInfo();\n const [isKeySizeDropdownOpen, setIsKeySizeDropdownOpen] = useState(false);\n const [isEllipticCurveDropdownOpen, setIsEllipticCurveDropdownOpen] = useState(false);\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const {id} = useParams();\n const providerId = useRouteMatch(\"/:providerType?\")?.params.providerType;\n const save = async (component) => {\n try {\n if (id) {\n await adminClient.components.update({id}, {\n ...component,\n parentId: component.parentId,\n providerId: providerType,\n providerType: KEY_PROVIDER_TYPE\n });\n addAlert(t(\"saveProviderSuccess\"), AlertVariant.success);\n } else {\n await adminClient.components.create({\n ...component,\n parentId: component.parentId,\n providerId: providerType,\n providerType: KEY_PROVIDER_TYPE,\n config: {priority: [\"0\"]}\n });\n handleModalToggle?.();\n addAlert(t(\"saveProviderSuccess\"), AlertVariant.success);\n refresh?.();\n }\n } catch (error) {\n addError(\"realm-settings:saveProviderError\", error);\n }\n };\n const form = useForm({mode: \"onChange\"});\n const setupForm = (component) => {\n form.reset();\n convertToFormValues(component, form.setValue);\n };\n useFetch(async () => {\n if (editMode)\n return await adminClient.components.findOne({id});\n }, (result) => {\n if (result) {\n setupForm(result);\n }\n }, []);\n const allComponentTypes = serverInfo.componentTypes?.[KEY_PROVIDER_TYPE] ?? [];\n const hmacSecretSizeOptions = allComponentTypes[2].properties[3].options;\n const hmacAlgorithmOptions = allComponentTypes[2].properties[4].options;\n return /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n id: \"add-provider\",\n className: \"pf-u-mt-lg\",\n role: \"manage-realm\",\n onSubmit: form.handleSubmit(save)\n }, editMode && /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"providerId\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"client-scopes-help:mapperName\",\n fieldLabelId: \"realm-settings:providerId\"\n }),\n fieldId: \"id\",\n isRequired: true,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: form.register(),\n id: \"id\",\n type: \"text\",\n name: \"id\",\n isReadOnly: editMode,\n \"aria-label\": t(\"consoleDisplayName\"),\n defaultValue: id,\n \"data-testid\": \"display-name-input\"\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:name\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"client-scopes-help:mapperName\",\n fieldLabelId: \"name\"\n }),\n fieldId: \"name\",\n isRequired: true,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, !editMode && /* @__PURE__ */ React.createElement(Controller, {\n name: \"name\",\n control: form.control,\n defaultValue: providerType,\n render: ({onChange, value}) => {\n return /* @__PURE__ */ React.createElement(TextInput, {\n id: \"name\",\n type: \"text\",\n \"aria-label\": t(\"consoleDisplayName\"),\n defaultValue: providerType,\n value,\n onChange: (value2) => onChange(value2),\n \"data-testid\": \"display-name-input\"\n });\n }\n }), editMode && /* @__PURE__ */ React.createElement(TextInput, {\n ref: form.register(),\n type: \"text\",\n id: \"name\",\n name: \"name\",\n defaultValue: providerId,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:enabled\"),\n fieldId: \"kc-enabled\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: t(\"realm-settings-help:enabled\"),\n fieldLabelId: \"enabled\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.enabled\",\n control: form.control,\n defaultValue: [\"true\"],\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Switch, {\n id: \"kc-enabled-switch\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value[0] === \"true\",\n \"data-testid\": value[0] === \"true\" ? \"enabled\" : \"disabled\",\n onChange: (value2) => {\n onChange([value2.toString()]);\n }\n })\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"active\"),\n fieldId: \"kc-active\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:active\",\n fieldLabelId: \"realm-settings:active\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.active\",\n control: form.control,\n defaultValue: [\"true\"],\n render: ({onChange, value}) => {\n return /* @__PURE__ */ React.createElement(Switch, {\n id: \"kc-active-switch\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value[0] === \"true\",\n \"data-testid\": value[0] === \"true\" ? \"active\" : \"passive\",\n onChange: (value2) => {\n onChange([value2.toString()]);\n }\n });\n }\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"secretSize\"),\n fieldId: \"kc-hmac-keysize\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:secretSize\",\n fieldLabelId: \"realm-settings:secretSize\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.secretSize\",\n control: form.control,\n defaultValue: [\"64\"],\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Select, {\n toggleId: \"kc-hmac-keysize\",\n onToggle: (isExpanded) => setIsKeySizeDropdownOpen(isExpanded),\n onSelect: (_, value2) => {\n onChange([value2.toString()]);\n setIsKeySizeDropdownOpen(false);\n },\n selections: [value.toString()],\n isOpen: isKeySizeDropdownOpen,\n variant: SelectVariant.single,\n \"aria-label\": t(\"hmacKeySize\"),\n \"data-testid\": \"select-secret-size\"\n }, hmacSecretSizeOptions.map((item) => /* @__PURE__ */ React.createElement(SelectOption, {\n selected: item === value,\n key: item,\n value: item\n })))\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"algorithm\"),\n fieldId: \"kc-algorithm\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:algorithm\",\n fieldLabelId: \"realm-settings:algorithm\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.algorithm\",\n control: form.control,\n defaultValue: [\"HS-256\"],\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Select, {\n toggleId: \"kc-elliptic\",\n onToggle: (isExpanded) => setIsEllipticCurveDropdownOpen(isExpanded),\n onSelect: (_, value2) => {\n onChange([value2.toString()]);\n setIsEllipticCurveDropdownOpen(false);\n },\n selections: [value.toString()],\n variant: SelectVariant.single,\n \"aria-label\": t(\"emailTheme\"),\n isOpen: isEllipticCurveDropdownOpen,\n placeholderText: \"Select one...\",\n \"data-testid\": \"select-email-theme\"\n }, hmacAlgorithmOptions.map((p, idx) => /* @__PURE__ */ React.createElement(SelectOption, {\n selected: p === value,\n key: `email-theme-${idx}`,\n value: p\n })))\n })), /* @__PURE__ */ React.createElement(ActionGroup, {\n className: \"kc-hmac-form-buttons\"\n }, /* @__PURE__ */ React.createElement(Button, {\n className: \"kc-hmac-form-save-button\",\n \"data-testid\": \"add-provider-button\",\n variant: \"primary\",\n type: \"submit\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n className: \"kc-hmac-form-cancel-button\",\n onClick: !editMode && handleModalToggle || void 0,\n variant: \"link\"\n }, t(\"common:cancel\"))));\n};\nexport default function HMACGeneratedSettings() {\n const {t} = useTranslation(\"realm-settings\");\n const providerId = useRouteMatch(\"/:realm/realm-settings/keys/:id?/:providerType?/settings\")?.params.providerType;\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: t(\"editProvider\"),\n subKey: providerId\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(HMACGeneratedForm, {\n providerType: providerId,\n editMode: true\n })));\n}\n", "import React, {useState} from \"../../../_snowpack/pkg/react.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n FormGroup,\n PageSection,\n Select,\n SelectOption,\n SelectVariant,\n Switch,\n TextInput,\n ValidatedOptions\n} from \"../../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {useTranslation} from \"../../../_snowpack/pkg/react-i18next.js\";\nimport {Controller, useForm} from \"../../../_snowpack/pkg/react-hook-form.js\";\nimport {HelpItem} from \"../../../components/help-enabler/HelpItem.js\";\nimport {useServerInfo} from \"../../../context/server-info/ServerInfoProvider.js\";\nimport {useAdminClient, useFetch} from \"../../../context/auth/AdminClient.js\";\nimport {useParams, useRouteMatch} from \"../../../_snowpack/pkg/react-router-dom.js\";\nimport {FormAccess} from \"../../../components/form-access/FormAccess.js\";\nimport {ViewHeader} from \"../../../components/view-header/ViewHeader.js\";\nimport {convertToFormValues, KEY_PROVIDER_TYPE} from \"../../../util.js\";\nimport {useAlerts} from \"../../../components/alert/Alerts.js\";\nexport const ECDSAGeneratedForm = ({\n editMode,\n providerType,\n handleModalToggle,\n refresh\n}) => {\n const {t} = useTranslation(\"realm-settings\");\n const serverInfo = useServerInfo();\n const [isKeySizeDropdownOpen, setIsKeySizeDropdownOpen] = useState(false);\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const {id} = useParams();\n const providerId = useRouteMatch(\"/:providerType?\")?.params.providerType;\n const save = async (component) => {\n try {\n if (id) {\n await adminClient.components.update({id}, {\n ...component,\n parentId: component.parentId,\n providerId: providerType,\n providerType: KEY_PROVIDER_TYPE\n });\n addAlert(t(\"saveProviderSuccess\"), AlertVariant.success);\n } else {\n await adminClient.components.create({\n ...component,\n parentId: component.parentId,\n providerId: providerType,\n providerType: KEY_PROVIDER_TYPE,\n config: {priority: [\"0\"]}\n });\n handleModalToggle?.();\n addAlert(t(\"saveProviderSuccess\"), AlertVariant.success);\n refresh?.();\n }\n } catch (error) {\n addError(\"realm-settings:saveProviderError\", error);\n }\n };\n const form = useForm({mode: \"onChange\"});\n const setupForm = (component) => {\n form.reset();\n convertToFormValues(component, form.setValue);\n };\n useFetch(async () => {\n if (editMode)\n return await adminClient.components.findOne({id});\n }, (result) => {\n if (result) {\n setupForm(result);\n }\n }, []);\n const allComponentTypes = serverInfo.componentTypes?.[KEY_PROVIDER_TYPE] ?? [];\n const ecdsaEllipticCurveOptions = allComponentTypes[1].properties[3].options;\n return /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n id: \"add-provider\",\n className: \"pf-u-mt-lg\",\n role: \"manage-realm\",\n onSubmit: form.handleSubmit(save)\n }, editMode && /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"providerId\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"client-scopes-help:mapperName\",\n fieldLabelId: \"client-scopes:providerId\"\n }),\n fieldId: \"id\",\n isRequired: true,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: form.register(),\n id: \"id\",\n type: \"text\",\n name: \"id\",\n isReadOnly: editMode,\n \"aria-label\": t(\"consoleDisplayName\"),\n defaultValue: id,\n \"data-testid\": \"display-name-input\"\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:name\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"client-scopes-help:mapperName\",\n fieldLabelId: \"name\"\n }),\n fieldId: \"name\",\n isRequired: true,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, !editMode && /* @__PURE__ */ React.createElement(Controller, {\n name: \"name\",\n control: form.control,\n defaultValue: providerType,\n render: ({onChange, value}) => {\n return /* @__PURE__ */ React.createElement(TextInput, {\n id: \"name\",\n type: \"text\",\n \"aria-label\": t(\"consoleDisplayName\"),\n value,\n onChange: (value2) => onChange(value2),\n \"data-testid\": \"display-name-input\"\n });\n }\n }), editMode && /* @__PURE__ */ React.createElement(TextInput, {\n ref: form.register(),\n type: \"text\",\n id: \"name\",\n name: \"name\",\n defaultValue: providerId,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:enabled\"),\n fieldId: \"kc-enabled\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: t(\"realm-settings-help:enabled\"),\n fieldLabelId: \"enabled\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.enabled\",\n control: form.control,\n defaultValue: [\"true\"],\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Switch, {\n id: \"kc-enabled-switch\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value[0] === \"true\",\n \"data-testid\": value[0] === \"true\" ? \"enabled\" : \"disabled\",\n onChange: (value2) => {\n onChange([value2.toString()]);\n }\n })\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"active\"),\n fieldId: \"kc-active\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:active\",\n fieldLabelId: \"realm-settings:active\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.active\",\n control: form.control,\n defaultValue: [\"true\"],\n render: ({onChange, value}) => {\n return /* @__PURE__ */ React.createElement(Switch, {\n id: \"kc-active-switch\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value[0] === \"true\",\n \"data-testid\": value[0] === \"true\" ? \"active\" : \"passive\",\n onChange: (value2) => {\n onChange([value2.toString()]);\n }\n });\n }\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"ellipticCurve\"),\n fieldId: \"kc-elliptic-curve\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:ellipticCurve\",\n fieldLabelId: \"realm-settings:ellipticCurve\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.ecdsaEllipticCurveKey\",\n control: form.control,\n defaultValue: [\"P-256\"],\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Select, {\n toggleId: \"kc-ecdsa-elliptic-curve\",\n onToggle: (isExpanded) => setIsKeySizeDropdownOpen(isExpanded),\n onSelect: (_, value2) => {\n onChange([value2.toString()]);\n setIsKeySizeDropdownOpen(false);\n },\n selections: [value.toString()],\n isOpen: isKeySizeDropdownOpen,\n variant: SelectVariant.single,\n \"aria-label\": t(\"ellipticCurve\"),\n \"data-testid\": \"select-elliptic-curve-size\"\n }, ecdsaEllipticCurveOptions?.map((item) => /* @__PURE__ */ React.createElement(SelectOption, {\n selected: item === value,\n key: item,\n value: item\n })))\n })), /* @__PURE__ */ React.createElement(ActionGroup, {\n className: \"kc-ecdsa-form-buttons\"\n }, /* @__PURE__ */ React.createElement(Button, {\n className: \"kc-ecdsa-form-save-button\",\n \"data-testid\": \"add-provider-button\",\n variant: \"primary\",\n type: \"submit\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n className: \"kc-ecdsa-form-cancel-button\",\n onClick: !editMode && handleModalToggle || void 0,\n variant: \"link\"\n }, t(\"common:cancel\"))));\n};\nexport default function ECDSAGeneratedSettings() {\n const {t} = useTranslation(\"realm-settings\");\n const providerId = useRouteMatch(\"/:realm/realm-settings/keys/:id?/:providerType?/settings\")?.params.providerType;\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: t(\"editProvider\"),\n subKey: providerId\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(ECDSAGeneratedForm, {\n providerType: providerId,\n editMode: true\n })));\n}\n", "import React, {useState} from \"../../../_snowpack/pkg/react.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n FormGroup,\n PageSection,\n Select,\n SelectOption,\n SelectVariant,\n Switch,\n TextInput,\n ValidatedOptions\n} from \"../../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {useTranslation} from \"../../../_snowpack/pkg/react-i18next.js\";\nimport {Controller, useForm} from \"../../../_snowpack/pkg/react-hook-form.js\";\nimport {HelpItem} from \"../../../components/help-enabler/HelpItem.js\";\nimport {useServerInfo} from \"../../../context/server-info/ServerInfoProvider.js\";\nimport {useAdminClient, useFetch} from \"../../../context/auth/AdminClient.js\";\nimport {useParams, useRouteMatch} from \"../../../_snowpack/pkg/react-router-dom.js\";\nimport {FormAccess} from \"../../../components/form-access/FormAccess.js\";\nimport {ViewHeader} from \"../../../components/view-header/ViewHeader.js\";\nimport {convertToFormValues, KEY_PROVIDER_TYPE} from \"../../../util.js\";\nimport {useAlerts} from \"../../../components/alert/Alerts.js\";\nexport const RSAGeneratedForm = ({\n editMode,\n providerType,\n handleModalToggle,\n refresh\n}) => {\n const {t} = useTranslation(\"realm-settings\");\n const serverInfo = useServerInfo();\n const [isKeySizeDropdownOpen, setIsKeySizeDropdownOpen] = useState(false);\n const [isEllipticCurveDropdownOpen, setIsEllipticCurveDropdownOpen] = useState(false);\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const {id} = useParams();\n const providerId = useRouteMatch(\"/:providerType?\")?.params.providerType;\n const save = async (component) => {\n try {\n if (id) {\n await adminClient.components.update({id}, {\n ...component,\n parentId: component.parentId,\n providerId: providerType,\n providerType: KEY_PROVIDER_TYPE\n });\n addAlert(t(\"saveProviderSuccess\"), AlertVariant.success);\n } else {\n await adminClient.components.create({\n ...component,\n parentId: component.parentId,\n providerId: providerType,\n providerType: KEY_PROVIDER_TYPE,\n config: {priority: [\"0\"]}\n });\n handleModalToggle?.();\n addAlert(t(\"saveProviderSuccess\"), AlertVariant.success);\n refresh?.();\n }\n } catch (error) {\n addError(\"realm-settings:saveProviderError\", error);\n }\n };\n const form = useForm({mode: \"onChange\"});\n const setupForm = (component) => {\n form.reset();\n convertToFormValues(component, form.setValue);\n };\n useFetch(async () => {\n if (editMode)\n return await adminClient.components.findOne({id});\n }, (result) => {\n if (result) {\n setupForm(result);\n }\n }, []);\n const allComponentTypes = serverInfo.componentTypes?.[KEY_PROVIDER_TYPE] ?? [];\n const rsaGeneratedKeySizeOptions = allComponentTypes[5].properties[4].options;\n const rsaGeneratedAlgorithmOptions = allComponentTypes[5].properties[3].options;\n return /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n id: \"add-provider\",\n className: \"pf-u-mt-lg\",\n role: \"manage-realm\",\n onSubmit: form.handleSubmit(save)\n }, editMode && /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"providerId\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"client-scopes-help:mapperName\",\n fieldLabelId: \"client-scopes:providerId\"\n }),\n fieldId: \"id\",\n isRequired: true,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: form.register(),\n id: \"id\",\n type: \"text\",\n name: \"id\",\n isReadOnly: editMode,\n \"aria-label\": t(\"consoleDisplayName\"),\n defaultValue: id,\n \"data-testid\": \"display-name-input\"\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:name\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"client-scopes-help:mapperName\",\n fieldLabelId: \"name\"\n }),\n fieldId: \"name\",\n isRequired: true,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, !editMode && /* @__PURE__ */ React.createElement(Controller, {\n name: \"name\",\n control: form.control,\n defaultValue: providerType,\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(TextInput, {\n id: \"name\",\n type: \"text\",\n \"aria-label\": t(\"consoleDisplayName\"),\n value,\n onChange: (value2) => onChange(value2),\n \"data-testid\": \"display-name-input\"\n })\n }), editMode && /* @__PURE__ */ React.createElement(TextInput, {\n ref: form.register(),\n type: \"text\",\n id: \"name\",\n name: \"name\",\n defaultValue: providerId,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:enabled\"),\n fieldId: \"kc-enabled\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:enabled\",\n fieldLabelId: \"enabled\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.enabled\",\n control: form.control,\n defaultValue: [\"true\"],\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Switch, {\n id: \"kc-enabled-switch\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value[0] === \"true\",\n \"data-testid\": value[0] === \"true\" ? \"enabled\" : \"disabled\",\n onChange: (value2) => {\n onChange([value2.toString()]);\n }\n })\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"active\"),\n fieldId: \"kc-active\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:active\",\n fieldLabelId: \"realm-settings:active\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.active\",\n control: form.control,\n defaultValue: [\"true\"],\n render: ({onChange, value}) => {\n return /* @__PURE__ */ React.createElement(Switch, {\n id: \"kc-active-switch\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value[0] === \"true\",\n \"data-testid\": value[0] === \"true\" ? \"active\" : \"passive\",\n onChange: (value2) => {\n onChange([value2.toString()]);\n }\n });\n }\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"secretSize\"),\n fieldId: \"kc-rsa-generated-keysize\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:secretSize\",\n fieldLabelId: \"realm-settings:secretSize\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.secretSize\",\n control: form.control,\n defaultValue: [\"2048\"],\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Select, {\n toggleId: \"kc-rsa-generated-keysize\",\n onToggle: (isExpanded) => setIsKeySizeDropdownOpen(isExpanded),\n onSelect: (_, value2) => {\n onChange([value2.toString()]);\n setIsKeySizeDropdownOpen(false);\n },\n selections: [value.toString()],\n isOpen: isKeySizeDropdownOpen,\n variant: SelectVariant.single,\n \"aria-label\": t(\"KeySize\"),\n \"data-testid\": \"select-secret-size\"\n }, rsaGeneratedKeySizeOptions.map((item) => /* @__PURE__ */ React.createElement(SelectOption, {\n selected: item === value,\n key: item,\n value: item\n })))\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"algorithm\"),\n fieldId: \"kc-algorithm\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:algorithm\",\n fieldLabelId: \"realm-settings:algorithm\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.algorithm\",\n control: form.control,\n defaultValue: [\"RS256\"],\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Select, {\n toggleId: \"kc-elliptic\",\n onToggle: (isExpanded) => setIsEllipticCurveDropdownOpen(isExpanded),\n onSelect: (_, value2) => {\n onChange([value2.toString()]);\n setIsEllipticCurveDropdownOpen(false);\n },\n selections: [value.toString()],\n variant: SelectVariant.single,\n \"aria-label\": t(\"emailTheme\"),\n isOpen: isEllipticCurveDropdownOpen,\n placeholderText: \"Select one...\",\n \"data-testid\": \"select-email-theme\"\n }, rsaGeneratedAlgorithmOptions.map((p, idx) => /* @__PURE__ */ React.createElement(SelectOption, {\n selected: p === value,\n key: `email-theme-${idx}`,\n value: p\n })))\n })), /* @__PURE__ */ React.createElement(ActionGroup, {\n className: \"kc-rsa-generated-form-buttons\"\n }, /* @__PURE__ */ React.createElement(Button, {\n className: \"kc-rsa-generated-form-save-button\",\n \"data-testid\": \"add-provider-button\",\n variant: \"primary\",\n type: \"submit\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n className: \"kc-rsa-generated-form-cancel-button\",\n onClick: !editMode && handleModalToggle || void 0,\n variant: \"link\"\n }, t(\"common:cancel\"))));\n};\nexport default function RSAGeneratedSettings() {\n const {t} = useTranslation(\"realm-settings\");\n const providerId = useRouteMatch(\"/:realm/realm-settings/keys/:id?/:providerType?/settings\")?.params.providerType;\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: t(\"editProvider\"),\n subKey: providerId\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(RSAGeneratedForm, {\n providerType: providerId,\n editMode: true\n })));\n}\n", "import React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n FormGroup,\n PageSection,\n Select,\n SelectOption,\n SelectVariant\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {FormAccess} from \"../components/form-access/FormAccess.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {useServerInfo} from \"../context/server-info/ServerInfoProvider.js\";\nimport {Controller, FormProvider, useForm} from \"../_snowpack/pkg/react-hook-form.js\";\nimport {HelpItem} from \"../components/help-enabler/HelpItem.js\";\nimport {Link, useHistory, useParams} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {toClientProfile} from \"./routes/ClientProfile.js\";\nimport {DynamicComponents} from \"../components/dynamic/DynamicComponents.js\";\nimport {convertToFormValues} from \"../util.js\";\nconst defaultValues = {\n config: {},\n executor: \"\"\n};\nexport default function ExecutorForm() {\n const {t} = useTranslation(\"realm-settings\");\n const history = useHistory();\n const {realm, profileName} = useParams();\n const {executorName} = useParams();\n const {addAlert, addError} = useAlerts();\n const [selectExecutorTypeOpen, setSelectExecutorTypeOpen] = useState(false);\n const serverInfo = useServerInfo();\n const adminClient = useAdminClient();\n const executorTypes = serverInfo.componentTypes?.[\"org.keycloak.services.clientpolicy.executor.ClientPolicyExecutorProvider\"];\n const [executors, setExecutors] = useState([]);\n const [executorProperties, setExecutorProperties] = useState([]);\n const [globalProfiles, setGlobalProfiles] = useState([]);\n const [profiles, setProfiles] = useState([]);\n const form = useForm({defaultValues});\n const {control, setValue, handleSubmit} = form;\n const editMode = !!executorName;\n useFetch(() => adminClient.clientPolicies.listProfiles({includeGlobalProfiles: true}), (profiles2) => {\n setGlobalProfiles(profiles2.globalProfiles ?? []);\n setProfiles(profiles2.profiles ?? []);\n const profile = profiles2.profiles.find((profile2) => profile2.name === profileName);\n const profileExecutor = profile?.executors.find((executor) => executor.executor === executorName);\n if (profileExecutor) {\n convertToFormValues(profileExecutor, setValue);\n }\n }, []);\n const save = async () => {\n const formValues = form.getValues();\n const updatedProfiles = profiles.map((profile) => {\n if (profile.name !== profileName) {\n return profile;\n }\n const profileExecutor = profile.executors.find((executor) => executor.executor === executorName);\n const executors2 = (profile.executors ?? []).concat({\n executor: formValues.executor,\n configuration: formValues.config\n });\n if (editMode) {\n profileExecutor.configuration = {\n ...profileExecutor.configuration,\n ...formValues.config\n };\n }\n if (editMode) {\n return profile;\n }\n return {\n ...profile,\n executors: executors2\n };\n });\n try {\n await adminClient.clientPolicies.createProfiles({\n profiles: updatedProfiles,\n globalProfiles\n });\n addAlert(editMode ? t(\"realm-settings:updateExecutorSuccess\") : t(\"realm-settings:addExecutorSuccess\"), AlertVariant.success);\n history.push(toClientProfile({realm, profileName}));\n } catch (error) {\n addError(editMode ? \"realm-settings:updateExecutorError\" : \"realm-settings:addExecutorError\", error);\n }\n };\n const globalProfile = globalProfiles.find((globalProfile2) => globalProfile2.name === profileName);\n const profileExecutorType = executorTypes?.find((executor) => executor.id === executorName);\n const editedProfileExecutors = profileExecutorType?.properties.map((property) => {\n const globalDefaultValues = editMode ? property.defaultValue : \"\";\n return {\n ...property,\n defaultValue: globalDefaultValues\n };\n });\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: editMode ? executorName : t(\"addExecutor\"),\n divider: true\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n role: \"manage-realm\",\n className: \"pf-u-mt-lg\"\n }, /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"executorType\"),\n fieldId: \"kc-executorType\",\n labelIcon: executors.length > 0 && executors[0].helpText !== \"\" ? /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: executors[0].helpText,\n fieldLabelId: \"realm-settings:executorTypeHelpText\"\n }) : editMode ? /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: profileExecutorType?.helpText,\n fieldLabelId: \"realm-settings:executorTypeHelpText\"\n }) : void 0\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"executor\",\n defaultValue: \"\",\n control,\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Select, {\n toggleId: \"kc-executor\",\n placeholderText: \"Select an executor\",\n onToggle: (isOpen) => setSelectExecutorTypeOpen(isOpen),\n onSelect: (_, value2) => {\n onChange(value2.toString());\n const selectedExecutor = executorTypes?.filter((type) => type.id === value2);\n setExecutors(selectedExecutor ?? []);\n setExecutorProperties(selectedExecutor?.[0].properties ?? []);\n setSelectExecutorTypeOpen(false);\n },\n selections: editMode ? executorName : value,\n variant: SelectVariant.single,\n \"data-testid\": \"executorType-select\",\n \"aria-label\": t(\"executorType\"),\n isOpen: selectExecutorTypeOpen,\n maxHeight: 580,\n isDisabled: editMode\n }, executorTypes?.map((option) => /* @__PURE__ */ React.createElement(SelectOption, {\n selected: option.id === value,\n key: option.id,\n value: option.id,\n description: option.helpText\n })))\n })), /* @__PURE__ */ React.createElement(FormProvider, {\n ...form\n }, /* @__PURE__ */ React.createElement(DynamicComponents, {\n properties: executorProperties\n }), editMode && /* @__PURE__ */ React.createElement(DynamicComponents, {\n properties: editedProfileExecutors\n })), !globalProfile && /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n variant: \"primary\",\n onClick: () => handleSubmit(save)(),\n \"data-testid\": \"addExecutor-saveBtn\"\n }, editMode ? t(\"common:save\") : t(\"common:add\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toClientProfile({realm, profileName})\n }),\n \"data-testid\": \"addExecutor-cancelBtn\"\n }, t(\"common:cancel\")))), editMode && globalProfile && /* @__PURE__ */ React.createElement(\"div\", {\n className: \"kc-backToProfile\"\n }, /* @__PURE__ */ React.createElement(Button, {\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toClientProfile({realm, profileName})\n }),\n variant: \"primary\"\n }, t(\"realm-settings:back\")))));\n}\n", "import React, {useEffect, useMemo, useState} from \"../_snowpack/pkg/react.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n ButtonVariant,\n DataList,\n DataListCell,\n DataListItem,\n DataListItemCells,\n DataListItemRow,\n Divider,\n DropdownItem,\n Flex,\n FlexItem,\n FormGroup,\n PageSection,\n Text,\n TextArea,\n TextInput,\n TextVariants,\n ValidatedOptions\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {useForm} from \"../_snowpack/pkg/react-hook-form.js\";\nimport {FormAccess} from \"../components/form-access/FormAccess.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {Link, useHistory, useParams} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {HelpItem} from \"../components/help-enabler/HelpItem.js\";\nimport {PlusCircleIcon, TrashIcon} from \"../_snowpack/pkg/@patternfly/react-icons.js\";\nimport \"./RealmSettingsSection.css\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {toAddExecutor} from \"./routes/AddExecutor.js\";\nimport {useServerInfo} from \"../context/server-info/ServerInfoProvider.js\";\nimport {toClientProfile} from \"./routes/ClientProfile.js\";\nimport {toExecutor} from \"./routes/Executor.js\";\nimport {toClientPolicies} from \"./routes/ClientPolicies.js\";\nconst defaultValues = {\n name: \"\",\n description: \"\",\n executors: []\n};\nexport default function ClientProfileForm() {\n const {t} = useTranslation(\"realm-settings\");\n const history = useHistory();\n const {\n handleSubmit,\n setValue,\n register,\n errors,\n formState: {isDirty}\n } = useForm({\n defaultValues,\n mode: \"onChange\"\n });\n const {addAlert, addError} = useAlerts();\n const adminClient = useAdminClient();\n const [globalProfiles, setGlobalProfiles] = useState([]);\n const [profiles, setProfiles] = useState([]);\n const {realm, profileName} = useParams();\n const serverInfo = useServerInfo();\n const executorTypes = useMemo(() => serverInfo.componentTypes?.[\"org.keycloak.services.clientpolicy.executor.ClientPolicyExecutorProvider\"], []);\n const [executorToDelete, setExecutorToDelete] = useState();\n const editMode = profileName ? true : false;\n const [key, setKey] = useState(0);\n const reload = () => setKey(new Date().getTime());\n useFetch(() => adminClient.clientPolicies.listProfiles({includeGlobalProfiles: true}), (profiles2) => {\n setGlobalProfiles(profiles2.globalProfiles ?? []);\n setProfiles(profiles2.profiles ?? []);\n }, [key]);\n const save = async (form) => {\n const updatedProfiles = editMode ? patchProfiles(form) : addProfile(form);\n try {\n await adminClient.clientPolicies.createProfiles({\n profiles: updatedProfiles,\n globalProfiles\n });\n addAlert(editMode ? t(\"realm-settings:updateClientProfileSuccess\") : t(\"realm-settings:createClientProfileSuccess\"), AlertVariant.success);\n history.push(toClientProfile({realm, profileName: form.name}));\n } catch (error) {\n addError(editMode ? \"realm-settings:updateClientProfileError\" : \"realm-settings:createClientProfileError\", error);\n }\n };\n const patchProfiles = (data) => profiles.map((profile2) => {\n if (profile2.name !== profileName) {\n return profile2;\n }\n return {\n ...profile2,\n name: data.name,\n description: data.description\n };\n });\n const addProfile = (data) => profiles.concat({\n ...data,\n executors: []\n });\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: executorToDelete?.name ? t(\"deleteExecutorProfileConfirmTitle\") : t(\"deleteClientProfileConfirmTitle\"),\n messageKey: executorToDelete?.name ? t(\"deleteExecutorProfileConfirm\", {\n executorName: executorToDelete.name\n }) : t(\"deleteClientProfileConfirm\", {\n profileName\n }),\n continueButtonLabel: t(\"delete\"),\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n if (executorToDelete?.name) {\n profileExecutors.splice(executorToDelete.idx, 1);\n try {\n await adminClient.clientPolicies.createProfiles({\n profiles,\n globalProfiles\n });\n addAlert(t(\"deleteExecutorSuccess\"), AlertVariant.success);\n history.push(toClientProfile({realm, profileName}));\n } catch (error) {\n addError(t(\"deleteExecutorError\"), error);\n }\n } else {\n const updatedProfiles = profiles.filter((profile2) => profile2.name !== profileName);\n try {\n await adminClient.clientPolicies.createProfiles({\n profiles: updatedProfiles,\n globalProfiles\n });\n addAlert(t(\"deleteClientSuccess\"), AlertVariant.success);\n history.push(toClientPolicies({realm}));\n } catch (error) {\n addError(t(\"deleteClientError\"), error);\n }\n }\n }\n });\n const profile = profiles.find((profile2) => profile2.name === profileName);\n const profileExecutors = profile?.executors || [];\n const globalProfile = globalProfiles.find((globalProfile2) => globalProfile2.name === profileName);\n const globalProfileExecutors = globalProfile?.executors || [];\n useEffect(() => {\n setValue(\"name\", globalProfile?.name ?? profile?.name);\n setValue(\"description\", globalProfile?.description ?? profile?.description);\n }, [profiles]);\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: editMode ? profileName : t(\"newClientProfile\"),\n badges: [\n {\n id: \"global-client-profile-badge\",\n text: globalProfile ? t(\"global\") : \"\"\n }\n ],\n divider: true,\n dropdownItems: !globalProfile ? [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"delete\",\n value: \"delete\",\n onClick: toggleDeleteDialog,\n \"data-testid\": \"deleteClientProfileDropdown\"\n }, t(\"deleteClientProfile\"))\n ] : void 0\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n role: \"view-realm\",\n className: \"pf-u-mt-lg\"\n }, /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"newClientProfileName\"),\n fieldId: \"kc-name\",\n helperText: t(\"createClientProfileNameHelperText\"),\n isRequired: true,\n helperTextInvalid: t(\"common:required\"),\n validated: errors.name ? ValidatedOptions.error : ValidatedOptions.default\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: register({required: true}),\n name: \"name\",\n type: \"text\",\n id: \"name\",\n \"aria-label\": t(\"name\"),\n \"data-testid\": \"client-profile-name\",\n isReadOnly: !!globalProfile\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:description\"),\n fieldId: \"kc-description\"\n }, /* @__PURE__ */ React.createElement(TextArea, {\n ref: register(),\n name: \"description\",\n type: \"text\",\n id: \"description\",\n \"aria-label\": t(\"description\"),\n \"data-testid\": \"client-profile-description\",\n isReadOnly: !!globalProfile\n })), /* @__PURE__ */ React.createElement(ActionGroup, null, !globalProfile && /* @__PURE__ */ React.createElement(Button, {\n variant: \"primary\",\n onClick: () => handleSubmit(save)(),\n \"data-testid\": \"saveCreateProfile\",\n isDisabled: !isDirty\n }, t(\"common:save\")), editMode && !globalProfile && /* @__PURE__ */ React.createElement(Button, {\n id: \"reloadProfile\",\n variant: \"link\",\n \"data-testid\": \"reloadProfile\",\n isDisabled: !isDirty,\n onClick: reload\n }, t(\"realm-settings:reload\")), !editMode && !globalProfile && /* @__PURE__ */ React.createElement(Button, {\n id: \"cancelCreateProfile\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: `/${realm}/realm-settings/clientPolicies`\n }),\n \"data-testid\": \"cancelCreateProfile\"\n }, t(\"common:cancel\"))), editMode && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Flex, null, /* @__PURE__ */ React.createElement(FlexItem, null, /* @__PURE__ */ React.createElement(Text, {\n className: \"kc-executors\",\n component: TextVariants.h1\n }, t(\"executors\"), /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings:executorsHelpText\",\n fieldLabelId: \"realm-settings:executors\"\n }))), profile && /* @__PURE__ */ React.createElement(FlexItem, {\n align: {default: \"alignRight\"}\n }, /* @__PURE__ */ React.createElement(Button, {\n id: \"addExecutor\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toAddExecutor({\n realm,\n profileName\n })\n }),\n variant: \"link\",\n className: \"kc-addExecutor\",\n \"data-testid\": \"addExecutor\",\n icon: /* @__PURE__ */ React.createElement(PlusCircleIcon, null)\n }, t(\"realm-settings:addExecutor\")))), profileExecutors.length > 0 && /* @__PURE__ */ React.createElement(DataList, {\n \"aria-label\": t(\"executors\"),\n isCompact: true\n }, profileExecutors.map((executor, idx) => /* @__PURE__ */ React.createElement(DataListItem, {\n \"aria-labelledby\": \"executors-list-item\",\n key: executor.executor,\n id: executor.executor\n }, /* @__PURE__ */ React.createElement(DataListItemRow, {\n \"data-testid\": \"executors-list-row\"\n }, /* @__PURE__ */ React.createElement(DataListItemCells, {\n dataListCells: [\n /* @__PURE__ */ React.createElement(DataListCell, {\n key: \"executor\",\n \"data-testid\": \"executor-type\"\n }, executor.configuration ? /* @__PURE__ */ React.createElement(Button, {\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toExecutor({\n realm,\n profileName,\n executorName: executor.executor\n })\n }),\n variant: \"link\",\n \"data-testid\": \"editExecutor\"\n }, executor.executor) : /* @__PURE__ */ React.createElement(\"span\", {\n className: \"kc-unclickable-executor\"\n }, executor.executor), executorTypes?.filter((type) => type.id === executor.executor).map((type) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(HelpItem, {\n key: type.id,\n helpText: type.helpText,\n fieldLabelId: \"realm-settings:executorTypeTextHelpText\"\n }), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n isInline: true,\n icon: /* @__PURE__ */ React.createElement(TrashIcon, {\n key: `executorType-trash-icon-${type.id}`,\n className: \"kc-executor-trash-icon\",\n \"data-testid\": \"deleteExecutor\"\n }),\n onClick: () => {\n toggleDeleteDialog();\n setExecutorToDelete({\n idx,\n name: type.id\n });\n }\n }))))\n ]\n }))))), globalProfileExecutors.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DataList, {\n \"aria-label\": t(\"executors\"),\n isCompact: true\n }, globalProfileExecutors.map((executor) => /* @__PURE__ */ React.createElement(DataListItem, {\n \"aria-labelledby\": \"global-executors-list-item\",\n key: executor.executor,\n id: executor.executor\n }, /* @__PURE__ */ React.createElement(DataListItemRow, {\n \"data-testid\": \"global-executors-list-row\"\n }, /* @__PURE__ */ React.createElement(DataListItemCells, {\n dataListCells: [\n /* @__PURE__ */ React.createElement(DataListCell, {\n key: \"executor\",\n \"data-testid\": \"global-executor-type\"\n }, Object.keys(executor.configuration).length !== 0 ? /* @__PURE__ */ React.createElement(Button, {\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toExecutor({\n realm,\n profileName,\n executorName: executor.executor\n })\n }),\n variant: \"link\",\n \"data-testid\": \"editExecutor\"\n }, executor.executor) : /* @__PURE__ */ React.createElement(\"span\", {\n className: \"kc-unclickable-executor\"\n }, executor.executor), executorTypes?.filter((type) => type.id === executor.executor).map((type) => /* @__PURE__ */ React.createElement(HelpItem, {\n key: type.id,\n helpText: type.helpText,\n fieldLabelId: \"realm-settings:executorTypeTextHelpText\"\n })))\n ]\n }))))), /* @__PURE__ */ React.createElement(Button, {\n id: \"backToClientPolicies\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: `/${realm}/realm-settings/clientPolicies`\n }),\n variant: \"primary\",\n className: \"kc-backToPolicies\",\n \"data-testid\": \"backToClientPolicies\"\n }, t(\"realm-settings:back\"))), profileExecutors.length === 0 && globalProfileExecutors.length === 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(Text, {\n className: \"kc-emptyExecutors\",\n component: TextVariants.h6\n }, t(\"realm-settings:emptyExecutors\")))))));\n}\n", "import React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {omit} from \"../_snowpack/pkg/lodash.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n ButtonVariant,\n FormGroup,\n Label,\n PageSection,\n ToolbarItem\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {Divider, Flex, FlexItem, Radio, Title} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {CodeEditor, Language} from \"../_snowpack/pkg/@patternfly/react-code-editor.js\";\nimport {KeycloakDataTable} from \"../components/table-toolbar/KeycloakDataTable.js\";\nimport {ListEmptyState} from \"../components/list-empty-state/ListEmptyState.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {prettyPrintJSON} from \"../util.js\";\nimport {Link} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {toAddClientProfile} from \"./routes/AddClientProfile.js\";\nimport {toClientProfile} from \"./routes/ClientProfile.js\";\nimport {KeycloakSpinner} from \"../components/keycloak-spinner/KeycloakSpinner.js\";\nimport \"./RealmSettingsSection.css\";\nexport default function ProfilesTab() {\n const {t} = useTranslation(\"realm-settings\");\n const adminClient = useAdminClient();\n const {realm} = useRealm();\n const {addAlert, addError} = useAlerts();\n const [tableProfiles, setTableProfiles] = useState();\n const [globalProfiles, setGlobalProfiles] = useState();\n const [selectedProfile, setSelectedProfile] = useState();\n const [show, setShow] = useState(false);\n const [code, setCode] = useState();\n const [key, setKey] = useState(0);\n useFetch(() => adminClient.clientPolicies.listProfiles({\n includeGlobalProfiles: true\n }), (allProfiles) => {\n setGlobalProfiles(allProfiles.globalProfiles);\n const globalProfiles2 = allProfiles.globalProfiles?.map((globalProfiles3) => ({\n ...globalProfiles3,\n global: true\n }));\n const profiles = allProfiles.profiles?.map((profiles2) => ({\n ...profiles2,\n global: false\n }));\n const allClientProfiles = globalProfiles2?.concat(profiles ?? []);\n setTableProfiles(allClientProfiles || []);\n setCode(JSON.stringify(allClientProfiles, null, 2));\n }, [key]);\n const loader = async () => tableProfiles ?? [];\n const normalizeProfile = (profile) => omit(profile, \"global\");\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: t(\"deleteClientProfileConfirmTitle\"),\n messageKey: t(\"deleteClientProfileConfirm\", {\n profileName: selectedProfile?.name\n }),\n continueButtonLabel: t(\"delete\"),\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n const updatedProfiles = tableProfiles?.filter((profile) => profile.name !== selectedProfile?.name && !profile.global).map((profile) => normalizeProfile(profile));\n try {\n await adminClient.clientPolicies.createProfiles({\n profiles: updatedProfiles,\n globalProfiles\n });\n addAlert(t(\"deleteClientSuccess\"), AlertVariant.success);\n setKey(key + 1);\n } catch (error) {\n addError(t(\"deleteClientError\"), error);\n }\n }\n });\n const cellFormatter = (row) => /* @__PURE__ */ React.createElement(Link, {\n to: toClientProfile({\n realm,\n profileName: row.name\n }),\n key: row.name\n }, row.name, \" \", row.global && /* @__PURE__ */ React.createElement(Label, {\n color: \"blue\"\n }, t(\"global\")));\n if (!tableProfiles) {\n return /* @__PURE__ */ React.createElement(KeycloakSpinner, null);\n }\n const save = async () => {\n if (!code) {\n return;\n }\n try {\n const obj = JSON.parse(code);\n const changedProfiles = obj.filter((profile) => !profile.global).map((profile) => normalizeProfile(profile));\n const changedGlobalProfiles = obj.filter((profile) => profile.global).map((profile) => normalizeProfile(profile));\n try {\n await adminClient.clientPolicies.createProfiles({\n profiles: changedProfiles,\n globalProfiles: changedGlobalProfiles\n });\n addAlert(t(\"realm-settings:updateClientProfilesSuccess\"), AlertVariant.success);\n setKey(key + 1);\n } catch (error) {\n addError(\"realm-settings:updateClientProfilesError\", error);\n }\n } catch (error) {\n console.warn(\"Invalid json, ignoring value using {}\");\n }\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(PageSection, null, /* @__PURE__ */ React.createElement(Flex, {\n className: \"kc-profiles-config-section\"\n }, /* @__PURE__ */ React.createElement(FlexItem, null, /* @__PURE__ */ React.createElement(Title, {\n headingLevel: \"h1\",\n size: \"md\"\n }, t(\"profilesConfigType\"))), /* @__PURE__ */ React.createElement(FlexItem, null, /* @__PURE__ */ React.createElement(Radio, {\n isChecked: !show,\n name: \"profilesView\",\n onChange: () => setShow(false),\n label: t(\"profilesConfigTypes.formView\"),\n id: \"formView-profilesView\",\n className: \"kc-form-radio-btn pf-u-mr-sm pf-u-ml-sm\",\n \"data-testid\": \"formView-profilesView\"\n })), /* @__PURE__ */ React.createElement(FlexItem, null, /* @__PURE__ */ React.createElement(Radio, {\n isChecked: show,\n name: \"profilesView\",\n onChange: () => setShow(true),\n label: t(\"profilesConfigTypes.jsonEditor\"),\n id: \"jsonEditor-profilesView\",\n className: \"kc-editor-radio-btn\",\n \"data-testid\": \"jsonEditor-profilesView\"\n })))), /* @__PURE__ */ React.createElement(Divider, null), !show ? /* @__PURE__ */ React.createElement(KeycloakDataTable, {\n key: tableProfiles.length,\n ariaLabelKey: \"realm-settings:profiles\",\n searchPlaceholderKey: \"realm-settings:clientProfileSearch\",\n loader,\n toolbarItem: /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(Button, {\n id: \"createProfile\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toAddClientProfile({realm})\n }),\n \"data-testid\": \"createProfile\"\n }, t(\"createClientProfile\"))),\n isRowDisabled: (value) => value.global,\n actions: [\n {\n title: t(\"common:delete\"),\n onRowClick: (profile) => {\n setSelectedProfile(profile);\n toggleDeleteDialog();\n }\n }\n ],\n columns: [\n {\n name: \"name\",\n displayKey: t(\"common:name\"),\n cellRenderer: cellFormatter\n },\n {\n name: \"description\",\n displayKey: t(\"clientProfileDescription\")\n }\n ],\n emptyState: /* @__PURE__ */ React.createElement(ListEmptyState, {\n message: t(\"emptyClientProfiles\"),\n instructions: t(\"emptyClientProfilesInstructions\")\n })\n }) : /* @__PURE__ */ React.createElement(FormGroup, {\n fieldId: \"jsonEditor\"\n }, /* @__PURE__ */ React.createElement(\"div\", {\n className: \"pf-u-mt-md pf-u-ml-lg\"\n }, /* @__PURE__ */ React.createElement(CodeEditor, {\n isLineNumbersVisible: true,\n isLanguageLabelVisible: true,\n isReadOnly: false,\n code,\n language: Language.json,\n height: \"30rem\",\n onChange: (value) => {\n setCode(value ?? \"\");\n }\n })), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(\"div\", {\n className: \"pf-u-mt-md\"\n }, /* @__PURE__ */ React.createElement(Button, {\n variant: ButtonVariant.primary,\n className: \"pf-u-mr-md pf-u-ml-lg\",\n onClick: save,\n \"data-testid\": \"jsonEditor-saveBtn\"\n }, t(\"save\")), /* @__PURE__ */ React.createElement(Button, {\n variant: ButtonVariant.link,\n onClick: () => {\n setCode(prettyPrintJSON(tableProfiles));\n },\n \"data-testid\": \"jsonEditor-reloadBtn\"\n }, t(\"reload\"))))));\n}\n", "import React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {Controller, FormProvider, useForm} from \"../_snowpack/pkg/react-hook-form.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n FormGroup,\n PageSection,\n Select,\n SelectOption,\n SelectVariant\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {FormAccess} from \"../components/form-access/FormAccess.js\";\nimport {FormPanel} from \"../components/scroll-form/FormPanel.js\";\nimport {HelpItem} from \"../components/help-enabler/HelpItem.js\";\nimport {useServerInfo} from \"../context/server-info/ServerInfoProvider.js\";\nimport {camelCase} from \"../_snowpack/pkg/lodash.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {useHistory, useParams} from \"../_snowpack/pkg/react-router.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {\n toEditClientPolicy\n} from \"./routes/EditClientPolicy.js\";\nimport {\n convertToMultiline,\n toValue\n} from \"../components/multi-line-input/multi-line-convert.js\";\nimport {\n COMPONENTS,\n isValidComponentType\n} from \"../components/dynamic/components.js\";\nimport {MultivaluedChipsComponent} from \"../components/dynamic/MultivaluedChipsComponent.js\";\nimport {MultivaluedRoleComponent} from \"../components/dynamic/MultivaluedRoleComponent.js\";\nexport default function NewClientPolicyCondition() {\n const {t} = useTranslation(\"realm-settings\");\n const {addAlert, addError} = useAlerts();\n const history = useHistory();\n const {realm} = useRealm();\n const [openConditionType, setOpenConditionType] = useState(false);\n const [policies, setPolicies] = useState([]);\n const [condition, setCondition] = useState([]);\n const [conditionData, setConditionData] = useState();\n const [conditionType, setConditionType] = useState(\"\");\n const [conditionProperties, setConditionProperties] = useState([]);\n const {policyName} = useParams();\n const {conditionName} = useParams();\n const serverInfo = useServerInfo();\n const form = useForm({\n shouldUnregister: false\n });\n const conditionTypes = serverInfo.componentTypes?.[\"org.keycloak.services.clientpolicy.condition.ClientPolicyConditionProvider\"];\n const adminClient = useAdminClient();\n const setupForm = (condition2, properties) => {\n form.reset();\n Object.entries(condition2.configuration).map(([key, value]) => {\n const formKey = `config.${key}`;\n const property = properties.find((p) => p.name === key);\n if (property?.type === \"MultivaluedString\" && property.name !== \"scopes\" && property.name !== \"groups\") {\n form.setValue(formKey, convertToMultiline(value));\n } else if (property?.name === \"client-scopes\") {\n form.setValue(\"config.scopes\", value);\n } else {\n form.setValue(formKey, value);\n }\n });\n };\n useFetch(() => adminClient.clientPolicies.listPolicies(), (policies2) => {\n setPolicies(policies2.policies ?? []);\n if (conditionName) {\n const currentPolicy = policies2.policies?.find((item) => item.name === policyName);\n const typeAndConfigData = currentPolicy?.conditions?.find((item) => item.condition === conditionName);\n const currentCondition = conditionTypes?.find((condition2) => condition2.id === conditionName);\n setConditionData(typeAndConfigData);\n setConditionProperties(currentCondition?.properties);\n setupForm(typeAndConfigData, currentCondition?.properties);\n }\n }, []);\n const save = async (configPolicy) => {\n const configValues = configPolicy.config;\n const writeConfig = () => {\n return conditionProperties.reduce((r, p) => {\n p.type === \"MultivaluedString\" && p.name !== \"scopes\" && p.name !== \"groups\" ? r[p.name] = toValue(configValues[p.name]) : r[p.name] = configValues[p.name];\n return r;\n }, {});\n };\n const updatedPolicies = policies.map((policy) => {\n if (policy.name !== policyName) {\n return policy;\n }\n let conditions = policy.conditions ?? [];\n if (conditionName) {\n const createdCondition = {\n condition: conditionData?.condition,\n configuration: writeConfig()\n };\n const index = conditions.findIndex((condition2) => conditionName === condition2.condition);\n if (index === -1) {\n return;\n }\n const newConditions = [\n ...conditions.slice(0, index),\n createdCondition,\n ...conditions.slice(index + 1)\n ];\n return {\n ...policy,\n conditions: newConditions\n };\n }\n conditions = conditions.concat({\n condition: condition[0].condition,\n configuration: writeConfig()\n });\n return {\n ...policy,\n conditions\n };\n });\n try {\n await adminClient.clientPolicies.updatePolicy({\n policies: updatedPolicies\n });\n setPolicies(updatedPolicies);\n history.push(`/${realm}/realm-settings/clientPolicies/${policyName}/edit-policy`);\n addAlert(conditionName ? t(\"realm-settings:updateClientConditionSuccess\") : t(\"realm-settings:createClientConditionSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"realm-settings:createClientConditionError\", error);\n }\n };\n return /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormPanel, {\n className: \"kc-login-screen\",\n title: conditionName ? t(\"editCondition\") : t(\"addCondition\")\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n role: \"manage-realm\",\n className: \"pf-u-mt-lg\",\n onSubmit: form.handleSubmit(save)\n }, /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"conditionType\"),\n fieldId: \"conditionType\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: conditionType ? `realm-settings-help:${camelCase(conditionType.replace(/-/g, \" \"))}` : \"realm-settings:anyClient\",\n fieldLabelId: \"realm-settings:conditionType\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"conditions\",\n defaultValue: \"any-client\",\n control: form.control,\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Select, {\n placeholderText: t(\"selectACondition\"),\n className: \"kc-conditionType-select\",\n \"data-testid\": \"conditionType-select\",\n toggleId: \"provider\",\n isDisabled: !!conditionName,\n onToggle: (toggle) => setOpenConditionType(toggle),\n onSelect: (_, value2) => {\n onChange(value2);\n setConditionProperties(value2.properties);\n setConditionType(value2.id);\n setCondition([\n {\n condition: value2.id\n }\n ]);\n setOpenConditionType(false);\n },\n selections: conditionName ? conditionName : conditionType,\n variant: SelectVariant.single,\n \"aria-label\": t(\"conditionType\"),\n isOpen: openConditionType\n }, conditionTypes?.map((condition2) => /* @__PURE__ */ React.createElement(SelectOption, {\n selected: condition2.id === value,\n description: t(`realm-settings-help:${camelCase(condition2.id.replace(/-/g, \" \"))}`),\n key: condition2.id,\n value: condition2\n }, condition2.id)))\n })), /* @__PURE__ */ React.createElement(FormProvider, {\n ...form\n }, conditionProperties.map((property) => {\n const componentType = property.type;\n if (property.name === \"roles\") {\n return /* @__PURE__ */ React.createElement(MultivaluedRoleComponent, {\n ...property\n });\n }\n if (property.name === \"scopes\" || property.name === \"groups\") {\n return /* @__PURE__ */ React.createElement(MultivaluedChipsComponent, {\n defaultValue: property.name === \"scopes\" ? \"offline_access\" : \"topgroup\",\n ...property\n });\n }\n if (isValidComponentType(componentType)) {\n const Component = COMPONENTS[componentType];\n return /* @__PURE__ */ React.createElement(Component, {\n key: property.name,\n ...property\n });\n } else {\n console.warn(`There is no editor registered for ${componentType}`);\n }\n })), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n variant: \"primary\",\n type: \"submit\",\n \"data-testid\": \"addCondition-saveBtn\",\n isDisabled: conditionType === \"\" && !conditionName\n }, conditionName ? t(\"common:save\") : t(\"common:add\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n \"data-testid\": \"addCondition-cancelBtn\",\n onClick: () => history.push(toEditClientPolicy({realm, policyName}))\n }, t(\"common:cancel\"))))));\n}\n", "import React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n ButtonVariant,\n DataList,\n DataListCell,\n DataListItem,\n DataListItemCells,\n DataListItemRow,\n Divider,\n DropdownItem,\n Flex,\n FlexItem,\n FormGroup,\n PageSection,\n Text,\n TextArea,\n TextInput,\n TextVariants,\n ValidatedOptions\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {Controller, useForm} from \"../_snowpack/pkg/react-hook-form.js\";\nimport {FormAccess} from \"../components/form-access/FormAccess.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {Link, useHistory, useParams} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {HelpItem} from \"../components/help-enabler/HelpItem.js\";\nimport {PlusCircleIcon, TrashIcon} from \"../_snowpack/pkg/@patternfly/react-icons.js\";\nimport \"./RealmSettingsSection.css\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {toClientPolicies} from \"./routes/ClientPolicies.js\";\nimport {toNewClientPolicyCondition} from \"./routes/AddCondition.js\";\nimport {useServerInfo} from \"../context/server-info/ServerInfoProvider.js\";\nimport {toEditClientPolicyCondition} from \"./routes/EditCondition.js\";\nimport {AddClientProfileModal} from \"./AddClientProfileModal.js\";\nconst defaultValues = {\n name: \"\",\n description: \"\",\n conditions: [],\n enabled: true,\n profiles: []\n};\nexport default function NewClientPolicyForm() {\n const {t} = useTranslation(\"realm-settings\");\n const {errors, reset: resetForm} = useForm({\n defaultValues\n });\n const {realm} = useRealm();\n const {addAlert, addError} = useAlerts();\n const adminClient = useAdminClient();\n const [policies, setPolicies] = useState([]);\n const [clientProfiles, setClientProfiles] = useState([]);\n const [currentPolicy, setCurrentPolicy] = useState();\n const [\n showAddConditionsAndProfilesForm,\n setShowAddConditionsAndProfilesForm\n ] = useState(false);\n const [conditionToDelete, setConditionToDelete] = useState();\n const [profilesModalOpen, setProfilesModalOpen] = useState(false);\n const [profileToDelete, setProfileToDelete] = useState();\n const {policyName} = useParams();\n const history = useHistory();\n const form = useForm({mode: \"onChange\"});\n const {handleSubmit} = form;\n const [key, setKey] = useState(0);\n const refresh = () => setKey(new Date().getTime());\n const formValues = form.getValues();\n const ClientPoliciesHeader = ({\n save: save2,\n onChange,\n value\n }) => {\n const {t: t2} = useTranslation(\"realm-settings\");\n const [toggleDisableDialog, DisableConfirm] = useConfirmDialog({\n titleKey: \"realm-settings:disablePolicyConfirmTitle\",\n messageKey: \"realm-settings:disablePolicyConfirm\",\n continueButtonLabel: \"common:disable\",\n onConfirm: () => {\n onChange(!value);\n save2();\n }\n });\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DisableConfirm, null), /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: showAddConditionsAndProfilesForm || policyName ? formValues.name : t2(\"createPolicy\"),\n divider: true,\n dropdownItems: showAddConditionsAndProfilesForm || policyName ? [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"delete\",\n value: \"delete\",\n onClick: () => {\n toggleDeleteDialog();\n },\n \"data-testid\": \"deleteClientPolicyDropdown\"\n }, t2(\"deleteClientPolicy\"))\n ] : void 0,\n isEnabled: value,\n onToggle: (value2) => {\n if (!value2) {\n toggleDisableDialog();\n } else {\n onChange(value2);\n save2();\n }\n }\n }));\n };\n useFetch(async () => {\n const [policies2, profiles] = await Promise.all([\n adminClient.clientPolicies.listPolicies(),\n adminClient.clientPolicies.listProfiles({\n includeGlobalProfiles: true\n })\n ]);\n return {policies: policies2, profiles};\n }, ({policies: policies2, profiles}) => {\n const currentPolicy2 = policies2.policies?.find((item) => item.name === policyName);\n const allClientProfiles = [\n ...profiles.globalProfiles ?? [],\n ...profiles.profiles ?? []\n ];\n setPolicies(policies2.policies ?? []);\n if (currentPolicy2) {\n setupForm(currentPolicy2);\n setClientProfiles(allClientProfiles);\n setCurrentPolicy(currentPolicy2);\n setShowAddConditionsAndProfilesForm(true);\n }\n }, [key]);\n const setupForm = (policy2) => {\n resetForm();\n Object.entries(policy2).map(([key2, value]) => {\n form.setValue(key2, value);\n });\n };\n const policy = policies.filter((policy2) => policy2.name === policyName);\n const policyConditions = policy[0]?.conditions || [];\n const policyProfiles = policy[0]?.profiles || [];\n const serverInfo = useServerInfo();\n const conditionTypes = serverInfo.componentTypes?.[\"org.keycloak.services.clientpolicy.condition.ClientPolicyConditionProvider\"];\n const save = async () => {\n const createdForm = form.getValues();\n const createdPolicy = {\n ...createdForm,\n profiles: [],\n conditions: []\n };\n const getAllPolicies = () => {\n const policyNameExists = policies.some((policy2) => policy2.name === createdPolicy.name);\n if (policyNameExists) {\n return policies.map((policy2) => policy2.name === createdPolicy.name ? createdPolicy : policy2);\n } else if (createdForm.name !== policyName) {\n return policies.filter((item) => item.name !== policyName).concat(createdForm);\n }\n return policies.concat(createdForm);\n };\n try {\n await adminClient.clientPolicies.updatePolicy({\n policies: getAllPolicies()\n });\n addAlert(policyName ? t(\"realm-settings:updateClientPolicySuccess\") : t(\"realm-settings:createClientPolicySuccess\"), AlertVariant.success);\n history.push(`/${realm}/realm-settings/clientPolicies/${createdForm.name}/edit-policy`);\n setShowAddConditionsAndProfilesForm(true);\n refresh();\n } catch (error) {\n addError(\"realm-settings:createClientPolicyError\", error);\n }\n };\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: t(\"deleteClientPolicyConfirmTitle\"),\n messageKey: t(\"deleteClientPolicyConfirm\", {\n policyName\n }),\n continueButtonLabel: t(\"delete\"),\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n const updatedPolicies = policies.filter((policy2) => policy2.name !== policyName);\n try {\n await adminClient.clientPolicies.updatePolicy({\n policies: updatedPolicies\n });\n addAlert(t(\"deleteClientPolicySuccess\"), AlertVariant.success);\n history.push(toClientPolicies({realm}));\n } catch (error) {\n addError(t(\"deleteClientPolicyError\"), error);\n }\n }\n });\n const [toggleDeleteConditionDialog, DeleteConditionConfirm] = useConfirmDialog({\n titleKey: t(\"deleteClientPolicyConditionConfirmTitle\"),\n messageKey: t(\"deleteClientPolicyConditionConfirm\", {\n condition: conditionToDelete?.name\n }),\n continueButtonLabel: t(\"delete\"),\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n if (conditionToDelete?.name) {\n currentPolicy?.conditions?.splice(conditionToDelete.idx, 1);\n try {\n await adminClient.clientPolicies.updatePolicy({\n policies\n });\n addAlert(t(\"deleteConditionSuccess\"), AlertVariant.success);\n history.push(`/${realm}/realm-settings/clientPolicies/${formValues.name}/edit-policy`);\n refresh();\n } catch (error) {\n addError(t(\"deleteConditionError\"), error);\n }\n } else {\n const updatedPolicies = policies.filter((policy2) => policy2.name !== policyName);\n try {\n await adminClient.clientPolicies.updatePolicy({\n policies: updatedPolicies\n });\n addAlert(t(\"deleteClientSuccess\"), AlertVariant.success);\n history.push(toClientPolicies({realm}));\n } catch (error) {\n addError(t(\"deleteClientError\"), error);\n }\n }\n }\n });\n const [toggleDeleteProfileDialog, DeleteProfileConfirm] = useConfirmDialog({\n titleKey: t(\"deleteClientPolicyProfileConfirmTitle\"),\n messageKey: t(\"deleteClientPolicyProfileConfirm\", {\n profileName: profileToDelete?.name,\n policyName\n }),\n continueButtonLabel: t(\"delete\"),\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n if (profileToDelete?.name) {\n currentPolicy?.profiles?.splice(profileToDelete.idx, 1);\n try {\n await adminClient.clientPolicies.updatePolicy({\n policies\n });\n addAlert(t(\"deleteClientPolicyProfileSuccess\"), AlertVariant.success);\n history.push(`/${realm}/realm-settings/clientPolicies/${formValues.name}/edit-policy`);\n } catch (error) {\n addError(t(\"deleteClientPolicyProfileError\"), error);\n }\n } else {\n const updatedPolicies = policies.filter((policy2) => policy2.name !== policyName);\n try {\n await adminClient.clientPolicies.updatePolicy({\n policies: updatedPolicies\n });\n addAlert(t(\"deleteClientSuccess\"), AlertVariant.success);\n history.push(toClientPolicies({realm}));\n } catch (error) {\n addError(t(\"deleteClientError\"), error);\n }\n }\n }\n });\n const reset = () => {\n form.setValue(\"name\", currentPolicy?.name);\n form.setValue(\"description\", currentPolicy?.description);\n };\n const refreshHeader = () => {\n setKey(new Date().getTime());\n };\n const toggleModal = () => {\n setProfilesModalOpen(!profilesModalOpen);\n };\n const addProfiles = async (profiles) => {\n const createdPolicy = {\n ...currentPolicy,\n profiles: (currentPolicy?.profiles ?? []).concat(profiles),\n conditions: currentPolicy?.conditions\n };\n const index = policies.findIndex((policy2) => createdPolicy.name === policy2.name);\n if (index === -1) {\n return;\n }\n const newPolicies = [\n ...policies.slice(0, index),\n createdPolicy,\n ...policies.slice(index + 1)\n ];\n try {\n await adminClient.clientPolicies.updatePolicy({\n policies: newPolicies\n });\n setPolicies(newPolicies);\n history.push(`/${realm}/realm-settings/clientPolicies/${formValues.name}/edit-policy`);\n addAlert(t(\"realm-settings:addClientProfileSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"realm-settings:addClientProfileError\", error);\n }\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConditionConfirm, null), /* @__PURE__ */ React.createElement(DeleteProfileConfirm, null), /* @__PURE__ */ React.createElement(AddClientProfileModal, {\n onConfirm: (profiles) => {\n addProfiles(profiles.map((item) => item.name));\n },\n allProfiles: policyProfiles,\n open: profilesModalOpen,\n toggleDialog: toggleModal\n }), /* @__PURE__ */ React.createElement(Controller, {\n name: \"enabled\",\n defaultValue: true,\n control: form.control,\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(ClientPoliciesHeader, {\n value,\n onChange,\n realmName: realm,\n refresh: refreshHeader,\n save\n })\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n onSubmit: handleSubmit(save),\n isHorizontal: true,\n role: \"view-realm\",\n className: \"pf-u-mt-lg\"\n }, /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:name\"),\n fieldId: \"kc-name\",\n isRequired: true,\n helperTextInvalid: t(\"common:required\"),\n validated: errors.name ? ValidatedOptions.error : ValidatedOptions.default\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: form.register({required: true}),\n type: \"text\",\n id: \"kc-client-profile-name\",\n name: \"name\",\n \"data-testid\": \"client-policy-name\"\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:description\"),\n fieldId: \"kc-description\"\n }, /* @__PURE__ */ React.createElement(TextArea, {\n name: \"description\",\n \"aria-label\": t(\"description\"),\n ref: form.register(),\n type: \"text\",\n id: \"kc-client-policy-description\",\n \"data-testid\": \"client-policy-description\"\n })), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n variant: \"primary\",\n type: \"submit\",\n \"data-testid\": \"saveCreatePolicy\",\n isDisabled: !formValues.name\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n id: \"cancelCreatePolicy\",\n variant: \"secondary\",\n onClick: () => showAddConditionsAndProfilesForm || policyName ? reset() : history.push(toClientPolicies({realm})),\n \"data-testid\": \"cancelCreatePolicy\"\n }, showAddConditionsAndProfilesForm ? t(\"common:revert\") : t(\"common:cancel\"))), (showAddConditionsAndProfilesForm || form.formState.isSubmitted) && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Flex, null, /* @__PURE__ */ React.createElement(FlexItem, null, /* @__PURE__ */ React.createElement(Text, {\n className: \"kc-conditions\",\n component: TextVariants.h1\n }, t(\"conditions\"), /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings:realm-settings-help:conditions\",\n fieldLabelId: \"realm-settings:conditions\"\n }))), /* @__PURE__ */ React.createElement(FlexItem, {\n align: {default: \"alignRight\"}\n }, /* @__PURE__ */ React.createElement(Button, {\n id: \"addCondition\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toNewClientPolicyCondition({\n realm,\n policyName: formValues.name\n })\n }),\n variant: \"link\",\n className: \"kc-addCondition\",\n \"data-testid\": \"addCondition\",\n icon: /* @__PURE__ */ React.createElement(PlusCircleIcon, null)\n }, t(\"realm-settings:addCondition\")))), policyConditions.length > 0 ? /* @__PURE__ */ React.createElement(DataList, {\n \"aria-label\": t(\"conditions\"),\n isCompact: true\n }, policyConditions.map((condition, idx) => /* @__PURE__ */ React.createElement(DataListItem, {\n \"aria-labelledby\": \"conditions-list-item\",\n key: `list-item-${idx}`,\n id: condition.condition,\n \"data-testid\": \"conditions-list-item\"\n }, /* @__PURE__ */ React.createElement(DataListItemRow, {\n \"data-testid\": \"conditions-list-row\"\n }, /* @__PURE__ */ React.createElement(DataListItemCells, {\n dataListCells: [\n /* @__PURE__ */ React.createElement(DataListCell, {\n key: `name-${idx}`,\n \"data-testid\": \"condition-type\"\n }, Object.keys(condition.configuration).length !== 0 ? /* @__PURE__ */ React.createElement(Link, {\n key: condition.condition,\n \"data-testid\": `${condition.condition}-condition-link`,\n to: toEditClientPolicyCondition({\n realm,\n conditionName: condition.condition,\n policyName\n }),\n className: \"kc-condition-link\"\n }, condition.condition) : condition.condition, conditionTypes?.map((type) => type.id === condition.condition && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: type.helpText,\n fieldLabelId: condition.condition\n }), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n isInline: true,\n icon: /* @__PURE__ */ React.createElement(TrashIcon, {\n className: \"kc-conditionType-trash-icon\",\n \"data-testid\": `delete-${condition.condition}-condition`,\n onClick: () => {\n toggleDeleteConditionDialog();\n setConditionToDelete({\n idx,\n name: type.id\n });\n }\n })\n }))))\n ]\n }))))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(Text, {\n className: \"kc-emptyConditions\",\n component: TextVariants.h6\n }, t(\"realm-settings:emptyConditions\")))), (showAddConditionsAndProfilesForm || form.formState.isSubmitted) && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Flex, null, /* @__PURE__ */ React.createElement(FlexItem, null, /* @__PURE__ */ React.createElement(Text, {\n className: \"kc-client-profiles\",\n component: TextVariants.h1\n }, t(\"clientProfiles\"), /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:clientProfiles\",\n fieldLabelId: \"realm-settings:clientProfiles\"\n }))), /* @__PURE__ */ React.createElement(FlexItem, {\n align: {default: \"alignRight\"}\n }, /* @__PURE__ */ React.createElement(Button, {\n id: \"addClientProfile\",\n variant: \"link\",\n className: \"kc-addClientProfile\",\n \"data-testid\": \"addClientProfile\",\n icon: /* @__PURE__ */ React.createElement(PlusCircleIcon, null),\n onClick: toggleModal\n }, t(\"realm-settings:addClientProfile\")))), policyProfiles.length > 0 ? /* @__PURE__ */ React.createElement(DataList, {\n \"aria-label\": t(\"profiles\"),\n isCompact: true\n }, policyProfiles.map((profile, idx) => /* @__PURE__ */ React.createElement(DataListItem, {\n \"aria-labelledby\": `${profile}-profile-list-item`,\n key: profile,\n id: `${profile}-profile-list-item`,\n \"data-testid\": \"profile-list-item\"\n }, /* @__PURE__ */ React.createElement(DataListItemRow, {\n \"data-testid\": \"profile-list-row\"\n }, /* @__PURE__ */ React.createElement(DataListItemCells, {\n dataListCells: [\n /* @__PURE__ */ React.createElement(DataListCell, {\n key: \"name\",\n \"data-testid\": \"profile-name\"\n }, profile && /* @__PURE__ */ React.createElement(Link, {\n key: profile,\n \"data-testid\": \"profile-name-link\",\n to: \"\",\n className: \"kc-profile-link\"\n }, profile), policyProfiles.filter((type) => type === profile).map((type) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: clientProfiles.find((profile2) => type === profile2.name)?.description,\n fieldLabelId: profile\n }), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n isInline: true,\n icon: /* @__PURE__ */ React.createElement(TrashIcon, {\n className: \"kc-conditionType-trash-icon\",\n \"data-testid\": \"deleteClientProfileDropdown\",\n onClick: () => {\n toggleDeleteProfileDialog();\n setProfileToDelete({\n idx,\n name: type\n });\n }\n })\n }))))\n ]\n }))))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(Text, {\n className: \"kc-emptyClientProfiles\",\n component: TextVariants.h6\n }, t(\"realm-settings:emptyProfiles\")))))));\n}\n", "import React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {Link} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {Breadcrumb, BreadcrumbItem} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {KeycloakSpinner} from \"../components/keycloak-spinner/KeycloakSpinner.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {KEY_PROVIDER_TYPE} from \"../util.js\";\nimport {toRealmSettings} from \"./routes/RealmSettings.js\";\nimport {RealmSettingsTabs} from \"./RealmSettingsTabs.js\";\nimport {toClientPolicies} from \"./routes/ClientPolicies.js\";\nexport const EditProviderCrumb = () => {\n const {t} = useTranslation(\"realm-settings\");\n const {realm} = useRealm();\n return /* @__PURE__ */ React.createElement(Breadcrumb, null, /* @__PURE__ */ React.createElement(BreadcrumbItem, {\n render: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toRealmSettings({realm, tab: \"keys\"})\n }, t(\"keys\"))\n }), /* @__PURE__ */ React.createElement(BreadcrumbItem, null, t(\"providers\")), /* @__PURE__ */ React.createElement(BreadcrumbItem, {\n isActive: true\n }, t(\"editProvider\")));\n};\nexport const ToClientPolicies = () => {\n const {t} = useTranslation(\"realm-settings\");\n const {realm} = useRealm();\n return /* @__PURE__ */ React.createElement(BreadcrumbItem, {\n render: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toClientPolicies({realm})\n }, t(\"clientPolicies\"))\n });\n};\nexport const EditPolicyCrumb = () => {\n const {t} = useTranslation(\"realm-settings\");\n return /* @__PURE__ */ React.createElement(Breadcrumb, null, /* @__PURE__ */ React.createElement(ToClientPolicies, null), /* @__PURE__ */ React.createElement(BreadcrumbItem, {\n isActive: true\n }, t(\"policyDetails\")));\n};\nexport const EditProfileCrumb = () => {\n const {t} = useTranslation(\"realm-settings\");\n const {realm} = useRealm();\n return /* @__PURE__ */ React.createElement(Breadcrumb, null, /* @__PURE__ */ React.createElement(BreadcrumbItem, {\n render: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toClientPolicies({realm})\n }, t(\"clientPolicies\"))\n }), /* @__PURE__ */ React.createElement(BreadcrumbItem, {\n isActive: true\n }, t(\"clientProfile\")));\n};\nexport const EditExecutorCrumb = () => {\n const {t} = useTranslation(\"realm-settings\");\n const {realm} = useRealm();\n return /* @__PURE__ */ React.createElement(Breadcrumb, null, /* @__PURE__ */ React.createElement(BreadcrumbItem, {\n render: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toClientPolicies({realm})\n }, t(\"clientPolicies\"))\n }), /* @__PURE__ */ React.createElement(BreadcrumbItem, {\n isActive: true\n }, t(\"executorDetails\")));\n};\nexport const NewPolicyCrumb = () => {\n const {t} = useTranslation(\"realm-settings\");\n const {realm} = useRealm();\n return /* @__PURE__ */ React.createElement(Breadcrumb, null, /* @__PURE__ */ React.createElement(BreadcrumbItem, {\n render: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toClientPolicies({realm})\n }, t(\"clientPolicies\"))\n }), /* @__PURE__ */ React.createElement(BreadcrumbItem, {\n isActive: true\n }, t(\"createPolicy\")));\n};\nconst sortByPriority = (components) => {\n const sortedComponents = [...components].sort((a, b) => {\n const priorityA = Number(a.config?.priority);\n const priorityB = Number(b.config?.priority);\n return (!isNaN(priorityB) ? priorityB : 0) - (!isNaN(priorityA) ? priorityA : 0);\n });\n return sortedComponents;\n};\nexport default function RealmSettingsSection() {\n const adminClient = useAdminClient();\n const {realm: realmName} = useRealm();\n const [realm, setRealm] = useState();\n const [realmComponents, setRealmComponents] = useState();\n const [key, setKey] = useState(0);\n const refresh = () => {\n setKey(key + 1);\n };\n useFetch(async () => {\n const realm2 = await adminClient.realms.findOne({realm: realmName});\n const realmComponents2 = await adminClient.components.find({\n type: KEY_PROVIDER_TYPE,\n realm: realmName\n });\n return {realm: realm2, realmComponents: realmComponents2};\n }, ({realm: realm2, realmComponents: realmComponents2}) => {\n setRealmComponents(sortByPriority(realmComponents2));\n setRealm(realm2);\n }, [key]);\n if (!realm || !realmComponents) {\n return /* @__PURE__ */ React.createElement(KeycloakSpinner, null);\n }\n return /* @__PURE__ */ React.createElement(RealmSettingsTabs, {\n realm,\n refresh,\n realmComponents\n });\n}\n", "import React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {useHistory, useParams, useRouteMatch} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {\n AlertVariant,\n ButtonVariant,\n DropdownItem,\n PageSection,\n Tab,\n TabTitleText\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {useForm} from \"../_snowpack/pkg/react-hook-form.js\";\nimport {omit} from \"../_snowpack/pkg/lodash.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {\n AttributesForm\n} from \"../components/attribute-form/AttributeForm.js\";\nimport {\n attributesToArray,\n arrayToAttributes\n} from \"../components/attribute-form/attribute-convert.js\";\nimport {KeycloakSpinner} from \"../components/keycloak-spinner/KeycloakSpinner.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {RealmRoleForm} from \"./RealmRoleForm.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {AssociatedRolesModal} from \"./AssociatedRolesModal.js\";\nimport {KeycloakTabs} from \"../components/keycloak-tabs/KeycloakTabs.js\";\nimport {AssociatedRolesTab} from \"./AssociatedRolesTab.js\";\nimport {UsersInRoleTab} from \"./UsersInRoleTab.js\";\nimport {toRealmRole} from \"./routes/RealmRole.js\";\nimport {\n ClientRoleRoute,\n toClientRole\n} from \"./routes/ClientRole.js\";\nexport default function RealmRoleTabs() {\n const {t} = useTranslation(\"roles\");\n const form = useForm({\n mode: \"onChange\"\n });\n const {setValue, getValues, trigger, reset} = form;\n const history = useHistory();\n const adminClient = useAdminClient();\n const [role, setRole] = useState();\n const {id, clientId} = useParams();\n const {url} = useRouteMatch();\n const {realm: realmName} = useRealm();\n const [key, setKey] = useState(\"\");\n const refresh = () => {\n setKey(`${new Date().getTime()}`);\n };\n const {addAlert, addError} = useAlerts();\n const [open, setOpen] = useState(false);\n const convert = (role2) => {\n const {attributes, ...rest} = role2;\n return {\n attributes: attributesToArray(attributes),\n ...rest\n };\n };\n const [realm, setRealm] = useState();\n useFetch(async () => {\n const realm2 = await adminClient.realms.findOne({realm: realmName});\n if (!id) {\n return {realm: realm2};\n }\n const role2 = await adminClient.roles.findOneById({id});\n return {realm: realm2, role: role2};\n }, ({realm: realm2, role: role2}) => {\n if (!realm2 || !role2 && id) {\n throw new Error(t(\"common:notFound\"));\n }\n if (role2) {\n const convertedRole = convert(role2);\n setRole(convertedRole);\n Object.entries(convertedRole).map((entry) => {\n setValue(entry[0], entry[1]);\n });\n }\n setRealm(realm2);\n }, [key]);\n const save = async () => {\n try {\n const values = getValues();\n if (values.attributes && values.attributes[values.attributes.length - 1]?.key === \"\") {\n setValue(\"attributes\", values.attributes.slice(0, values.attributes.length - 1));\n }\n if (!await trigger()) {\n return;\n }\n const {attributes, ...rest} = values;\n let roleRepresentation = rest;\n roleRepresentation.name = roleRepresentation.name?.trim();\n if (id) {\n if (attributes) {\n roleRepresentation.attributes = arrayToAttributes(attributes);\n }\n roleRepresentation = {\n ...omit(role, \"attributes\"),\n ...roleRepresentation\n };\n if (!clientId) {\n await adminClient.roles.updateById({id}, roleRepresentation);\n } else {\n await adminClient.clients.updateRole({id: clientId, roleName: values.name}, roleRepresentation);\n }\n setRole(convert(roleRepresentation));\n } else {\n let createdRole;\n if (!clientId) {\n await adminClient.roles.create(roleRepresentation);\n createdRole = await adminClient.roles.findOneByName({\n name: values.name\n });\n } else {\n await adminClient.clients.createRole({\n id: clientId,\n name: values.name\n });\n if (values.description) {\n await adminClient.clients.updateRole({id: clientId, roleName: values.name}, roleRepresentation);\n }\n createdRole = await adminClient.clients.findRole({\n id: clientId,\n roleName: values.name\n });\n }\n if (!createdRole) {\n throw new Error(t(\"common:notFound\"));\n }\n setRole(convert(createdRole));\n history.push(url.substr(0, url.lastIndexOf(\"/\") + 1) + createdRole.id + \"/details\");\n }\n addAlert(t(id ? \"roleSaveSuccess\" : \"roleCreated\"), AlertVariant.success);\n } catch (error) {\n addError(`roles:${id ? \"roleSave\" : \"roleCreate\"}Error`, error);\n }\n };\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"roles:roleDeleteConfirm\",\n messageKey: t(\"roles:roleDeleteConfirmDialog\", {\n name: role?.name || t(\"createRole\")\n }),\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n if (!clientId) {\n await adminClient.roles.delById({id});\n } else {\n await adminClient.clients.delRole({\n id: clientId,\n roleName: role.name\n });\n }\n addAlert(t(\"roleDeletedSuccess\"), AlertVariant.success);\n history.push(url.substr(0, url.indexOf(\"/roles\") + \"/roles\".length));\n } catch (error) {\n addError(\"roles:roleDeleteError\", error);\n }\n }\n });\n const dropdownItems = url.includes(\"associated-roles\") ? [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"delete-all-associated\",\n component: \"button\",\n onClick: () => toggleDeleteAllAssociatedRolesDialog()\n }, t(\"roles:removeAllAssociatedRoles\")),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"delete-role\",\n component: \"button\",\n onClick: () => {\n toggleDeleteDialog();\n }\n }, t(\"deleteRole\"))\n ] : [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"toggle-modal\",\n \"data-testid\": \"add-roles\",\n component: \"button\",\n onClick: () => toggleModal()\n }, t(\"addAssociatedRolesText\")),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"delete-role\",\n component: \"button\",\n onClick: () => toggleDeleteDialog()\n }, t(\"deleteRole\"))\n ];\n const [\n toggleDeleteAllAssociatedRolesDialog,\n DeleteAllAssociatedRolesConfirm\n ] = useConfirmDialog({\n titleKey: t(\"roles:removeAllAssociatedRoles\") + \"?\",\n messageKey: t(\"roles:removeAllAssociatedRolesConfirmDialog\", {\n name: role?.name || t(\"createRole\")\n }),\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n const additionalRoles = await adminClient.roles.getCompositeRoles({\n id: role.id\n });\n await adminClient.roles.delCompositeRoles({id}, additionalRoles);\n addAlert(t(\"compositeRoleOff\"), AlertVariant.success, t(\"compositesRemovedAlertDescription\"));\n const loc = url.replace(/\\/AssociatedRoles/g, \"/details\");\n history.push(loc);\n refresh();\n } catch (error) {\n addError(\"roles:roleDeleteError\", error);\n }\n }\n });\n const toggleModal = () => {\n setOpen(!open);\n };\n const clientRoleRouteMatch = useRouteMatch(ClientRoleRoute.path);\n const toAssociatedRoles = () => {\n const to = clientRoleRouteMatch ? toClientRole({\n ...clientRoleRouteMatch.params,\n tab: \"associated-roles\"\n }) : toRealmRole({\n realm: realm?.realm,\n id,\n tab: \"associated-roles\"\n });\n history.push(to);\n };\n const addComposites = async (composites) => {\n try {\n await adminClient.roles.createComposite({roleId: role?.id, realm: realm.realm}, composites);\n refresh();\n toAssociatedRoles();\n addAlert(t(\"addAssociatedRolesSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"roles:addAssociatedRolesError\", error);\n }\n };\n const isDefaultRole = (name) => realm?.defaultRole.name === name;\n if (!realm) {\n return /* @__PURE__ */ React.createElement(KeycloakSpinner, null);\n }\n if (!role) {\n return /* @__PURE__ */ React.createElement(RealmRoleForm, {\n reset: () => reset(role),\n form,\n save,\n editMode: false\n });\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(DeleteAllAssociatedRolesConfirm, null), open && /* @__PURE__ */ React.createElement(AssociatedRolesModal, {\n id,\n toggleDialog: toggleModal,\n onConfirm: addComposites\n }), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: role.name || t(\"createRole\"),\n badges: [\n {\n id: \"composite-role-badge\",\n text: role.composite ? t(\"composite\") : \"\",\n readonly: true\n }\n ],\n subKey: id ? \"\" : \"roles:roleCreateExplain\",\n actionsDropdownId: \"roles-actions-dropdown\",\n dropdownItems,\n divider: !id\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n className: \"pf-u-p-0\"\n }, id && /* @__PURE__ */ React.createElement(KeycloakTabs, {\n isBox: true,\n mountOnEnter: true\n }, /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"details\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:details\"))\n }, /* @__PURE__ */ React.createElement(RealmRoleForm, {\n reset: () => reset(role),\n form,\n save,\n editMode: true\n })), role.composite && /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"associated-roles\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"associatedRolesText\"))\n }, /* @__PURE__ */ React.createElement(AssociatedRolesTab, {\n parentRole: role,\n refresh\n })), !isDefaultRole(role.name) && /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"attributes\",\n className: \"kc-attributes-tab\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:attributes\"))\n }, /* @__PURE__ */ React.createElement(AttributesForm, {\n form,\n save,\n reset: () => reset(role)\n })), !isDefaultRole(role.name) && /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"users-in-role\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"usersInRole\"))\n }, /* @__PURE__ */ React.createElement(UsersInRoleTab, {\n \"data-cy\": \"users-in-role-tab\"\n })))));\n}\n", "//! moment.js\n//! version : 2.29.1\n//! authors : Tim Wood, Iskren Chernev, Moment.js contributors\n//! license : MIT\n//! momentjs.com\n\nvar hookCallback;\n\nfunction hooks() {\n return hookCallback.apply(null, arguments);\n}\n\n// This is done to register the method called with moment()\n// without creating circular dependencies.\nfunction setHookCallback(callback) {\n hookCallback = callback;\n}\n\nfunction isArray(input) {\n return (\n input instanceof Array ||\n Object.prototype.toString.call(input) === '[object Array]'\n );\n}\n\nfunction isObject(input) {\n // IE8 will treat undefined and null as object if it wasn't for\n // input != null\n return (\n input != null &&\n Object.prototype.toString.call(input) === '[object Object]'\n );\n}\n\nfunction hasOwnProp(a, b) {\n return Object.prototype.hasOwnProperty.call(a, b);\n}\n\nfunction isObjectEmpty(obj) {\n if (Object.getOwnPropertyNames) {\n return Object.getOwnPropertyNames(obj).length === 0;\n } else {\n var k;\n for (k in obj) {\n if (hasOwnProp(obj, k)) {\n return false;\n }\n }\n return true;\n }\n}\n\nfunction isUndefined(input) {\n return input === void 0;\n}\n\nfunction isNumber(input) {\n return (\n typeof input === 'number' ||\n Object.prototype.toString.call(input) === '[object Number]'\n );\n}\n\nfunction isDate(input) {\n return (\n input instanceof Date ||\n Object.prototype.toString.call(input) === '[object Date]'\n );\n}\n\nfunction map(arr, fn) {\n var res = [],\n i;\n for (i = 0; i < arr.length; ++i) {\n res.push(fn(arr[i], i));\n }\n return res;\n}\n\nfunction extend(a, b) {\n for (var i in b) {\n if (hasOwnProp(b, i)) {\n a[i] = b[i];\n }\n }\n\n if (hasOwnProp(b, 'toString')) {\n a.toString = b.toString;\n }\n\n if (hasOwnProp(b, 'valueOf')) {\n a.valueOf = b.valueOf;\n }\n\n return a;\n}\n\nfunction createUTC(input, format, locale, strict) {\n return createLocalOrUTC(input, format, locale, strict, true).utc();\n}\n\nfunction defaultParsingFlags() {\n // We need to deep clone this object.\n return {\n empty: false,\n unusedTokens: [],\n unusedInput: [],\n overflow: -2,\n charsLeftOver: 0,\n nullInput: false,\n invalidEra: null,\n invalidMonth: null,\n invalidFormat: false,\n userInvalidated: false,\n iso: false,\n parsedDateParts: [],\n era: null,\n meridiem: null,\n rfc2822: false,\n weekdayMismatch: false,\n };\n}\n\nfunction getParsingFlags(m) {\n if (m._pf == null) {\n m._pf = defaultParsingFlags();\n }\n return m._pf;\n}\n\nvar some;\nif (Array.prototype.some) {\n some = Array.prototype.some;\n} else {\n some = function (fun) {\n var t = Object(this),\n len = t.length >>> 0,\n i;\n\n for (i = 0; i < len; i++) {\n if (i in t && fun.call(this, t[i], i, t)) {\n return true;\n }\n }\n\n return false;\n };\n}\n\nfunction isValid(m) {\n if (m._isValid == null) {\n var flags = getParsingFlags(m),\n parsedParts = some.call(flags.parsedDateParts, function (i) {\n return i != null;\n }),\n isNowValid =\n !isNaN(m._d.getTime()) &&\n flags.overflow < 0 &&\n !flags.empty &&\n !flags.invalidEra &&\n !flags.invalidMonth &&\n !flags.invalidWeekday &&\n !flags.weekdayMismatch &&\n !flags.nullInput &&\n !flags.invalidFormat &&\n !flags.userInvalidated &&\n (!flags.meridiem || (flags.meridiem && parsedParts));\n\n if (m._strict) {\n isNowValid =\n isNowValid &&\n flags.charsLeftOver === 0 &&\n flags.unusedTokens.length === 0 &&\n flags.bigHour === undefined;\n }\n\n if (Object.isFrozen == null || !Object.isFrozen(m)) {\n m._isValid = isNowValid;\n } else {\n return isNowValid;\n }\n }\n return m._isValid;\n}\n\nfunction createInvalid(flags) {\n var m = createUTC(NaN);\n if (flags != null) {\n extend(getParsingFlags(m), flags);\n } else {\n getParsingFlags(m).userInvalidated = true;\n }\n\n return m;\n}\n\n// Plugins that add properties should also add the key here (null value),\n// so we can properly clone ourselves.\nvar momentProperties = (hooks.momentProperties = []),\n updateInProgress = false;\n\nfunction copyConfig(to, from) {\n var i, prop, val;\n\n if (!isUndefined(from._isAMomentObject)) {\n to._isAMomentObject = from._isAMomentObject;\n }\n if (!isUndefined(from._i)) {\n to._i = from._i;\n }\n if (!isUndefined(from._f)) {\n to._f = from._f;\n }\n if (!isUndefined(from._l)) {\n to._l = from._l;\n }\n if (!isUndefined(from._strict)) {\n to._strict = from._strict;\n }\n if (!isUndefined(from._tzm)) {\n to._tzm = from._tzm;\n }\n if (!isUndefined(from._isUTC)) {\n to._isUTC = from._isUTC;\n }\n if (!isUndefined(from._offset)) {\n to._offset = from._offset;\n }\n if (!isUndefined(from._pf)) {\n to._pf = getParsingFlags(from);\n }\n if (!isUndefined(from._locale)) {\n to._locale = from._locale;\n }\n\n if (momentProperties.length > 0) {\n for (i = 0; i < momentProperties.length; i++) {\n prop = momentProperties[i];\n val = from[prop];\n if (!isUndefined(val)) {\n to[prop] = val;\n }\n }\n }\n\n return to;\n}\n\n// Moment prototype object\nfunction Moment(config) {\n copyConfig(this, config);\n this._d = new Date(config._d != null ? config._d.getTime() : NaN);\n if (!this.isValid()) {\n this._d = new Date(NaN);\n }\n // Prevent infinite loop in case updateOffset creates new moment\n // objects.\n if (updateInProgress === false) {\n updateInProgress = true;\n hooks.updateOffset(this);\n updateInProgress = false;\n }\n}\n\nfunction isMoment(obj) {\n return (\n obj instanceof Moment || (obj != null && obj._isAMomentObject != null)\n );\n}\n\nfunction warn(msg) {\n if (\n hooks.suppressDeprecationWarnings === false &&\n typeof console !== 'undefined' &&\n console.warn\n ) {\n console.warn('Deprecation warning: ' + msg);\n }\n}\n\nfunction deprecate(msg, fn) {\n var firstTime = true;\n\n return extend(function () {\n if (hooks.deprecationHandler != null) {\n hooks.deprecationHandler(null, msg);\n }\n if (firstTime) {\n var args = [],\n arg,\n i,\n key;\n for (i = 0; i < arguments.length; i++) {\n arg = '';\n if (typeof arguments[i] === 'object') {\n arg += '\\n[' + i + '] ';\n for (key in arguments[0]) {\n if (hasOwnProp(arguments[0], key)) {\n arg += key + ': ' + arguments[0][key] + ', ';\n }\n }\n arg = arg.slice(0, -2); // Remove trailing comma and space\n } else {\n arg = arguments[i];\n }\n args.push(arg);\n }\n warn(\n msg +\n '\\nArguments: ' +\n Array.prototype.slice.call(args).join('') +\n '\\n' +\n new Error().stack\n );\n firstTime = false;\n }\n return fn.apply(this, arguments);\n }, fn);\n}\n\nvar deprecations = {};\n\nfunction deprecateSimple(name, msg) {\n if (hooks.deprecationHandler != null) {\n hooks.deprecationHandler(name, msg);\n }\n if (!deprecations[name]) {\n warn(msg);\n deprecations[name] = true;\n }\n}\n\nhooks.suppressDeprecationWarnings = false;\nhooks.deprecationHandler = null;\n\nfunction isFunction(input) {\n return (\n (typeof Function !== 'undefined' && input instanceof Function) ||\n Object.prototype.toString.call(input) === '[object Function]'\n );\n}\n\nfunction set(config) {\n var prop, i;\n for (i in config) {\n if (hasOwnProp(config, i)) {\n prop = config[i];\n if (isFunction(prop)) {\n this[i] = prop;\n } else {\n this['_' + i] = prop;\n }\n }\n }\n this._config = config;\n // Lenient ordinal parsing accepts just a number in addition to\n // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.\n // TODO: Remove \"ordinalParse\" fallback in next major release.\n this._dayOfMonthOrdinalParseLenient = new RegExp(\n (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +\n '|' +\n /\\d{1,2}/.source\n );\n}\n\nfunction mergeConfigs(parentConfig, childConfig) {\n var res = extend({}, parentConfig),\n prop;\n for (prop in childConfig) {\n if (hasOwnProp(childConfig, prop)) {\n if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {\n res[prop] = {};\n extend(res[prop], parentConfig[prop]);\n extend(res[prop], childConfig[prop]);\n } else if (childConfig[prop] != null) {\n res[prop] = childConfig[prop];\n } else {\n delete res[prop];\n }\n }\n }\n for (prop in parentConfig) {\n if (\n hasOwnProp(parentConfig, prop) &&\n !hasOwnProp(childConfig, prop) &&\n isObject(parentConfig[prop])\n ) {\n // make sure changes to properties don't modify parent config\n res[prop] = extend({}, res[prop]);\n }\n }\n return res;\n}\n\nfunction Locale(config) {\n if (config != null) {\n this.set(config);\n }\n}\n\nvar keys;\n\nif (Object.keys) {\n keys = Object.keys;\n} else {\n keys = function (obj) {\n var i,\n res = [];\n for (i in obj) {\n if (hasOwnProp(obj, i)) {\n res.push(i);\n }\n }\n return res;\n };\n}\n\nvar defaultCalendar = {\n sameDay: '[Today at] LT',\n nextDay: '[Tomorrow at] LT',\n nextWeek: 'dddd [at] LT',\n lastDay: '[Yesterday at] LT',\n lastWeek: '[Last] dddd [at] LT',\n sameElse: 'L',\n};\n\nfunction calendar(key, mom, now) {\n var output = this._calendar[key] || this._calendar['sameElse'];\n return isFunction(output) ? output.call(mom, now) : output;\n}\n\nfunction zeroFill(number, targetLength, forceSign) {\n var absNumber = '' + Math.abs(number),\n zerosToFill = targetLength - absNumber.length,\n sign = number >= 0;\n return (\n (sign ? (forceSign ? '+' : '') : '-') +\n Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +\n absNumber\n );\n}\n\nvar formattingTokens = /(\\[[^\\[]*\\])|(\\\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,\n localFormattingTokens = /(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g,\n formatFunctions = {},\n formatTokenFunctions = {};\n\n// token: 'M'\n// padded: ['MM', 2]\n// ordinal: 'Mo'\n// callback: function () { this.month() + 1 }\nfunction addFormatToken(token, padded, ordinal, callback) {\n var func = callback;\n if (typeof callback === 'string') {\n func = function () {\n return this[callback]();\n };\n }\n if (token) {\n formatTokenFunctions[token] = func;\n }\n if (padded) {\n formatTokenFunctions[padded[0]] = function () {\n return zeroFill(func.apply(this, arguments), padded[1], padded[2]);\n };\n }\n if (ordinal) {\n formatTokenFunctions[ordinal] = function () {\n return this.localeData().ordinal(\n func.apply(this, arguments),\n token\n );\n };\n }\n}\n\nfunction removeFormattingTokens(input) {\n if (input.match(/\\[[\\s\\S]/)) {\n return input.replace(/^\\[|\\]$/g, '');\n }\n return input.replace(/\\\\/g, '');\n}\n\nfunction makeFormatFunction(format) {\n var array = format.match(formattingTokens),\n i,\n length;\n\n for (i = 0, length = array.length; i < length; i++) {\n if (formatTokenFunctions[array[i]]) {\n array[i] = formatTokenFunctions[array[i]];\n } else {\n array[i] = removeFormattingTokens(array[i]);\n }\n }\n\n return function (mom) {\n var output = '',\n i;\n for (i = 0; i < length; i++) {\n output += isFunction(array[i])\n ? array[i].call(mom, format)\n : array[i];\n }\n return output;\n };\n}\n\n// format date using native date object\nfunction formatMoment(m, format) {\n if (!m.isValid()) {\n return m.localeData().invalidDate();\n }\n\n format = expandFormat(format, m.localeData());\n formatFunctions[format] =\n formatFunctions[format] || makeFormatFunction(format);\n\n return formatFunctions[format](m);\n}\n\nfunction expandFormat(format, locale) {\n var i = 5;\n\n function replaceLongDateFormatTokens(input) {\n return locale.longDateFormat(input) || input;\n }\n\n localFormattingTokens.lastIndex = 0;\n while (i >= 0 && localFormattingTokens.test(format)) {\n format = format.replace(\n localFormattingTokens,\n replaceLongDateFormatTokens\n );\n localFormattingTokens.lastIndex = 0;\n i -= 1;\n }\n\n return format;\n}\n\nvar defaultLongDateFormat = {\n LTS: 'h:mm:ss A',\n LT: 'h:mm A',\n L: 'MM/DD/YYYY',\n LL: 'MMMM D, YYYY',\n LLL: 'MMMM D, YYYY h:mm A',\n LLLL: 'dddd, MMMM D, YYYY h:mm A',\n};\n\nfunction longDateFormat(key) {\n var format = this._longDateFormat[key],\n formatUpper = this._longDateFormat[key.toUpperCase()];\n\n if (format || !formatUpper) {\n return format;\n }\n\n this._longDateFormat[key] = formatUpper\n .match(formattingTokens)\n .map(function (tok) {\n if (\n tok === 'MMMM' ||\n tok === 'MM' ||\n tok === 'DD' ||\n tok === 'dddd'\n ) {\n return tok.slice(1);\n }\n return tok;\n })\n .join('');\n\n return this._longDateFormat[key];\n}\n\nvar defaultInvalidDate = 'Invalid date';\n\nfunction invalidDate() {\n return this._invalidDate;\n}\n\nvar defaultOrdinal = '%d',\n defaultDayOfMonthOrdinalParse = /\\d{1,2}/;\n\nfunction ordinal(number) {\n return this._ordinal.replace('%d', number);\n}\n\nvar defaultRelativeTime = {\n future: 'in %s',\n past: '%s ago',\n s: 'a few seconds',\n ss: '%d seconds',\n m: 'a minute',\n mm: '%d minutes',\n h: 'an hour',\n hh: '%d hours',\n d: 'a day',\n dd: '%d days',\n w: 'a week',\n ww: '%d weeks',\n M: 'a month',\n MM: '%d months',\n y: 'a year',\n yy: '%d years',\n};\n\nfunction relativeTime(number, withoutSuffix, string, isFuture) {\n var output = this._relativeTime[string];\n return isFunction(output)\n ? output(number, withoutSuffix, string, isFuture)\n : output.replace(/%d/i, number);\n}\n\nfunction pastFuture(diff, output) {\n var format = this._relativeTime[diff > 0 ? 'future' : 'past'];\n return isFunction(format) ? format(output) : format.replace(/%s/i, output);\n}\n\nvar aliases = {};\n\nfunction addUnitAlias(unit, shorthand) {\n var lowerCase = unit.toLowerCase();\n aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;\n}\n\nfunction normalizeUnits(units) {\n return typeof units === 'string'\n ? aliases[units] || aliases[units.toLowerCase()]\n : undefined;\n}\n\nfunction normalizeObjectUnits(inputObject) {\n var normalizedInput = {},\n normalizedProp,\n prop;\n\n for (prop in inputObject) {\n if (hasOwnProp(inputObject, prop)) {\n normalizedProp = normalizeUnits(prop);\n if (normalizedProp) {\n normalizedInput[normalizedProp] = inputObject[prop];\n }\n }\n }\n\n return normalizedInput;\n}\n\nvar priorities = {};\n\nfunction addUnitPriority(unit, priority) {\n priorities[unit] = priority;\n}\n\nfunction getPrioritizedUnits(unitsObj) {\n var units = [],\n u;\n for (u in unitsObj) {\n if (hasOwnProp(unitsObj, u)) {\n units.push({ unit: u, priority: priorities[u] });\n }\n }\n units.sort(function (a, b) {\n return a.priority - b.priority;\n });\n return units;\n}\n\nfunction isLeapYear(year) {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n}\n\nfunction absFloor(number) {\n if (number < 0) {\n // -0 -> 0\n return Math.ceil(number) || 0;\n } else {\n return Math.floor(number);\n }\n}\n\nfunction toInt(argumentForCoercion) {\n var coercedNumber = +argumentForCoercion,\n value = 0;\n\n if (coercedNumber !== 0 && isFinite(coercedNumber)) {\n value = absFloor(coercedNumber);\n }\n\n return value;\n}\n\nfunction makeGetSet(unit, keepTime) {\n return function (value) {\n if (value != null) {\n set$1(this, unit, value);\n hooks.updateOffset(this, keepTime);\n return this;\n } else {\n return get(this, unit);\n }\n };\n}\n\nfunction get(mom, unit) {\n return mom.isValid()\n ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()\n : NaN;\n}\n\nfunction set$1(mom, unit, value) {\n if (mom.isValid() && !isNaN(value)) {\n if (\n unit === 'FullYear' &&\n isLeapYear(mom.year()) &&\n mom.month() === 1 &&\n mom.date() === 29\n ) {\n value = toInt(value);\n mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](\n value,\n mom.month(),\n daysInMonth(value, mom.month())\n );\n } else {\n mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);\n }\n }\n}\n\n// MOMENTS\n\nfunction stringGet(units) {\n units = normalizeUnits(units);\n if (isFunction(this[units])) {\n return this[units]();\n }\n return this;\n}\n\nfunction stringSet(units, value) {\n if (typeof units === 'object') {\n units = normalizeObjectUnits(units);\n var prioritized = getPrioritizedUnits(units),\n i;\n for (i = 0; i < prioritized.length; i++) {\n this[prioritized[i].unit](units[prioritized[i].unit]);\n }\n } else {\n units = normalizeUnits(units);\n if (isFunction(this[units])) {\n return this[units](value);\n }\n }\n return this;\n}\n\nvar match1 = /\\d/, // 0 - 9\n match2 = /\\d\\d/, // 00 - 99\n match3 = /\\d{3}/, // 000 - 999\n match4 = /\\d{4}/, // 0000 - 9999\n match6 = /[+-]?\\d{6}/, // -999999 - 999999\n match1to2 = /\\d\\d?/, // 0 - 99\n match3to4 = /\\d\\d\\d\\d?/, // 999 - 9999\n match5to6 = /\\d\\d\\d\\d\\d\\d?/, // 99999 - 999999\n match1to3 = /\\d{1,3}/, // 0 - 999\n match1to4 = /\\d{1,4}/, // 0 - 9999\n match1to6 = /[+-]?\\d{1,6}/, // -999999 - 999999\n matchUnsigned = /\\d+/, // 0 - inf\n matchSigned = /[+-]?\\d+/, // -inf - inf\n matchOffset = /Z|[+-]\\d\\d:?\\d\\d/gi, // +00:00 -00:00 +0000 -0000 or Z\n matchShortOffset = /Z|[+-]\\d\\d(?::?\\d\\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z\n matchTimestamp = /[+-]?\\d+(\\.\\d{1,3})?/, // 123456789 123456789.123\n // any word (or two) characters or numbers including two/three word month in arabic.\n // includes scottish gaelic two word and hyphenated months\n matchWord = /[0-9]{0,256}['a-z\\u00A0-\\u05FF\\u0700-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFF07\\uFF10-\\uFFEF]{1,256}|[\\u0600-\\u06FF\\/]{1,256}(\\s*?[\\u0600-\\u06FF]{1,256}){1,2}/i,\n regexes;\n\nregexes = {};\n\nfunction addRegexToken(token, regex, strictRegex) {\n regexes[token] = isFunction(regex)\n ? regex\n : function (isStrict, localeData) {\n return isStrict && strictRegex ? strictRegex : regex;\n };\n}\n\nfunction getParseRegexForToken(token, config) {\n if (!hasOwnProp(regexes, token)) {\n return new RegExp(unescapeFormat(token));\n }\n\n return regexes[token](config._strict, config._locale);\n}\n\n// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript\nfunction unescapeFormat(s) {\n return regexEscape(\n s\n .replace('\\\\', '')\n .replace(/\\\\(\\[)|\\\\(\\])|\\[([^\\]\\[]*)\\]|\\\\(.)/g, function (\n matched,\n p1,\n p2,\n p3,\n p4\n ) {\n return p1 || p2 || p3 || p4;\n })\n );\n}\n\nfunction regexEscape(s) {\n return s.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}\n\nvar tokens = {};\n\nfunction addParseToken(token, callback) {\n var i,\n func = callback;\n if (typeof token === 'string') {\n token = [token];\n }\n if (isNumber(callback)) {\n func = function (input, array) {\n array[callback] = toInt(input);\n };\n }\n for (i = 0; i < token.length; i++) {\n tokens[token[i]] = func;\n }\n}\n\nfunction addWeekParseToken(token, callback) {\n addParseToken(token, function (input, array, config, token) {\n config._w = config._w || {};\n callback(input, config._w, config, token);\n });\n}\n\nfunction addTimeToArrayFromToken(token, input, config) {\n if (input != null && hasOwnProp(tokens, token)) {\n tokens[token](input, config._a, config, token);\n }\n}\n\nvar YEAR = 0,\n MONTH = 1,\n DATE = 2,\n HOUR = 3,\n MINUTE = 4,\n SECOND = 5,\n MILLISECOND = 6,\n WEEK = 7,\n WEEKDAY = 8;\n\nfunction mod(n, x) {\n return ((n % x) + x) % x;\n}\n\nvar indexOf;\n\nif (Array.prototype.indexOf) {\n indexOf = Array.prototype.indexOf;\n} else {\n indexOf = function (o) {\n // I know\n var i;\n for (i = 0; i < this.length; ++i) {\n if (this[i] === o) {\n return i;\n }\n }\n return -1;\n };\n}\n\nfunction daysInMonth(year, month) {\n if (isNaN(year) || isNaN(month)) {\n return NaN;\n }\n var modMonth = mod(month, 12);\n year += (month - modMonth) / 12;\n return modMonth === 1\n ? isLeapYear(year)\n ? 29\n : 28\n : 31 - ((modMonth % 7) % 2);\n}\n\n// FORMATTING\n\naddFormatToken('M', ['MM', 2], 'Mo', function () {\n return this.month() + 1;\n});\n\naddFormatToken('MMM', 0, 0, function (format) {\n return this.localeData().monthsShort(this, format);\n});\n\naddFormatToken('MMMM', 0, 0, function (format) {\n return this.localeData().months(this, format);\n});\n\n// ALIASES\n\naddUnitAlias('month', 'M');\n\n// PRIORITY\n\naddUnitPriority('month', 8);\n\n// PARSING\n\naddRegexToken('M', match1to2);\naddRegexToken('MM', match1to2, match2);\naddRegexToken('MMM', function (isStrict, locale) {\n return locale.monthsShortRegex(isStrict);\n});\naddRegexToken('MMMM', function (isStrict, locale) {\n return locale.monthsRegex(isStrict);\n});\n\naddParseToken(['M', 'MM'], function (input, array) {\n array[MONTH] = toInt(input) - 1;\n});\n\naddParseToken(['MMM', 'MMMM'], function (input, array, config, token) {\n var month = config._locale.monthsParse(input, token, config._strict);\n // if we didn't find a month name, mark the date as invalid.\n if (month != null) {\n array[MONTH] = month;\n } else {\n getParsingFlags(config).invalidMonth = input;\n }\n});\n\n// LOCALES\n\nvar defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split(\n '_'\n ),\n defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split(\n '_'\n ),\n MONTHS_IN_FORMAT = /D[oD]?(\\[[^\\[\\]]*\\]|\\s)+MMMM?/,\n defaultMonthsShortRegex = matchWord,\n defaultMonthsRegex = matchWord;\n\nfunction localeMonths(m, format) {\n if (!m) {\n return isArray(this._months)\n ? this._months\n : this._months['standalone'];\n }\n return isArray(this._months)\n ? this._months[m.month()]\n : this._months[\n (this._months.isFormat || MONTHS_IN_FORMAT).test(format)\n ? 'format'\n : 'standalone'\n ][m.month()];\n}\n\nfunction localeMonthsShort(m, format) {\n if (!m) {\n return isArray(this._monthsShort)\n ? this._monthsShort\n : this._monthsShort['standalone'];\n }\n return isArray(this._monthsShort)\n ? this._monthsShort[m.month()]\n : this._monthsShort[\n MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'\n ][m.month()];\n}\n\nfunction handleStrictParse(monthName, format, strict) {\n var i,\n ii,\n mom,\n llc = monthName.toLocaleLowerCase();\n if (!this._monthsParse) {\n // this is not used\n this._monthsParse = [];\n this._longMonthsParse = [];\n this._shortMonthsParse = [];\n for (i = 0; i < 12; ++i) {\n mom = createUTC([2000, i]);\n this._shortMonthsParse[i] = this.monthsShort(\n mom,\n ''\n ).toLocaleLowerCase();\n this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();\n }\n }\n\n if (strict) {\n if (format === 'MMM') {\n ii = indexOf.call(this._shortMonthsParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._longMonthsParse, llc);\n return ii !== -1 ? ii : null;\n }\n } else {\n if (format === 'MMM') {\n ii = indexOf.call(this._shortMonthsParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._longMonthsParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._longMonthsParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortMonthsParse, llc);\n return ii !== -1 ? ii : null;\n }\n }\n}\n\nfunction localeMonthsParse(monthName, format, strict) {\n var i, mom, regex;\n\n if (this._monthsParseExact) {\n return handleStrictParse.call(this, monthName, format, strict);\n }\n\n if (!this._monthsParse) {\n this._monthsParse = [];\n this._longMonthsParse = [];\n this._shortMonthsParse = [];\n }\n\n // TODO: add sorting\n // Sorting makes sure if one month (or abbr) is a prefix of another\n // see sorting in computeMonthsParse\n for (i = 0; i < 12; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, i]);\n if (strict && !this._longMonthsParse[i]) {\n this._longMonthsParse[i] = new RegExp(\n '^' + this.months(mom, '').replace('.', '') + '$',\n 'i'\n );\n this._shortMonthsParse[i] = new RegExp(\n '^' + this.monthsShort(mom, '').replace('.', '') + '$',\n 'i'\n );\n }\n if (!strict && !this._monthsParse[i]) {\n regex =\n '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');\n this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');\n }\n // test the regex\n if (\n strict &&\n format === 'MMMM' &&\n this._longMonthsParse[i].test(monthName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'MMM' &&\n this._shortMonthsParse[i].test(monthName)\n ) {\n return i;\n } else if (!strict && this._monthsParse[i].test(monthName)) {\n return i;\n }\n }\n}\n\n// MOMENTS\n\nfunction setMonth(mom, value) {\n var dayOfMonth;\n\n if (!mom.isValid()) {\n // No op\n return mom;\n }\n\n if (typeof value === 'string') {\n if (/^\\d+$/.test(value)) {\n value = toInt(value);\n } else {\n value = mom.localeData().monthsParse(value);\n // TODO: Another silent failure?\n if (!isNumber(value)) {\n return mom;\n }\n }\n }\n\n dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));\n mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);\n return mom;\n}\n\nfunction getSetMonth(value) {\n if (value != null) {\n setMonth(this, value);\n hooks.updateOffset(this, true);\n return this;\n } else {\n return get(this, 'Month');\n }\n}\n\nfunction getDaysInMonth() {\n return daysInMonth(this.year(), this.month());\n}\n\nfunction monthsShortRegex(isStrict) {\n if (this._monthsParseExact) {\n if (!hasOwnProp(this, '_monthsRegex')) {\n computeMonthsParse.call(this);\n }\n if (isStrict) {\n return this._monthsShortStrictRegex;\n } else {\n return this._monthsShortRegex;\n }\n } else {\n if (!hasOwnProp(this, '_monthsShortRegex')) {\n this._monthsShortRegex = defaultMonthsShortRegex;\n }\n return this._monthsShortStrictRegex && isStrict\n ? this._monthsShortStrictRegex\n : this._monthsShortRegex;\n }\n}\n\nfunction monthsRegex(isStrict) {\n if (this._monthsParseExact) {\n if (!hasOwnProp(this, '_monthsRegex')) {\n computeMonthsParse.call(this);\n }\n if (isStrict) {\n return this._monthsStrictRegex;\n } else {\n return this._monthsRegex;\n }\n } else {\n if (!hasOwnProp(this, '_monthsRegex')) {\n this._monthsRegex = defaultMonthsRegex;\n }\n return this._monthsStrictRegex && isStrict\n ? this._monthsStrictRegex\n : this._monthsRegex;\n }\n}\n\nfunction computeMonthsParse() {\n function cmpLenRev(a, b) {\n return b.length - a.length;\n }\n\n var shortPieces = [],\n longPieces = [],\n mixedPieces = [],\n i,\n mom;\n for (i = 0; i < 12; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, i]);\n shortPieces.push(this.monthsShort(mom, ''));\n longPieces.push(this.months(mom, ''));\n mixedPieces.push(this.months(mom, ''));\n mixedPieces.push(this.monthsShort(mom, ''));\n }\n // Sorting makes sure if one month (or abbr) is a prefix of another it\n // will match the longer piece.\n shortPieces.sort(cmpLenRev);\n longPieces.sort(cmpLenRev);\n mixedPieces.sort(cmpLenRev);\n for (i = 0; i < 12; i++) {\n shortPieces[i] = regexEscape(shortPieces[i]);\n longPieces[i] = regexEscape(longPieces[i]);\n }\n for (i = 0; i < 24; i++) {\n mixedPieces[i] = regexEscape(mixedPieces[i]);\n }\n\n this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._monthsShortRegex = this._monthsRegex;\n this._monthsStrictRegex = new RegExp(\n '^(' + longPieces.join('|') + ')',\n 'i'\n );\n this._monthsShortStrictRegex = new RegExp(\n '^(' + shortPieces.join('|') + ')',\n 'i'\n );\n}\n\n// FORMATTING\n\naddFormatToken('Y', 0, 0, function () {\n var y = this.year();\n return y <= 9999 ? zeroFill(y, 4) : '+' + y;\n});\n\naddFormatToken(0, ['YY', 2], 0, function () {\n return this.year() % 100;\n});\n\naddFormatToken(0, ['YYYY', 4], 0, 'year');\naddFormatToken(0, ['YYYYY', 5], 0, 'year');\naddFormatToken(0, ['YYYYYY', 6, true], 0, 'year');\n\n// ALIASES\n\naddUnitAlias('year', 'y');\n\n// PRIORITIES\n\naddUnitPriority('year', 1);\n\n// PARSING\n\naddRegexToken('Y', matchSigned);\naddRegexToken('YY', match1to2, match2);\naddRegexToken('YYYY', match1to4, match4);\naddRegexToken('YYYYY', match1to6, match6);\naddRegexToken('YYYYYY', match1to6, match6);\n\naddParseToken(['YYYYY', 'YYYYYY'], YEAR);\naddParseToken('YYYY', function (input, array) {\n array[YEAR] =\n input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);\n});\naddParseToken('YY', function (input, array) {\n array[YEAR] = hooks.parseTwoDigitYear(input);\n});\naddParseToken('Y', function (input, array) {\n array[YEAR] = parseInt(input, 10);\n});\n\n// HELPERS\n\nfunction daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n}\n\n// HOOKS\n\nhooks.parseTwoDigitYear = function (input) {\n return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);\n};\n\n// MOMENTS\n\nvar getSetYear = makeGetSet('FullYear', true);\n\nfunction getIsLeapYear() {\n return isLeapYear(this.year());\n}\n\nfunction createDate(y, m, d, h, M, s, ms) {\n // can't just apply() to create a date:\n // https://stackoverflow.com/q/181348\n var date;\n // the date constructor remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n date = new Date(y + 400, m, d, h, M, s, ms);\n if (isFinite(date.getFullYear())) {\n date.setFullYear(y);\n }\n } else {\n date = new Date(y, m, d, h, M, s, ms);\n }\n\n return date;\n}\n\nfunction createUTCDate(y) {\n var date, args;\n // the Date.UTC function remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n args = Array.prototype.slice.call(arguments);\n // preserve leap years using a full 400 year cycle, then reset\n args[0] = y + 400;\n date = new Date(Date.UTC.apply(null, args));\n if (isFinite(date.getUTCFullYear())) {\n date.setUTCFullYear(y);\n }\n } else {\n date = new Date(Date.UTC.apply(null, arguments));\n }\n\n return date;\n}\n\n// start-of-first-week - start-of-year\nfunction firstWeekOffset(year, dow, doy) {\n var // first-week day -- which january is always in the first week (4 for iso, 1 for other)\n fwd = 7 + dow - doy,\n // first-week day local weekday -- which local weekday is fwd\n fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;\n\n return -fwdlw + fwd - 1;\n}\n\n// https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday\nfunction dayOfYearFromWeeks(year, week, weekday, dow, doy) {\n var localWeekday = (7 + weekday - dow) % 7,\n weekOffset = firstWeekOffset(year, dow, doy),\n dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,\n resYear,\n resDayOfYear;\n\n if (dayOfYear <= 0) {\n resYear = year - 1;\n resDayOfYear = daysInYear(resYear) + dayOfYear;\n } else if (dayOfYear > daysInYear(year)) {\n resYear = year + 1;\n resDayOfYear = dayOfYear - daysInYear(year);\n } else {\n resYear = year;\n resDayOfYear = dayOfYear;\n }\n\n return {\n year: resYear,\n dayOfYear: resDayOfYear,\n };\n}\n\nfunction weekOfYear(mom, dow, doy) {\n var weekOffset = firstWeekOffset(mom.year(), dow, doy),\n week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,\n resWeek,\n resYear;\n\n if (week < 1) {\n resYear = mom.year() - 1;\n resWeek = week + weeksInYear(resYear, dow, doy);\n } else if (week > weeksInYear(mom.year(), dow, doy)) {\n resWeek = week - weeksInYear(mom.year(), dow, doy);\n resYear = mom.year() + 1;\n } else {\n resYear = mom.year();\n resWeek = week;\n }\n\n return {\n week: resWeek,\n year: resYear,\n };\n}\n\nfunction weeksInYear(year, dow, doy) {\n var weekOffset = firstWeekOffset(year, dow, doy),\n weekOffsetNext = firstWeekOffset(year + 1, dow, doy);\n return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;\n}\n\n// FORMATTING\n\naddFormatToken('w', ['ww', 2], 'wo', 'week');\naddFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');\n\n// ALIASES\n\naddUnitAlias('week', 'w');\naddUnitAlias('isoWeek', 'W');\n\n// PRIORITIES\n\naddUnitPriority('week', 5);\naddUnitPriority('isoWeek', 5);\n\n// PARSING\n\naddRegexToken('w', match1to2);\naddRegexToken('ww', match1to2, match2);\naddRegexToken('W', match1to2);\naddRegexToken('WW', match1to2, match2);\n\naddWeekParseToken(['w', 'ww', 'W', 'WW'], function (\n input,\n week,\n config,\n token\n) {\n week[token.substr(0, 1)] = toInt(input);\n});\n\n// HELPERS\n\n// LOCALES\n\nfunction localeWeek(mom) {\n return weekOfYear(mom, this._week.dow, this._week.doy).week;\n}\n\nvar defaultLocaleWeek = {\n dow: 0, // Sunday is the first day of the week.\n doy: 6, // The week that contains Jan 6th is the first week of the year.\n};\n\nfunction localeFirstDayOfWeek() {\n return this._week.dow;\n}\n\nfunction localeFirstDayOfYear() {\n return this._week.doy;\n}\n\n// MOMENTS\n\nfunction getSetWeek(input) {\n var week = this.localeData().week(this);\n return input == null ? week : this.add((input - week) * 7, 'd');\n}\n\nfunction getSetISOWeek(input) {\n var week = weekOfYear(this, 1, 4).week;\n return input == null ? week : this.add((input - week) * 7, 'd');\n}\n\n// FORMATTING\n\naddFormatToken('d', 0, 'do', 'day');\n\naddFormatToken('dd', 0, 0, function (format) {\n return this.localeData().weekdaysMin(this, format);\n});\n\naddFormatToken('ddd', 0, 0, function (format) {\n return this.localeData().weekdaysShort(this, format);\n});\n\naddFormatToken('dddd', 0, 0, function (format) {\n return this.localeData().weekdays(this, format);\n});\n\naddFormatToken('e', 0, 0, 'weekday');\naddFormatToken('E', 0, 0, 'isoWeekday');\n\n// ALIASES\n\naddUnitAlias('day', 'd');\naddUnitAlias('weekday', 'e');\naddUnitAlias('isoWeekday', 'E');\n\n// PRIORITY\naddUnitPriority('day', 11);\naddUnitPriority('weekday', 11);\naddUnitPriority('isoWeekday', 11);\n\n// PARSING\n\naddRegexToken('d', match1to2);\naddRegexToken('e', match1to2);\naddRegexToken('E', match1to2);\naddRegexToken('dd', function (isStrict, locale) {\n return locale.weekdaysMinRegex(isStrict);\n});\naddRegexToken('ddd', function (isStrict, locale) {\n return locale.weekdaysShortRegex(isStrict);\n});\naddRegexToken('dddd', function (isStrict, locale) {\n return locale.weekdaysRegex(isStrict);\n});\n\naddWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {\n var weekday = config._locale.weekdaysParse(input, token, config._strict);\n // if we didn't get a weekday name, mark the date as invalid\n if (weekday != null) {\n week.d = weekday;\n } else {\n getParsingFlags(config).invalidWeekday = input;\n }\n});\n\naddWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {\n week[token] = toInt(input);\n});\n\n// HELPERS\n\nfunction parseWeekday(input, locale) {\n if (typeof input !== 'string') {\n return input;\n }\n\n if (!isNaN(input)) {\n return parseInt(input, 10);\n }\n\n input = locale.weekdaysParse(input);\n if (typeof input === 'number') {\n return input;\n }\n\n return null;\n}\n\nfunction parseIsoWeekday(input, locale) {\n if (typeof input === 'string') {\n return locale.weekdaysParse(input) % 7 || 7;\n }\n return isNaN(input) ? null : input;\n}\n\n// LOCALES\nfunction shiftWeekdays(ws, n) {\n return ws.slice(n, 7).concat(ws.slice(0, n));\n}\n\nvar defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(\n '_'\n ),\n defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),\n defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),\n defaultWeekdaysRegex = matchWord,\n defaultWeekdaysShortRegex = matchWord,\n defaultWeekdaysMinRegex = matchWord;\n\nfunction localeWeekdays(m, format) {\n var weekdays = isArray(this._weekdays)\n ? this._weekdays\n : this._weekdays[\n m && m !== true && this._weekdays.isFormat.test(format)\n ? 'format'\n : 'standalone'\n ];\n return m === true\n ? shiftWeekdays(weekdays, this._week.dow)\n : m\n ? weekdays[m.day()]\n : weekdays;\n}\n\nfunction localeWeekdaysShort(m) {\n return m === true\n ? shiftWeekdays(this._weekdaysShort, this._week.dow)\n : m\n ? this._weekdaysShort[m.day()]\n : this._weekdaysShort;\n}\n\nfunction localeWeekdaysMin(m) {\n return m === true\n ? shiftWeekdays(this._weekdaysMin, this._week.dow)\n : m\n ? this._weekdaysMin[m.day()]\n : this._weekdaysMin;\n}\n\nfunction handleStrictParse$1(weekdayName, format, strict) {\n var i,\n ii,\n mom,\n llc = weekdayName.toLocaleLowerCase();\n if (!this._weekdaysParse) {\n this._weekdaysParse = [];\n this._shortWeekdaysParse = [];\n this._minWeekdaysParse = [];\n\n for (i = 0; i < 7; ++i) {\n mom = createUTC([2000, 1]).day(i);\n this._minWeekdaysParse[i] = this.weekdaysMin(\n mom,\n ''\n ).toLocaleLowerCase();\n this._shortWeekdaysParse[i] = this.weekdaysShort(\n mom,\n ''\n ).toLocaleLowerCase();\n this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();\n }\n }\n\n if (strict) {\n if (format === 'dddd') {\n ii = indexOf.call(this._weekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else if (format === 'ddd') {\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n }\n } else {\n if (format === 'dddd') {\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else if (format === 'ddd') {\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._minWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n }\n }\n}\n\nfunction localeWeekdaysParse(weekdayName, format, strict) {\n var i, mom, regex;\n\n if (this._weekdaysParseExact) {\n return handleStrictParse$1.call(this, weekdayName, format, strict);\n }\n\n if (!this._weekdaysParse) {\n this._weekdaysParse = [];\n this._minWeekdaysParse = [];\n this._shortWeekdaysParse = [];\n this._fullWeekdaysParse = [];\n }\n\n for (i = 0; i < 7; i++) {\n // make the regex if we don't have it already\n\n mom = createUTC([2000, 1]).day(i);\n if (strict && !this._fullWeekdaysParse[i]) {\n this._fullWeekdaysParse[i] = new RegExp(\n '^' + this.weekdays(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n this._shortWeekdaysParse[i] = new RegExp(\n '^' + this.weekdaysShort(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n this._minWeekdaysParse[i] = new RegExp(\n '^' + this.weekdaysMin(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n }\n if (!this._weekdaysParse[i]) {\n regex =\n '^' +\n this.weekdays(mom, '') +\n '|^' +\n this.weekdaysShort(mom, '') +\n '|^' +\n this.weekdaysMin(mom, '');\n this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');\n }\n // test the regex\n if (\n strict &&\n format === 'dddd' &&\n this._fullWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'ddd' &&\n this._shortWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'dd' &&\n this._minWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {\n return i;\n }\n }\n}\n\n// MOMENTS\n\nfunction getSetDayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();\n if (input != null) {\n input = parseWeekday(input, this.localeData());\n return this.add(input - day, 'd');\n } else {\n return day;\n }\n}\n\nfunction getSetLocaleDayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;\n return input == null ? weekday : this.add(input - weekday, 'd');\n}\n\nfunction getSetISODayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n\n // behaves the same as moment#day except\n // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)\n // as a setter, sunday should belong to the previous week.\n\n if (input != null) {\n var weekday = parseIsoWeekday(input, this.localeData());\n return this.day(this.day() % 7 ? weekday : weekday - 7);\n } else {\n return this.day() || 7;\n }\n}\n\nfunction weekdaysRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysStrictRegex;\n } else {\n return this._weekdaysRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n this._weekdaysRegex = defaultWeekdaysRegex;\n }\n return this._weekdaysStrictRegex && isStrict\n ? this._weekdaysStrictRegex\n : this._weekdaysRegex;\n }\n}\n\nfunction weekdaysShortRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysShortStrictRegex;\n } else {\n return this._weekdaysShortRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysShortRegex')) {\n this._weekdaysShortRegex = defaultWeekdaysShortRegex;\n }\n return this._weekdaysShortStrictRegex && isStrict\n ? this._weekdaysShortStrictRegex\n : this._weekdaysShortRegex;\n }\n}\n\nfunction weekdaysMinRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysMinStrictRegex;\n } else {\n return this._weekdaysMinRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysMinRegex')) {\n this._weekdaysMinRegex = defaultWeekdaysMinRegex;\n }\n return this._weekdaysMinStrictRegex && isStrict\n ? this._weekdaysMinStrictRegex\n : this._weekdaysMinRegex;\n }\n}\n\nfunction computeWeekdaysParse() {\n function cmpLenRev(a, b) {\n return b.length - a.length;\n }\n\n var minPieces = [],\n shortPieces = [],\n longPieces = [],\n mixedPieces = [],\n i,\n mom,\n minp,\n shortp,\n longp;\n for (i = 0; i < 7; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, 1]).day(i);\n minp = regexEscape(this.weekdaysMin(mom, ''));\n shortp = regexEscape(this.weekdaysShort(mom, ''));\n longp = regexEscape(this.weekdays(mom, ''));\n minPieces.push(minp);\n shortPieces.push(shortp);\n longPieces.push(longp);\n mixedPieces.push(minp);\n mixedPieces.push(shortp);\n mixedPieces.push(longp);\n }\n // Sorting makes sure if one weekday (or abbr) is a prefix of another it\n // will match the longer piece.\n minPieces.sort(cmpLenRev);\n shortPieces.sort(cmpLenRev);\n longPieces.sort(cmpLenRev);\n mixedPieces.sort(cmpLenRev);\n\n this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._weekdaysShortRegex = this._weekdaysRegex;\n this._weekdaysMinRegex = this._weekdaysRegex;\n\n this._weekdaysStrictRegex = new RegExp(\n '^(' + longPieces.join('|') + ')',\n 'i'\n );\n this._weekdaysShortStrictRegex = new RegExp(\n '^(' + shortPieces.join('|') + ')',\n 'i'\n );\n this._weekdaysMinStrictRegex = new RegExp(\n '^(' + minPieces.join('|') + ')',\n 'i'\n );\n}\n\n// FORMATTING\n\nfunction hFormat() {\n return this.hours() % 12 || 12;\n}\n\nfunction kFormat() {\n return this.hours() || 24;\n}\n\naddFormatToken('H', ['HH', 2], 0, 'hour');\naddFormatToken('h', ['hh', 2], 0, hFormat);\naddFormatToken('k', ['kk', 2], 0, kFormat);\n\naddFormatToken('hmm', 0, 0, function () {\n return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);\n});\n\naddFormatToken('hmmss', 0, 0, function () {\n return (\n '' +\n hFormat.apply(this) +\n zeroFill(this.minutes(), 2) +\n zeroFill(this.seconds(), 2)\n );\n});\n\naddFormatToken('Hmm', 0, 0, function () {\n return '' + this.hours() + zeroFill(this.minutes(), 2);\n});\n\naddFormatToken('Hmmss', 0, 0, function () {\n return (\n '' +\n this.hours() +\n zeroFill(this.minutes(), 2) +\n zeroFill(this.seconds(), 2)\n );\n});\n\nfunction meridiem(token, lowercase) {\n addFormatToken(token, 0, 0, function () {\n return this.localeData().meridiem(\n this.hours(),\n this.minutes(),\n lowercase\n );\n });\n}\n\nmeridiem('a', true);\nmeridiem('A', false);\n\n// ALIASES\n\naddUnitAlias('hour', 'h');\n\n// PRIORITY\naddUnitPriority('hour', 13);\n\n// PARSING\n\nfunction matchMeridiem(isStrict, locale) {\n return locale._meridiemParse;\n}\n\naddRegexToken('a', matchMeridiem);\naddRegexToken('A', matchMeridiem);\naddRegexToken('H', match1to2);\naddRegexToken('h', match1to2);\naddRegexToken('k', match1to2);\naddRegexToken('HH', match1to2, match2);\naddRegexToken('hh', match1to2, match2);\naddRegexToken('kk', match1to2, match2);\n\naddRegexToken('hmm', match3to4);\naddRegexToken('hmmss', match5to6);\naddRegexToken('Hmm', match3to4);\naddRegexToken('Hmmss', match5to6);\n\naddParseToken(['H', 'HH'], HOUR);\naddParseToken(['k', 'kk'], function (input, array, config) {\n var kInput = toInt(input);\n array[HOUR] = kInput === 24 ? 0 : kInput;\n});\naddParseToken(['a', 'A'], function (input, array, config) {\n config._isPm = config._locale.isPM(input);\n config._meridiem = input;\n});\naddParseToken(['h', 'hh'], function (input, array, config) {\n array[HOUR] = toInt(input);\n getParsingFlags(config).bigHour = true;\n});\naddParseToken('hmm', function (input, array, config) {\n var pos = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos));\n array[MINUTE] = toInt(input.substr(pos));\n getParsingFlags(config).bigHour = true;\n});\naddParseToken('hmmss', function (input, array, config) {\n var pos1 = input.length - 4,\n pos2 = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos1));\n array[MINUTE] = toInt(input.substr(pos1, 2));\n array[SECOND] = toInt(input.substr(pos2));\n getParsingFlags(config).bigHour = true;\n});\naddParseToken('Hmm', function (input, array, config) {\n var pos = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos));\n array[MINUTE] = toInt(input.substr(pos));\n});\naddParseToken('Hmmss', function (input, array, config) {\n var pos1 = input.length - 4,\n pos2 = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos1));\n array[MINUTE] = toInt(input.substr(pos1, 2));\n array[SECOND] = toInt(input.substr(pos2));\n});\n\n// LOCALES\n\nfunction localeIsPM(input) {\n // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays\n // Using charAt should be more compatible.\n return (input + '').toLowerCase().charAt(0) === 'p';\n}\n\nvar defaultLocaleMeridiemParse = /[ap]\\.?m?\\.?/i,\n // Setting the hour should keep the time, because the user explicitly\n // specified which hour they want. So trying to maintain the same hour (in\n // a new timezone) makes sense. Adding/subtracting hours does not follow\n // this rule.\n getSetHour = makeGetSet('Hours', true);\n\nfunction localeMeridiem(hours, minutes, isLower) {\n if (hours > 11) {\n return isLower ? 'pm' : 'PM';\n } else {\n return isLower ? 'am' : 'AM';\n }\n}\n\nvar baseConfig = {\n calendar: defaultCalendar,\n longDateFormat: defaultLongDateFormat,\n invalidDate: defaultInvalidDate,\n ordinal: defaultOrdinal,\n dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,\n relativeTime: defaultRelativeTime,\n\n months: defaultLocaleMonths,\n monthsShort: defaultLocaleMonthsShort,\n\n week: defaultLocaleWeek,\n\n weekdays: defaultLocaleWeekdays,\n weekdaysMin: defaultLocaleWeekdaysMin,\n weekdaysShort: defaultLocaleWeekdaysShort,\n\n meridiemParse: defaultLocaleMeridiemParse,\n};\n\n// internal storage for locale config files\nvar locales = {},\n localeFamilies = {},\n globalLocale;\n\nfunction commonPrefix(arr1, arr2) {\n var i,\n minl = Math.min(arr1.length, arr2.length);\n for (i = 0; i < minl; i += 1) {\n if (arr1[i] !== arr2[i]) {\n return i;\n }\n }\n return minl;\n}\n\nfunction normalizeLocale(key) {\n return key ? key.toLowerCase().replace('_', '-') : key;\n}\n\n// pick the locale from the array\n// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each\n// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root\nfunction chooseLocale(names) {\n var i = 0,\n j,\n next,\n locale,\n split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (\n next &&\n next.length >= j &&\n commonPrefix(split, next) >= j - 1\n ) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return globalLocale;\n}\n\nfunction loadLocale(name) {\n var oldLocale = null,\n aliasedRequire;\n // TODO: Find a better way to register and load all the locales in Node\n if (\n locales[name] === undefined &&\n typeof module !== 'undefined' &&\n module &&\n module.exports\n ) {\n try {\n oldLocale = globalLocale._abbr;\n aliasedRequire = require;\n aliasedRequire('./locale/' + name);\n getSetGlobalLocale(oldLocale);\n } catch (e) {\n // mark as not found to avoid repeating expensive file require call causing high CPU\n // when trying to find en-US, en_US, en-us for every format call\n locales[name] = null; // null means not found\n }\n }\n return locales[name];\n}\n\n// This function will load locale and then set the global locale. If\n// no arguments are passed in, it will simply return the current global\n// locale key.\nfunction getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn(\n 'Locale ' + key + ' not found. Did you forget to load it?'\n );\n }\n }\n }\n\n return globalLocale._abbr;\n}\n\nfunction defineLocale(name, config) {\n if (config !== null) {\n var locale,\n parentConfig = baseConfig;\n config.abbr = name;\n if (locales[name] != null) {\n deprecateSimple(\n 'defineLocaleOverride',\n 'use moment.updateLocale(localeName, config) to change ' +\n 'an existing locale. moment.defineLocale(localeName, ' +\n 'config) should only be used for creating a new locale ' +\n 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'\n );\n parentConfig = locales[name]._config;\n } else if (config.parentLocale != null) {\n if (locales[config.parentLocale] != null) {\n parentConfig = locales[config.parentLocale]._config;\n } else {\n locale = loadLocale(config.parentLocale);\n if (locale != null) {\n parentConfig = locale._config;\n } else {\n if (!localeFamilies[config.parentLocale]) {\n localeFamilies[config.parentLocale] = [];\n }\n localeFamilies[config.parentLocale].push({\n name: name,\n config: config,\n });\n return null;\n }\n }\n }\n locales[name] = new Locale(mergeConfigs(parentConfig, config));\n\n if (localeFamilies[name]) {\n localeFamilies[name].forEach(function (x) {\n defineLocale(x.name, x.config);\n });\n }\n\n // backwards compat for now: also set the locale\n // make sure we set the locale AFTER all child locales have been\n // created, so we won't end up with the child locale set.\n getSetGlobalLocale(name);\n\n return locales[name];\n } else {\n // useful for testing\n delete locales[name];\n return null;\n }\n}\n\nfunction updateLocale(name, config) {\n if (config != null) {\n var locale,\n tmpLocale,\n parentConfig = baseConfig;\n\n if (locales[name] != null && locales[name].parentLocale != null) {\n // Update existing child locale in-place to avoid memory-leaks\n locales[name].set(mergeConfigs(locales[name]._config, config));\n } else {\n // MERGE\n tmpLocale = loadLocale(name);\n if (tmpLocale != null) {\n parentConfig = tmpLocale._config;\n }\n config = mergeConfigs(parentConfig, config);\n if (tmpLocale == null) {\n // updateLocale is called for creating a new locale\n // Set abbr so it will have a name (getters return\n // undefined otherwise).\n config.abbr = name;\n }\n locale = new Locale(config);\n locale.parentLocale = locales[name];\n locales[name] = locale;\n }\n\n // backwards compat for now: also set the locale\n getSetGlobalLocale(name);\n } else {\n // pass null for config to unupdate, useful for tests\n if (locales[name] != null) {\n if (locales[name].parentLocale != null) {\n locales[name] = locales[name].parentLocale;\n if (name === getSetGlobalLocale()) {\n getSetGlobalLocale(name);\n }\n } else if (locales[name] != null) {\n delete locales[name];\n }\n }\n }\n return locales[name];\n}\n\n// returns locale data\nfunction getLocale(key) {\n var locale;\n\n if (key && key._locale && key._locale._abbr) {\n key = key._locale._abbr;\n }\n\n if (!key) {\n return globalLocale;\n }\n\n if (!isArray(key)) {\n //short-circuit everything else\n locale = loadLocale(key);\n if (locale) {\n return locale;\n }\n key = [key];\n }\n\n return chooseLocale(key);\n}\n\nfunction listLocales() {\n return keys(locales);\n}\n\nfunction checkOverflow(m) {\n var overflow,\n a = m._a;\n\n if (a && getParsingFlags(m).overflow === -2) {\n overflow =\n a[MONTH] < 0 || a[MONTH] > 11\n ? MONTH\n : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])\n ? DATE\n : a[HOUR] < 0 ||\n a[HOUR] > 24 ||\n (a[HOUR] === 24 &&\n (a[MINUTE] !== 0 ||\n a[SECOND] !== 0 ||\n a[MILLISECOND] !== 0))\n ? HOUR\n : a[MINUTE] < 0 || a[MINUTE] > 59\n ? MINUTE\n : a[SECOND] < 0 || a[SECOND] > 59\n ? SECOND\n : a[MILLISECOND] < 0 || a[MILLISECOND] > 999\n ? MILLISECOND\n : -1;\n\n if (\n getParsingFlags(m)._overflowDayOfYear &&\n (overflow < YEAR || overflow > DATE)\n ) {\n overflow = DATE;\n }\n if (getParsingFlags(m)._overflowWeeks && overflow === -1) {\n overflow = WEEK;\n }\n if (getParsingFlags(m)._overflowWeekday && overflow === -1) {\n overflow = WEEKDAY;\n }\n\n getParsingFlags(m).overflow = overflow;\n }\n\n return m;\n}\n\n// iso 8601 regex\n// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)\nvar extendedIsoRegex = /^\\s*((?:[+-]\\d{6}|\\d{4})-(?:\\d\\d-\\d\\d|W\\d\\d-\\d|W\\d\\d|\\d\\d\\d|\\d\\d))(?:(T| )(\\d\\d(?::\\d\\d(?::\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n basicIsoRegex = /^\\s*((?:[+-]\\d{6}|\\d{4})(?:\\d\\d\\d\\d|W\\d\\d\\d|W\\d\\d|\\d\\d\\d|\\d\\d|))(?:(T| )(\\d\\d(?:\\d\\d(?:\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n tzRegex = /Z|[+-]\\d\\d(?::?\\d\\d)?/,\n isoDates = [\n ['YYYYYY-MM-DD', /[+-]\\d{6}-\\d\\d-\\d\\d/],\n ['YYYY-MM-DD', /\\d{4}-\\d\\d-\\d\\d/],\n ['GGGG-[W]WW-E', /\\d{4}-W\\d\\d-\\d/],\n ['GGGG-[W]WW', /\\d{4}-W\\d\\d/, false],\n ['YYYY-DDD', /\\d{4}-\\d{3}/],\n ['YYYY-MM', /\\d{4}-\\d\\d/, false],\n ['YYYYYYMMDD', /[+-]\\d{10}/],\n ['YYYYMMDD', /\\d{8}/],\n ['GGGG[W]WWE', /\\d{4}W\\d{3}/],\n ['GGGG[W]WW', /\\d{4}W\\d{2}/, false],\n ['YYYYDDD', /\\d{7}/],\n ['YYYYMM', /\\d{6}/, false],\n ['YYYY', /\\d{4}/, false],\n ],\n // iso time formats and regexes\n isoTimes = [\n ['HH:mm:ss.SSSS', /\\d\\d:\\d\\d:\\d\\d\\.\\d+/],\n ['HH:mm:ss,SSSS', /\\d\\d:\\d\\d:\\d\\d,\\d+/],\n ['HH:mm:ss', /\\d\\d:\\d\\d:\\d\\d/],\n ['HH:mm', /\\d\\d:\\d\\d/],\n ['HHmmss.SSSS', /\\d\\d\\d\\d\\d\\d\\.\\d+/],\n ['HHmmss,SSSS', /\\d\\d\\d\\d\\d\\d,\\d+/],\n ['HHmmss', /\\d\\d\\d\\d\\d\\d/],\n ['HHmm', /\\d\\d\\d\\d/],\n ['HH', /\\d\\d/],\n ],\n aspNetJsonRegex = /^\\/?Date\\((-?\\d+)/i,\n // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3\n rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\\d{4}))$/,\n obsOffsets = {\n UT: 0,\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60,\n };\n\n// date from iso format\nfunction configFromISO(config) {\n var i,\n l,\n string = config._i,\n match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),\n allowTime,\n dateFormat,\n timeFormat,\n tzFormat;\n\n if (match) {\n getParsingFlags(config).iso = true;\n\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(match[1])) {\n dateFormat = isoDates[i][0];\n allowTime = isoDates[i][2] !== false;\n break;\n }\n }\n if (dateFormat == null) {\n config._isValid = false;\n return;\n }\n if (match[3]) {\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(match[3])) {\n // match[2] should be 'T' or space\n timeFormat = (match[2] || ' ') + isoTimes[i][0];\n break;\n }\n }\n if (timeFormat == null) {\n config._isValid = false;\n return;\n }\n }\n if (!allowTime && timeFormat != null) {\n config._isValid = false;\n return;\n }\n if (match[4]) {\n if (tzRegex.exec(match[4])) {\n tzFormat = 'Z';\n } else {\n config._isValid = false;\n return;\n }\n }\n config._f = dateFormat + (timeFormat || '') + (tzFormat || '');\n configFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n}\n\nfunction extractFromRFC2822Strings(\n yearStr,\n monthStr,\n dayStr,\n hourStr,\n minuteStr,\n secondStr\n) {\n var result = [\n untruncateYear(yearStr),\n defaultLocaleMonthsShort.indexOf(monthStr),\n parseInt(dayStr, 10),\n parseInt(hourStr, 10),\n parseInt(minuteStr, 10),\n ];\n\n if (secondStr) {\n result.push(parseInt(secondStr, 10));\n }\n\n return result;\n}\n\nfunction untruncateYear(yearStr) {\n var year = parseInt(yearStr, 10);\n if (year <= 49) {\n return 2000 + year;\n } else if (year <= 999) {\n return 1900 + year;\n }\n return year;\n}\n\nfunction preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^)]*\\)|[\\n\\t]/g, ' ')\n .replace(/(\\s\\s+)/g, ' ')\n .replace(/^\\s\\s*/, '')\n .replace(/\\s\\s*$/, '');\n}\n\nfunction checkWeekday(weekdayStr, parsedInput, config) {\n if (weekdayStr) {\n // TODO: Replace the vanilla JS Date object with an independent day-of-week check.\n var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),\n weekdayActual = new Date(\n parsedInput[0],\n parsedInput[1],\n parsedInput[2]\n ).getDay();\n if (weekdayProvided !== weekdayActual) {\n getParsingFlags(config).weekdayMismatch = true;\n config._isValid = false;\n return false;\n }\n }\n return true;\n}\n\nfunction calculateOffset(obsOffset, militaryOffset, numOffset) {\n if (obsOffset) {\n return obsOffsets[obsOffset];\n } else if (militaryOffset) {\n // the only allowed military tz is Z\n return 0;\n } else {\n var hm = parseInt(numOffset, 10),\n m = hm % 100,\n h = (hm - m) / 100;\n return h * 60 + m;\n }\n}\n\n// date and time from ref 2822 format\nfunction configFromRFC2822(config) {\n var match = rfc2822.exec(preprocessRFC2822(config._i)),\n parsedArray;\n if (match) {\n parsedArray = extractFromRFC2822Strings(\n match[4],\n match[3],\n match[2],\n match[5],\n match[6],\n match[7]\n );\n if (!checkWeekday(match[1], parsedArray, config)) {\n return;\n }\n\n config._a = parsedArray;\n config._tzm = calculateOffset(match[8], match[9], match[10]);\n\n config._d = createUTCDate.apply(null, config._a);\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n\n getParsingFlags(config).rfc2822 = true;\n } else {\n config._isValid = false;\n }\n}\n\n// date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict\nfunction configFromString(config) {\n var matched = aspNetJsonRegex.exec(config._i);\n if (matched !== null) {\n config._d = new Date(+matched[1]);\n return;\n }\n\n configFromISO(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }\n\n configFromRFC2822(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }\n\n if (config._strict) {\n config._isValid = false;\n } else {\n // Final attempt, use Input Fallback\n hooks.createFromInputFallback(config);\n }\n}\n\nhooks.createFromInputFallback = deprecate(\n 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +\n 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +\n 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',\n function (config) {\n config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));\n }\n);\n\n// Pick the first defined of two or three arguments.\nfunction defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}\n\nfunction currentDateArray(config) {\n // hooks is actually the exported moment object\n var nowValue = new Date(hooks.now());\n if (config._useUTC) {\n return [\n nowValue.getUTCFullYear(),\n nowValue.getUTCMonth(),\n nowValue.getUTCDate(),\n ];\n }\n return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];\n}\n\n// convert an array to a date.\n// the array should mirror the parameters below\n// note: all values past the year are optional and will default to the lowest possible value.\n// [year, month, day , hour, minute, second, millisecond]\nfunction configFromArray(config) {\n var i,\n date,\n input = [],\n currentDate,\n expectedWeekday,\n yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear != null) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (\n config._dayOfYear > daysInYear(yearToUse) ||\n config._dayOfYear === 0\n ) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] =\n config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (\n config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0\n ) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(\n null,\n input\n );\n expectedWeekday = config._useUTC\n ? config._d.getUTCDay()\n : config._d.getDay();\n\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n\n // check for mismatching day of week\n if (\n config._w &&\n typeof config._w.d !== 'undefined' &&\n config._w.d !== expectedWeekday\n ) {\n getParsingFlags(config).weekdayMismatch = true;\n }\n}\n\nfunction dayOfYearFromWeekInfo(config) {\n var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;\n\n w = config._w;\n if (w.GG != null || w.W != null || w.E != null) {\n dow = 1;\n doy = 4;\n\n // TODO: We need to take the current isoWeekYear, but that depends on\n // how we interpret now (local, utc, fixed offset). So create\n // a now version of current config (take local/utc/offset flags, and\n // create now).\n weekYear = defaults(\n w.GG,\n config._a[YEAR],\n weekOfYear(createLocal(), 1, 4).year\n );\n week = defaults(w.W, 1);\n weekday = defaults(w.E, 1);\n if (weekday < 1 || weekday > 7) {\n weekdayOverflow = true;\n }\n } else {\n dow = config._locale._week.dow;\n doy = config._locale._week.doy;\n\n curWeek = weekOfYear(createLocal(), dow, doy);\n\n weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);\n\n // Default to current week.\n week = defaults(w.w, curWeek.week);\n\n if (w.d != null) {\n // weekday -- low day numbers are considered next week\n weekday = w.d;\n if (weekday < 0 || weekday > 6) {\n weekdayOverflow = true;\n }\n } else if (w.e != null) {\n // local weekday -- counting starts from beginning of week\n weekday = w.e + dow;\n if (w.e < 0 || w.e > 6) {\n weekdayOverflow = true;\n }\n } else {\n // default to beginning of week\n weekday = dow;\n }\n }\n if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {\n getParsingFlags(config)._overflowWeeks = true;\n } else if (weekdayOverflow != null) {\n getParsingFlags(config)._overflowWeekday = true;\n } else {\n temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);\n config._a[YEAR] = temp.year;\n config._dayOfYear = temp.dayOfYear;\n }\n}\n\n// constant that refers to the ISO standard\nhooks.ISO_8601 = function () {};\n\n// constant that refers to the RFC 2822 form\nhooks.RFC_2822 = function () {};\n\n// date from string and format string\nfunction configFromStringAndFormat(config) {\n // TODO: Move this to another part of the creation flow to prevent circular deps\n if (config._f === hooks.ISO_8601) {\n configFromISO(config);\n return;\n }\n if (config._f === hooks.RFC_2822) {\n configFromRFC2822(config);\n return;\n }\n config._a = [];\n getParsingFlags(config).empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i,\n parsedInput,\n tokens,\n token,\n skipped,\n stringLength = string.length,\n totalParsedInputLength = 0,\n era;\n\n tokens =\n expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) ||\n [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n getParsingFlags(config).unusedInput.push(skipped);\n }\n string = string.slice(\n string.indexOf(parsedInput) + parsedInput.length\n );\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n getParsingFlags(config).empty = false;\n } else {\n getParsingFlags(config).unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n } else if (config._strict && !parsedInput) {\n getParsingFlags(config).unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n getParsingFlags(config).charsLeftOver =\n stringLength - totalParsedInputLength;\n if (string.length > 0) {\n getParsingFlags(config).unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (\n config._a[HOUR] <= 12 &&\n getParsingFlags(config).bigHour === true &&\n config._a[HOUR] > 0\n ) {\n getParsingFlags(config).bigHour = undefined;\n }\n\n getParsingFlags(config).parsedDateParts = config._a.slice(0);\n getParsingFlags(config).meridiem = config._meridiem;\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(\n config._locale,\n config._a[HOUR],\n config._meridiem\n );\n\n // handle era\n era = getParsingFlags(config).era;\n if (era !== null) {\n config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);\n }\n\n configFromArray(config);\n checkOverflow(config);\n}\n\nfunction meridiemFixWrap(locale, hour, meridiem) {\n var isPm;\n\n if (meridiem == null) {\n // nothing to do\n return hour;\n }\n if (locale.meridiemHour != null) {\n return locale.meridiemHour(hour, meridiem);\n } else if (locale.isPM != null) {\n // Fallback\n isPm = locale.isPM(meridiem);\n if (isPm && hour < 12) {\n hour += 12;\n }\n if (!isPm && hour === 12) {\n hour = 0;\n }\n return hour;\n } else {\n // this is not supposed to happen\n return hour;\n }\n}\n\n// date from string and array of format strings\nfunction configFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n scoreToBeat,\n i,\n currentScore,\n validFormatFound,\n bestFormatIsValid = false;\n\n if (config._f.length === 0) {\n getParsingFlags(config).invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n validFormatFound = false;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._f = config._f[i];\n configFromStringAndFormat(tempConfig);\n\n if (isValid(tempConfig)) {\n validFormatFound = true;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += getParsingFlags(tempConfig).charsLeftOver;\n\n //or tokens\n currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;\n\n getParsingFlags(tempConfig).score = currentScore;\n\n if (!bestFormatIsValid) {\n if (\n scoreToBeat == null ||\n currentScore < scoreToBeat ||\n validFormatFound\n ) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n if (validFormatFound) {\n bestFormatIsValid = true;\n }\n }\n } else {\n if (currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n }\n\n extend(config, bestMoment || tempConfig);\n}\n\nfunction configFromObject(config) {\n if (config._d) {\n return;\n }\n\n var i = normalizeObjectUnits(config._i),\n dayOrDate = i.day === undefined ? i.date : i.day;\n config._a = map(\n [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],\n function (obj) {\n return obj && parseInt(obj, 10);\n }\n );\n\n configFromArray(config);\n}\n\nfunction createFromConfig(config) {\n var res = new Moment(checkOverflow(prepareConfig(config)));\n if (res._nextDay) {\n // Adding is smart enough around DST\n res.add(1, 'd');\n res._nextDay = undefined;\n }\n\n return res;\n}\n\nfunction prepareConfig(config) {\n var input = config._i,\n format = config._f;\n\n config._locale = config._locale || getLocale(config._l);\n\n if (input === null || (format === undefined && input === '')) {\n return createInvalid({ nullInput: true });\n }\n\n if (typeof input === 'string') {\n config._i = input = config._locale.preparse(input);\n }\n\n if (isMoment(input)) {\n return new Moment(checkOverflow(input));\n } else if (isDate(input)) {\n config._d = input;\n } else if (isArray(format)) {\n configFromStringAndArray(config);\n } else if (format) {\n configFromStringAndFormat(config);\n } else {\n configFromInput(config);\n }\n\n if (!isValid(config)) {\n config._d = null;\n }\n\n return config;\n}\n\nfunction configFromInput(config) {\n var input = config._i;\n if (isUndefined(input)) {\n config._d = new Date(hooks.now());\n } else if (isDate(input)) {\n config._d = new Date(input.valueOf());\n } else if (typeof input === 'string') {\n configFromString(config);\n } else if (isArray(input)) {\n config._a = map(input.slice(0), function (obj) {\n return parseInt(obj, 10);\n });\n configFromArray(config);\n } else if (isObject(input)) {\n configFromObject(config);\n } else if (isNumber(input)) {\n // from milliseconds\n config._d = new Date(input);\n } else {\n hooks.createFromInputFallback(config);\n }\n}\n\nfunction createLocalOrUTC(input, format, locale, strict, isUTC) {\n var c = {};\n\n if (format === true || format === false) {\n strict = format;\n format = undefined;\n }\n\n if (locale === true || locale === false) {\n strict = locale;\n locale = undefined;\n }\n\n if (\n (isObject(input) && isObjectEmpty(input)) ||\n (isArray(input) && input.length === 0)\n ) {\n input = undefined;\n }\n // object construction must be done this way.\n // https://github.com/moment/moment/issues/1423\n c._isAMomentObject = true;\n c._useUTC = c._isUTC = isUTC;\n c._l = locale;\n c._i = input;\n c._f = format;\n c._strict = strict;\n\n return createFromConfig(c);\n}\n\nfunction createLocal(input, format, locale, strict) {\n return createLocalOrUTC(input, format, locale, strict, false);\n}\n\nvar prototypeMin = deprecate(\n 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',\n function () {\n var other = createLocal.apply(null, arguments);\n if (this.isValid() && other.isValid()) {\n return other < this ? this : other;\n } else {\n return createInvalid();\n }\n }\n ),\n prototypeMax = deprecate(\n 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',\n function () {\n var other = createLocal.apply(null, arguments);\n if (this.isValid() && other.isValid()) {\n return other > this ? this : other;\n } else {\n return createInvalid();\n }\n }\n );\n\n// Pick a moment m from moments so that m[fn](other) is true for all\n// other. This relies on the function fn to be transitive.\n//\n// moments should either be an array of moment objects or an array, whose\n// first element is an array of moment objects.\nfunction pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n}\n\n// TODO: Use [].sort instead?\nfunction min() {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}\n\nfunction max() {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isAfter', args);\n}\n\nvar now = function () {\n return Date.now ? Date.now() : +new Date();\n};\n\nvar ordering = [\n 'year',\n 'quarter',\n 'month',\n 'week',\n 'day',\n 'hour',\n 'minute',\n 'second',\n 'millisecond',\n];\n\nfunction isDurationValid(m) {\n var key,\n unitHasDecimal = false,\n i;\n for (key in m) {\n if (\n hasOwnProp(m, key) &&\n !(\n indexOf.call(ordering, key) !== -1 &&\n (m[key] == null || !isNaN(m[key]))\n )\n ) {\n return false;\n }\n }\n\n for (i = 0; i < ordering.length; ++i) {\n if (m[ordering[i]]) {\n if (unitHasDecimal) {\n return false; // only allow non-integers for smallest unit\n }\n if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {\n unitHasDecimal = true;\n }\n }\n }\n\n return true;\n}\n\nfunction isValid$1() {\n return this._isValid;\n}\n\nfunction createInvalid$1() {\n return createDuration(NaN);\n}\n\nfunction Duration(duration) {\n var normalizedInput = normalizeObjectUnits(duration),\n years = normalizedInput.year || 0,\n quarters = normalizedInput.quarter || 0,\n months = normalizedInput.month || 0,\n weeks = normalizedInput.week || normalizedInput.isoWeek || 0,\n days = normalizedInput.day || 0,\n hours = normalizedInput.hour || 0,\n minutes = normalizedInput.minute || 0,\n seconds = normalizedInput.second || 0,\n milliseconds = normalizedInput.millisecond || 0;\n\n this._isValid = isDurationValid(normalizedInput);\n\n // representation for dateAddRemove\n this._milliseconds =\n +milliseconds +\n seconds * 1e3 + // 1000\n minutes * 6e4 + // 1000 * 60\n hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978\n // Because of dateAddRemove treats 24 hours as different from a\n // day when working around DST, we need to store them separately\n this._days = +days + weeks * 7;\n // It is impossible to translate months into days without knowing\n // which months you are are talking about, so we have to store\n // it separately.\n this._months = +months + quarters * 3 + years * 12;\n\n this._data = {};\n\n this._locale = getLocale();\n\n this._bubble();\n}\n\nfunction isDuration(obj) {\n return obj instanceof Duration;\n}\n\nfunction absRound(number) {\n if (number < 0) {\n return Math.round(-1 * number) * -1;\n } else {\n return Math.round(number);\n }\n}\n\n// compare two arrays, return the number of differences\nfunction compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (\n (dontConvert && array1[i] !== array2[i]) ||\n (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))\n ) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n}\n\n// FORMATTING\n\nfunction offset(token, separator) {\n addFormatToken(token, 0, 0, function () {\n var offset = this.utcOffset(),\n sign = '+';\n if (offset < 0) {\n offset = -offset;\n sign = '-';\n }\n return (\n sign +\n zeroFill(~~(offset / 60), 2) +\n separator +\n zeroFill(~~offset % 60, 2)\n );\n });\n}\n\noffset('Z', ':');\noffset('ZZ', '');\n\n// PARSING\n\naddRegexToken('Z', matchShortOffset);\naddRegexToken('ZZ', matchShortOffset);\naddParseToken(['Z', 'ZZ'], function (input, array, config) {\n config._useUTC = true;\n config._tzm = offsetFromString(matchShortOffset, input);\n});\n\n// HELPERS\n\n// timezone chunker\n// '+10:00' > ['10', '00']\n// '-1530' > ['-15', '30']\nvar chunkOffset = /([\\+\\-]|\\d\\d)/gi;\n\nfunction offsetFromString(matcher, string) {\n var matches = (string || '').match(matcher),\n chunk,\n parts,\n minutes;\n\n if (matches === null) {\n return null;\n }\n\n chunk = matches[matches.length - 1] || [];\n parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];\n minutes = +(parts[1] * 60) + toInt(parts[2]);\n\n return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;\n}\n\n// Return a moment from input, that is local/utc/zone equivalent to model.\nfunction cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff =\n (isMoment(input) || isDate(input)\n ? input.valueOf()\n : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n}\n\nfunction getDateOffset(m) {\n // On Firefox.24 Date#getTimezoneOffset returns a floating point.\n // https://github.com/moment/moment/pull/1871\n return -Math.round(m._d.getTimezoneOffset());\n}\n\n// HOOKS\n\n// This function will be called whenever a moment is mutated.\n// It is intended to keep the offset in sync with the timezone.\nhooks.updateOffset = function () {};\n\n// MOMENTS\n\n// keepLocalTime = true means only change the timezone, without\n// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->\n// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset\n// +0200, so we adjust the time as needed, to be valid.\n//\n// Keeping the time actually adds/subtracts (one hour)\n// from the actual represented time. That is why we call updateOffset\n// a second time. In case it wants us to change the offset again\n// _changeInProgress == true case, then we have to adjust, because\n// there is no such time in the given timezone.\nfunction getSetOffset(input, keepLocalTime, keepMinutes) {\n var offset = this._offset || 0,\n localAdjust;\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n if (input != null) {\n if (typeof input === 'string') {\n input = offsetFromString(matchShortOffset, input);\n if (input === null) {\n return this;\n }\n } else if (Math.abs(input) < 16 && !keepMinutes) {\n input = input * 60;\n }\n if (!this._isUTC && keepLocalTime) {\n localAdjust = getDateOffset(this);\n }\n this._offset = input;\n this._isUTC = true;\n if (localAdjust != null) {\n this.add(localAdjust, 'm');\n }\n if (offset !== input) {\n if (!keepLocalTime || this._changeInProgress) {\n addSubtract(\n this,\n createDuration(input - offset, 'm'),\n 1,\n false\n );\n } else if (!this._changeInProgress) {\n this._changeInProgress = true;\n hooks.updateOffset(this, true);\n this._changeInProgress = null;\n }\n }\n return this;\n } else {\n return this._isUTC ? offset : getDateOffset(this);\n }\n}\n\nfunction getSetZone(input, keepLocalTime) {\n if (input != null) {\n if (typeof input !== 'string') {\n input = -input;\n }\n\n this.utcOffset(input, keepLocalTime);\n\n return this;\n } else {\n return -this.utcOffset();\n }\n}\n\nfunction setOffsetToUTC(keepLocalTime) {\n return this.utcOffset(0, keepLocalTime);\n}\n\nfunction setOffsetToLocal(keepLocalTime) {\n if (this._isUTC) {\n this.utcOffset(0, keepLocalTime);\n this._isUTC = false;\n\n if (keepLocalTime) {\n this.subtract(getDateOffset(this), 'm');\n }\n }\n return this;\n}\n\nfunction setOffsetToParsedOffset() {\n if (this._tzm != null) {\n this.utcOffset(this._tzm, false, true);\n } else if (typeof this._i === 'string') {\n var tZone = offsetFromString(matchOffset, this._i);\n if (tZone != null) {\n this.utcOffset(tZone);\n } else {\n this.utcOffset(0, true);\n }\n }\n return this;\n}\n\nfunction hasAlignedHourOffset(input) {\n if (!this.isValid()) {\n return false;\n }\n input = input ? createLocal(input).utcOffset() : 0;\n\n return (this.utcOffset() - input) % 60 === 0;\n}\n\nfunction isDaylightSavingTime() {\n return (\n this.utcOffset() > this.clone().month(0).utcOffset() ||\n this.utcOffset() > this.clone().month(5).utcOffset()\n );\n}\n\nfunction isDaylightSavingTimeShifted() {\n if (!isUndefined(this._isDSTShifted)) {\n return this._isDSTShifted;\n }\n\n var c = {},\n other;\n\n copyConfig(c, this);\n c = prepareConfig(c);\n\n if (c._a) {\n other = c._isUTC ? createUTC(c._a) : createLocal(c._a);\n this._isDSTShifted =\n this.isValid() && compareArrays(c._a, other.toArray()) > 0;\n } else {\n this._isDSTShifted = false;\n }\n\n return this._isDSTShifted;\n}\n\nfunction isLocal() {\n return this.isValid() ? !this._isUTC : false;\n}\n\nfunction isUtcOffset() {\n return this.isValid() ? this._isUTC : false;\n}\n\nfunction isUtc() {\n return this.isValid() ? this._isUTC && this._offset === 0 : false;\n}\n\n// ASP.NET json date format regex\nvar aspNetRegex = /^(-|\\+)?(?:(\\d*)[. ])?(\\d+):(\\d+)(?::(\\d+)(\\.\\d*)?)?$/,\n // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html\n // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere\n // and further modified to allow for strings containing both week and day\n isoRegex = /^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;\n\nfunction createDuration(input, key) {\n var duration = input,\n // matching against regexp is expensive, do it on demand\n match = null,\n sign,\n ret,\n diffRes;\n\n if (isDuration(input)) {\n duration = {\n ms: input._milliseconds,\n d: input._days,\n M: input._months,\n };\n } else if (isNumber(input) || !isNaN(+input)) {\n duration = {};\n if (key) {\n duration[key] = +input;\n } else {\n duration.milliseconds = +input;\n }\n } else if ((match = aspNetRegex.exec(input))) {\n sign = match[1] === '-' ? -1 : 1;\n duration = {\n y: 0,\n d: toInt(match[DATE]) * sign,\n h: toInt(match[HOUR]) * sign,\n m: toInt(match[MINUTE]) * sign,\n s: toInt(match[SECOND]) * sign,\n ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match\n };\n } else if ((match = isoRegex.exec(input))) {\n sign = match[1] === '-' ? -1 : 1;\n duration = {\n y: parseIso(match[2], sign),\n M: parseIso(match[3], sign),\n w: parseIso(match[4], sign),\n d: parseIso(match[5], sign),\n h: parseIso(match[6], sign),\n m: parseIso(match[7], sign),\n s: parseIso(match[8], sign),\n };\n } else if (duration == null) {\n // checks for null or undefined\n duration = {};\n } else if (\n typeof duration === 'object' &&\n ('from' in duration || 'to' in duration)\n ) {\n diffRes = momentsDifference(\n createLocal(duration.from),\n createLocal(duration.to)\n );\n\n duration = {};\n duration.ms = diffRes.milliseconds;\n duration.M = diffRes.months;\n }\n\n ret = new Duration(duration);\n\n if (isDuration(input) && hasOwnProp(input, '_locale')) {\n ret._locale = input._locale;\n }\n\n if (isDuration(input) && hasOwnProp(input, '_isValid')) {\n ret._isValid = input._isValid;\n }\n\n return ret;\n}\n\ncreateDuration.fn = Duration.prototype;\ncreateDuration.invalid = createInvalid$1;\n\nfunction parseIso(inp, sign) {\n // We'd normally use ~~inp for this, but unfortunately it also\n // converts floats to ints.\n // inp may be undefined, so careful calling replace on it.\n var res = inp && parseFloat(inp.replace(',', '.'));\n // apply sign while we're at it\n return (isNaN(res) ? 0 : res) * sign;\n}\n\nfunction positiveMomentsDifference(base, other) {\n var res = {};\n\n res.months =\n other.month() - base.month() + (other.year() - base.year()) * 12;\n if (base.clone().add(res.months, 'M').isAfter(other)) {\n --res.months;\n }\n\n res.milliseconds = +other - +base.clone().add(res.months, 'M');\n\n return res;\n}\n\nfunction momentsDifference(base, other) {\n var res;\n if (!(base.isValid() && other.isValid())) {\n return { milliseconds: 0, months: 0 };\n }\n\n other = cloneWithOffset(other, base);\n if (base.isBefore(other)) {\n res = positiveMomentsDifference(base, other);\n } else {\n res = positiveMomentsDifference(other, base);\n res.milliseconds = -res.milliseconds;\n res.months = -res.months;\n }\n\n return res;\n}\n\n// TODO: remove 'name' arg after deprecation is removed\nfunction createAdder(direction, name) {\n return function (val, period) {\n var dur, tmp;\n //invert the arguments, but complain about it\n if (period !== null && !isNaN(+period)) {\n deprecateSimple(\n name,\n 'moment().' +\n name +\n '(period, number) is deprecated. Please use moment().' +\n name +\n '(number, period). ' +\n 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'\n );\n tmp = val;\n val = period;\n period = tmp;\n }\n\n dur = createDuration(val, period);\n addSubtract(this, dur, direction);\n return this;\n };\n}\n\nfunction addSubtract(mom, duration, isAdding, updateOffset) {\n var milliseconds = duration._milliseconds,\n days = absRound(duration._days),\n months = absRound(duration._months);\n\n if (!mom.isValid()) {\n // No op\n return;\n }\n\n updateOffset = updateOffset == null ? true : updateOffset;\n\n if (months) {\n setMonth(mom, get(mom, 'Month') + months * isAdding);\n }\n if (days) {\n set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);\n }\n if (milliseconds) {\n mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);\n }\n if (updateOffset) {\n hooks.updateOffset(mom, days || months);\n }\n}\n\nvar add = createAdder(1, 'add'),\n subtract = createAdder(-1, 'subtract');\n\nfunction isString(input) {\n return typeof input === 'string' || input instanceof String;\n}\n\n// type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined\nfunction isMomentInput(input) {\n return (\n isMoment(input) ||\n isDate(input) ||\n isString(input) ||\n isNumber(input) ||\n isNumberOrStringArray(input) ||\n isMomentInputObject(input) ||\n input === null ||\n input === undefined\n );\n}\n\nfunction isMomentInputObject(input) {\n var objectTest = isObject(input) && !isObjectEmpty(input),\n propertyTest = false,\n properties = [\n 'years',\n 'year',\n 'y',\n 'months',\n 'month',\n 'M',\n 'days',\n 'day',\n 'd',\n 'dates',\n 'date',\n 'D',\n 'hours',\n 'hour',\n 'h',\n 'minutes',\n 'minute',\n 'm',\n 'seconds',\n 'second',\n 's',\n 'milliseconds',\n 'millisecond',\n 'ms',\n ],\n i,\n property;\n\n for (i = 0; i < properties.length; i += 1) {\n property = properties[i];\n propertyTest = propertyTest || hasOwnProp(input, property);\n }\n\n return objectTest && propertyTest;\n}\n\nfunction isNumberOrStringArray(input) {\n var arrayTest = isArray(input),\n dataTypeTest = false;\n if (arrayTest) {\n dataTypeTest =\n input.filter(function (item) {\n return !isNumber(item) && isString(input);\n }).length === 0;\n }\n return arrayTest && dataTypeTest;\n}\n\nfunction isCalendarSpec(input) {\n var objectTest = isObject(input) && !isObjectEmpty(input),\n propertyTest = false,\n properties = [\n 'sameDay',\n 'nextDay',\n 'lastDay',\n 'nextWeek',\n 'lastWeek',\n 'sameElse',\n ],\n i,\n property;\n\n for (i = 0; i < properties.length; i += 1) {\n property = properties[i];\n propertyTest = propertyTest || hasOwnProp(input, property);\n }\n\n return objectTest && propertyTest;\n}\n\nfunction getCalendarFormat(myMoment, now) {\n var diff = myMoment.diff(now, 'days', true);\n return diff < -6\n ? 'sameElse'\n : diff < -1\n ? 'lastWeek'\n : diff < 0\n ? 'lastDay'\n : diff < 1\n ? 'sameDay'\n : diff < 2\n ? 'nextDay'\n : diff < 7\n ? 'nextWeek'\n : 'sameElse';\n}\n\nfunction calendar$1(time, formats) {\n // Support for single parameter, formats only overload to the calendar function\n if (arguments.length === 1) {\n if (!arguments[0]) {\n time = undefined;\n formats = undefined;\n } else if (isMomentInput(arguments[0])) {\n time = arguments[0];\n formats = undefined;\n } else if (isCalendarSpec(arguments[0])) {\n formats = arguments[0];\n time = undefined;\n }\n }\n // We want to compare the start of today, vs this.\n // Getting start-of-today depends on whether we're local/utc/offset or not.\n var now = time || createLocal(),\n sod = cloneWithOffset(now, this).startOf('day'),\n format = hooks.calendarFormat(this, sod) || 'sameElse',\n output =\n formats &&\n (isFunction(formats[format])\n ? formats[format].call(this, now)\n : formats[format]);\n\n return this.format(\n output || this.localeData().calendar(format, this, createLocal(now))\n );\n}\n\nfunction clone() {\n return new Moment(this);\n}\n\nfunction isAfter(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input);\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() > localInput.valueOf();\n } else {\n return localInput.valueOf() < this.clone().startOf(units).valueOf();\n }\n}\n\nfunction isBefore(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input);\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() < localInput.valueOf();\n } else {\n return this.clone().endOf(units).valueOf() < localInput.valueOf();\n }\n}\n\nfunction isBetween(from, to, units, inclusivity) {\n var localFrom = isMoment(from) ? from : createLocal(from),\n localTo = isMoment(to) ? to : createLocal(to);\n if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {\n return false;\n }\n inclusivity = inclusivity || '()';\n return (\n (inclusivity[0] === '('\n ? this.isAfter(localFrom, units)\n : !this.isBefore(localFrom, units)) &&\n (inclusivity[1] === ')'\n ? this.isBefore(localTo, units)\n : !this.isAfter(localTo, units))\n );\n}\n\nfunction isSame(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input),\n inputMs;\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() === localInput.valueOf();\n } else {\n inputMs = localInput.valueOf();\n return (\n this.clone().startOf(units).valueOf() <= inputMs &&\n inputMs <= this.clone().endOf(units).valueOf()\n );\n }\n}\n\nfunction isSameOrAfter(input, units) {\n return this.isSame(input, units) || this.isAfter(input, units);\n}\n\nfunction isSameOrBefore(input, units) {\n return this.isSame(input, units) || this.isBefore(input, units);\n}\n\nfunction diff(input, units, asFloat) {\n var that, zoneDelta, output;\n\n if (!this.isValid()) {\n return NaN;\n }\n\n that = cloneWithOffset(input, this);\n\n if (!that.isValid()) {\n return NaN;\n }\n\n zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;\n\n units = normalizeUnits(units);\n\n switch (units) {\n case 'year':\n output = monthDiff(this, that) / 12;\n break;\n case 'month':\n output = monthDiff(this, that);\n break;\n case 'quarter':\n output = monthDiff(this, that) / 3;\n break;\n case 'second':\n output = (this - that) / 1e3;\n break; // 1000\n case 'minute':\n output = (this - that) / 6e4;\n break; // 1000 * 60\n case 'hour':\n output = (this - that) / 36e5;\n break; // 1000 * 60 * 60\n case 'day':\n output = (this - that - zoneDelta) / 864e5;\n break; // 1000 * 60 * 60 * 24, negate dst\n case 'week':\n output = (this - that - zoneDelta) / 6048e5;\n break; // 1000 * 60 * 60 * 24 * 7, negate dst\n default:\n output = this - that;\n }\n\n return asFloat ? output : absFloor(output);\n}\n\nfunction monthDiff(a, b) {\n if (a.date() < b.date()) {\n // end-of-month calculations work correct when the start month has more\n // days than the end month.\n return -monthDiff(b, a);\n }\n // difference in months\n var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),\n // b is in (anchor - 1 month, anchor + 1 month)\n anchor = a.clone().add(wholeMonthDiff, 'months'),\n anchor2,\n adjust;\n\n if (b - anchor < 0) {\n anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');\n // linear across the month\n adjust = (b - anchor) / (anchor - anchor2);\n } else {\n anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');\n // linear across the month\n adjust = (b - anchor) / (anchor2 - anchor);\n }\n\n //check for negative zero, return zero if negative zero\n return -(wholeMonthDiff + adjust) || 0;\n}\n\nhooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';\nhooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';\n\nfunction toString() {\n return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');\n}\n\nfunction toISOString(keepOffset) {\n if (!this.isValid()) {\n return null;\n }\n var utc = keepOffset !== true,\n m = utc ? this.clone().utc() : this;\n if (m.year() < 0 || m.year() > 9999) {\n return formatMoment(\n m,\n utc\n ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'\n : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'\n );\n }\n if (isFunction(Date.prototype.toISOString)) {\n // native implementation is ~50x faster, use it when we can\n if (utc) {\n return this.toDate().toISOString();\n } else {\n return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)\n .toISOString()\n .replace('Z', formatMoment(m, 'Z'));\n }\n }\n return formatMoment(\n m,\n utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'\n );\n}\n\n/**\n * Return a human readable representation of a moment that can\n * also be evaluated to get a new moment which is the same\n *\n * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects\n */\nfunction inspect() {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment',\n zone = '',\n prefix,\n year,\n datetime,\n suffix;\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n prefix = '[' + func + '(\"]';\n year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';\n datetime = '-MM-DD[T]HH:mm:ss.SSS';\n suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n}\n\nfunction format(inputString) {\n if (!inputString) {\n inputString = this.isUtc()\n ? hooks.defaultFormatUtc\n : hooks.defaultFormat;\n }\n var output = formatMoment(this, inputString);\n return this.localeData().postformat(output);\n}\n\nfunction from(time, withoutSuffix) {\n if (\n this.isValid() &&\n ((isMoment(time) && time.isValid()) || createLocal(time).isValid())\n ) {\n return createDuration({ to: this, from: time })\n .locale(this.locale())\n .humanize(!withoutSuffix);\n } else {\n return this.localeData().invalidDate();\n }\n}\n\nfunction fromNow(withoutSuffix) {\n return this.from(createLocal(), withoutSuffix);\n}\n\nfunction to(time, withoutSuffix) {\n if (\n this.isValid() &&\n ((isMoment(time) && time.isValid()) || createLocal(time).isValid())\n ) {\n return createDuration({ from: this, to: time })\n .locale(this.locale())\n .humanize(!withoutSuffix);\n } else {\n return this.localeData().invalidDate();\n }\n}\n\nfunction toNow(withoutSuffix) {\n return this.to(createLocal(), withoutSuffix);\n}\n\n// If passed a locale key, it will set the locale for this\n// instance. Otherwise, it will return the locale configuration\n// variables for this instance.\nfunction locale(key) {\n var newLocaleData;\n\n if (key === undefined) {\n return this._locale._abbr;\n } else {\n newLocaleData = getLocale(key);\n if (newLocaleData != null) {\n this._locale = newLocaleData;\n }\n return this;\n }\n}\n\nvar lang = deprecate(\n 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',\n function (key) {\n if (key === undefined) {\n return this.localeData();\n } else {\n return this.locale(key);\n }\n }\n);\n\nfunction localeData() {\n return this._locale;\n}\n\nvar MS_PER_SECOND = 1000,\n MS_PER_MINUTE = 60 * MS_PER_SECOND,\n MS_PER_HOUR = 60 * MS_PER_MINUTE,\n MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;\n\n// actual modulo - handles negative numbers (for dates before 1970):\nfunction mod$1(dividend, divisor) {\n return ((dividend % divisor) + divisor) % divisor;\n}\n\nfunction localStartOfDate(y, m, d) {\n // the date constructor remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n return new Date(y + 400, m, d) - MS_PER_400_YEARS;\n } else {\n return new Date(y, m, d).valueOf();\n }\n}\n\nfunction utcStartOfDate(y, m, d) {\n // Date.UTC remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;\n } else {\n return Date.UTC(y, m, d);\n }\n}\n\nfunction startOf(units) {\n var time, startOfDate;\n units = normalizeUnits(units);\n if (units === undefined || units === 'millisecond' || !this.isValid()) {\n return this;\n }\n\n startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;\n\n switch (units) {\n case 'year':\n time = startOfDate(this.year(), 0, 1);\n break;\n case 'quarter':\n time = startOfDate(\n this.year(),\n this.month() - (this.month() % 3),\n 1\n );\n break;\n case 'month':\n time = startOfDate(this.year(), this.month(), 1);\n break;\n case 'week':\n time = startOfDate(\n this.year(),\n this.month(),\n this.date() - this.weekday()\n );\n break;\n case 'isoWeek':\n time = startOfDate(\n this.year(),\n this.month(),\n this.date() - (this.isoWeekday() - 1)\n );\n break;\n case 'day':\n case 'date':\n time = startOfDate(this.year(), this.month(), this.date());\n break;\n case 'hour':\n time = this._d.valueOf();\n time -= mod$1(\n time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),\n MS_PER_HOUR\n );\n break;\n case 'minute':\n time = this._d.valueOf();\n time -= mod$1(time, MS_PER_MINUTE);\n break;\n case 'second':\n time = this._d.valueOf();\n time -= mod$1(time, MS_PER_SECOND);\n break;\n }\n\n this._d.setTime(time);\n hooks.updateOffset(this, true);\n return this;\n}\n\nfunction endOf(units) {\n var time, startOfDate;\n units = normalizeUnits(units);\n if (units === undefined || units === 'millisecond' || !this.isValid()) {\n return this;\n }\n\n startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;\n\n switch (units) {\n case 'year':\n time = startOfDate(this.year() + 1, 0, 1) - 1;\n break;\n case 'quarter':\n time =\n startOfDate(\n this.year(),\n this.month() - (this.month() % 3) + 3,\n 1\n ) - 1;\n break;\n case 'month':\n time = startOfDate(this.year(), this.month() + 1, 1) - 1;\n break;\n case 'week':\n time =\n startOfDate(\n this.year(),\n this.month(),\n this.date() - this.weekday() + 7\n ) - 1;\n break;\n case 'isoWeek':\n time =\n startOfDate(\n this.year(),\n this.month(),\n this.date() - (this.isoWeekday() - 1) + 7\n ) - 1;\n break;\n case 'day':\n case 'date':\n time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;\n break;\n case 'hour':\n time = this._d.valueOf();\n time +=\n MS_PER_HOUR -\n mod$1(\n time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),\n MS_PER_HOUR\n ) -\n 1;\n break;\n case 'minute':\n time = this._d.valueOf();\n time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;\n break;\n case 'second':\n time = this._d.valueOf();\n time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;\n break;\n }\n\n this._d.setTime(time);\n hooks.updateOffset(this, true);\n return this;\n}\n\nfunction valueOf() {\n return this._d.valueOf() - (this._offset || 0) * 60000;\n}\n\nfunction unix() {\n return Math.floor(this.valueOf() / 1000);\n}\n\nfunction toDate() {\n return new Date(this.valueOf());\n}\n\nfunction toArray() {\n var m = this;\n return [\n m.year(),\n m.month(),\n m.date(),\n m.hour(),\n m.minute(),\n m.second(),\n m.millisecond(),\n ];\n}\n\nfunction toObject() {\n var m = this;\n return {\n years: m.year(),\n months: m.month(),\n date: m.date(),\n hours: m.hours(),\n minutes: m.minutes(),\n seconds: m.seconds(),\n milliseconds: m.milliseconds(),\n };\n}\n\nfunction toJSON() {\n // new Date(NaN).toJSON() === null\n return this.isValid() ? this.toISOString() : null;\n}\n\nfunction isValid$2() {\n return isValid(this);\n}\n\nfunction parsingFlags() {\n return extend({}, getParsingFlags(this));\n}\n\nfunction invalidAt() {\n return getParsingFlags(this).overflow;\n}\n\nfunction creationData() {\n return {\n input: this._i,\n format: this._f,\n locale: this._locale,\n isUTC: this._isUTC,\n strict: this._strict,\n };\n}\n\naddFormatToken('N', 0, 0, 'eraAbbr');\naddFormatToken('NN', 0, 0, 'eraAbbr');\naddFormatToken('NNN', 0, 0, 'eraAbbr');\naddFormatToken('NNNN', 0, 0, 'eraName');\naddFormatToken('NNNNN', 0, 0, 'eraNarrow');\n\naddFormatToken('y', ['y', 1], 'yo', 'eraYear');\naddFormatToken('y', ['yy', 2], 0, 'eraYear');\naddFormatToken('y', ['yyy', 3], 0, 'eraYear');\naddFormatToken('y', ['yyyy', 4], 0, 'eraYear');\n\naddRegexToken('N', matchEraAbbr);\naddRegexToken('NN', matchEraAbbr);\naddRegexToken('NNN', matchEraAbbr);\naddRegexToken('NNNN', matchEraName);\naddRegexToken('NNNNN', matchEraNarrow);\n\naddParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (\n input,\n array,\n config,\n token\n) {\n var era = config._locale.erasParse(input, token, config._strict);\n if (era) {\n getParsingFlags(config).era = era;\n } else {\n getParsingFlags(config).invalidEra = input;\n }\n});\n\naddRegexToken('y', matchUnsigned);\naddRegexToken('yy', matchUnsigned);\naddRegexToken('yyy', matchUnsigned);\naddRegexToken('yyyy', matchUnsigned);\naddRegexToken('yo', matchEraYearOrdinal);\n\naddParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);\naddParseToken(['yo'], function (input, array, config, token) {\n var match;\n if (config._locale._eraYearOrdinalRegex) {\n match = input.match(config._locale._eraYearOrdinalRegex);\n }\n\n if (config._locale.eraYearOrdinalParse) {\n array[YEAR] = config._locale.eraYearOrdinalParse(input, match);\n } else {\n array[YEAR] = parseInt(input, 10);\n }\n});\n\nfunction localeEras(m, format) {\n var i,\n l,\n date,\n eras = this._eras || getLocale('en')._eras;\n for (i = 0, l = eras.length; i < l; ++i) {\n switch (typeof eras[i].since) {\n case 'string':\n // truncate time\n date = hooks(eras[i].since).startOf('day');\n eras[i].since = date.valueOf();\n break;\n }\n\n switch (typeof eras[i].until) {\n case 'undefined':\n eras[i].until = +Infinity;\n break;\n case 'string':\n // truncate time\n date = hooks(eras[i].until).startOf('day').valueOf();\n eras[i].until = date.valueOf();\n break;\n }\n }\n return eras;\n}\n\nfunction localeErasParse(eraName, format, strict) {\n var i,\n l,\n eras = this.eras(),\n name,\n abbr,\n narrow;\n eraName = eraName.toUpperCase();\n\n for (i = 0, l = eras.length; i < l; ++i) {\n name = eras[i].name.toUpperCase();\n abbr = eras[i].abbr.toUpperCase();\n narrow = eras[i].narrow.toUpperCase();\n\n if (strict) {\n switch (format) {\n case 'N':\n case 'NN':\n case 'NNN':\n if (abbr === eraName) {\n return eras[i];\n }\n break;\n\n case 'NNNN':\n if (name === eraName) {\n return eras[i];\n }\n break;\n\n case 'NNNNN':\n if (narrow === eraName) {\n return eras[i];\n }\n break;\n }\n } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {\n return eras[i];\n }\n }\n}\n\nfunction localeErasConvertYear(era, year) {\n var dir = era.since <= era.until ? +1 : -1;\n if (year === undefined) {\n return hooks(era.since).year();\n } else {\n return hooks(era.since).year() + (year - era.offset) * dir;\n }\n}\n\nfunction getEraName() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].name;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].name;\n }\n }\n\n return '';\n}\n\nfunction getEraNarrow() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].narrow;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].narrow;\n }\n }\n\n return '';\n}\n\nfunction getEraAbbr() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].abbr;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].abbr;\n }\n }\n\n return '';\n}\n\nfunction getEraYear() {\n var i,\n l,\n dir,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n dir = eras[i].since <= eras[i].until ? +1 : -1;\n\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (\n (eras[i].since <= val && val <= eras[i].until) ||\n (eras[i].until <= val && val <= eras[i].since)\n ) {\n return (\n (this.year() - hooks(eras[i].since).year()) * dir +\n eras[i].offset\n );\n }\n }\n\n return this.year();\n}\n\nfunction erasNameRegex(isStrict) {\n if (!hasOwnProp(this, '_erasNameRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasNameRegex : this._erasRegex;\n}\n\nfunction erasAbbrRegex(isStrict) {\n if (!hasOwnProp(this, '_erasAbbrRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasAbbrRegex : this._erasRegex;\n}\n\nfunction erasNarrowRegex(isStrict) {\n if (!hasOwnProp(this, '_erasNarrowRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasNarrowRegex : this._erasRegex;\n}\n\nfunction matchEraAbbr(isStrict, locale) {\n return locale.erasAbbrRegex(isStrict);\n}\n\nfunction matchEraName(isStrict, locale) {\n return locale.erasNameRegex(isStrict);\n}\n\nfunction matchEraNarrow(isStrict, locale) {\n return locale.erasNarrowRegex(isStrict);\n}\n\nfunction matchEraYearOrdinal(isStrict, locale) {\n return locale._eraYearOrdinalRegex || matchUnsigned;\n}\n\nfunction computeErasParse() {\n var abbrPieces = [],\n namePieces = [],\n narrowPieces = [],\n mixedPieces = [],\n i,\n l,\n eras = this.eras();\n\n for (i = 0, l = eras.length; i < l; ++i) {\n namePieces.push(regexEscape(eras[i].name));\n abbrPieces.push(regexEscape(eras[i].abbr));\n narrowPieces.push(regexEscape(eras[i].narrow));\n\n mixedPieces.push(regexEscape(eras[i].name));\n mixedPieces.push(regexEscape(eras[i].abbr));\n mixedPieces.push(regexEscape(eras[i].narrow));\n }\n\n this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');\n this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');\n this._erasNarrowRegex = new RegExp(\n '^(' + narrowPieces.join('|') + ')',\n 'i'\n );\n}\n\n// FORMATTING\n\naddFormatToken(0, ['gg', 2], 0, function () {\n return this.weekYear() % 100;\n});\n\naddFormatToken(0, ['GG', 2], 0, function () {\n return this.isoWeekYear() % 100;\n});\n\nfunction addWeekYearFormatToken(token, getter) {\n addFormatToken(0, [token, token.length], 0, getter);\n}\n\naddWeekYearFormatToken('gggg', 'weekYear');\naddWeekYearFormatToken('ggggg', 'weekYear');\naddWeekYearFormatToken('GGGG', 'isoWeekYear');\naddWeekYearFormatToken('GGGGG', 'isoWeekYear');\n\n// ALIASES\n\naddUnitAlias('weekYear', 'gg');\naddUnitAlias('isoWeekYear', 'GG');\n\n// PRIORITY\n\naddUnitPriority('weekYear', 1);\naddUnitPriority('isoWeekYear', 1);\n\n// PARSING\n\naddRegexToken('G', matchSigned);\naddRegexToken('g', matchSigned);\naddRegexToken('GG', match1to2, match2);\naddRegexToken('gg', match1to2, match2);\naddRegexToken('GGGG', match1to4, match4);\naddRegexToken('gggg', match1to4, match4);\naddRegexToken('GGGGG', match1to6, match6);\naddRegexToken('ggggg', match1to6, match6);\n\naddWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (\n input,\n week,\n config,\n token\n) {\n week[token.substr(0, 2)] = toInt(input);\n});\n\naddWeekParseToken(['gg', 'GG'], function (input, week, config, token) {\n week[token] = hooks.parseTwoDigitYear(input);\n});\n\n// MOMENTS\n\nfunction getSetWeekYear(input) {\n return getSetWeekYearHelper.call(\n this,\n input,\n this.week(),\n this.weekday(),\n this.localeData()._week.dow,\n this.localeData()._week.doy\n );\n}\n\nfunction getSetISOWeekYear(input) {\n return getSetWeekYearHelper.call(\n this,\n input,\n this.isoWeek(),\n this.isoWeekday(),\n 1,\n 4\n );\n}\n\nfunction getISOWeeksInYear() {\n return weeksInYear(this.year(), 1, 4);\n}\n\nfunction getISOWeeksInISOWeekYear() {\n return weeksInYear(this.isoWeekYear(), 1, 4);\n}\n\nfunction getWeeksInYear() {\n var weekInfo = this.localeData()._week;\n return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);\n}\n\nfunction getWeeksInWeekYear() {\n var weekInfo = this.localeData()._week;\n return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);\n}\n\nfunction getSetWeekYearHelper(input, week, weekday, dow, doy) {\n var weeksTarget;\n if (input == null) {\n return weekOfYear(this, dow, doy).year;\n } else {\n weeksTarget = weeksInYear(input, dow, doy);\n if (week > weeksTarget) {\n week = weeksTarget;\n }\n return setWeekAll.call(this, input, week, weekday, dow, doy);\n }\n}\n\nfunction setWeekAll(weekYear, week, weekday, dow, doy) {\n var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),\n date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);\n\n this.year(date.getUTCFullYear());\n this.month(date.getUTCMonth());\n this.date(date.getUTCDate());\n return this;\n}\n\n// FORMATTING\n\naddFormatToken('Q', 0, 'Qo', 'quarter');\n\n// ALIASES\n\naddUnitAlias('quarter', 'Q');\n\n// PRIORITY\n\naddUnitPriority('quarter', 7);\n\n// PARSING\n\naddRegexToken('Q', match1);\naddParseToken('Q', function (input, array) {\n array[MONTH] = (toInt(input) - 1) * 3;\n});\n\n// MOMENTS\n\nfunction getSetQuarter(input) {\n return input == null\n ? Math.ceil((this.month() + 1) / 3)\n : this.month((input - 1) * 3 + (this.month() % 3));\n}\n\n// FORMATTING\n\naddFormatToken('D', ['DD', 2], 'Do', 'date');\n\n// ALIASES\n\naddUnitAlias('date', 'D');\n\n// PRIORITY\naddUnitPriority('date', 9);\n\n// PARSING\n\naddRegexToken('D', match1to2);\naddRegexToken('DD', match1to2, match2);\naddRegexToken('Do', function (isStrict, locale) {\n // TODO: Remove \"ordinalParse\" fallback in next major release.\n return isStrict\n ? locale._dayOfMonthOrdinalParse || locale._ordinalParse\n : locale._dayOfMonthOrdinalParseLenient;\n});\n\naddParseToken(['D', 'DD'], DATE);\naddParseToken('Do', function (input, array) {\n array[DATE] = toInt(input.match(match1to2)[0]);\n});\n\n// MOMENTS\n\nvar getSetDayOfMonth = makeGetSet('Date', true);\n\n// FORMATTING\n\naddFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');\n\n// ALIASES\n\naddUnitAlias('dayOfYear', 'DDD');\n\n// PRIORITY\naddUnitPriority('dayOfYear', 4);\n\n// PARSING\n\naddRegexToken('DDD', match1to3);\naddRegexToken('DDDD', match3);\naddParseToken(['DDD', 'DDDD'], function (input, array, config) {\n config._dayOfYear = toInt(input);\n});\n\n// HELPERS\n\n// MOMENTS\n\nfunction getSetDayOfYear(input) {\n var dayOfYear =\n Math.round(\n (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5\n ) + 1;\n return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');\n}\n\n// FORMATTING\n\naddFormatToken('m', ['mm', 2], 0, 'minute');\n\n// ALIASES\n\naddUnitAlias('minute', 'm');\n\n// PRIORITY\n\naddUnitPriority('minute', 14);\n\n// PARSING\n\naddRegexToken('m', match1to2);\naddRegexToken('mm', match1to2, match2);\naddParseToken(['m', 'mm'], MINUTE);\n\n// MOMENTS\n\nvar getSetMinute = makeGetSet('Minutes', false);\n\n// FORMATTING\n\naddFormatToken('s', ['ss', 2], 0, 'second');\n\n// ALIASES\n\naddUnitAlias('second', 's');\n\n// PRIORITY\n\naddUnitPriority('second', 15);\n\n// PARSING\n\naddRegexToken('s', match1to2);\naddRegexToken('ss', match1to2, match2);\naddParseToken(['s', 'ss'], SECOND);\n\n// MOMENTS\n\nvar getSetSecond = makeGetSet('Seconds', false);\n\n// FORMATTING\n\naddFormatToken('S', 0, 0, function () {\n return ~~(this.millisecond() / 100);\n});\n\naddFormatToken(0, ['SS', 2], 0, function () {\n return ~~(this.millisecond() / 10);\n});\n\naddFormatToken(0, ['SSS', 3], 0, 'millisecond');\naddFormatToken(0, ['SSSS', 4], 0, function () {\n return this.millisecond() * 10;\n});\naddFormatToken(0, ['SSSSS', 5], 0, function () {\n return this.millisecond() * 100;\n});\naddFormatToken(0, ['SSSSSS', 6], 0, function () {\n return this.millisecond() * 1000;\n});\naddFormatToken(0, ['SSSSSSS', 7], 0, function () {\n return this.millisecond() * 10000;\n});\naddFormatToken(0, ['SSSSSSSS', 8], 0, function () {\n return this.millisecond() * 100000;\n});\naddFormatToken(0, ['SSSSSSSSS', 9], 0, function () {\n return this.millisecond() * 1000000;\n});\n\n// ALIASES\n\naddUnitAlias('millisecond', 'ms');\n\n// PRIORITY\n\naddUnitPriority('millisecond', 16);\n\n// PARSING\n\naddRegexToken('S', match1to3, match1);\naddRegexToken('SS', match1to3, match2);\naddRegexToken('SSS', match1to3, match3);\n\nvar token, getSetMillisecond;\nfor (token = 'SSSS'; token.length <= 9; token += 'S') {\n addRegexToken(token, matchUnsigned);\n}\n\nfunction parseMs(input, array) {\n array[MILLISECOND] = toInt(('0.' + input) * 1000);\n}\n\nfor (token = 'S'; token.length <= 9; token += 'S') {\n addParseToken(token, parseMs);\n}\n\ngetSetMillisecond = makeGetSet('Milliseconds', false);\n\n// FORMATTING\n\naddFormatToken('z', 0, 0, 'zoneAbbr');\naddFormatToken('zz', 0, 0, 'zoneName');\n\n// MOMENTS\n\nfunction getZoneAbbr() {\n return this._isUTC ? 'UTC' : '';\n}\n\nfunction getZoneName() {\n return this._isUTC ? 'Coordinated Universal Time' : '';\n}\n\nvar proto = Moment.prototype;\n\nproto.add = add;\nproto.calendar = calendar$1;\nproto.clone = clone;\nproto.diff = diff;\nproto.endOf = endOf;\nproto.format = format;\nproto.from = from;\nproto.fromNow = fromNow;\nproto.to = to;\nproto.toNow = toNow;\nproto.get = stringGet;\nproto.invalidAt = invalidAt;\nproto.isAfter = isAfter;\nproto.isBefore = isBefore;\nproto.isBetween = isBetween;\nproto.isSame = isSame;\nproto.isSameOrAfter = isSameOrAfter;\nproto.isSameOrBefore = isSameOrBefore;\nproto.isValid = isValid$2;\nproto.lang = lang;\nproto.locale = locale;\nproto.localeData = localeData;\nproto.max = prototypeMax;\nproto.min = prototypeMin;\nproto.parsingFlags = parsingFlags;\nproto.set = stringSet;\nproto.startOf = startOf;\nproto.subtract = subtract;\nproto.toArray = toArray;\nproto.toObject = toObject;\nproto.toDate = toDate;\nproto.toISOString = toISOString;\nproto.inspect = inspect;\nif (typeof Symbol !== 'undefined' && Symbol.for != null) {\n proto[Symbol.for('nodejs.util.inspect.custom')] = function () {\n return 'Moment<' + this.format() + '>';\n };\n}\nproto.toJSON = toJSON;\nproto.toString = toString;\nproto.unix = unix;\nproto.valueOf = valueOf;\nproto.creationData = creationData;\nproto.eraName = getEraName;\nproto.eraNarrow = getEraNarrow;\nproto.eraAbbr = getEraAbbr;\nproto.eraYear = getEraYear;\nproto.year = getSetYear;\nproto.isLeapYear = getIsLeapYear;\nproto.weekYear = getSetWeekYear;\nproto.isoWeekYear = getSetISOWeekYear;\nproto.quarter = proto.quarters = getSetQuarter;\nproto.month = getSetMonth;\nproto.daysInMonth = getDaysInMonth;\nproto.week = proto.weeks = getSetWeek;\nproto.isoWeek = proto.isoWeeks = getSetISOWeek;\nproto.weeksInYear = getWeeksInYear;\nproto.weeksInWeekYear = getWeeksInWeekYear;\nproto.isoWeeksInYear = getISOWeeksInYear;\nproto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;\nproto.date = getSetDayOfMonth;\nproto.day = proto.days = getSetDayOfWeek;\nproto.weekday = getSetLocaleDayOfWeek;\nproto.isoWeekday = getSetISODayOfWeek;\nproto.dayOfYear = getSetDayOfYear;\nproto.hour = proto.hours = getSetHour;\nproto.minute = proto.minutes = getSetMinute;\nproto.second = proto.seconds = getSetSecond;\nproto.millisecond = proto.milliseconds = getSetMillisecond;\nproto.utcOffset = getSetOffset;\nproto.utc = setOffsetToUTC;\nproto.local = setOffsetToLocal;\nproto.parseZone = setOffsetToParsedOffset;\nproto.hasAlignedHourOffset = hasAlignedHourOffset;\nproto.isDST = isDaylightSavingTime;\nproto.isLocal = isLocal;\nproto.isUtcOffset = isUtcOffset;\nproto.isUtc = isUtc;\nproto.isUTC = isUtc;\nproto.zoneAbbr = getZoneAbbr;\nproto.zoneName = getZoneName;\nproto.dates = deprecate(\n 'dates accessor is deprecated. Use date instead.',\n getSetDayOfMonth\n);\nproto.months = deprecate(\n 'months accessor is deprecated. Use month instead',\n getSetMonth\n);\nproto.years = deprecate(\n 'years accessor is deprecated. Use year instead',\n getSetYear\n);\nproto.zone = deprecate(\n 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',\n getSetZone\n);\nproto.isDSTShifted = deprecate(\n 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',\n isDaylightSavingTimeShifted\n);\n\nfunction createUnix(input) {\n return createLocal(input * 1000);\n}\n\nfunction createInZone() {\n return createLocal.apply(null, arguments).parseZone();\n}\n\nfunction preParsePostFormat(string) {\n return string;\n}\n\nvar proto$1 = Locale.prototype;\n\nproto$1.calendar = calendar;\nproto$1.longDateFormat = longDateFormat;\nproto$1.invalidDate = invalidDate;\nproto$1.ordinal = ordinal;\nproto$1.preparse = preParsePostFormat;\nproto$1.postformat = preParsePostFormat;\nproto$1.relativeTime = relativeTime;\nproto$1.pastFuture = pastFuture;\nproto$1.set = set;\nproto$1.eras = localeEras;\nproto$1.erasParse = localeErasParse;\nproto$1.erasConvertYear = localeErasConvertYear;\nproto$1.erasAbbrRegex = erasAbbrRegex;\nproto$1.erasNameRegex = erasNameRegex;\nproto$1.erasNarrowRegex = erasNarrowRegex;\n\nproto$1.months = localeMonths;\nproto$1.monthsShort = localeMonthsShort;\nproto$1.monthsParse = localeMonthsParse;\nproto$1.monthsRegex = monthsRegex;\nproto$1.monthsShortRegex = monthsShortRegex;\nproto$1.week = localeWeek;\nproto$1.firstDayOfYear = localeFirstDayOfYear;\nproto$1.firstDayOfWeek = localeFirstDayOfWeek;\n\nproto$1.weekdays = localeWeekdays;\nproto$1.weekdaysMin = localeWeekdaysMin;\nproto$1.weekdaysShort = localeWeekdaysShort;\nproto$1.weekdaysParse = localeWeekdaysParse;\n\nproto$1.weekdaysRegex = weekdaysRegex;\nproto$1.weekdaysShortRegex = weekdaysShortRegex;\nproto$1.weekdaysMinRegex = weekdaysMinRegex;\n\nproto$1.isPM = localeIsPM;\nproto$1.meridiem = localeMeridiem;\n\nfunction get$1(format, index, field, setter) {\n var locale = getLocale(),\n utc = createUTC().set(setter, index);\n return locale[field](utc, format);\n}\n\nfunction listMonthsImpl(format, index, field) {\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n\n if (index != null) {\n return get$1(format, index, field, 'month');\n }\n\n var i,\n out = [];\n for (i = 0; i < 12; i++) {\n out[i] = get$1(format, i, field, 'month');\n }\n return out;\n}\n\n// ()\n// (5)\n// (fmt, 5)\n// (fmt)\n// (true)\n// (true, 5)\n// (true, fmt, 5)\n// (true, fmt)\nfunction listWeekdaysImpl(localeSorted, format, index, field) {\n if (typeof localeSorted === 'boolean') {\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n } else {\n format = localeSorted;\n index = format;\n localeSorted = false;\n\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n }\n\n var locale = getLocale(),\n shift = localeSorted ? locale._week.dow : 0,\n i,\n out = [];\n\n if (index != null) {\n return get$1(format, (index + shift) % 7, field, 'day');\n }\n\n for (i = 0; i < 7; i++) {\n out[i] = get$1(format, (i + shift) % 7, field, 'day');\n }\n return out;\n}\n\nfunction listMonths(format, index) {\n return listMonthsImpl(format, index, 'months');\n}\n\nfunction listMonthsShort(format, index) {\n return listMonthsImpl(format, index, 'monthsShort');\n}\n\nfunction listWeekdays(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdays');\n}\n\nfunction listWeekdaysShort(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');\n}\n\nfunction listWeekdaysMin(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');\n}\n\ngetSetGlobalLocale('en', {\n eras: [\n {\n since: '0001-01-01',\n until: +Infinity,\n offset: 1,\n name: 'Anno Domini',\n narrow: 'AD',\n abbr: 'AD',\n },\n {\n since: '0000-12-31',\n until: -Infinity,\n offset: 1,\n name: 'Before Christ',\n narrow: 'BC',\n abbr: 'BC',\n },\n ],\n dayOfMonthOrdinalParse: /\\d{1,2}(th|st|nd|rd)/,\n ordinal: function (number) {\n var b = number % 10,\n output =\n toInt((number % 100) / 10) === 1\n ? 'th'\n : b === 1\n ? 'st'\n : b === 2\n ? 'nd'\n : b === 3\n ? 'rd'\n : 'th';\n return number + output;\n },\n});\n\n// Side effect imports\n\nhooks.lang = deprecate(\n 'moment.lang is deprecated. Use moment.locale instead.',\n getSetGlobalLocale\n);\nhooks.langData = deprecate(\n 'moment.langData is deprecated. Use moment.localeData instead.',\n getLocale\n);\n\nvar mathAbs = Math.abs;\n\nfunction abs() {\n var data = this._data;\n\n this._milliseconds = mathAbs(this._milliseconds);\n this._days = mathAbs(this._days);\n this._months = mathAbs(this._months);\n\n data.milliseconds = mathAbs(data.milliseconds);\n data.seconds = mathAbs(data.seconds);\n data.minutes = mathAbs(data.minutes);\n data.hours = mathAbs(data.hours);\n data.months = mathAbs(data.months);\n data.years = mathAbs(data.years);\n\n return this;\n}\n\nfunction addSubtract$1(duration, input, value, direction) {\n var other = createDuration(input, value);\n\n duration._milliseconds += direction * other._milliseconds;\n duration._days += direction * other._days;\n duration._months += direction * other._months;\n\n return duration._bubble();\n}\n\n// supports only 2.0-style add(1, 's') or add(duration)\nfunction add$1(input, value) {\n return addSubtract$1(this, input, value, 1);\n}\n\n// supports only 2.0-style subtract(1, 's') or subtract(duration)\nfunction subtract$1(input, value) {\n return addSubtract$1(this, input, value, -1);\n}\n\nfunction absCeil(number) {\n if (number < 0) {\n return Math.floor(number);\n } else {\n return Math.ceil(number);\n }\n}\n\nfunction bubble() {\n var milliseconds = this._milliseconds,\n days = this._days,\n months = this._months,\n data = this._data,\n seconds,\n minutes,\n hours,\n years,\n monthsFromDays;\n\n // if we have a mix of positive and negative values, bubble down first\n // check: https://github.com/moment/moment/issues/2166\n if (\n !(\n (milliseconds >= 0 && days >= 0 && months >= 0) ||\n (milliseconds <= 0 && days <= 0 && months <= 0)\n )\n ) {\n milliseconds += absCeil(monthsToDays(months) + days) * 864e5;\n days = 0;\n months = 0;\n }\n\n // The following code bubbles up values, see the tests for\n // examples of what that means.\n data.milliseconds = milliseconds % 1000;\n\n seconds = absFloor(milliseconds / 1000);\n data.seconds = seconds % 60;\n\n minutes = absFloor(seconds / 60);\n data.minutes = minutes % 60;\n\n hours = absFloor(minutes / 60);\n data.hours = hours % 24;\n\n days += absFloor(hours / 24);\n\n // convert days to months\n monthsFromDays = absFloor(daysToMonths(days));\n months += monthsFromDays;\n days -= absCeil(monthsToDays(monthsFromDays));\n\n // 12 months -> 1 year\n years = absFloor(months / 12);\n months %= 12;\n\n data.days = days;\n data.months = months;\n data.years = years;\n\n return this;\n}\n\nfunction daysToMonths(days) {\n // 400 years have 146097 days (taking into account leap year rules)\n // 400 years have 12 months === 4800\n return (days * 4800) / 146097;\n}\n\nfunction monthsToDays(months) {\n // the reverse of daysToMonths\n return (months * 146097) / 4800;\n}\n\nfunction as(units) {\n if (!this.isValid()) {\n return NaN;\n }\n var days,\n months,\n milliseconds = this._milliseconds;\n\n units = normalizeUnits(units);\n\n if (units === 'month' || units === 'quarter' || units === 'year') {\n days = this._days + milliseconds / 864e5;\n months = this._months + daysToMonths(days);\n switch (units) {\n case 'month':\n return months;\n case 'quarter':\n return months / 3;\n case 'year':\n return months / 12;\n }\n } else {\n // handle milliseconds separately because of floating point math errors (issue #1867)\n days = this._days + Math.round(monthsToDays(this._months));\n switch (units) {\n case 'week':\n return days / 7 + milliseconds / 6048e5;\n case 'day':\n return days + milliseconds / 864e5;\n case 'hour':\n return days * 24 + milliseconds / 36e5;\n case 'minute':\n return days * 1440 + milliseconds / 6e4;\n case 'second':\n return days * 86400 + milliseconds / 1000;\n // Math.floor prevents floating point math errors here\n case 'millisecond':\n return Math.floor(days * 864e5) + milliseconds;\n default:\n throw new Error('Unknown unit ' + units);\n }\n }\n}\n\n// TODO: Use this.as('ms')?\nfunction valueOf$1() {\n if (!this.isValid()) {\n return NaN;\n }\n return (\n this._milliseconds +\n this._days * 864e5 +\n (this._months % 12) * 2592e6 +\n toInt(this._months / 12) * 31536e6\n );\n}\n\nfunction makeAs(alias) {\n return function () {\n return this.as(alias);\n };\n}\n\nvar asMilliseconds = makeAs('ms'),\n asSeconds = makeAs('s'),\n asMinutes = makeAs('m'),\n asHours = makeAs('h'),\n asDays = makeAs('d'),\n asWeeks = makeAs('w'),\n asMonths = makeAs('M'),\n asQuarters = makeAs('Q'),\n asYears = makeAs('y');\n\nfunction clone$1() {\n return createDuration(this);\n}\n\nfunction get$2(units) {\n units = normalizeUnits(units);\n return this.isValid() ? this[units + 's']() : NaN;\n}\n\nfunction makeGetter(name) {\n return function () {\n return this.isValid() ? this._data[name] : NaN;\n };\n}\n\nvar milliseconds = makeGetter('milliseconds'),\n seconds = makeGetter('seconds'),\n minutes = makeGetter('minutes'),\n hours = makeGetter('hours'),\n days = makeGetter('days'),\n months = makeGetter('months'),\n years = makeGetter('years');\n\nfunction weeks() {\n return absFloor(this.days() / 7);\n}\n\nvar round = Math.round,\n thresholds = {\n ss: 44, // a few seconds to seconds\n s: 45, // seconds to minute\n m: 45, // minutes to hour\n h: 22, // hours to day\n d: 26, // days to month/week\n w: null, // weeks to month\n M: 11, // months to year\n };\n\n// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize\nfunction substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {\n return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);\n}\n\nfunction relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {\n var duration = createDuration(posNegDuration).abs(),\n seconds = round(duration.as('s')),\n minutes = round(duration.as('m')),\n hours = round(duration.as('h')),\n days = round(duration.as('d')),\n months = round(duration.as('M')),\n weeks = round(duration.as('w')),\n years = round(duration.as('y')),\n a =\n (seconds <= thresholds.ss && ['s', seconds]) ||\n (seconds < thresholds.s && ['ss', seconds]) ||\n (minutes <= 1 && ['m']) ||\n (minutes < thresholds.m && ['mm', minutes]) ||\n (hours <= 1 && ['h']) ||\n (hours < thresholds.h && ['hh', hours]) ||\n (days <= 1 && ['d']) ||\n (days < thresholds.d && ['dd', days]);\n\n if (thresholds.w != null) {\n a =\n a ||\n (weeks <= 1 && ['w']) ||\n (weeks < thresholds.w && ['ww', weeks]);\n }\n a = a ||\n (months <= 1 && ['M']) ||\n (months < thresholds.M && ['MM', months]) ||\n (years <= 1 && ['y']) || ['yy', years];\n\n a[2] = withoutSuffix;\n a[3] = +posNegDuration > 0;\n a[4] = locale;\n return substituteTimeAgo.apply(null, a);\n}\n\n// This function allows you to set the rounding function for relative time strings\nfunction getSetRelativeTimeRounding(roundingFunction) {\n if (roundingFunction === undefined) {\n return round;\n }\n if (typeof roundingFunction === 'function') {\n round = roundingFunction;\n return true;\n }\n return false;\n}\n\n// This function allows you to set a threshold for relative time strings\nfunction getSetRelativeTimeThreshold(threshold, limit) {\n if (thresholds[threshold] === undefined) {\n return false;\n }\n if (limit === undefined) {\n return thresholds[threshold];\n }\n thresholds[threshold] = limit;\n if (threshold === 's') {\n thresholds.ss = limit - 1;\n }\n return true;\n}\n\nfunction humanize(argWithSuffix, argThresholds) {\n if (!this.isValid()) {\n return this.localeData().invalidDate();\n }\n\n var withSuffix = false,\n th = thresholds,\n locale,\n output;\n\n if (typeof argWithSuffix === 'object') {\n argThresholds = argWithSuffix;\n argWithSuffix = false;\n }\n if (typeof argWithSuffix === 'boolean') {\n withSuffix = argWithSuffix;\n }\n if (typeof argThresholds === 'object') {\n th = Object.assign({}, thresholds, argThresholds);\n if (argThresholds.s != null && argThresholds.ss == null) {\n th.ss = argThresholds.s - 1;\n }\n }\n\n locale = this.localeData();\n output = relativeTime$1(this, !withSuffix, th, locale);\n\n if (withSuffix) {\n output = locale.pastFuture(+this, output);\n }\n\n return locale.postformat(output);\n}\n\nvar abs$1 = Math.abs;\n\nfunction sign(x) {\n return (x > 0) - (x < 0) || +x;\n}\n\nfunction toISOString$1() {\n // for ISO strings we do not use the normal bubbling rules:\n // * milliseconds bubble up until they become hours\n // * days do not bubble at all\n // * months bubble up until they become years\n // This is because there is no context-free conversion between hours and days\n // (think of clock changes)\n // and also not between days and months (28-31 days per month)\n if (!this.isValid()) {\n return this.localeData().invalidDate();\n }\n\n var seconds = abs$1(this._milliseconds) / 1000,\n days = abs$1(this._days),\n months = abs$1(this._months),\n minutes,\n hours,\n years,\n s,\n total = this.asSeconds(),\n totalSign,\n ymSign,\n daysSign,\n hmsSign;\n\n if (!total) {\n // this is the same as C#'s (Noda) and python (isodate)...\n // but not other JS (goog.date)\n return 'P0D';\n }\n\n // 3600 seconds -> 60 minutes -> 1 hour\n minutes = absFloor(seconds / 60);\n hours = absFloor(minutes / 60);\n seconds %= 60;\n minutes %= 60;\n\n // 12 months -> 1 year\n years = absFloor(months / 12);\n months %= 12;\n\n // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js\n s = seconds ? seconds.toFixed(3).replace(/\\.?0+$/, '') : '';\n\n totalSign = total < 0 ? '-' : '';\n ymSign = sign(this._months) !== sign(total) ? '-' : '';\n daysSign = sign(this._days) !== sign(total) ? '-' : '';\n hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';\n\n return (\n totalSign +\n 'P' +\n (years ? ymSign + years + 'Y' : '') +\n (months ? ymSign + months + 'M' : '') +\n (days ? daysSign + days + 'D' : '') +\n (hours || minutes || seconds ? 'T' : '') +\n (hours ? hmsSign + hours + 'H' : '') +\n (minutes ? hmsSign + minutes + 'M' : '') +\n (seconds ? hmsSign + s + 'S' : '')\n );\n}\n\nvar proto$2 = Duration.prototype;\n\nproto$2.isValid = isValid$1;\nproto$2.abs = abs;\nproto$2.add = add$1;\nproto$2.subtract = subtract$1;\nproto$2.as = as;\nproto$2.asMilliseconds = asMilliseconds;\nproto$2.asSeconds = asSeconds;\nproto$2.asMinutes = asMinutes;\nproto$2.asHours = asHours;\nproto$2.asDays = asDays;\nproto$2.asWeeks = asWeeks;\nproto$2.asMonths = asMonths;\nproto$2.asQuarters = asQuarters;\nproto$2.asYears = asYears;\nproto$2.valueOf = valueOf$1;\nproto$2._bubble = bubble;\nproto$2.clone = clone$1;\nproto$2.get = get$2;\nproto$2.milliseconds = milliseconds;\nproto$2.seconds = seconds;\nproto$2.minutes = minutes;\nproto$2.hours = hours;\nproto$2.days = days;\nproto$2.weeks = weeks;\nproto$2.months = months;\nproto$2.years = years;\nproto$2.humanize = humanize;\nproto$2.toISOString = toISOString$1;\nproto$2.toString = toISOString$1;\nproto$2.toJSON = toISOString$1;\nproto$2.locale = locale;\nproto$2.localeData = localeData;\n\nproto$2.toIsoString = deprecate(\n 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',\n toISOString$1\n);\nproto$2.lang = lang;\n\n// FORMATTING\n\naddFormatToken('X', 0, 0, 'unix');\naddFormatToken('x', 0, 0, 'valueOf');\n\n// PARSING\n\naddRegexToken('x', matchSigned);\naddRegexToken('X', matchTimestamp);\naddParseToken('X', function (input, array, config) {\n config._d = new Date(parseFloat(input) * 1000);\n});\naddParseToken('x', function (input, array, config) {\n config._d = new Date(toInt(input));\n});\n\n//! moment.js\n\nhooks.version = '2.29.1';\n\nsetHookCallback(createLocal);\n\nhooks.fn = proto;\nhooks.min = min;\nhooks.max = max;\nhooks.now = now;\nhooks.utc = createUTC;\nhooks.unix = createUnix;\nhooks.months = listMonths;\nhooks.isDate = isDate;\nhooks.locale = getSetGlobalLocale;\nhooks.invalid = createInvalid;\nhooks.duration = createDuration;\nhooks.isMoment = isMoment;\nhooks.weekdays = listWeekdays;\nhooks.parseZone = createInZone;\nhooks.localeData = getLocale;\nhooks.isDuration = isDuration;\nhooks.monthsShort = listMonthsShort;\nhooks.weekdaysMin = listWeekdaysMin;\nhooks.defineLocale = defineLocale;\nhooks.updateLocale = updateLocale;\nhooks.locales = listLocales;\nhooks.weekdaysShort = listWeekdaysShort;\nhooks.normalizeUnits = normalizeUnits;\nhooks.relativeTimeRounding = getSetRelativeTimeRounding;\nhooks.relativeTimeThreshold = getSetRelativeTimeThreshold;\nhooks.calendarFormat = getCalendarFormat;\nhooks.prototype = proto;\n\n// currently HTML5 input type only supports 24-hour formats\nhooks.HTML5_FMT = {\n DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // \n DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // \n DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // \n DATE: 'YYYY-MM-DD', // \n TIME: 'HH:mm', // \n TIME_SECONDS: 'HH:mm:ss', // \n TIME_MS: 'HH:mm:ss.SSS', // \n WEEK: 'GGGG-[W]WW', // \n MONTH: 'YYYY-MM', // \n};\n\nexport default hooks;\n", "import React, {useState} from \"../../_snowpack/pkg/react.js\";\nimport {useTranslation} from \"../../_snowpack/pkg/react-i18next.js\";\nimport {Controller, useForm} from \"../../_snowpack/pkg/react-hook-form.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n FormGroup,\n NumberInput,\n PageSection\n} from \"../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {FormAccess} from \"../../components/form-access/FormAccess.js\";\nimport {ViewHeader} from \"../../components/view-header/ViewHeader.js\";\nimport {HelpItem} from \"../../components/help-enabler/HelpItem.js\";\nimport {TimeSelector} from \"../../components/time-selector/TimeSelector.js\";\nimport {Link, useHistory} from \"../../_snowpack/pkg/react-router-dom.js\";\nimport {useRealm} from \"../../context/realm-context/RealmContext.js\";\nimport {useAdminClient} from \"../../context/auth/AdminClient.js\";\nimport {useAlerts} from \"../../components/alert/Alerts.js\";\nimport {AccessTokenDialog} from \"./AccessTokenDialog.js\";\nimport {toClients} from \"../routes/Clients.js\";\nexport default function CreateInitialAccessToken() {\n const {t} = useTranslation(\"clients\");\n const {handleSubmit, control} = useForm();\n const adminClient = useAdminClient();\n const {realm} = useRealm();\n const {addAlert, addError} = useAlerts();\n const history = useHistory();\n const [token, setToken] = useState(\"\");\n const save = async (clientToken) => {\n try {\n const access = await adminClient.realms.createClientsInitialAccess({realm}, clientToken);\n setToken(access.token);\n } catch (error) {\n addError(\"clients:tokenSaveError\", error);\n }\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, token && /* @__PURE__ */ React.createElement(AccessTokenDialog, {\n token,\n toggleDialog: () => {\n setToken(\"\");\n addAlert(t(\"tokenSaveSuccess\"), AlertVariant.success);\n history.push(toClients({realm, tab: \"initialAccessToken\"}));\n }\n }), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"clients:createToken\",\n subKey: \"clients-help:createToken\"\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n role: \"create-client\",\n onSubmit: handleSubmit(save)\n }, /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"expiration\"),\n fieldId: \"expiration\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"clients-help:expiration\",\n fieldLabelId: \"clients:expiration\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"expiration\",\n defaultValue: 86400,\n control,\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(TimeSelector, {\n \"data-testid\": \"expiration\",\n value,\n onChange,\n units: [\"days\", \"hours\", \"minutes\", \"seconds\"]\n })\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"count\"),\n fieldId: \"count\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"clients-help:count\",\n fieldLabelId: \"clients:count\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"count\",\n defaultValue: 1,\n control,\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(NumberInput, {\n \"data-testid\": \"count\",\n inputName: \"count\",\n inputAriaLabel: t(\"count\"),\n min: 1,\n value,\n onPlus: () => onChange(value + 1),\n onMinus: () => onChange(value - 1),\n onChange: (event) => onChange(Number(event.target.value))\n })\n })), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n variant: \"primary\",\n type: \"submit\",\n \"data-testid\": \"save\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n \"data-testid\": \"cancel\",\n variant: \"link\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toClients({realm, tab: \"initialAccessToken\"})\n })\n }, t(\"common:cancel\"))))));\n}\n", "import {\n ActionGroup,\n AlertVariant,\n Button,\n FormGroup,\n PageSection,\n TextInput\n} from \"../../_snowpack/pkg/@patternfly/react-core.js\";\nimport React, {useState} from \"../../_snowpack/pkg/react.js\";\nimport {FormProvider, useForm} from \"../../_snowpack/pkg/react-hook-form.js\";\nimport {useTranslation} from \"../../_snowpack/pkg/react-i18next.js\";\nimport {Link, useHistory} from \"../../_snowpack/pkg/react-router-dom.js\";\nimport {useAlerts} from \"../../components/alert/Alerts.js\";\nimport {FormAccess} from \"../../components/form-access/FormAccess.js\";\nimport {JsonFileUpload} from \"../../components/json-file-upload/JsonFileUpload.js\";\nimport {ViewHeader} from \"../../components/view-header/ViewHeader.js\";\nimport {useAdminClient} from \"../../context/auth/AdminClient.js\";\nimport {useRealm} from \"../../context/realm-context/RealmContext.js\";\nimport {convertFormValuesToObject, convertToFormValues} from \"../../util.js\";\nimport {CapabilityConfig} from \"../add/CapabilityConfig.js\";\nimport {ClientDescription} from \"../ClientDescription.js\";\nimport {toClient} from \"../routes/Client.js\";\nimport {toClients} from \"../routes/Clients.js\";\nexport default function ImportForm() {\n const {t} = useTranslation(\"clients\");\n const history = useHistory();\n const adminClient = useAdminClient();\n const {realm} = useRealm();\n const form = useForm();\n const {register, handleSubmit, setValue} = form;\n const [imported, setImported] = useState({});\n const {addAlert, addError} = useAlerts();\n const handleFileChange = (obj) => {\n const defaultClient = {\n protocol: \"\",\n clientId: \"\",\n name: \"\",\n description: \"\"\n };\n convertToFormValues(obj || defaultClient, setValue);\n setImported(obj || defaultClient);\n };\n const save = async (client) => {\n try {\n const newClient = await adminClient.clients.create({\n ...imported,\n ...convertFormValuesToObject(client)\n });\n addAlert(t(\"clientImportSuccess\"), AlertVariant.success);\n history.push(toClient({realm, clientId: newClient.id, tab: \"settings\"}));\n } catch (error) {\n addError(\"clients:clientImportError\", error);\n }\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"clients:importClient\",\n subKey: \"clients:clientsExplain\"\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n onSubmit: handleSubmit(save),\n role: \"manage-clients\"\n }, /* @__PURE__ */ React.createElement(FormProvider, {\n ...form\n }, /* @__PURE__ */ React.createElement(JsonFileUpload, {\n id: \"realm-file\",\n onChange: handleFileChange\n }), /* @__PURE__ */ React.createElement(ClientDescription, null), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:type\"),\n fieldId: \"kc-type\"\n }, /* @__PURE__ */ React.createElement(TextInput, {\n type: \"text\",\n id: \"kc-type\",\n name: \"protocol\",\n isReadOnly: true,\n ref: register()\n })), /* @__PURE__ */ React.createElement(CapabilityConfig, {\n unWrap: true\n }), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n variant: \"primary\",\n type: \"submit\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toClients({realm})\n })\n }, t(\"common:cancel\")))))));\n}\n", "import {\n AlertVariant,\n Badge,\n Button,\n ButtonVariant,\n PageSection,\n Tab,\n TabTitleText,\n ToolbarItem\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {cellWidth, TableText} from \"../_snowpack/pkg/@patternfly/react-table.js\";\nimport React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {Link} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {formattedLinkTableCell} from \"../components/external-link/FormattedLink.js\";\nimport {KeycloakTabs} from \"../components/keycloak-tabs/KeycloakTabs.js\";\nimport {\n KeycloakDataTable\n} from \"../components/table-toolbar/KeycloakDataTable.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useAdminClient} from \"../context/auth/AdminClient.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {emptyFormatter, exportClient, getBaseUrl} from \"../util.js\";\nimport {InitialAccessTokenList} from \"./initial-access/InitialAccessTokenList.js\";\nimport {toAddClient} from \"./routes/AddClient.js\";\nimport {toClient} from \"./routes/Client.js\";\nimport {toImportClient} from \"./routes/ImportClient.js\";\nimport {isRealmClient, getProtocolName} from \"./utils.js\";\nexport default function ClientsSection() {\n const {t} = useTranslation(\"clients\");\n const {addAlert, addError} = useAlerts();\n const adminClient = useAdminClient();\n const {realm} = useRealm();\n const baseUrl = getBaseUrl(adminClient);\n const [key, setKey] = useState(0);\n const refresh = () => setKey(new Date().getTime());\n const [selectedClient, setSelectedClient] = useState();\n const loader = async (first, max, search) => {\n const params = {\n first,\n max\n };\n if (search) {\n params.clientId = search;\n params.search = true;\n }\n return await adminClient.clients.find({...params});\n };\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: t(\"clientDelete\", {clientId: selectedClient?.clientId}),\n messageKey: \"clients:clientDeleteConfirm\",\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.clients.del({\n id: selectedClient.id\n });\n addAlert(t(\"clientDeletedSuccess\"), AlertVariant.success);\n refresh();\n } catch (error) {\n addError(\"clients:clientDeleteError\", error);\n }\n }\n });\n const ClientDetailLink = (client) => /* @__PURE__ */ React.createElement(Link, {\n key: client.id,\n to: toClient({realm, clientId: client.id, tab: \"settings\"})\n }, client.clientId, !client.enabled && /* @__PURE__ */ React.createElement(Badge, {\n key: `${client.id}-disabled`,\n isRead: true,\n className: \"pf-u-ml-sm\"\n }, t(\"common:disabled\")));\n const ClientDescription = (client) => /* @__PURE__ */ React.createElement(TableText, {\n wrapModifier: \"truncate\"\n }, emptyFormatter()(client.description));\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"clients:clientList\",\n subKey: \"clients:clientsExplain\",\n divider: false\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n className: \"pf-u-p-0\"\n }, /* @__PURE__ */ React.createElement(KeycloakTabs, {\n isBox: true\n }, /* @__PURE__ */ React.createElement(Tab, {\n \"data-testid\": \"list\",\n eventKey: \"list\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"clientsList\"))\n }, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(KeycloakDataTable, {\n key,\n loader,\n isPaginated: true,\n ariaLabelKey: \"clients:clientList\",\n searchPlaceholderKey: \"clients:searchForClient\",\n toolbarItem: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(Button, {\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toAddClient({realm})\n })\n }, t(\"createClient\"))), /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(Button, {\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toImportClient({realm})\n }),\n variant: \"link\"\n }, t(\"importClient\")))),\n actionResolver: (rowData) => {\n const client = rowData.data;\n const actions = [\n {\n title: t(\"common:export\"),\n onClick() {\n exportClient(client);\n }\n }\n ];\n if (!isRealmClient(client)) {\n actions.push({\n title: t(\"common:delete\"),\n onClick() {\n setSelectedClient(client);\n toggleDeleteDialog();\n }\n });\n }\n return actions;\n },\n columns: [\n {\n name: \"clientId\",\n displayKey: \"common:clientId\",\n cellRenderer: ClientDetailLink\n },\n {\n name: \"protocol\",\n displayKey: \"common:type\",\n cellRenderer: (client) => getProtocolName(t, client.protocol ?? \"openid-connect\")\n },\n {\n name: \"description\",\n displayKey: \"common:description\",\n transforms: [cellWidth(20)],\n cellRenderer: ClientDescription\n },\n {\n name: \"baseUrl\",\n displayKey: \"clients:homeURL\",\n cellFormatters: [formattedLinkTableCell(), emptyFormatter()],\n cellRenderer: (client) => {\n if (client.rootUrl) {\n if (!client.rootUrl.startsWith(\"http\") || client.rootUrl.includes(\"$\")) {\n client.rootUrl = client.rootUrl.replace(\"${authBaseUrl}\", baseUrl).replace(\"${authAdminUrl}\", baseUrl) + (client.baseUrl ? client.baseUrl.substr(1) : \"\");\n }\n }\n return client.rootUrl;\n }\n }\n ]\n })), /* @__PURE__ */ React.createElement(Tab, {\n \"data-testid\": \"initialAccessToken\",\n eventKey: \"initialAccessToken\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"initialAccessToken\"))\n }, /* @__PURE__ */ React.createElement(InitialAccessTokenList, null)))));\n}\n", "import React, {useState} from \"../../_snowpack/pkg/react.js\";\nimport {Link, useHistory, useParams} from \"../../_snowpack/pkg/react-router-dom.js\";\nimport {Controller, FormProvider, useForm} from \"../../_snowpack/pkg/react-hook-form.js\";\nimport {useTranslation} from \"../../_snowpack/pkg/react-i18next.js\";\nimport {\n ActionGroup,\n Alert,\n AlertVariant,\n Button,\n ButtonVariant,\n DropdownItem,\n FormGroup,\n PageSection,\n Switch,\n TextInput,\n ValidatedOptions\n} from \"../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {toResourceDetails} from \"../routes/Resource.js\";\nimport {KeycloakSpinner} from \"../../components/keycloak-spinner/KeycloakSpinner.js\";\nimport {useAdminClient, useFetch} from \"../../context/auth/AdminClient.js\";\nimport {HelpItem} from \"../../components/help-enabler/HelpItem.js\";\nimport {ViewHeader} from \"../../components/view-header/ViewHeader.js\";\nimport {useConfirmDialog} from \"../../components/confirm-dialog/ConfirmDialog.js\";\nimport {useAlerts} from \"../../components/alert/Alerts.js\";\nimport {FormAccess} from \"../../components/form-access/FormAccess.js\";\nimport {convertFormValuesToObject, convertToFormValues} from \"../../util.js\";\nimport {MultiLineInput} from \"../../components/multi-line-input/MultiLineInput.js\";\nimport {toClient} from \"../routes/Client.js\";\nimport {ScopePicker} from \"./ScopePicker.js\";\nimport {AttributeInput} from \"../../components/attribute-input/AttributeInput.js\";\nimport \"./resource-details.css\";\nexport default function ResourceDetails() {\n const {t} = useTranslation(\"clients\");\n const [client, setClient] = useState();\n const [resource, setResource] = useState();\n const [permissions, setPermission] = useState();\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const form = useForm({\n shouldUnregister: false,\n mode: \"onChange\"\n });\n const {register, errors, control, setValue, handleSubmit} = form;\n const {id, resourceId, realm} = useParams();\n const history = useHistory();\n const setupForm = (resource2 = {}) => {\n convertToFormValues(resource2, setValue, [\"uris\"]);\n };\n useFetch(async () => {\n const [client2, resource2, permissions2] = await Promise.all([\n adminClient.clients.findOne({id}),\n resourceId ? adminClient.clients.getResource({id, resourceId}) : Promise.resolve(void 0),\n resourceId ? adminClient.clients.listPermissionsByResource({id, resourceId}) : Promise.resolve(void 0)\n ]);\n return {client: client2, resource: resource2, permissions: permissions2};\n }, ({client: client2, resource: resource2, permissions: permissions2}) => {\n if (!client2) {\n throw new Error(t(\"common:notFound\"));\n }\n setClient(client2);\n setPermission(permissions2);\n setResource(resource2);\n setupForm(resource2);\n }, []);\n const save = async (submitted) => {\n const resource2 = convertFormValuesToObject(submitted, [\"uris\"]);\n try {\n if (resourceId) {\n await adminClient.clients.updateResource({id, resourceId}, resource2);\n } else {\n const result = await adminClient.clients.createResource({id}, resource2);\n history.push(toResourceDetails({realm, id, resourceId: result._id}));\n }\n addAlert(t((resourceId ? \"update\" : \"create\") + \"ResourceSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"clients:resourceSaveError\", error);\n }\n };\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"clients:deleteResource\",\n children: /* @__PURE__ */ React.createElement(React.Fragment, null, t(\"deleteResourceConfirm\"), permissions?.length !== 0 && /* @__PURE__ */ React.createElement(Alert, {\n variant: \"warning\",\n isInline: true,\n isPlain: true,\n title: t(\"deleteResourceWarning\"),\n className: \"pf-u-pt-lg\"\n }, /* @__PURE__ */ React.createElement(\"p\", {\n className: \"pf-u-pt-xs\"\n }, permissions?.map((permission) => /* @__PURE__ */ React.createElement(\"strong\", {\n key: permission.id,\n className: \"pf-u-pr-md\"\n }, permission.name))))),\n continueButtonLabel: \"clients:confirm\",\n onConfirm: async () => {\n try {\n await adminClient.clients.delResource({\n id,\n resourceId\n });\n addAlert(t(\"resourceDeletedSuccess\"), AlertVariant.success);\n history.push(toClient({realm, clientId: id, tab: \"authorization\"}));\n } catch (error) {\n addError(\"clients:resourceDeletedError\", error);\n }\n }\n });\n if (!client) {\n return /* @__PURE__ */ React.createElement(KeycloakSpinner, null);\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: resourceId ? resource?.name : \"clients:createResource\",\n dropdownItems: resourceId ? [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"delete\",\n \"data-testid\": \"delete-resource\",\n onClick: () => toggleDeleteDialog()\n }, t(\"common:delete\"))\n ] : void 0\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormProvider, {\n ...form\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n role: \"manage-clients\",\n className: \"keycloak__resource-details__form\",\n onSubmit: handleSubmit(save)\n }, /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"owner\"),\n fieldId: \"owner\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"clients-help:owner\",\n fieldLabelId: \"clients:owner\"\n })\n }, /* @__PURE__ */ React.createElement(TextInput, {\n id: \"owner\",\n value: client.clientId,\n isReadOnly: true\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:name\"),\n fieldId: \"name\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"clients-help:resourceName\",\n fieldLabelId: \"name\"\n }),\n helperTextInvalid: t(\"common:required\"),\n validated: errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n isRequired: true\n }, /* @__PURE__ */ React.createElement(TextInput, {\n id: \"name\",\n name: \"name\",\n ref: register({required: true}),\n validated: errors.name ? ValidatedOptions.error : ValidatedOptions.default\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"displayName\"),\n fieldId: \"displayName\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"clients-help:displayName\",\n fieldLabelId: \"name\"\n })\n }, /* @__PURE__ */ React.createElement(TextInput, {\n id: \"displayName\",\n name: \"name\",\n ref: register\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"type\"),\n fieldId: \"type\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"clients-help:type\",\n fieldLabelId: \"type\"\n })\n }, /* @__PURE__ */ React.createElement(TextInput, {\n id: \"type\",\n name: \"type\",\n ref: register\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"uris\"),\n fieldId: \"uris\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"clients-help:uris\",\n fieldLabelId: \"clients:uris\"\n })\n }, /* @__PURE__ */ React.createElement(MultiLineInput, {\n name: \"uris\",\n \"aria-label\": t(\"uri\"),\n addButtonLabel: \"clients:addUri\"\n })), /* @__PURE__ */ React.createElement(ScopePicker, {\n clientId: id\n }), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"iconUri\"),\n fieldId: \"iconUri\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"clients-help:iconUri\",\n fieldLabelId: \"clients:iconUri\"\n })\n }, /* @__PURE__ */ React.createElement(TextInput, {\n id: \"iconUri\",\n name: \"icon_uri\",\n ref: register\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n hasNoPaddingTop: true,\n label: t(\"ownerManagedAccess\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"clients-help:ownerManagedAccess\",\n fieldLabelId: \"clients:ownerManagedAccess\"\n }),\n fieldId: \"ownerManagedAccess\"\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"ownerManagedAccess\",\n control,\n defaultValue: false,\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Switch, {\n id: \"ownerManagedAccess\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value,\n onChange\n })\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n hasNoPaddingTop: true,\n label: t(\"resourceAttribute\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"clients-help:resourceAttribute\",\n fieldLabelId: \"clients:resourceAttribute\"\n }),\n fieldId: \"resourceAttribute\"\n }, /* @__PURE__ */ React.createElement(AttributeInput, {\n name: \"attributes\"\n })), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(\"div\", {\n className: \"pf-u-mt-md\"\n }, /* @__PURE__ */ React.createElement(Button, {\n variant: ButtonVariant.primary,\n type: \"submit\",\n \"data-testid\": \"save\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n \"data-testid\": \"cancel\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toClient({\n realm,\n clientId: id,\n tab: \"authorization\"\n })\n })\n }, t(\"common:cancel\"))))))));\n}\n", "import {\n Alert,\n AlertVariant,\n ButtonVariant,\n Divider,\n DropdownItem,\n Label,\n PageSection,\n Tab,\n Tabs,\n TabTitleText,\n Tooltip\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {InfoCircleIcon} from \"../_snowpack/pkg/@patternfly/react-icons.js\";\nimport _, {cloneDeep} from \"../_snowpack/pkg/lodash.js\";\nimport React, {useMemo, useState} from \"../_snowpack/pkg/react.js\";\nimport {Controller, FormProvider, useForm, useWatch} from \"../_snowpack/pkg/react-hook-form.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {useHistory, useParams} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {\n ConfirmDialogModal,\n useConfirmDialog\n} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {DownloadDialog} from \"../components/download-dialog/DownloadDialog.js\";\nimport {KeycloakTabs} from \"../components/keycloak-tabs/KeycloakTabs.js\";\nimport {\n ViewHeader\n} from \"../components/view-header/ViewHeader.js\";\nimport {KeycloakSpinner} from \"../components/keycloak-spinner/KeycloakSpinner.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {RolesList} from \"../realm-roles/RolesList.js\";\nimport {\n convertFormValuesToObject,\n convertToFormValues,\n exportClient\n} from \"../util.js\";\nimport useToggle from \"../utils/useToggle.js\";\nimport {AdvancedTab} from \"./AdvancedTab.js\";\nimport {ClientSettings} from \"./ClientSettings.js\";\nimport {Credentials} from \"./credentials/Credentials.js\";\nimport {Keys} from \"./keys/Keys.js\";\nimport {toClients} from \"./routes/Clients.js\";\nimport {ClientScopes} from \"./scopes/ClientScopes.js\";\nimport {EvaluateScopes} from \"./scopes/EvaluateScopes.js\";\nimport {ServiceAccount} from \"./service-account/ServiceAccount.js\";\nimport {isRealmClient, getProtocolName} from \"./utils.js\";\nimport {SamlKeys} from \"./keys/SamlKeys.js\";\nimport {MapperList} from \"../client-scopes/details/MapperList.js\";\nimport {toMapper} from \"./routes/Mapper.js\";\nimport {AuthorizationSettings} from \"./authorization/Settings.js\";\nimport {AuthorizationResources} from \"./authorization/Resources.js\";\nconst ClientDetailHeader = ({\n onChange,\n value,\n save,\n client,\n toggleDownloadDialog,\n toggleDeleteDialog\n}) => {\n const {t} = useTranslation(\"clients\");\n const [toggleDisableDialog, DisableConfirm] = useConfirmDialog({\n titleKey: \"clients:disableConfirmTitle\",\n messageKey: \"clients:disableConfirm\",\n continueButtonLabel: \"common:disable\",\n onConfirm: () => {\n onChange(!value);\n save();\n }\n });\n const badges = useMemo(() => {\n const protocolName = getProtocolName(t, client.protocol ?? \"openid-connect\");\n const text = client.bearerOnly ? /* @__PURE__ */ React.createElement(Tooltip, {\n \"data-testid\": \"bearer-only-explainer-tooltip\",\n content: t(\"explainBearerOnly\")\n }, /* @__PURE__ */ React.createElement(Label, {\n \"data-testid\": \"bearer-only-explainer-label\",\n icon: /* @__PURE__ */ React.createElement(InfoCircleIcon, null)\n }, protocolName)) : /* @__PURE__ */ React.createElement(Label, null, protocolName);\n return [{text}];\n }, [client, t]);\n const dropdownItems = [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"download\",\n onClick: toggleDownloadDialog\n }, t(\"downloadAdapterConfig\")),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"export\",\n onClick: () => exportClient(client)\n }, t(\"common:export\")),\n ...!isRealmClient(client) ? [\n /* @__PURE__ */ React.createElement(Divider, {\n key: \"divider\"\n }),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n \"data-testid\": \"delete-client\",\n key: \"delete\",\n onClick: toggleDeleteDialog\n }, t(\"common:delete\"))\n ] : []\n ];\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DisableConfirm, null), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: client ? client.clientId : \"\",\n subKey: \"clients:clientsExplain\",\n badges,\n divider: false,\n helpTextKey: \"clients-help:enableDisable\",\n dropdownItems,\n isEnabled: value,\n onToggle: (value2) => {\n if (!value2) {\n toggleDisableDialog();\n } else {\n onChange(value2);\n save();\n }\n }\n }));\n};\nexport default function ClientDetails() {\n const {t} = useTranslation(\"clients\");\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const {realm} = useRealm();\n const history = useHistory();\n const [downloadDialogOpen, toggleDownloadDialogOpen] = useToggle();\n const [changeAuthenticatorOpen, toggleChangeAuthenticatorOpen] = useToggle();\n const [clientScopeSubTab, setClientScopeSubTab] = useState(30);\n const [authorizationSubTab, setAuthorizationSubTab] = useState(40);\n const form = useForm({shouldUnregister: false});\n const {clientId} = useParams();\n const clientAuthenticatorType = useWatch({\n control: form.control,\n name: \"clientAuthenticatorType\",\n defaultValue: \"client-secret\"\n });\n const [client, setClient] = useState();\n const loader = async () => {\n const roles = await adminClient.clients.listRoles({id: clientId});\n return _.sortBy(roles, (role) => role.name?.toUpperCase());\n };\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"clients:clientDeleteConfirmTitle\",\n messageKey: \"clients:clientDeleteConfirm\",\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.clients.del({id: clientId});\n addAlert(t(\"clientDeletedSuccess\"), AlertVariant.success);\n history.push(toClients({realm}));\n } catch (error) {\n addError(\"clients:clientDeleteError\", error);\n }\n }\n });\n const setupForm = (client2) => {\n convertToFormValues(client2, form.setValue, [\"redirectUris\", \"webOrigins\"]);\n };\n useFetch(() => adminClient.clients.findOne({id: clientId}), (fetchedClient) => {\n if (!fetchedClient) {\n throw new Error(t(\"common:notFound\"));\n }\n setClient(cloneDeep(fetchedClient));\n setupForm(fetchedClient);\n }, [clientId]);\n const save = async ({confirmed = false, messageKey = \"clientSaveSuccess\"} = {\n confirmed: false,\n messageKey: \"clientSaveSuccess\"\n }) => {\n if (await form.trigger()) {\n if (!client?.publicClient && client?.clientAuthenticatorType !== clientAuthenticatorType && !confirmed) {\n toggleChangeAuthenticatorOpen();\n return;\n }\n const submittedClient = convertFormValuesToObject(form.getValues(), [\n \"redirectUris\",\n \"webOrigins\"\n ]);\n try {\n const newClient = {\n ...client,\n ...submittedClient\n };\n newClient.clientId = newClient.clientId?.trim();\n await adminClient.clients.update({id: clientId}, newClient);\n setupForm(newClient);\n setClient(newClient);\n addAlert(t(messageKey), AlertVariant.success);\n } catch (error) {\n addError(\"clients:clientSaveError\", error);\n }\n }\n };\n const addMappers = async (mappers) => {\n if (!Array.isArray(mappers)) {\n const mapper = mappers;\n history.push(toMapper({\n realm,\n id: client.id,\n mapperId: mapper.id\n }));\n } else {\n try {\n await adminClient.clients.addMultipleProtocolMappers({id: client.id}, mappers);\n setClient(await adminClient.clients.findOne({id: client.id}));\n addAlert(t(\"common:mappingCreatedSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"common:mappingCreatedError\", error);\n }\n }\n };\n const onDeleteMapper = async (mapper) => {\n try {\n await adminClient.clients.delProtocolMapper({\n id: client.id,\n mapperId: mapper.id\n });\n setClient({\n ...client,\n protocolMappers: client?.protocolMappers?.filter((m) => m.id !== mapper.id)\n });\n addAlert(t(\"common:mappingDeletedSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"common:mappingDeletedError\", error);\n }\n return true;\n };\n if (!client) {\n return /* @__PURE__ */ React.createElement(KeycloakSpinner, null);\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ConfirmDialogModal, {\n continueButtonLabel: \"common:yes\",\n titleKey: t(\"changeAuthenticatorConfirmTitle\", {\n clientAuthenticatorType\n }),\n open: changeAuthenticatorOpen,\n toggleDialog: toggleChangeAuthenticatorOpen,\n onConfirm: () => save({confirmed: true})\n }, /* @__PURE__ */ React.createElement(React.Fragment, null, t(\"changeAuthenticatorConfirm\", {\n clientAuthenticatorType\n }), clientAuthenticatorType === \"client-jwt\" && /* @__PURE__ */ React.createElement(Alert, {\n variant: \"info\",\n isInline: true,\n title: t(\"signedJWTConfirm\")\n }))), /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(DownloadDialog, {\n id: client.id,\n protocol: client.protocol,\n open: downloadDialogOpen,\n toggleDialog: toggleDownloadDialogOpen\n }), /* @__PURE__ */ React.createElement(Controller, {\n name: \"enabled\",\n control: form.control,\n defaultValue: true,\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(ClientDetailHeader, {\n value,\n onChange,\n client,\n save,\n toggleDeleteDialog,\n toggleDownloadDialog: toggleDownloadDialogOpen\n })\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n className: \"pf-u-p-0\"\n }, /* @__PURE__ */ React.createElement(FormProvider, {\n ...form\n }, /* @__PURE__ */ React.createElement(KeycloakTabs, {\n \"data-testid\": \"client-tabs\",\n isBox: true,\n mountOnEnter: true\n }, /* @__PURE__ */ React.createElement(Tab, {\n id: \"settings\",\n eventKey: \"settings\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:settings\"))\n }, /* @__PURE__ */ React.createElement(ClientSettings, {\n client,\n save: () => save(),\n reset: () => setupForm(client)\n })), (!client.publicClient && !isRealmClient(client) || client.protocol === \"saml\") && /* @__PURE__ */ React.createElement(Tab, {\n id: \"keys\",\n eventKey: \"keys\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"keys\"))\n }, client.protocol === \"openid-connect\" && /* @__PURE__ */ React.createElement(Keys, {\n clientId,\n save\n }), client.protocol === \"saml\" && /* @__PURE__ */ React.createElement(SamlKeys, {\n clientId,\n save\n })), !client.publicClient && !isRealmClient(client) && /* @__PURE__ */ React.createElement(Tab, {\n id: \"credentials\",\n eventKey: \"credentials\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"credentials\"))\n }, /* @__PURE__ */ React.createElement(Credentials, {\n clientId,\n save: () => save()\n })), !isRealmClient(client) && /* @__PURE__ */ React.createElement(Tab, {\n id: \"mappers\",\n eventKey: \"mappers\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"mappers\"))\n }, /* @__PURE__ */ React.createElement(MapperList, {\n model: client,\n onAdd: addMappers,\n onDelete: onDeleteMapper,\n detailLink: (mapperId) => toMapper({realm, id: client.id, mapperId})\n })), /* @__PURE__ */ React.createElement(Tab, {\n id: \"roles\",\n eventKey: \"roles\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"roles\"))\n }, /* @__PURE__ */ React.createElement(RolesList, {\n loader,\n paginated: false,\n messageBundle: \"clients\"\n })), !isRealmClient(client) && /* @__PURE__ */ React.createElement(Tab, {\n id: \"clientScopes\",\n eventKey: \"clientScopes\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"clientScopes\"))\n }, /* @__PURE__ */ React.createElement(Tabs, {\n activeKey: clientScopeSubTab,\n onSelect: (_2, key) => setClientScopeSubTab(key)\n }, /* @__PURE__ */ React.createElement(Tab, {\n id: \"setup\",\n eventKey: 30,\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"setup\"))\n }, /* @__PURE__ */ React.createElement(ClientScopes, {\n clientName: client.clientId,\n clientId,\n protocol: client.protocol\n })), /* @__PURE__ */ React.createElement(Tab, {\n id: \"evaluate\",\n eventKey: 31,\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"evaluate\"))\n }, /* @__PURE__ */ React.createElement(EvaluateScopes, {\n clientId,\n protocol: client.protocol\n })))), client.serviceAccountsEnabled && /* @__PURE__ */ React.createElement(Tab, {\n id: \"authorization\",\n eventKey: \"authorization\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"authorization\"))\n }, /* @__PURE__ */ React.createElement(Tabs, {\n activeKey: authorizationSubTab,\n onSelect: (_2, key) => setAuthorizationSubTab(key),\n mountOnEnter: true,\n unmountOnExit: true\n }, /* @__PURE__ */ React.createElement(Tab, {\n id: \"settings\",\n eventKey: 40,\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"settings\"))\n }, /* @__PURE__ */ React.createElement(AuthorizationSettings, {\n clientId\n })), /* @__PURE__ */ React.createElement(Tab, {\n id: \"resources\",\n eventKey: 41,\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"resources\"))\n }, /* @__PURE__ */ React.createElement(AuthorizationResources, {\n clientId\n })))), client.serviceAccountsEnabled && /* @__PURE__ */ React.createElement(Tab, {\n id: \"serviceAccount\",\n eventKey: \"serviceAccount\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"serviceAccount\"))\n }, /* @__PURE__ */ React.createElement(ServiceAccount, {\n client\n })), /* @__PURE__ */ React.createElement(Tab, {\n id: \"advanced\",\n eventKey: \"advanced\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"advanced\"))\n }, /* @__PURE__ */ React.createElement(AdvancedTab, {\n save,\n client\n }))))));\n}\n", "import {\n AlertVariant,\n Button,\n PageSection,\n Wizard,\n WizardContextConsumer,\n WizardFooter\n} from \"../../_snowpack/pkg/@patternfly/react-core.js\";\nimport React, {useState} from \"../../_snowpack/pkg/react.js\";\nimport {FormProvider, useForm} from \"../../_snowpack/pkg/react-hook-form.js\";\nimport {useTranslation} from \"../../_snowpack/pkg/react-i18next.js\";\nimport {useHistory} from \"../../_snowpack/pkg/react-router-dom.js\";\nimport {useAlerts} from \"../../components/alert/Alerts.js\";\nimport {ViewHeader} from \"../../components/view-header/ViewHeader.js\";\nimport {useAdminClient} from \"../../context/auth/AdminClient.js\";\nimport {useRealm} from \"../../context/realm-context/RealmContext.js\";\nimport {convertFormValuesToObject} from \"../../util.js\";\nimport {toClient} from \"../routes/Client.js\";\nimport {toClients} from \"../routes/Clients.js\";\nimport {CapabilityConfig} from \"./CapabilityConfig.js\";\nimport {GeneralSettings} from \"./GeneralSettings.js\";\nexport default function NewClientForm() {\n const {t} = useTranslation(\"clients\");\n const {realm} = useRealm();\n const adminClient = useAdminClient();\n const history = useHistory();\n const [showCapabilityConfig, setShowCapabilityConfig] = useState(false);\n const [client, setClient] = useState({\n protocol: \"openid-connect\",\n clientId: \"\",\n name: \"\",\n description: \"\",\n publicClient: true,\n authorizationServicesEnabled: false,\n serviceAccountsEnabled: false,\n implicitFlowEnabled: false,\n directAccessGrantsEnabled: true,\n standardFlowEnabled: true\n });\n const {addAlert, addError} = useAlerts();\n const methods = useForm({defaultValues: client});\n const save = async () => {\n try {\n const newClient = await adminClient.clients.create({\n ...convertFormValuesToObject(client),\n clientId: client.clientId?.trim()\n });\n addAlert(t(\"createSuccess\"), AlertVariant.success);\n history.push(toClient({realm, clientId: newClient.id, tab: \"settings\"}));\n } catch (error) {\n addError(\"clients:createError\", error);\n }\n };\n const forward = async (onNext) => {\n if (await methods.trigger()) {\n setClient({\n ...client,\n ...convertFormValuesToObject(methods.getValues())\n });\n setShowCapabilityConfig(true);\n onNext?.();\n }\n };\n const back = () => {\n setClient({...client, ...convertFormValuesToObject(methods.getValues())});\n methods.reset({\n ...client,\n ...convertFormValuesToObject(methods.getValues())\n });\n };\n const onGoToStep = (newStep) => {\n if (newStep.id === \"generalSettings\") {\n back();\n } else {\n forward();\n }\n };\n const Footer = () => /* @__PURE__ */ React.createElement(WizardFooter, null, /* @__PURE__ */ React.createElement(WizardContextConsumer, null, ({activeStep, onNext, onBack, onClose}) => {\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, {\n variant: \"primary\",\n type: \"submit\",\n onClick: () => {\n forward(onNext);\n }\n }, activeStep.name === t(\"capabilityConfig\") ? t(\"common:save\") : t(\"common:next\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"secondary\",\n onClick: () => {\n back();\n onBack();\n },\n isDisabled: activeStep.name === t(\"generalSettings\")\n }, t(\"common:back\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n onClick: onClose\n }, t(\"common:cancel\")));\n }));\n const title = t(\"createClient\");\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"clients:createClient\",\n subKey: \"clients:clientsExplain\"\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormProvider, {\n ...methods\n }, /* @__PURE__ */ React.createElement(Wizard, {\n onClose: () => history.push(toClients({realm})),\n navAriaLabel: `${title} steps`,\n mainAriaLabel: `${title} content`,\n steps: [\n {\n id: \"generalSettings\",\n name: t(\"generalSettings\"),\n component: /* @__PURE__ */ React.createElement(GeneralSettings, null)\n },\n ...showCapabilityConfig ? [\n {\n id: \"capabilityConfig\",\n name: t(\"capabilityConfig\"),\n component: /* @__PURE__ */ React.createElement(CapabilityConfig, {\n protocol: client.protocol\n })\n }\n ] : []\n ],\n footer: /* @__PURE__ */ React.createElement(Footer, null),\n onSave: save,\n onGoToStep\n }))));\n}\n", "import React, {useState} from \"../../_snowpack/pkg/react.js\";\nimport {Link, useHistory, useParams} from \"../../_snowpack/pkg/react-router-dom.js\";\nimport {useTranslation} from \"../../_snowpack/pkg/react-i18next.js\";\nimport {FormProvider, useForm} from \"../../_snowpack/pkg/react-hook-form.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n FormGroup,\n PageSection,\n TextInput,\n ValidatedOptions\n} from \"../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {useRealm} from \"../../context/realm-context/RealmContext.js\";\nimport {ViewHeader} from \"../../components/view-header/ViewHeader.js\";\nimport {FormAccess} from \"../../components/form-access/FormAccess.js\";\nimport {useAdminClient, useFetch} from \"../../context/auth/AdminClient.js\";\nimport {useAlerts} from \"../../components/alert/Alerts.js\";\nimport {\n toIdentityProviderEditMapper\n} from \"../routes/EditMapper.js\";\nimport {convertFormValuesToObject, convertToFormValues} from \"../../util.js\";\nimport {toIdentityProvider} from \"../routes/IdentityProvider.js\";\nimport {AddMapperForm} from \"./AddMapperForm.js\";\nimport {DynamicComponents} from \"../../components/dynamic/DynamicComponents.js\";\nimport {KeycloakSpinner} from \"../../components/keycloak-spinner/KeycloakSpinner.js\";\nexport default function AddMapper() {\n const {t} = useTranslation(\"identity-providers\");\n const form = useForm({\n shouldUnregister: false\n });\n const {handleSubmit, register, errors} = form;\n const {addAlert, addError} = useAlerts();\n const history = useHistory();\n const {realm} = useRealm();\n const adminClient = useAdminClient();\n const {providerId, alias} = useParams();\n const {id} = useParams();\n const [mapperTypes, setMapperTypes] = useState();\n const [mapperType, setMapperType] = useState();\n const [currentMapper, setCurrentMapper] = useState();\n const save = async (idpMapper) => {\n const mapper = convertFormValuesToObject(idpMapper);\n const attributes = JSON.stringify(idpMapper.config.attributes ?? []);\n const claims = JSON.stringify(idpMapper.config.claims ?? []);\n const identityProviderMapper = {\n ...mapper,\n config: {\n ...mapper.config,\n attributes,\n claims\n },\n identityProviderAlias: alias\n };\n if (id) {\n try {\n await adminClient.identityProviders.updateMapper({\n id,\n alias\n }, {...identityProviderMapper, name: currentMapper?.name});\n addAlert(t(\"mapperSaveSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(t(\"mapperSaveError\"), error);\n }\n } else {\n try {\n const createdMapper = await adminClient.identityProviders.createMapper({\n identityProviderMapper,\n alias\n });\n addAlert(t(\"mapperCreateSuccess\"), AlertVariant.success);\n history.push(toIdentityProviderEditMapper({\n realm,\n alias,\n providerId,\n id: createdMapper.id\n }));\n } catch (error) {\n addError(t(\"mapperCreateError\"), error);\n }\n }\n };\n useFetch(() => Promise.all([\n id ? adminClient.identityProviders.findOneMapper({alias, id}) : null,\n adminClient.identityProviders.findMapperTypes({alias})\n ]), ([mapper, mapperTypes2]) => {\n if (mapper) {\n setCurrentMapper(mapper);\n setupForm(mapper);\n setMapperType(mapper.identityProviderMapper);\n } else {\n setMapperType(Object.keys(mapperTypes2)[0]);\n }\n setMapperTypes(mapperTypes2);\n }, []);\n const setupForm = (mapper) => {\n convertToFormValues(mapper, form.setValue);\n form.setValue(\"config.attributes\", JSON.parse(mapper.config.attributes));\n form.setValue(\"config.claims\", JSON.parse(mapper.config.claims));\n };\n if (!mapperTypes) {\n return /* @__PURE__ */ React.createElement(KeycloakSpinner, null);\n }\n return /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(ViewHeader, {\n className: \"kc-add-mapper-title\",\n titleKey: id ? t(\"editIdPMapper\", {\n providerId: providerId[0].toUpperCase() + providerId.substring(1)\n }) : t(\"addIdPMapper\", {\n providerId: providerId[0].toUpperCase() + providerId.substring(1)\n }),\n divider: true\n }), /* @__PURE__ */ React.createElement(FormAccess, {\n role: \"manage-identity-providers\",\n isHorizontal: true,\n onSubmit: handleSubmit(save),\n className: \"pf-u-mt-lg\"\n }, id && /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:id\"),\n fieldId: \"kc-mapper-id\",\n validated: errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: register(),\n type: \"text\",\n value: currentMapper?.id,\n \"datatest-id\": \"name-input\",\n id: \"kc-name\",\n name: \"name\",\n isDisabled: !!id,\n validated: errors.name ? ValidatedOptions.error : ValidatedOptions.default\n })), /* @__PURE__ */ React.createElement(AddMapperForm, {\n form,\n id,\n mapperTypes,\n updateMapperType: setMapperType,\n mapperType\n }), /* @__PURE__ */ React.createElement(FormProvider, {\n ...form\n }, mapperType && mapperTypes[mapperType].properties && /* @__PURE__ */ React.createElement(DynamicComponents, {\n properties: mapperTypes[mapperType].properties\n })), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n \"data-testid\": \"new-mapper-save-button\",\n variant: \"primary\",\n type: \"submit\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toIdentityProvider({\n realm,\n providerId,\n alias,\n tab: \"settings\"\n })\n })\n }, t(\"common:cancel\")))));\n}\n", "import React from \"../../_snowpack/pkg/react.js\";\nimport {Link, useHistory, useParams} from \"../../_snowpack/pkg/react-router-dom.js\";\nimport {useTranslation} from \"../../_snowpack/pkg/react-i18next.js\";\nimport {FormProvider, useForm} from \"../../_snowpack/pkg/react-hook-form.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n PageSection\n} from \"../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {ViewHeader} from \"../../components/view-header/ViewHeader.js\";\nimport {toUpperCase} from \"../../util.js\";\nimport {FormAccess} from \"../../components/form-access/FormAccess.js\";\nimport {useAdminClient} from \"../../context/auth/AdminClient.js\";\nimport {useRealm} from \"../../context/realm-context/RealmContext.js\";\nimport {useAlerts} from \"../../components/alert/Alerts.js\";\nimport {GeneralSettings} from \"./GeneralSettings.js\";\nimport {toIdentityProvider} from \"../routes/IdentityProvider.js\";\nimport {toIdentityProviders} from \"../routes/IdentityProviders.js\";\nexport default function AddIdentityProvider() {\n const {t} = useTranslation(\"identity-providers\");\n const {providerId} = useParams();\n const form = useForm();\n const {\n handleSubmit,\n formState: {isDirty}\n } = form;\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const history = useHistory();\n const {realm} = useRealm();\n const save = async (provider) => {\n try {\n await adminClient.identityProviders.create({\n ...provider,\n providerId,\n alias: providerId\n });\n addAlert(t(\"createSuccess\"), AlertVariant.success);\n history.push(toIdentityProvider({\n realm,\n providerId,\n alias: providerId,\n tab: \"settings\"\n }));\n } catch (error) {\n addError(\"identity-providers:createError\", error);\n }\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: t(\"addIdentityProvider\", {\n provider: toUpperCase(providerId)\n })\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n role: \"manage-identity-providers\",\n isHorizontal: true,\n onSubmit: handleSubmit(save)\n }, /* @__PURE__ */ React.createElement(FormProvider, {\n ...form\n }, /* @__PURE__ */ React.createElement(GeneralSettings, {\n id: providerId\n })), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n isDisabled: !isDirty,\n variant: \"primary\",\n type: \"submit\",\n \"data-testid\": \"createProvider\"\n }, t(\"common:add\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n \"data-testid\": \"cancel\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toIdentityProviders({realm})\n })\n }, t(\"common:cancel\"))))));\n}\n", "import React, {Fragment, useState} from \"../_snowpack/pkg/react.js\";\nimport {Link, useHistory} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport _ from \"../_snowpack/pkg/lodash.js\";\nimport {\n AlertVariant,\n Badge,\n Button,\n ButtonVariant,\n Card,\n CardTitle,\n Dropdown,\n DropdownGroup,\n DropdownItem,\n DropdownToggle,\n Gallery,\n PageSection,\n Spinner,\n Split,\n SplitItem,\n Text,\n TextContent,\n TextVariants,\n ToolbarItem\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useFetch, useAdminClient} from \"../context/auth/AdminClient.js\";\nimport {KeycloakDataTable} from \"../components/table-toolbar/KeycloakDataTable.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {useServerInfo} from \"../context/server-info/ServerInfoProvider.js\";\nimport {upperCaseFormatter} from \"../util.js\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {ProviderIconMapper} from \"./ProviderIconMapper.js\";\nimport {ManageOderDialog} from \"./ManageOrderDialog.js\";\nimport {toIdentityProvider} from \"./routes/IdentityProvider.js\";\nimport {toIdentityProviderCreate} from \"./routes/IdentityProviderCreate.js\";\nexport default function IdentityProvidersSection() {\n const {t} = useTranslation(\"identity-providers\");\n const identityProviders = _.groupBy(useServerInfo().identityProviders, \"groupName\");\n const {realm} = useRealm();\n const history = useHistory();\n const [key, setKey] = useState(0);\n const refresh = () => setKey(new Date().getTime());\n const [addProviderOpen, setAddProviderOpen] = useState(false);\n const [manageDisplayDialog, setManageDisplayDialog] = useState(false);\n const [providers, setProviders] = useState();\n const [selectedProvider, setSelectedProvider] = useState();\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n useFetch(async () => {\n const provider = await adminClient.realms.findOne({realm});\n if (!provider) {\n throw new Error(t(\"common:notFound\"));\n }\n return provider.identityProviders;\n }, (providers2) => {\n setProviders(providers2);\n }, []);\n const loader = () => Promise.resolve(_.sortBy(providers, \"alias\"));\n const DetailLink = (identityProvider) => /* @__PURE__ */ React.createElement(Link, {\n key: identityProvider.providerId,\n to: toIdentityProvider({\n realm,\n providerId: identityProvider.providerId,\n alias: identityProvider.alias,\n tab: \"settings\"\n })\n }, identityProvider.displayName ? identityProvider.displayName : identityProvider.alias, !identityProvider.enabled && /* @__PURE__ */ React.createElement(Badge, {\n key: `${identityProvider.providerId}-disabled`,\n isRead: true,\n className: \"pf-u-ml-sm\"\n }, t(\"common:disabled\")));\n const navigateToCreate = (providerId) => history.push(toIdentityProviderCreate({\n realm,\n providerId\n }));\n const identityProviderOptions = () => Object.keys(identityProviders).map((group) => /* @__PURE__ */ React.createElement(DropdownGroup, {\n key: group,\n label: group\n }, _.sortBy(identityProviders[group], \"name\").map((provider) => /* @__PURE__ */ React.createElement(DropdownItem, {\n key: provider.id,\n value: provider.id,\n component: /* @__PURE__ */ React.createElement(Link, {\n to: toIdentityProviderCreate({\n realm,\n providerId: provider.id\n }),\n \"data-testid\": provider.id\n }, provider.name)\n }))));\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"identity-providers:deleteProvider\",\n messageKey: t(\"deleteConfirm\", {provider: selectedProvider?.alias}),\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.identityProviders.del({\n alias: selectedProvider.alias\n });\n setProviders([\n ...providers.filter((p) => p.alias !== selectedProvider?.alias)\n ]);\n refresh();\n addAlert(t(\"deletedSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"identity-providers:deleteError\", error);\n }\n }\n });\n if (!providers) {\n return /* @__PURE__ */ React.createElement(Spinner, null);\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), manageDisplayDialog && /* @__PURE__ */ React.createElement(ManageOderDialog, {\n onClose: () => setManageDisplayDialog(false),\n providers: providers.filter((p) => p.enabled)\n }), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"common:identityProviders\",\n subKey: \"identity-providers:listExplain\"\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: providers.length === 0 ? \"default\" : \"light\",\n className: providers.length === 0 ? \"\" : \"pf-u-p-0\"\n }, providers.length === 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TextContent, null, /* @__PURE__ */ React.createElement(Text, {\n component: TextVariants.p\n }, t(\"getStarted\"))), Object.keys(identityProviders).map((group) => /* @__PURE__ */ React.createElement(Fragment, {\n key: group\n }, /* @__PURE__ */ React.createElement(TextContent, null, /* @__PURE__ */ React.createElement(Text, {\n className: \"pf-u-mt-lg\",\n component: TextVariants.h2\n }, group, \":\")), /* @__PURE__ */ React.createElement(\"hr\", {\n className: \"pf-u-mb-lg\"\n }), /* @__PURE__ */ React.createElement(Gallery, {\n hasGutter: true\n }, _.sortBy(identityProviders[group], \"name\").map((provider) => /* @__PURE__ */ React.createElement(Card, {\n className: \"keycloak-empty-state-card\",\n key: provider.id,\n isHoverable: true,\n \"data-testid\": `${provider.id}-card`,\n onClick: () => navigateToCreate(provider.id)\n }, /* @__PURE__ */ React.createElement(CardTitle, null, /* @__PURE__ */ React.createElement(Split, {\n hasGutter: true\n }, /* @__PURE__ */ React.createElement(SplitItem, null, /* @__PURE__ */ React.createElement(ProviderIconMapper, {\n provider\n })), /* @__PURE__ */ React.createElement(SplitItem, {\n isFilled: true\n }, provider.name))))))))), providers.length !== 0 && /* @__PURE__ */ React.createElement(KeycloakDataTable, {\n key,\n loader,\n ariaLabelKey: \"common:identityProviders\",\n searchPlaceholderKey: \"identity-providers:searchForProvider\",\n toolbarItem: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(Dropdown, {\n \"data-testid\": \"addProviderDropdown\",\n toggle: /* @__PURE__ */ React.createElement(DropdownToggle, {\n onToggle: () => setAddProviderOpen(!addProviderOpen),\n isPrimary: true\n }, t(\"addProvider\")),\n isOpen: addProviderOpen,\n dropdownItems: identityProviderOptions()\n })), /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(Button, {\n \"data-testid\": \"manageDisplayOrder\",\n variant: \"link\",\n onClick: () => setManageDisplayDialog(true)\n }, t(\"manageDisplayOrder\")))),\n actions: [\n {\n title: t(\"common:delete\"),\n onRowClick: (provider) => {\n setSelectedProvider(provider);\n toggleDeleteDialog();\n }\n }\n ],\n columns: [\n {\n name: \"alias\",\n displayKey: \"common:name\",\n cellRenderer: DetailLink\n },\n {\n name: \"providerId\",\n displayKey: \"identity-providers:providerDetails\",\n cellFormatters: [upperCaseFormatter()]\n }\n ]\n })));\n}\n", "import React, {useState} from \"../../_snowpack/pkg/react.js\";\nimport {Link, useHistory, useParams} from \"../../_snowpack/pkg/react-router-dom.js\";\nimport {useTranslation} from \"../../_snowpack/pkg/react-i18next.js\";\nimport {Controller, FormProvider, useForm} from \"../../_snowpack/pkg/react-hook-form.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n ButtonVariant,\n Divider,\n DropdownItem,\n Form,\n PageSection,\n Tab,\n TabTitleText,\n ToolbarItem\n} from \"../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {FormAccess} from \"../../components/form-access/FormAccess.js\";\nimport {ScrollForm} from \"../../components/scroll-form/ScrollForm.js\";\nimport {ViewHeader} from \"../../components/view-header/ViewHeader.js\";\nimport {KeycloakSpinner} from \"../../components/keycloak-spinner/KeycloakSpinner.js\";\nimport {useFetch, useAdminClient} from \"../../context/auth/AdminClient.js\";\nimport {GeneralSettings} from \"./GeneralSettings.js\";\nimport {AdvancedSettings} from \"./AdvancedSettings.js\";\nimport {useConfirmDialog} from \"../../components/confirm-dialog/ConfirmDialog.js\";\nimport {useAlerts} from \"../../components/alert/Alerts.js\";\nimport {useRealm} from \"../../context/realm-context/RealmContext.js\";\nimport {KeycloakTabs} from \"../../components/keycloak-tabs/KeycloakTabs.js\";\nimport {ExtendedNonDiscoverySettings} from \"./ExtendedNonDiscoverySettings.js\";\nimport {DiscoverySettings} from \"./DiscoverySettings.js\";\nimport {DescriptorSettings} from \"./DescriptorSettings.js\";\nimport {OIDCGeneralSettings} from \"./OIDCGeneralSettings.js\";\nimport {SamlGeneralSettings} from \"./SamlGeneralSettings.js\";\nimport {OIDCAuthentication} from \"./OIDCAuthentication.js\";\nimport {ReqAuthnConstraints} from \"./ReqAuthnConstraintsSettings.js\";\nimport {KeycloakDataTable} from \"../../components/table-toolbar/KeycloakDataTable.js\";\nimport {ListEmptyState} from \"../../components/list-empty-state/ListEmptyState.js\";\nimport {toIdentityProviderAddMapper} from \"../routes/AddMapper.js\";\nimport {toIdentityProviderEditMapper} from \"../routes/EditMapper.js\";\nimport {toIdentityProviders} from \"../routes/IdentityProviders.js\";\nimport {toUpperCase} from \"../../util.js\";\nimport {\n toIdentityProvider\n} from \"../routes/IdentityProvider.js\";\nconst Header = ({onChange, value, save, toggleDeleteDialog}) => {\n const {t} = useTranslation(\"identity-providers\");\n const {alias} = useParams();\n const [toggleDisableDialog, DisableConfirm] = useConfirmDialog({\n titleKey: \"identity-providers:disableProvider\",\n messageKey: t(\"disableConfirm\", {provider: alias}),\n continueButtonLabel: \"common:disable\",\n onConfirm: () => {\n onChange(!value);\n save();\n }\n });\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DisableConfirm, null), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: toUpperCase(alias),\n divider: false,\n dropdownItems: [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"delete\",\n onClick: () => toggleDeleteDialog()\n }, t(\"common:delete\"))\n ],\n isEnabled: value,\n onToggle: (value2) => {\n if (!value2) {\n toggleDisableDialog();\n } else {\n onChange(value2);\n save();\n }\n }\n }));\n};\nexport default function DetailSettings() {\n const {t} = useTranslation(\"identity-providers\");\n const {alias, providerId} = useParams();\n const form = useForm();\n const {handleSubmit, getValues, reset} = form;\n const [provider, setProvider] = useState();\n const [selectedMapper, setSelectedMapper] = useState();\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const history = useHistory();\n const {realm} = useRealm();\n const [key, setKey] = useState(0);\n const refresh = () => setKey(key + 1);\n const MapperLink = ({name, mapperId}) => /* @__PURE__ */ React.createElement(Link, {\n to: toIdentityProviderEditMapper({\n realm,\n alias,\n providerId: provider?.providerId,\n id: mapperId\n })\n }, name);\n useFetch(() => adminClient.identityProviders.findOne({alias}), (fetchedProvider) => {\n if (!fetchedProvider) {\n throw new Error(t(\"common:notFound\"));\n }\n reset(fetchedProvider);\n setProvider(fetchedProvider);\n }, []);\n const save = async (provider2) => {\n const p = provider2 || getValues();\n try {\n await adminClient.identityProviders.update({alias}, {...p, alias, providerId});\n addAlert(t(\"updateSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"identity-providers:updateError\", error);\n }\n };\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"identity-providers:deleteProvider\",\n messageKey: t(\"identity-providers:deleteConfirm\", {provider: alias}),\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.identityProviders.del({alias});\n addAlert(t(\"deletedSuccess\"), AlertVariant.success);\n history.push(toIdentityProviders({realm}));\n } catch (error) {\n addError(\"identity-providers:deleteErrorError\", error);\n }\n }\n });\n const [toggleDeleteMapperDialog, DeleteMapperConfirm] = useConfirmDialog({\n titleKey: \"identity-providers:deleteProviderMapper\",\n messageKey: t(\"identity-providers:deleteMapperConfirm\", {\n mapper: selectedMapper?.name\n }),\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.identityProviders.delMapper({\n alias,\n id: selectedMapper?.mapperId\n });\n addAlert(t(\"deleteMapperSuccess\"), AlertVariant.success);\n refresh();\n history.push(toIdentityProvider({providerId, alias, tab: \"mappers\", realm}));\n } catch (error) {\n addError(\"identity-providers:deleteErrorError\", error);\n }\n }\n });\n if (!provider) {\n return /* @__PURE__ */ React.createElement(KeycloakSpinner, null);\n }\n const sections = [t(\"generalSettings\"), t(\"advancedSettings\")];\n const isOIDC = provider.providerId.includes(\"oidc\");\n const isSAML = provider.providerId.includes(\"saml\");\n const loader = async () => {\n const [loaderMappers, loaderMapperTypes] = await Promise.all([\n adminClient.identityProviders.findMappers({alias}),\n adminClient.identityProviders.findMapperTypes({alias})\n ]);\n const components = loaderMappers.map((loaderMapper) => {\n const mapperType = Object.values(loaderMapperTypes).find((loaderMapperType) => loaderMapper.identityProviderMapper === loaderMapperType.id);\n const result = {\n ...mapperType,\n name: loaderMapper.name,\n type: mapperType?.name,\n mapperId: loaderMapper.id\n };\n return result;\n });\n return components;\n };\n if (isOIDC) {\n sections.splice(1, 0, t(\"oidcSettings\"));\n }\n if (isSAML) {\n sections.splice(1, 0, t(\"samlSettings\"));\n sections.splice(2, 0, t(\"reqAuthnConstraints\"));\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(DeleteMapperConfirm, null), /* @__PURE__ */ React.createElement(Controller, {\n name: \"enabled\",\n control: form.control,\n defaultValue: true,\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Header, {\n value,\n onChange,\n save,\n toggleDeleteDialog\n })\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n className: \"pf-u-p-0\"\n }, /* @__PURE__ */ React.createElement(FormProvider, {\n ...form\n }, /* @__PURE__ */ React.createElement(KeycloakTabs, {\n isBox: true\n }, /* @__PURE__ */ React.createElement(Tab, {\n id: \"settings\",\n eventKey: \"settings\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:settings\"))\n }, /* @__PURE__ */ React.createElement(ScrollForm, {\n className: \"pf-u-px-lg\",\n sections\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n role: \"manage-identity-providers\",\n isHorizontal: true,\n onSubmit: handleSubmit(save)\n }, !isOIDC && !isSAML && /* @__PURE__ */ React.createElement(GeneralSettings, {\n create: false,\n id: alias\n }), isOIDC && /* @__PURE__ */ React.createElement(OIDCGeneralSettings, {\n id: alias\n }), isSAML && /* @__PURE__ */ React.createElement(SamlGeneralSettings, {\n id: alias\n })), isOIDC && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DiscoverySettings, {\n readOnly: false\n }), /* @__PURE__ */ React.createElement(Form, {\n isHorizontal: true,\n className: \"pf-u-py-lg\"\n }, /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(OIDCAuthentication, {\n create: false\n })), /* @__PURE__ */ React.createElement(ExtendedNonDiscoverySettings, null)), isSAML && /* @__PURE__ */ React.createElement(DescriptorSettings, {\n readOnly: false\n }), isSAML && /* @__PURE__ */ React.createElement(FormAccess, {\n role: \"manage-identity-providers\",\n isHorizontal: true,\n onSubmit: handleSubmit(save)\n }, /* @__PURE__ */ React.createElement(ReqAuthnConstraints, null)), /* @__PURE__ */ React.createElement(FormAccess, {\n role: \"manage-identity-providers\",\n isHorizontal: true,\n onSubmit: handleSubmit(save)\n }, /* @__PURE__ */ React.createElement(AdvancedSettings, {\n isOIDC,\n isSAML\n }), /* @__PURE__ */ React.createElement(ActionGroup, {\n className: \"keycloak__form_actions\"\n }, /* @__PURE__ */ React.createElement(Button, {\n \"data-testid\": \"save\",\n type: \"submit\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n \"data-testid\": \"revert\",\n variant: \"link\",\n onClick: () => {\n reset();\n }\n }, t(\"common:revert\")))))), /* @__PURE__ */ React.createElement(Tab, {\n id: \"mappers\",\n \"data-testid\": \"mappers-tab\",\n eventKey: \"mappers\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:mappers\"))\n }, /* @__PURE__ */ React.createElement(KeycloakDataTable, {\n emptyState: /* @__PURE__ */ React.createElement(ListEmptyState, {\n message: t(\"identity-providers:noMappers\"),\n instructions: t(\"identity-providers:noMappersInstructions\"),\n primaryActionText: t(\"identity-providers:addMapper\"),\n onPrimaryAction: () => history.push(toIdentityProviderAddMapper({\n realm,\n alias,\n providerId: provider.providerId,\n tab: \"mappers\"\n }))\n }),\n loader,\n key,\n isPaginated: true,\n ariaLabelKey: \"identity-providers:mappersList\",\n searchPlaceholderKey: \"identity-providers:searchForMapper\",\n toolbarItem: /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(Link, {\n to: toIdentityProviderAddMapper({\n realm,\n alias,\n providerId: provider.providerId,\n tab: \"mappers\"\n }),\n id: \"add-mapper-button\"\n }, t(\"addMapper\"))),\n columns: [\n {\n name: \"name\",\n displayKey: \"common:name\",\n cellRenderer: MapperLink\n },\n {\n name: \"category\",\n displayKey: \"common:category\"\n },\n {\n name: \"type\",\n displayKey: \"common:type\"\n }\n ],\n actions: [\n {\n title: t(\"common:delete\"),\n onRowClick: (mapper) => {\n setSelectedMapper(mapper);\n toggleDeleteMapperDialog();\n }\n }\n ]\n }))))));\n}\n", "import {\n AlertVariant,\n Button,\n ButtonVariant,\n Dropdown,\n DropdownItem,\n EmptyState,\n InputGroup,\n KebabToggle,\n Label,\n PageSection,\n Text,\n TextContent,\n TextInput,\n Toolbar,\n ToolbarContent,\n ToolbarItem,\n Tooltip\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {\n ExclamationCircleIcon,\n InfoCircleIcon,\n SearchIcon,\n WarningTriangleIcon\n} from \"../_snowpack/pkg/@patternfly/react-icons.js\";\nimport React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {Link, useHistory} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {ListEmptyState} from \"../components/list-empty-state/ListEmptyState.js\";\nimport {KeycloakDataTable} from \"../components/table-toolbar/KeycloakDataTable.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {emptyFormatter} from \"../util.js\";\nimport {toUser} from \"./routes/User.js\";\nimport {toAddUser} from \"./routes/AddUser.js\";\nimport \"./user-section.css\";\nexport default function UsersSection() {\n const {t} = useTranslation(\"users\");\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const {realm: realmName} = useRealm();\n const history = useHistory();\n const [listUsers, setListUsers] = useState(false);\n const [searchUser, setSearchUser] = useState();\n const [realm, setRealm] = useState();\n const [kebabOpen, setKebabOpen] = useState(false);\n const [selectedRows, setSelectedRows] = useState([]);\n const [key, setKey] = useState(\"\");\n const refresh = () => setKey(`${new Date().getTime()}`);\n useFetch(() => {\n const testParams = {\n type: \"org.keycloak.storage.UserStorageProvider\"\n };\n return Promise.all([\n adminClient.components.find(testParams),\n adminClient.realms.findOne({realm: realmName})\n ]).catch(() => [[], void 0]);\n }, ([storageProviders, realm2]) => {\n setListUsers(!(storageProviders.length > 0));\n setRealm(realm2);\n refresh();\n }, []);\n const UserDetailLink = (user) => /* @__PURE__ */ React.createElement(Link, {\n key: user.username,\n to: toUser({realm: realmName, id: user.id, tab: \"settings\"})\n }, user.username);\n const loader = async (first, max, search) => {\n const params = {\n first,\n max\n };\n const searchParam = search || searchUser || \"\";\n if (searchParam) {\n params.search = searchParam;\n }\n if (!listUsers && !searchParam) {\n return [];\n }\n try {\n const users = await adminClient.users.find({...params});\n if (realm?.bruteForceProtected) {\n const brutes = await Promise.all(users.map((user) => adminClient.attackDetection.findOne({\n id: user.id\n })));\n for (let index = 0; index < users.length; index++) {\n const user = users[index];\n user.brute = brutes[index];\n }\n }\n return users;\n } catch (error) {\n addError(\"users:noUsersFoundError\", error);\n return [];\n }\n };\n const [toggleUnlockUsersDialog, UnlockUsersConfirm] = useConfirmDialog({\n titleKey: \"users:unlockAllUsers\",\n messageKey: \"users:unlockUsersConfirm\",\n continueButtonLabel: \"users:unlock\",\n onConfirm: async () => {\n try {\n await adminClient.attackDetection.delAll();\n refresh();\n addAlert(t(\"unlockUsersSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"users:unlockUsersError\", error);\n }\n }\n });\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"users:deleteConfirm\",\n messageKey: t(\"deleteConfirmDialog\", {count: selectedRows.length}),\n continueButtonLabel: \"delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n for (const user of selectedRows) {\n await adminClient.users.del({id: user.id});\n }\n setSelectedRows([]);\n refresh();\n addAlert(t(\"userDeletedSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"users:userDeletedError\", error);\n }\n }\n });\n const StatusRow = (user) => {\n return /* @__PURE__ */ React.createElement(React.Fragment, null, !user.enabled && /* @__PURE__ */ React.createElement(Label, {\n key: user.id,\n color: \"red\",\n icon: /* @__PURE__ */ React.createElement(InfoCircleIcon, null)\n }, t(\"disabled\")), user.brute?.disabled && /* @__PURE__ */ React.createElement(Label, {\n key: user.id,\n color: \"orange\",\n icon: /* @__PURE__ */ React.createElement(WarningTriangleIcon, null)\n }, t(\"temporaryDisabled\")), user.enabled && !user.brute?.disabled && \"—\");\n };\n const ValidatedEmail = (user) => {\n return /* @__PURE__ */ React.createElement(React.Fragment, null, !user.emailVerified && /* @__PURE__ */ React.createElement(Tooltip, {\n key: `email-verified-${user.id}`,\n content: /* @__PURE__ */ React.createElement(React.Fragment, null, t(\"notVerified\"))\n }, /* @__PURE__ */ React.createElement(ExclamationCircleIcon, {\n className: \"keycloak__user-section__email-verified\"\n })), \" \", emptyFormatter()(user.email));\n };\n const goToCreate = () => history.push(toAddUser({realm: realmName}));\n const toolbar = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(Button, {\n \"data-testid\": \"add-user\",\n onClick: goToCreate\n }, t(\"addUser\"))), !realm?.bruteForceProtected ? /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(Button, {\n variant: ButtonVariant.plain,\n onClick: toggleDeleteDialog,\n isDisabled: selectedRows.length === 0\n }, t(\"deleteUser\"))) : /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(Dropdown, {\n toggle: /* @__PURE__ */ React.createElement(KebabToggle, {\n onToggle: (open) => setKebabOpen(open)\n }),\n isOpen: kebabOpen,\n isPlain: true,\n dropdownItems: [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"deleteUser\",\n component: \"button\",\n isDisabled: selectedRows.length === 0,\n onClick: () => {\n toggleDeleteDialog();\n setKebabOpen(false);\n }\n }, t(\"deleteUser\")),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"unlock\",\n component: \"button\",\n onClick: () => {\n toggleUnlockUsersDialog();\n setKebabOpen(false);\n }\n }, t(\"unlockAllUsers\"))\n ]\n })));\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(UnlockUsersConfirm, null), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"users:title\"\n }), /* @__PURE__ */ React.createElement(PageSection, {\n \"data-testid\": \"users-page\",\n variant: \"light\",\n className: \"pf-u-p-0\"\n }, /* @__PURE__ */ React.createElement(KeycloakDataTable, {\n key,\n loader,\n isPaginated: true,\n ariaLabelKey: \"users:title\",\n searchPlaceholderKey: \"users:searchForUser\",\n canSelectAll: true,\n onSelect: (rows) => setSelectedRows([...rows]),\n emptyState: !listUsers ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Toolbar, null, /* @__PURE__ */ React.createElement(ToolbarContent, null, /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(InputGroup, null, /* @__PURE__ */ React.createElement(TextInput, {\n name: \"search-input\",\n type: \"search\",\n \"aria-label\": t(\"search\"),\n placeholder: t(\"users:searchForUser\"),\n onChange: (value) => {\n setSearchUser(value);\n },\n onKeyDown: (e) => {\n if (e.key === \"Enter\") {\n refresh();\n }\n }\n }), /* @__PURE__ */ React.createElement(Button, {\n variant: ButtonVariant.control,\n \"aria-label\": t(\"common:search\"),\n onClick: refresh\n }, /* @__PURE__ */ React.createElement(SearchIcon, null)))), toolbar)), /* @__PURE__ */ React.createElement(EmptyState, {\n \"data-testid\": \"empty-state\",\n variant: \"large\"\n }, /* @__PURE__ */ React.createElement(TextContent, {\n className: \"kc-search-users-text\"\n }, /* @__PURE__ */ React.createElement(Text, null, t(\"searchForUserDescription\"))))) : /* @__PURE__ */ React.createElement(ListEmptyState, {\n message: t(\"noUsersFound\"),\n instructions: t(\"emptyInstructions\"),\n primaryActionText: t(\"createNewUser\"),\n onPrimaryAction: goToCreate\n }),\n toolbarItem: toolbar,\n actions: [\n {\n title: t(\"common:delete\"),\n onRowClick: (user) => {\n setSelectedRows([user]);\n toggleDeleteDialog();\n }\n }\n ],\n columns: [\n {\n name: \"username\",\n displayKey: \"users:username\",\n cellRenderer: UserDetailLink\n },\n {\n name: \"email\",\n displayKey: \"users:email\",\n cellRenderer: ValidatedEmail\n },\n {\n name: \"lastName\",\n displayKey: \"users:lastName\",\n cellFormatters: [emptyFormatter()]\n },\n {\n name: \"firstName\",\n displayKey: \"users:firstName\",\n cellFormatters: [emptyFormatter()]\n },\n {\n name: \"status\",\n displayKey: \"users:status\",\n cellRenderer: StatusRow\n }\n ]\n })));\n}\n", "import React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {\n AlertVariant,\n ButtonVariant,\n DropdownItem,\n PageSection,\n Tab,\n TabTitleText\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {FormProvider, useForm} from \"../_snowpack/pkg/react-hook-form.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {UserForm} from \"./UserForm.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {useHistory, useParams} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {KeycloakTabs} from \"../components/keycloak-tabs/KeycloakTabs.js\";\nimport {UserGroups} from \"./UserGroups.js\";\nimport {UserConsents} from \"./UserConsents.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {UserIdentityProviderLinks} from \"./UserIdentityProviderLinks.js\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {toUser} from \"./routes/User.js\";\nimport {toUsers} from \"./routes/Users.js\";\nimport {UserRoleMapping} from \"./UserRoleMapping.js\";\nimport {UserAttributes} from \"./UserAttributes.js\";\nimport {UserCredentials} from \"./UserCredentials.js\";\nimport {useAccess} from \"../context/access/Access.js\";\nconst UsersTabs = () => {\n const {t} = useTranslation(\"users\");\n const {addAlert, addError} = useAlerts();\n const history = useHistory();\n const {realm} = useRealm();\n const {hasAccess} = useAccess();\n const adminClient = useAdminClient();\n const userForm = useForm({mode: \"onChange\"});\n const {id} = useParams();\n const [user, setUser] = useState();\n const [bruteForced, setBruteForced] = useState();\n const [addedGroups, setAddedGroups] = useState([]);\n useFetch(async () => {\n if (id) {\n const user2 = await adminClient.users.findOne({id});\n if (!user2) {\n throw new Error(t(\"common:notFound\"));\n }\n const isBruteForceProtected = (await adminClient.realms.findOne({\n realm\n })).bruteForceProtected;\n const bruteForce = await adminClient.attackDetection.findOne({\n id: user2.id\n });\n const isLocked = isBruteForceProtected && bruteForce && bruteForce.disabled;\n return {user: user2, bruteForced: {isBruteForceProtected, isLocked}};\n }\n return {user: void 0};\n }, ({user: user2, bruteForced: bruteForced2}) => {\n setUser(user2);\n setBruteForced(bruteForced2);\n user2 && setupForm(user2);\n }, []);\n const setupForm = (user2) => {\n userForm.reset(user2);\n };\n const updateGroups = (groups) => {\n setAddedGroups(groups);\n };\n const save = async (user2) => {\n user2.username = user2.username?.trim();\n try {\n if (id) {\n await adminClient.users.update({id}, user2);\n addAlert(t(\"userSaved\"), AlertVariant.success);\n } else {\n const createdUser = await adminClient.users.create(user2);\n addedGroups.forEach(async (group) => {\n await adminClient.users.addToGroup({\n id: createdUser.id,\n groupId: group.id\n });\n });\n addAlert(t(\"userCreated\"), AlertVariant.success);\n history.push(toUser({id: createdUser.id, realm, tab: \"settings\"}));\n }\n } catch (error) {\n addError(\"users:userCreateError\", error);\n }\n };\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"users:deleteConfirm\",\n messageKey: \"users:deleteConfirmCurrentUser\",\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.users.del({id});\n addAlert(t(\"userDeletedSuccess\"), AlertVariant.success);\n history.push(toUsers({realm}));\n } catch (error) {\n addError(\"users:userDeletedError\", error);\n }\n }\n });\n const [toggleImpersonateDialog, ImpersonateConfirm] = useConfirmDialog({\n titleKey: \"users:impersonateConfirm\",\n messageKey: \"users:impersonateConfirmDialog\",\n continueButtonLabel: \"users:impersonate\",\n onConfirm: async () => {\n try {\n const data = await adminClient.users.impersonation({id}, {user: id, realm});\n if (data.sameRealm) {\n window.location = data.redirect;\n } else {\n window.open(data.redirect, \"_blank\");\n }\n } catch (error) {\n addError(\"users:impersonateError\", error);\n }\n }\n });\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ImpersonateConfirm, null), /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: user?.username || t(\"createUser\"),\n divider: !id,\n dropdownItems: [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"impersonate\",\n onClick: () => toggleImpersonateDialog()\n }, t(\"impersonate\")),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"delete\",\n onClick: () => toggleDeleteDialog()\n }, t(\"common:delete\"))\n ]\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n className: \"pf-u-p-0\"\n }, /* @__PURE__ */ React.createElement(FormProvider, {\n ...userForm\n }, id && user && /* @__PURE__ */ React.createElement(KeycloakTabs, {\n isBox: true,\n mountOnEnter: true\n }, /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"settings\",\n \"data-testid\": \"user-details-tab\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:details\"))\n }, /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, bruteForced && /* @__PURE__ */ React.createElement(UserForm, {\n onGroupsUpdate: updateGroups,\n save,\n user,\n bruteForce: bruteForced\n }))), /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"attributes\",\n \"data-testid\": \"attributes\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:attributes\"))\n }, /* @__PURE__ */ React.createElement(UserAttributes, {\n user\n })), /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"credentials\",\n \"data-testid\": \"credentials\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:credentials\"))\n }, /* @__PURE__ */ React.createElement(UserCredentials, {\n user\n })), /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"groups\",\n \"data-testid\": \"user-groups-tab\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:groups\"))\n }, /* @__PURE__ */ React.createElement(UserGroups, {\n user\n })), /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"consents\",\n \"data-testid\": \"user-consents-tab\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"consents\"))\n }, /* @__PURE__ */ React.createElement(UserConsents, null)), /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"role-mapping\",\n \"data-testid\": \"role-mapping-tab\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"roleMapping\"))\n }, /* @__PURE__ */ React.createElement(UserRoleMapping, {\n id,\n name: user.username\n })), hasAccess(\"view-identity-providers\") && /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"identity-provider-links\",\n \"data-testid\": \"identity-provider-links-tab\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"identityProviderLinks\"))\n }, /* @__PURE__ */ React.createElement(UserIdentityProviderLinks, null))), !id && /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(UserForm, {\n onGroupsUpdate: updateGroups,\n save\n })))));\n};\nexport default UsersTabs;\n", "import {\n ActionGroup,\n Button,\n Chip,\n ChipGroup,\n DescriptionList,\n DescriptionListDescription,\n DescriptionListGroup,\n DescriptionListTerm,\n Dropdown,\n DropdownToggle,\n Flex,\n FlexItem,\n Form,\n FormGroup,\n PageSection,\n Select,\n SelectOption,\n SelectVariant,\n Tab,\n TabTitleText,\n TextInput,\n Tooltip\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {CheckCircleIcon, WarningTriangleIcon} from \"../_snowpack/pkg/@patternfly/react-icons.js\";\nimport {cellWidth, expandable} from \"../_snowpack/pkg/@patternfly/react-table.js\";\nimport {pickBy} from \"../_snowpack/pkg/lodash.js\";\nimport moment from \"../_snowpack/pkg/moment.js\";\nimport React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {Controller, useForm} from \"../_snowpack/pkg/react-hook-form.js\";\nimport {Trans, useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {Link} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {KeycloakTabs} from \"../components/keycloak-tabs/KeycloakTabs.js\";\nimport {ListEmptyState} from \"../components/list-empty-state/ListEmptyState.js\";\nimport {KeycloakDataTable} from \"../components/table-toolbar/KeycloakDataTable.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {toRealmSettings} from \"../realm-settings/routes/RealmSettings.js\";\nimport {toUser} from \"../user/routes/User.js\";\nimport {AdminEvents} from \"./AdminEvents.js\";\nimport \"./events.css\";\nconst defaultValues = {\n client: \"\",\n dateFrom: \"\",\n dateTo: \"\",\n user: \"\",\n type: []\n};\nconst StatusRow = (event) => !event.error ? /* @__PURE__ */ React.createElement(\"span\", null, /* @__PURE__ */ React.createElement(CheckCircleIcon, {\n color: \"green\"\n}), \" \", event.type) : /* @__PURE__ */ React.createElement(Tooltip, {\n content: event.error\n}, /* @__PURE__ */ React.createElement(\"span\", null, /* @__PURE__ */ React.createElement(WarningTriangleIcon, {\n color: \"orange\"\n}), \" \", event.type));\nconst DetailCell = (event) => /* @__PURE__ */ React.createElement(DescriptionList, {\n isHorizontal: true,\n className: \"keycloak_eventsection_details\"\n}, Object.entries(event.details).map(([key, value]) => /* @__PURE__ */ React.createElement(DescriptionListGroup, {\n key\n}, /* @__PURE__ */ React.createElement(DescriptionListTerm, null, key), /* @__PURE__ */ React.createElement(DescriptionListDescription, null, value))));\nexport default function EventsSection() {\n const {t} = useTranslation(\"events\");\n const adminClient = useAdminClient();\n const {realm} = useRealm();\n const [key, setKey] = useState(0);\n const [searchDropdownOpen, setSearchDropdownOpen] = useState(false);\n const [selectOpen, setSelectOpen] = useState(false);\n const [events, setEvents] = useState();\n const [activeFilters, setActiveFilters] = useState({});\n const filterLabels = {\n client: t(\"client\"),\n dateFrom: t(\"dateFrom\"),\n dateTo: t(\"dateTo\"),\n user: t(\"userId\"),\n type: t(\"eventType\")\n };\n const {\n getValues,\n register,\n reset,\n formState: {isDirty},\n control\n } = useForm({\n shouldUnregister: false,\n mode: \"onChange\",\n defaultValues\n });\n useFetch(() => adminClient.realms.getConfigEvents({realm}), (events2) => setEvents(events2), []);\n function loader(first, max) {\n return adminClient.realms.findEvents({\n ...activeFilters,\n realm,\n first,\n max\n });\n }\n function submitSearch() {\n setSearchDropdownOpen(false);\n commitFilters();\n }\n function removeFilter(key2) {\n const formValues = {...getValues()};\n delete formValues[key2];\n reset({...defaultValues, ...formValues});\n commitFilters();\n }\n function removeFilterValue(key2, valueToRemove) {\n const formValues = getValues();\n const fieldValue = formValues[key2];\n const newFieldValue = Array.isArray(fieldValue) ? fieldValue.filter((val) => val !== valueToRemove) : fieldValue;\n reset({...formValues, [key2]: newFieldValue});\n commitFilters();\n }\n function commitFilters() {\n const newFilters = pickBy(getValues(), (value) => value !== \"\" || Array.isArray(value) && value.length > 0);\n setActiveFilters(newFilters);\n setKey(key + 1);\n }\n function refresh() {\n commitFilters();\n }\n const UserDetailLink = (event) => /* @__PURE__ */ React.createElement(React.Fragment, null, event.userId && /* @__PURE__ */ React.createElement(Link, {\n key: `link-${event.time}-${event.type}`,\n to: toUser({\n realm,\n id: event.userId,\n tab: \"settings\"\n })\n }, event.userId), !event.userId && t(\"noUserDetails\"));\n const userEventSearchFormDisplay = () => {\n return /* @__PURE__ */ React.createElement(Flex, {\n direction: {default: \"column\"},\n spaceItems: {default: \"spaceItemsNone\"}\n }, /* @__PURE__ */ React.createElement(FlexItem, null, /* @__PURE__ */ React.createElement(Dropdown, {\n id: \"user-events-search-select\",\n \"data-testid\": \"UserEventsSearchSelector\",\n className: \"pf-u-ml-md\",\n toggle: /* @__PURE__ */ React.createElement(DropdownToggle, {\n \"data-testid\": \"userEventsSearchSelectorToggle\",\n onToggle: (isOpen) => setSearchDropdownOpen(isOpen),\n className: \"keycloak__events_search_selector_dropdown__toggle\"\n }, t(\"searchForUserEvent\")),\n isOpen: searchDropdownOpen\n }, /* @__PURE__ */ React.createElement(Form, {\n isHorizontal: true,\n className: \"keycloak__events_search__form\",\n \"data-testid\": \"searchForm\"\n }, /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"userId\"),\n fieldId: \"kc-userId\",\n className: \"keycloak__events_search__form_label\"\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: register(),\n type: \"text\",\n id: \"kc-userId\",\n name: \"user\",\n \"data-testid\": \"userId-searchField\"\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"eventType\"),\n fieldId: \"kc-eventType\",\n className: \"keycloak__events_search__form_label\"\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"type\",\n control,\n render: ({\n onChange,\n value\n }) => /* @__PURE__ */ React.createElement(Select, {\n className: \"keycloak__events_search__type_select\",\n name: \"eventType\",\n \"data-testid\": \"event-type-searchField\",\n chipGroupProps: {\n numChips: 1,\n expandedText: t(\"common:hide\"),\n collapsedText: t(\"common:showRemaining\")\n },\n variant: SelectVariant.typeaheadMulti,\n typeAheadAriaLabel: \"Select\",\n onToggle: (isOpen) => setSelectOpen(isOpen),\n selections: value,\n onSelect: (_, selectedValue) => {\n const option = selectedValue.toString();\n const changedValue = value.includes(option) ? value.filter((item) => item !== option) : [...value, option];\n onChange(changedValue);\n },\n onClear: (event) => {\n event.stopPropagation();\n onChange([]);\n },\n isOpen: selectOpen,\n \"aria-labelledby\": \"eventType\",\n chipGroupComponent: /* @__PURE__ */ React.createElement(ChipGroup, null, value.map((chip) => /* @__PURE__ */ React.createElement(Chip, {\n key: chip,\n onClick: (event) => {\n event.stopPropagation();\n onChange(value.filter((val) => val !== chip));\n }\n }, chip)))\n }, events?.enabledEventTypes?.map((option) => /* @__PURE__ */ React.createElement(SelectOption, {\n key: option,\n value: option\n })))\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"client\"),\n fieldId: \"kc-client\",\n className: \"keycloak__events_search__form_label\"\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: register(),\n type: \"text\",\n id: \"kc-client\",\n name: \"client\",\n \"data-testid\": \"client-searchField\"\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"dateFrom\"),\n fieldId: \"kc-dateFrom\",\n className: \"keycloak__events_search__form_label\"\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: register(),\n type: \"text\",\n id: \"kc-dateFrom\",\n name: \"dateFrom\",\n className: \"pf-c-form-control pf-m-icon pf-m-calendar\",\n placeholder: \"yyyy-MM-dd\",\n \"data-testid\": \"dateFrom-searchField\"\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"dateTo\"),\n fieldId: \"kc-dateTo\",\n className: \"keycloak__events_search__form_label\"\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: register(),\n type: \"text\",\n id: \"kc-dateTo\",\n name: \"dateTo\",\n className: \"pf-c-form-control pf-m-icon pf-m-calendar\",\n placeholder: \"yyyy-MM-dd\",\n \"data-testid\": \"dateTo-searchField\"\n })), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n className: \"keycloak__user_events_search__form_btn\",\n variant: \"primary\",\n onClick: submitSearch,\n \"data-testid\": \"search-events-btn\",\n isDisabled: !isDirty\n }, t(\"searchUserEventsBtn\"))))), /* @__PURE__ */ React.createElement(Button, {\n className: \"pf-u-ml-md\",\n onClick: refresh,\n \"data-testid\": \"refresh-btn\"\n }, t(\"refresh\"))), /* @__PURE__ */ React.createElement(FlexItem, null, Object.entries(activeFilters).length > 0 && /* @__PURE__ */ React.createElement(\"div\", {\n className: \"keycloak__searchChips pf-u-ml-md\"\n }, Object.entries(activeFilters).map((filter) => {\n const [key2, value] = filter;\n return /* @__PURE__ */ React.createElement(ChipGroup, {\n className: \"pf-u-mt-md pf-u-mr-md\",\n key: key2,\n categoryName: filterLabels[key2],\n isClosable: true,\n onClick: () => removeFilter(key2)\n }, typeof value === \"string\" ? /* @__PURE__ */ React.createElement(Chip, {\n isReadOnly: true\n }, value) : value.map((entry) => /* @__PURE__ */ React.createElement(Chip, {\n key: entry,\n onClick: () => removeFilterValue(key2, entry)\n }, entry)));\n }))));\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"events:title\",\n subKey: /* @__PURE__ */ React.createElement(Trans, {\n i18nKey: \"events:eventExplain\"\n }, \"If you want to configure user events, Admin events or Event listeners, please enter\", /* @__PURE__ */ React.createElement(Link, {\n to: toRealmSettings({realm, tab: \"events\"})\n }, t(\"eventConfig\")), \"page realm settings to configure.\"),\n divider: false\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n className: \"pf-u-p-0\"\n }, /* @__PURE__ */ React.createElement(KeycloakTabs, {\n isBox: true\n }, /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"userEvents\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"userEvents\"))\n }, /* @__PURE__ */ React.createElement(\"div\", {\n className: \"keycloak__events_table\"\n }, /* @__PURE__ */ React.createElement(KeycloakDataTable, {\n key,\n loader,\n detailColumns: [\n {\n name: \"details\",\n enabled: (event) => event.details !== void 0,\n cellRenderer: DetailCell\n }\n ],\n isPaginated: true,\n ariaLabelKey: \"events:title\",\n toolbarItem: userEventSearchFormDisplay(),\n columns: [\n {\n name: \"time\",\n displayKey: \"events:time\",\n cellRenderer: (row) => moment(row.time).format(\"LLL\"),\n cellFormatters: [expandable]\n },\n {\n name: \"userId\",\n displayKey: \"events:user\",\n cellRenderer: UserDetailLink\n },\n {\n name: \"type\",\n displayKey: \"events:eventType\",\n cellRenderer: StatusRow\n },\n {\n name: \"ipAddress\",\n displayKey: \"events:ipAddress\",\n transforms: [cellWidth(10)]\n },\n {\n name: \"clientId\",\n displayKey: \"events:client\"\n }\n ],\n emptyState: /* @__PURE__ */ React.createElement(ListEmptyState, {\n message: t(\"emptyEvents\"),\n instructions: t(\"emptyEventsInstructions\")\n }),\n isSearching: Object.keys(activeFilters).length > 0\n }))), /* @__PURE__ */ React.createElement(Tab, {\n eventKey: \"adminEvents\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"adminEvents\")),\n \"data-testid\": \"admin-events-tab\"\n }, /* @__PURE__ */ React.createElement(AdminEvents, null)))));\n}\n", "import React, {useEffect, useState} from \"../_snowpack/pkg/react.js\";\nimport {Link} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {\n Button,\n ButtonVariant,\n Chip,\n ChipGroup,\n InputGroup,\n PageSection,\n PageSectionVariants,\n Stack,\n StackItem,\n TextInput,\n ToolbarItem\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {SearchIcon} from \"../_snowpack/pkg/@patternfly/react-icons.js\";\nimport {KeycloakDataTable} from \"../components/table-toolbar/KeycloakDataTable.js\";\nimport {useAdminClient} from \"../context/auth/AdminClient.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {ListEmptyState} from \"../components/list-empty-state/ListEmptyState.js\";\nimport {GroupPath} from \"../components/group/GroupPath.js\";\nimport {useSubGroups} from \"./SubGroupsContext.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nexport default function SearchGroups() {\n const {t} = useTranslation(\"groups\");\n const adminClient = useAdminClient();\n const {realm} = useRealm();\n const [searchTerm, setSearchTerm] = useState(\"\");\n const [searchTerms, setSearchTerms] = useState([]);\n const [key, setKey] = useState(0);\n const refresh = () => setKey(new Date().getTime());\n const {setSubGroups} = useSubGroups();\n useEffect(() => setSubGroups([{name: t(\"searchGroups\"), id: \"search\"}]), []);\n const deleteTerm = (id) => {\n const index = searchTerms.indexOf(id);\n searchTerms.splice(index, 1);\n setSearchTerms([...searchTerms]);\n refresh();\n };\n const addTerm = () => {\n if (searchTerm !== \"\") {\n setSearchTerms([...searchTerms, searchTerm]);\n setSearchTerm(\"\");\n refresh();\n }\n };\n const GroupNameCell = (group) => /* @__PURE__ */ React.createElement(Link, {\n key: group.id,\n to: `/${realm}/groups/search/${group.link}`,\n onClick: () => setSubGroups([{name: t(\"searchGroups\"), id: \"search\"}, group])\n }, group.name);\n const flatten = (groups, id) => {\n let result = [];\n for (const group of groups) {\n const link = `${id || \"\"}${id ? \"/\" : \"\"}${group.id}`;\n result.push({...group, link});\n if (group.subGroups) {\n result = [...result, ...flatten(group.subGroups, link)];\n }\n }\n return result;\n };\n const loader = async (first, max) => {\n const params = {\n first,\n max\n };\n let result = [];\n if (searchTerms[0]) {\n result = await adminClient.groups.find({\n ...params,\n search: searchTerms[0]\n });\n result = flatten(result);\n for (const searchTerm2 of searchTerms) {\n result = result.filter((group) => group.name?.includes(searchTerm2));\n }\n }\n return result;\n };\n const Path = (group) => /* @__PURE__ */ React.createElement(GroupPath, {\n group\n });\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"groups:searchGroups\"\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: PageSectionVariants.light,\n className: \"pf-u-p-0\"\n }, /* @__PURE__ */ React.createElement(KeycloakDataTable, {\n key,\n isSearching: true,\n toolbarItem: /* @__PURE__ */ React.createElement(ToolbarItem, null, /* @__PURE__ */ React.createElement(Stack, null, /* @__PURE__ */ React.createElement(StackItem, {\n className: \"pf-u-mb-sm\"\n }, /* @__PURE__ */ React.createElement(InputGroup, null, /* @__PURE__ */ React.createElement(TextInput, {\n name: \"search\",\n \"data-testid\": \"group-search\",\n type: \"search\",\n \"aria-label\": t(\"search\"),\n placeholder: t(\"searchGroups\"),\n value: searchTerm,\n onChange: (value) => setSearchTerm(value),\n onKeyDown: (event) => {\n if (event.key === \"Enter\") {\n addTerm();\n }\n }\n }), /* @__PURE__ */ React.createElement(Button, {\n \"data-testid\": \"search-button\",\n variant: ButtonVariant.control,\n \"aria-label\": t(\"search\"),\n onClick: addTerm\n }, /* @__PURE__ */ React.createElement(SearchIcon, null)))), /* @__PURE__ */ React.createElement(StackItem, null, /* @__PURE__ */ React.createElement(ChipGroup, null, searchTerms.map((term) => /* @__PURE__ */ React.createElement(Chip, {\n key: term,\n onClick: () => deleteTerm(term)\n }, term)))))),\n ariaLabelKey: \"groups:groups\",\n isPaginated: true,\n loader,\n columns: [\n {\n name: \"name\",\n displayKey: \"groups:groupName\",\n cellRenderer: GroupNameCell\n },\n {\n name: \"path\",\n displayKey: \"groups:path\",\n cellRenderer: Path\n }\n ],\n emptyState: /* @__PURE__ */ React.createElement(ListEmptyState, {\n message: t(\"noSearchResults\"),\n instructions: t(\"noSearchResultsInstructions\"),\n hasIcon: false\n })\n })));\n}\n", "import React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {Link, useHistory, useLocation} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {\n DropdownItem,\n PageSection,\n PageSectionVariants,\n AlertVariant,\n Tab,\n TabTitleText,\n Tabs\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useFetch, useAdminClient} from \"../context/auth/AdminClient.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {useSubGroups} from \"./SubGroupsContext.js\";\nimport {GroupTable} from \"./GroupTable.js\";\nimport {getId, getLastId} from \"./groupIdUtils.js\";\nimport {Members} from \"./Members.js\";\nimport {GroupAttributes} from \"./GroupAttributes.js\";\nimport {GroupsModal} from \"./GroupsModal.js\";\nimport {toGroups} from \"./routes/Groups.js\";\nimport {toGroupsSearch} from \"./routes/GroupsSearch.js\";\nimport {GroupRoleMapping} from \"./GroupRoleMapping.js\";\nimport \"./GroupsSection.css\";\nexport default function GroupsSection() {\n const {t} = useTranslation(\"groups\");\n const [activeTab, setActiveTab] = useState(0);\n const adminClient = useAdminClient();\n const {subGroups, setSubGroups, currentGroup} = useSubGroups();\n const {addAlert, addError} = useAlerts();\n const {realm} = useRealm();\n const [rename, setRename] = useState();\n const history = useHistory();\n const location = useLocation();\n const id = getLastId(location.pathname);\n const deleteGroup = async (group) => {\n try {\n await adminClient.groups.del({\n id: group.id\n });\n addAlert(t(\"groupDeleted\", {count: 1}), AlertVariant.success);\n } catch (error) {\n addError(\"groups:groupDeleteError\", error);\n }\n return true;\n };\n useFetch(async () => {\n const ids = getId(location.pathname);\n const isNavigationStateInValid = ids && ids.length > subGroups.length;\n if (isNavigationStateInValid) {\n const groups = [];\n for (const i of ids) {\n const group = await adminClient.groups.findOne({id: i});\n if (group) {\n groups.push(group);\n } else {\n throw new Error(t(\"common:notFound\"));\n }\n }\n return groups;\n }\n return [];\n }, (groups) => {\n if (groups.length)\n setSubGroups(groups);\n }, [id]);\n const SearchDropdown = /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"searchGroup\",\n component: /* @__PURE__ */ React.createElement(Link, {\n \"data-testid\": \"searchGroup\",\n to: toGroupsSearch({realm})\n }, t(\"searchGroup\"))\n });\n return /* @__PURE__ */ React.createElement(React.Fragment, null, rename && /* @__PURE__ */ React.createElement(GroupsModal, {\n id,\n rename,\n refresh: (group) => setSubGroups([...subGroups.slice(0, subGroups.length - 1), group]),\n handleModalToggle: () => setRename(void 0)\n }), /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: !id ? \"groups:groups\" : currentGroup().name,\n subKey: !id ? \"groups:groupsDescription\" : \"\",\n divider: !id,\n dropdownItems: id ? [\n SearchDropdown,\n /* @__PURE__ */ React.createElement(DropdownItem, {\n \"data-testid\": \"renameGroupAction\",\n key: \"renameGroup\",\n onClick: () => setRename(currentGroup().name)\n }, t(\"renameGroup\")),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n \"data-testid\": \"deleteGroup\",\n key: \"deleteGroup\",\n onClick: async () => {\n await deleteGroup({id});\n history.push(toGroups({realm}));\n }\n }, t(\"deleteGroup\"))\n ] : [SearchDropdown]\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: PageSectionVariants.light,\n className: \"pf-u-p-0\"\n }, subGroups.length > 0 && /* @__PURE__ */ React.createElement(Tabs, {\n inset: {\n default: \"insetNone\",\n md: \"insetSm\",\n xl: \"inset2xl\",\n \"2xl\": \"insetLg\"\n },\n activeKey: activeTab,\n onSelect: (_, key) => setActiveTab(key),\n isBox: true\n }, /* @__PURE__ */ React.createElement(Tab, {\n \"data-testid\": \"groups\",\n eventKey: 0,\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"childGroups\"))\n }, /* @__PURE__ */ React.createElement(GroupTable, null)), /* @__PURE__ */ React.createElement(Tab, {\n \"data-testid\": \"members\",\n eventKey: 1,\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"members\"))\n }, /* @__PURE__ */ React.createElement(Members, null)), /* @__PURE__ */ React.createElement(Tab, {\n \"data-testid\": \"attributes\",\n eventKey: 2,\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:attributes\"))\n }, /* @__PURE__ */ React.createElement(GroupAttributes, null)), /* @__PURE__ */ React.createElement(Tab, {\n eventKey: 3,\n \"data-testid\": \"role-mapping-tab\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"roleMapping\"))\n }, /* @__PURE__ */ React.createElement(GroupRoleMapping, {\n id,\n name: currentGroup().name\n }))), subGroups.length === 0 && /* @__PURE__ */ React.createElement(GroupTable, null)));\n}\n", "import React from \"../../_snowpack/pkg/react.js\";\nimport {Link, useHistory, useRouteMatch} from \"../../_snowpack/pkg/react-router-dom.js\";\nimport {useTranslation} from \"../../_snowpack/pkg/react-i18next.js\";\nimport {FormProvider, useForm} from \"../../_snowpack/pkg/react-hook-form.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n PageSection\n} from \"../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {FormAccess} from \"../../components/form-access/FormAccess.js\";\nimport {ViewHeader} from \"../../components/view-header/ViewHeader.js\";\nimport {useAdminClient} from \"../../context/auth/AdminClient.js\";\nimport {OIDCGeneralSettings} from \"./OIDCGeneralSettings.js\";\nimport {OpenIdConnectSettings} from \"./OpenIdConnectSettings.js\";\nimport {useRealm} from \"../../context/realm-context/RealmContext.js\";\nimport {OIDCAuthentication} from \"./OIDCAuthentication.js\";\nimport {useAlerts} from \"../../components/alert/Alerts.js\";\nimport {toIdentityProvider} from \"../routes/IdentityProvider.js\";\nimport {toIdentityProviders} from \"../routes/IdentityProviders.js\";\nexport default function AddOpenIdConnect() {\n const {t} = useTranslation(\"identity-providers\");\n const history = useHistory();\n const {url} = useRouteMatch();\n const isKeycloak = url.endsWith(\"keycloak-oidc\");\n const id = `${isKeycloak ? \"keycloak-\" : \"\"}oidc`;\n const form = useForm({\n defaultValues: {alias: id}\n });\n const {\n handleSubmit,\n formState: {isDirty}\n } = form;\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const {realm} = useRealm();\n const save = async (provider) => {\n delete provider.discoveryEndpoint;\n try {\n await adminClient.identityProviders.create({\n ...provider,\n providerId: id\n });\n addAlert(t(\"createSuccess\"), AlertVariant.success);\n history.push(toIdentityProvider({\n realm,\n providerId: id,\n alias: provider.alias,\n tab: \"settings\"\n }));\n } catch (error) {\n addError(\"identity-providers:createError\", error);\n }\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: t(isKeycloak ? \"addKeycloakOpenIdProvider\" : \"addOpenIdProvider\")\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormProvider, {\n ...form\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n role: \"manage-identity-providers\",\n isHorizontal: true,\n onSubmit: handleSubmit(save)\n }, /* @__PURE__ */ React.createElement(OIDCGeneralSettings, {\n id\n }), /* @__PURE__ */ React.createElement(OpenIdConnectSettings, null), /* @__PURE__ */ React.createElement(OIDCAuthentication, null), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n isDisabled: !isDirty,\n variant: \"primary\",\n type: \"submit\",\n \"data-testid\": \"createProvider\"\n }, t(\"common:add\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n \"data-testid\": \"cancel\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toIdentityProviders({realm})\n })\n }, t(\"common:cancel\")))))));\n}\n", "import React from \"../../_snowpack/pkg/react.js\";\nimport {Link, useHistory} from \"../../_snowpack/pkg/react-router-dom.js\";\nimport {useTranslation} from \"../../_snowpack/pkg/react-i18next.js\";\nimport {FormProvider, useForm} from \"../../_snowpack/pkg/react-hook-form.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n PageSection\n} from \"../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {FormAccess} from \"../../components/form-access/FormAccess.js\";\nimport {ViewHeader} from \"../../components/view-header/ViewHeader.js\";\nimport {useAdminClient} from \"../../context/auth/AdminClient.js\";\nimport {SamlGeneralSettings} from \"./SamlGeneralSettings.js\";\nimport {SamlConnectSettings} from \"./SamlConnectSettings.js\";\nimport {useRealm} from \"../../context/realm-context/RealmContext.js\";\nimport {useAlerts} from \"../../components/alert/Alerts.js\";\nimport {toIdentityProvider} from \"../routes/IdentityProvider.js\";\nimport {toIdentityProviders} from \"../routes/IdentityProviders.js\";\nexport default function AddSamlConnect() {\n const {t} = useTranslation(\"identity-providers\");\n const history = useHistory();\n const id = \"saml\";\n const form = useForm({\n defaultValues: {alias: id}\n });\n const {\n handleSubmit,\n formState: {isDirty}\n } = form;\n const adminClient = useAdminClient();\n const {addAlert} = useAlerts();\n const {realm} = useRealm();\n const save = async (provider) => {\n delete provider.discoveryEndpoint;\n try {\n await adminClient.identityProviders.create({\n ...provider,\n providerId: id\n });\n addAlert(t(\"createSuccess\"), AlertVariant.success);\n history.push(toIdentityProvider({\n realm,\n providerId: id,\n alias: provider.alias,\n tab: \"settings\"\n }));\n } catch (error) {\n addAlert(t(\"createError\", {\n error: error.response?.data?.errorMessage || error\n }), AlertVariant.danger);\n }\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: t(\"addSamlProvider\")\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(FormProvider, {\n ...form\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n role: \"manage-identity-providers\",\n isHorizontal: true,\n onSubmit: handleSubmit(save)\n }, /* @__PURE__ */ React.createElement(SamlGeneralSettings, {\n id\n }), /* @__PURE__ */ React.createElement(SamlConnectSettings, null), /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n isDisabled: !isDirty,\n variant: \"primary\",\n type: \"submit\",\n \"data-testid\": \"createProvider\"\n }, t(\"common:add\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n \"data-testid\": \"cancel\",\n component: (props) => /* @__PURE__ */ React.createElement(Link, {\n ...props,\n to: toIdentityProviders({realm})\n })\n }, t(\"common:cancel\")))))));\n}\n", "import React from \"../_snowpack/pkg/react.js\";\nimport {PageSection} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useAdminClient} from \"../context/auth/AdminClient.js\";\nimport {RolesList} from \"./RolesList.js\";\nexport default function RealmRolesSection() {\n const adminClient = useAdminClient();\n const loader = (first, max, search) => {\n const params = {\n first,\n max\n };\n const searchParam = search || \"\";\n if (searchParam) {\n params.search = searchParam;\n }\n return adminClient.roles.find(params);\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"roles:title\",\n subKey: \"roles:roleExplain\"\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n padding: {default: \"noPadding\"}\n }, /* @__PURE__ */ React.createElement(RolesList, {\n loader\n })));\n}\n", "import React, {useState} from \"../../../_snowpack/pkg/react.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n FileUpload,\n FormGroup,\n PageSection,\n Select,\n SelectOption,\n SelectVariant,\n Switch,\n TextInput,\n ValidatedOptions\n} from \"../../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {useTranslation} from \"../../../_snowpack/pkg/react-i18next.js\";\nimport {Controller, useForm} from \"../../../_snowpack/pkg/react-hook-form.js\";\nimport {HelpItem} from \"../../../components/help-enabler/HelpItem.js\";\nimport {useServerInfo} from \"../../../context/server-info/ServerInfoProvider.js\";\nimport {useAdminClient, useFetch} from \"../../../context/auth/AdminClient.js\";\nimport {useParams, useRouteMatch} from \"../../../_snowpack/pkg/react-router-dom.js\";\nimport {FormAccess} from \"../../../components/form-access/FormAccess.js\";\nimport {ViewHeader} from \"../../../components/view-header/ViewHeader.js\";\nimport {convertToFormValues, KEY_PROVIDER_TYPE} from \"../../../util.js\";\nimport {useAlerts} from \"../../../components/alert/Alerts.js\";\nexport const RSAForm = ({\n editMode,\n providerType,\n handleModalToggle,\n refresh\n}) => {\n const {t} = useTranslation(\"realm-settings\");\n const serverInfo = useServerInfo();\n const [component, setComponent] = useState();\n const [isRSAalgDropdownOpen, setIsRSAalgDropdownOpen] = useState(false);\n const [keyFileName, setKeyFileName] = useState(\"\");\n const [certificateFileName, setCertificateFileName] = useState(\"\");\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const {id} = useParams();\n const providerId = useRouteMatch(\"/:providerType?\")?.params.providerType;\n const save = async (component2) => {\n try {\n if (id) {\n await adminClient.components.update({id}, {\n ...component2,\n parentId: component2.parentId,\n providerId: providerType,\n providerType: KEY_PROVIDER_TYPE\n });\n addAlert(t(\"saveProviderSuccess\"), AlertVariant.success);\n } else {\n await adminClient.components.create({\n ...component2,\n parentId: component2.parentId,\n providerId: providerType,\n providerType: KEY_PROVIDER_TYPE,\n config: {priority: [\"0\"]}\n });\n handleModalToggle?.();\n addAlert(t(\"saveProviderSuccess\"), AlertVariant.success);\n refresh?.();\n }\n } catch (error) {\n addError(\"realm-settings:saveProviderError\", error);\n }\n };\n const form = useForm({mode: \"onChange\"});\n const setupForm = (component2) => {\n form.reset();\n convertToFormValues(component2, form.setValue);\n };\n useFetch(async () => {\n if (editMode)\n return await adminClient.components.findOne({id});\n }, (result) => {\n if (result) {\n setupForm(result);\n setComponent(result);\n }\n }, []);\n const allComponentTypes = serverInfo.componentTypes?.[KEY_PROVIDER_TYPE] ?? [];\n const rsaAlgOptions = allComponentTypes[4].properties[3].options;\n return /* @__PURE__ */ React.createElement(FormAccess, {\n isHorizontal: true,\n id: \"add-provider\",\n className: \"pf-u-mt-lg\",\n role: \"manage-realm\",\n onSubmit: form.handleSubmit(save)\n }, editMode && /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"providerId\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"client-scopes-help:mapperName\",\n fieldLabelId: \"realm-settings:providerId\"\n }),\n fieldId: \"id\",\n isRequired: true,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, /* @__PURE__ */ React.createElement(TextInput, {\n ref: form.register(),\n id: \"id\",\n type: \"text\",\n name: \"id\",\n isReadOnly: editMode,\n \"aria-label\": t(\"consoleDisplayName\"),\n defaultValue: id,\n \"data-testid\": \"display-name-input\"\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:name\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"client-scopes-help:mapperName\",\n fieldLabelId: \"name\"\n }),\n fieldId: \"name\",\n isRequired: true,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default,\n helperTextInvalid: t(\"common:required\")\n }, !editMode && /* @__PURE__ */ React.createElement(Controller, {\n name: \"name\",\n control: form.control,\n defaultValue: providerType,\n render: ({onChange, value}) => {\n return /* @__PURE__ */ React.createElement(TextInput, {\n id: \"name\",\n type: \"text\",\n \"aria-label\": t(\"consoleDisplayName\"),\n defaultValue: providerType,\n value,\n onChange: (value2) => onChange(value2),\n \"data-testid\": \"display-name-input\"\n });\n }\n }), editMode && /* @__PURE__ */ React.createElement(TextInput, {\n ref: form.register(),\n type: \"text\",\n id: \"name\",\n name: \"name\",\n defaultValue: providerId,\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:enabled\"),\n fieldId: \"kc-enabled\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: t(\"realm-settings-help:enabled\"),\n fieldLabelId: \"enabled\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.enabled\",\n control: form.control,\n defaultValue: [\"true\"],\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Switch, {\n id: \"kc-enabled-switch\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value[0] === \"true\",\n \"data-testid\": value[0] === \"true\" ? \"enabled\" : \"disabled\",\n onChange: (value2) => {\n onChange([value2.toString()]);\n }\n })\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"active\"),\n fieldId: \"kc-active\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:active\",\n fieldLabelId: \"active\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.active\",\n control: form.control,\n defaultValue: [\"true\"],\n render: ({onChange, value}) => {\n return /* @__PURE__ */ React.createElement(Switch, {\n id: \"kc-active-switch\",\n label: t(\"common:on\"),\n labelOff: t(\"common:off\"),\n isChecked: value[0] === \"true\",\n \"data-testid\": value[0] === \"true\" ? \"active\" : \"passive\",\n onChange: (value2) => {\n onChange([value2.toString()]);\n }\n });\n }\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"algorithm\"),\n fieldId: \"kc-algorithm\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:algorithm\",\n fieldLabelId: \"realm-settings:algorithm\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.algorithm\",\n defaultValue: [\"RS256\"],\n control: form.control,\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Select, {\n toggleId: \"kc-rsa-algorithm\",\n onToggle: () => setIsRSAalgDropdownOpen(!isRSAalgDropdownOpen),\n onSelect: (_, value2) => {\n onChange([value2.toString()]);\n setIsRSAalgDropdownOpen(false);\n },\n selections: [value.toString()],\n variant: SelectVariant.single,\n \"aria-label\": t(\"algorithm\"),\n isOpen: isRSAalgDropdownOpen,\n \"data-testid\": \"select-rsa-algorithm\"\n }, rsaAlgOptions.map((p, idx) => /* @__PURE__ */ React.createElement(SelectOption, {\n selected: p === value,\n key: `rsa-algorithm-${idx}`,\n value: p\n })))\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"privateRSAKey\"),\n fieldId: \"kc-private-rsa-key\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:privateRSAKey\",\n fieldLabelId: \"realm-settings:privateRSAKey\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.privateKey\",\n control: form.control,\n defaultValue: [],\n render: ({onChange}) => /* @__PURE__ */ React.createElement(FileUpload, {\n id: \"importPrivateKey\",\n type: \"text\",\n value: component?.config?.privateKey[0],\n filenamePlaceholder: \"Upload a PEM file or paste key below\",\n filename: keyFileName,\n onChange: (value, fileName) => {\n setKeyFileName(fileName);\n onChange([value]);\n }\n })\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"x509Certificate\"),\n fieldId: \"kc-aes-keysize\",\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"realm-settings-help:x509Certificate\",\n fieldLabelId: \"realm-settings:x509Certificate\"\n })\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.certificate\",\n control: form.control,\n defaultValue: [],\n render: ({onChange}) => /* @__PURE__ */ React.createElement(FileUpload, {\n id: \"importCertificate\",\n type: \"text\",\n value: component?.config?.certificate[0],\n filenamePlaceholder: \"Upload a PEM file or paste key below\",\n filename: certificateFileName,\n onChange: (value, fileName) => {\n setCertificateFileName(fileName);\n onChange([value]);\n }\n })\n })), /* @__PURE__ */ React.createElement(ActionGroup, {\n className: \"kc-hmac-form-buttons\"\n }, /* @__PURE__ */ React.createElement(Button, {\n className: \"kc-hmac-form-save-button\",\n \"data-testid\": \"add-provider-button\",\n variant: \"primary\",\n type: \"submit\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n className: \"kc-hmac-form-cancel-button\",\n onClick: !editMode && handleModalToggle || void 0,\n variant: \"link\"\n }, t(\"common:cancel\"))));\n};\nexport default function RSASettings() {\n const {t} = useTranslation(\"realm-settings\");\n const providerId = useRouteMatch(\"/:realm/realm-settings/keys/:id?/:providerType?/settings\")?.params.providerType;\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: t(\"editProvider\"),\n subKey: providerId\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(RSAForm, {\n providerType: providerId,\n editMode: true\n })));\n}\n", "import React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {Link} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport moment from \"../_snowpack/pkg/moment.js\";\nimport {\n DropdownItem,\n PageSection,\n Select,\n SelectOption,\n SelectVariant\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {FilterIcon} from \"../_snowpack/pkg/@patternfly/react-icons.js\";\nimport {ListEmptyState} from \"../components/list-empty-state/ListEmptyState.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {KeycloakDataTable} from \"../components/table-toolbar/KeycloakDataTable.js\";\nimport {useAdminClient} from \"../context/auth/AdminClient.js\";\nimport {CubesIcon} from \"../_snowpack/pkg/@patternfly/react-icons.js\";\nimport \"./SessionsSection.css\";\nimport {RevocationModal} from \"./RevocationModal.js\";\nimport {LogoutAllSessionsModal} from \"./LogoutAllSessionsModal.js\";\nconst Clients = (row) => {\n return /* @__PURE__ */ React.createElement(React.Fragment, null, Object.values(row.clients).map((client) => /* @__PURE__ */ React.createElement(Link, {\n key: client,\n to: \"\",\n className: \"pf-u-mx-sm\"\n }, client)));\n};\nexport default function SessionsSection() {\n const {t} = useTranslation(\"sessions\");\n const adminClient = useAdminClient();\n const [filterDropdownOpen, setFilterDropdownOpen] = useState(false);\n const [revocationModalOpen, setRevocationModalOpen] = useState(false);\n const [logoutAllSessionsModalOpen, setLogoutAllSessionsModalOpen] = useState(false);\n const [activeClientDetails, setActiveClientDetails] = useState([]);\n const [filterType, setFilterType] = useState(t(\"sessionsType.allSessions\").toString());\n const [key, setKey] = useState(0);\n const [noSessions, setNoSessions] = useState(false);\n const refresh = () => {\n setKey(new Date().getTime());\n };\n const handleRevocationModalToggle = () => {\n setRevocationModalOpen(!revocationModalOpen);\n };\n const handleLogoutAllSessionsModalToggle = () => {\n setLogoutAllSessionsModalOpen(!logoutAllSessionsModalOpen);\n };\n const loader = async () => {\n const activeClients = await adminClient.sessions.find();\n const clientSessions = (await Promise.all(activeClients.map((client) => adminClient.clients.listSessions({id: client.id})))).flat();\n setNoSessions(clientSessions.length === 0);\n const allClients = await adminClient.clients.find();\n const getActiveClientDetails = allClients.filter((x) => activeClients.map((y) => y.id).includes(x.id));\n setActiveClientDetails(getActiveClientDetails);\n const userIds = Array.from(new Set(clientSessions.map((session) => session.userId)));\n const userSessions = (await Promise.all(userIds.map((userId) => adminClient.users.listSessions({id: userId})))).flat();\n return userSessions;\n };\n const dropdownItems = [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"toggle-modal\",\n \"data-testid\": \"revocation\",\n component: \"button\",\n onClick: () => handleRevocationModalToggle()\n }, t(\"revocation\")),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"delete-role\",\n \"data-testid\": \"logout-all\",\n component: \"button\",\n isDisabled: noSessions,\n onClick: () => handleLogoutAllSessionsModalToggle()\n }, t(\"signOutAllActiveSessions\"))\n ];\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n dropdownItems,\n titleKey: \"sessions:title\",\n subKey: \"sessions:sessionExplain\"\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n className: \"pf-u-p-0\"\n }, revocationModalOpen && /* @__PURE__ */ React.createElement(RevocationModal, {\n handleModalToggle: handleRevocationModalToggle,\n activeClients: activeClientDetails,\n save: () => {\n handleRevocationModalToggle();\n }\n }), logoutAllSessionsModalOpen && /* @__PURE__ */ React.createElement(LogoutAllSessionsModal, {\n handleModalToggle: handleLogoutAllSessionsModalToggle\n }), /* @__PURE__ */ React.createElement(KeycloakDataTable, {\n key,\n loader,\n ariaLabelKey: \"session:title\",\n searchPlaceholderKey: \"sessions:searchForSession\",\n searchTypeComponent: /* @__PURE__ */ React.createElement(Select, {\n \"data-testid\": \"filter-session-type-select\",\n isOpen: filterDropdownOpen,\n className: \"kc-filter-session-type-select\",\n variant: SelectVariant.single,\n onToggle: (isExpanded) => setFilterDropdownOpen(isExpanded),\n toggleIcon: /* @__PURE__ */ React.createElement(FilterIcon, null),\n onSelect: (_, value) => {\n setFilterType(value.toString());\n refresh();\n setFilterDropdownOpen(false);\n },\n selections: filterType\n }, /* @__PURE__ */ React.createElement(SelectOption, {\n \"data-testid\": \"all-sessions-option\",\n value: t(\"sessionsType.allSessions\"),\n isPlaceholder: true\n }), /* @__PURE__ */ React.createElement(SelectOption, {\n \"data-testid\": \"regular-sso-option\",\n value: t(\"sessionsType.regularSSO\")\n }), /* @__PURE__ */ React.createElement(SelectOption, {\n \"data-testid\": \"offline-option\",\n value: t(\"sessionsType.offline\")\n }), /* @__PURE__ */ React.createElement(SelectOption, {\n \"data-testid\": \"direct-grant-option\",\n value: t(\"sessionsType.directGrant\")\n }), /* @__PURE__ */ React.createElement(SelectOption, {\n \"data-testid\": \"service-account-option\",\n value: t(\"sessionsType.serviceAccount\")\n })),\n columns: [\n {\n name: \"username\",\n displayKey: \"sessions:subject\"\n },\n {\n name: \"lastAccess\",\n displayKey: \"sessions:lastAccess\",\n cellRenderer: (row) => moment(row.lastAccess).fromNow()\n },\n {\n name: \"start\",\n displayKey: \"sessions:startDate\",\n cellRenderer: (row) => moment(row.lastAccess).format(\"LLL\")\n },\n {\n name: \"clients\",\n displayKey: \"sessions:accessedClients\",\n cellRenderer: Clients\n }\n ],\n emptyState: /* @__PURE__ */ React.createElement(ListEmptyState, {\n hasIcon: true,\n icon: CubesIcon,\n message: t(\"noSessions\"),\n instructions: t(\"noSessionsDescription\")\n })\n })));\n}\n", "import React from \"../_snowpack/pkg/react.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n ButtonVariant,\n DropdownItem,\n Form,\n PageSection\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {KerberosSettingsRequired} from \"./kerberos/KerberosSettingsRequired.js\";\nimport {SettingsCache} from \"./shared/SettingsCache.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {Controller, useForm} from \"../_snowpack/pkg/react-hook-form.js\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useHistory, useParams} from \"../_snowpack/pkg/react-router-dom.js\";\nconst KerberosSettingsHeader = ({\n onChange,\n value,\n save,\n toggleDeleteDialog\n}) => {\n const {t} = useTranslation(\"user-federation\");\n const {id} = useParams();\n const [toggleDisableDialog, DisableConfirm] = useConfirmDialog({\n titleKey: \"user-federation:userFedDisableConfirmTitle\",\n messageKey: \"user-federation:userFedDisableConfirm\",\n continueButtonLabel: \"common:disable\",\n onConfirm: () => {\n onChange(\"false\");\n save();\n }\n });\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DisableConfirm, null), !id ? /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"Kerberos\"\n }) : /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"Kerberos\",\n dropdownItems: [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"delete\",\n onClick: () => toggleDeleteDialog(),\n \"data-testid\": \"delete-kerberos-cmd\"\n }, t(\"deleteProvider\"))\n ],\n isEnabled: value === \"true\",\n onToggle: (value2) => {\n if (!value2) {\n toggleDisableDialog();\n } else {\n onChange(value2.toString());\n save();\n }\n }\n }));\n};\nexport default function UserFederationKerberosSettings() {\n const {t} = useTranslation(\"user-federation\");\n const form = useForm({mode: \"onChange\"});\n const history = useHistory();\n const adminClient = useAdminClient();\n const {realm} = useRealm();\n const {id} = useParams();\n const {addAlert, addError} = useAlerts();\n useFetch(async () => {\n if (id) {\n return adminClient.components.findOne({id});\n }\n }, (fetchedComponent) => {\n if (fetchedComponent) {\n setupForm(fetchedComponent);\n } else if (id) {\n throw new Error(t(\"common:notFound\"));\n }\n }, []);\n const setupForm = (component) => {\n form.reset({...component});\n };\n const save = async (component) => {\n try {\n if (!id) {\n await adminClient.components.create(component);\n history.push(`/${realm}/user-federation`);\n } else {\n await adminClient.components.update({id}, component);\n }\n setupForm(component);\n addAlert(t(!id ? \"createSuccess\" : \"saveSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(`user-federation:${!id ? \"createError\" : \"saveError\"}`, error);\n }\n };\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"user-federation:userFedDeleteConfirmTitle\",\n messageKey: \"user-federation:userFedDeleteConfirm\",\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.components.del({id});\n addAlert(t(\"userFedDeletedSuccess\"), AlertVariant.success);\n history.replace(`/${realm}/user-federation`);\n } catch (error) {\n addAlert(\"user-federation:userFedDeleteError\", error);\n }\n }\n });\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.enabled[0]\",\n defaultValue: [\"true\"][0],\n control: form.control,\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(KerberosSettingsHeader, {\n value,\n onChange,\n save: () => save(form.getValues()),\n toggleDeleteDialog\n })\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\"\n }, /* @__PURE__ */ React.createElement(KerberosSettingsRequired, {\n form,\n showSectionHeading: true\n })), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n isFilled: true\n }, /* @__PURE__ */ React.createElement(SettingsCache, {\n form,\n showSectionHeading: true\n }), /* @__PURE__ */ React.createElement(Form, {\n onSubmit: form.handleSubmit(save)\n }, /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n isDisabled: !form.formState.isDirty,\n variant: \"primary\",\n type: \"submit\",\n \"data-testid\": \"kerberos-save\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n onClick: () => history.push(`/${realm}/user-federation`),\n \"data-testid\": \"kerberos-cancel\"\n }, t(\"common:cancel\"))))));\n}\n", "import React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n ButtonVariant,\n DropdownItem,\n DropdownSeparator,\n Form,\n PageSection,\n Tab,\n TabTitleText\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {LdapSettingsAdvanced} from \"./ldap/LdapSettingsAdvanced.js\";\nimport {LdapSettingsKerberosIntegration} from \"./ldap/LdapSettingsKerberosIntegration.js\";\nimport {SettingsCache} from \"./shared/SettingsCache.js\";\nimport {LdapSettingsSynchronization} from \"./ldap/LdapSettingsSynchronization.js\";\nimport {LdapSettingsGeneral} from \"./ldap/LdapSettingsGeneral.js\";\nimport {LdapSettingsConnection} from \"./ldap/LdapSettingsConnection.js\";\nimport {LdapSettingsSearching} from \"./ldap/LdapSettingsSearching.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport {Controller, useForm} from \"../_snowpack/pkg/react-hook-form.js\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useHistory, useParams} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {ScrollForm} from \"../components/scroll-form/ScrollForm.js\";\nimport {KeycloakTabs} from \"../components/keycloak-tabs/KeycloakTabs.js\";\nimport {LdapMapperList} from \"./ldap/mappers/LdapMapperList.js\";\nconst LdapSettingsHeader = ({\n onChange,\n value,\n editMode,\n save,\n toggleDeleteDialog,\n toggleRemoveUsersDialog\n}) => {\n const {t} = useTranslation(\"user-federation\");\n const {id} = useParams();\n const adminClient = useAdminClient();\n const {addAlert, addError} = useAlerts();\n const [toggleDisableDialog, DisableConfirm] = useConfirmDialog({\n titleKey: \"user-federation:userFedDisableConfirmTitle\",\n messageKey: \"user-federation:userFedDisableConfirm\",\n continueButtonLabel: \"common:disable\",\n onConfirm: () => {\n onChange(\"false\");\n save();\n }\n });\n const [toggleUnlinkUsersDialog, UnlinkUsersDialog] = useConfirmDialog({\n titleKey: \"user-federation:userFedUnlinkUsersConfirmTitle\",\n messageKey: \"user-federation:userFedUnlinkUsersConfirm\",\n continueButtonLabel: \"user-federation:unlinkUsers\",\n onConfirm: () => unlinkUsers()\n });\n const syncChangedUsers = async () => {\n try {\n if (id) {\n const response = await adminClient.userStorageProvider.sync({\n id,\n action: \"triggerChangedUsersSync\"\n });\n if (response.ignored) {\n addAlert(`${response.status}.`, AlertVariant.warning);\n } else {\n addAlert(t(\"syncUsersSuccess\") + `${response.added} users added, ${response.updated} users updated, ${response.removed} users removed, ${response.failed} users failed.`, AlertVariant.success);\n }\n }\n } catch (error) {\n addError(\"user-federation:syncUsersError\", error);\n }\n };\n const syncAllUsers = async () => {\n try {\n if (id) {\n const response = await adminClient.userStorageProvider.sync({\n id,\n action: \"triggerFullSync\"\n });\n if (response.ignored) {\n addAlert(`${response.status}.`, AlertVariant.warning);\n } else {\n addAlert(t(\"syncUsersSuccess\") + `${response.added} users added, ${response.updated} users updated, ${response.removed} users removed, ${response.failed} users failed.`, AlertVariant.success);\n }\n }\n } catch (error) {\n addError(\"user-federation:syncUsersError\", error);\n }\n };\n const unlinkUsers = async () => {\n try {\n if (id) {\n await adminClient.userStorageProvider.unlinkUsers({id});\n }\n addAlert(t(\"unlinkUsersSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"user-federation:unlinkUsersError\", error);\n }\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DisableConfirm, null), /* @__PURE__ */ React.createElement(UnlinkUsersDialog, null), !id ? /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: t(\"addOneLdap\")\n }) : /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"LDAP\",\n dropdownItems: [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"sync\",\n onClick: syncChangedUsers\n }, t(\"syncChangedUsers\")),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"syncall\",\n onClick: syncAllUsers\n }, t(\"syncAllUsers\")),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"unlink\",\n isDisabled: editMode ? !editMode.includes(\"UNSYNCED\") : false,\n onClick: toggleUnlinkUsersDialog\n }, t(\"unlinkUsers\")),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"remove\",\n onClick: toggleRemoveUsersDialog\n }, t(\"removeImported\")),\n /* @__PURE__ */ React.createElement(DropdownSeparator, {\n key: \"separator\"\n }),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"delete\",\n onClick: toggleDeleteDialog,\n \"data-testid\": \"delete-ldap-cmd\"\n }, t(\"deleteProvider\"))\n ],\n isEnabled: value === \"true\",\n onToggle: (value2) => {\n if (!value2) {\n toggleDisableDialog();\n } else {\n onChange(\"\" + value2);\n save();\n }\n }\n }));\n};\nexport default function UserFederationLdapSettings() {\n const {t} = useTranslation(\"user-federation\");\n const form = useForm({mode: \"onChange\"});\n const history = useHistory();\n const adminClient = useAdminClient();\n const {realm} = useRealm();\n const {id} = useParams();\n const {addAlert, addError} = useAlerts();\n const [component, setComponent] = useState();\n const [refreshCount, setRefreshCount] = useState(0);\n const editMode = component?.config?.editMode;\n const refresh = () => setRefreshCount((count) => count + 1);\n useFetch(async () => {\n if (id) {\n return await adminClient.components.findOne({id});\n }\n return void 0;\n }, (fetchedComponent) => {\n if (fetchedComponent) {\n setupForm(fetchedComponent);\n setComponent(fetchedComponent);\n } else if (id) {\n throw new Error(t(\"common:notFound\"));\n }\n }, [refreshCount]);\n const setupForm = (component2) => {\n form.reset({...component2});\n form.setValue(\"config.periodicChangedUsersSync\", component2.config?.[\"changedSyncPeriod\"][0] !== \"-1\");\n form.setValue(\"config.periodicFullSync\", component2.config?.[\"fullSyncPeriod\"][0] !== \"-1\");\n };\n const removeImportedUsers = async () => {\n try {\n if (id) {\n await adminClient.userStorageProvider.removeImportedUsers({id});\n }\n addAlert(t(\"removeImportedUsersSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"user-federation:removeImportedUsersError\", error);\n }\n };\n const save = async (component2) => {\n if (component2.config?.periodicChangedUsersSync !== null) {\n if (component2.config?.periodicChangedUsersSync === false) {\n component2.config.changedSyncPeriod = [\"-1\"];\n }\n delete component2.config?.periodicChangedUsersSync;\n }\n if (component2.config?.periodicFullSync !== null) {\n if (component2.config?.periodicFullSync === false) {\n component2.config.fullSyncPeriod = [\"-1\"];\n }\n delete component2.config?.periodicFullSync;\n }\n try {\n if (!id) {\n await adminClient.components.create(component2);\n history.push(`/${realm}/user-federation`);\n } else {\n await adminClient.components.update({id}, component2);\n }\n addAlert(t(id ? \"saveSuccess\" : \"createSuccess\"), AlertVariant.success);\n refresh();\n } catch (error) {\n addError(`user-federation:${id ? \"saveError\" : \"createError\"}`, error);\n }\n };\n const [toggleRemoveUsersDialog, RemoveUsersConfirm] = useConfirmDialog({\n titleKey: t(\"removeImportedUsers\"),\n messageKey: t(\"removeImportedUsersMessage\"),\n continueButtonLabel: \"common:remove\",\n onConfirm: async () => {\n try {\n removeImportedUsers();\n addAlert(t(\"removeImportedUsersSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"user-federation:removeImportedUsersError\", error);\n }\n }\n });\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"user-federation:userFedDeleteConfirmTitle\",\n messageKey: \"user-federation:userFedDeleteConfirm\",\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.components.del({id});\n addAlert(t(\"userFedDeletedSuccess\"), AlertVariant.success);\n history.replace(`/${realm}/user-federation`);\n } catch (error) {\n addError(\"user-federation:userFedDeleteError\", error);\n }\n }\n });\n const addLdapFormContent = () => {\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ScrollForm, {\n sections: [\n t(\"generalOptions\"),\n t(\"connectionAndAuthenticationSettings\"),\n t(\"ldapSearchingAndUpdatingSettings\"),\n t(\"synchronizationSettings\"),\n t(\"kerberosIntegration\"),\n t(\"cacheSettings\"),\n t(\"advancedSettings\")\n ]\n }, /* @__PURE__ */ React.createElement(LdapSettingsGeneral, {\n form,\n vendorEdit: !!id\n }), /* @__PURE__ */ React.createElement(LdapSettingsConnection, {\n form,\n edit: !!id\n }), /* @__PURE__ */ React.createElement(LdapSettingsSearching, {\n form\n }), /* @__PURE__ */ React.createElement(LdapSettingsSynchronization, {\n form\n }), /* @__PURE__ */ React.createElement(LdapSettingsKerberosIntegration, {\n form\n }), /* @__PURE__ */ React.createElement(SettingsCache, {\n form\n }), /* @__PURE__ */ React.createElement(LdapSettingsAdvanced, {\n form\n })), /* @__PURE__ */ React.createElement(Form, {\n onSubmit: form.handleSubmit(save)\n }, /* @__PURE__ */ React.createElement(ActionGroup, {\n className: \"keycloak__form_actions\"\n }, /* @__PURE__ */ React.createElement(Button, {\n isDisabled: !form.formState.isDirty,\n variant: \"primary\",\n type: \"submit\",\n \"data-testid\": \"ldap-save\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n onClick: () => history.push(`/${realm}/user-federation`),\n \"data-testid\": \"ldap-cancel\"\n }, t(\"common:cancel\")))));\n };\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(RemoveUsersConfirm, null), /* @__PURE__ */ React.createElement(Controller, {\n name: \"config.enabled[0]\",\n defaultValue: [\"true\"][0],\n control: form.control,\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(LdapSettingsHeader, {\n editMode,\n value,\n save: () => save(form.getValues()),\n onChange,\n toggleDeleteDialog,\n toggleRemoveUsersDialog\n })\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n isFilled: true\n }, id ? /* @__PURE__ */ React.createElement(KeycloakTabs, {\n isBox: true\n }, /* @__PURE__ */ React.createElement(Tab, {\n id: \"settings\",\n eventKey: \"settings\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:settings\"))\n }, addLdapFormContent()), /* @__PURE__ */ React.createElement(Tab, {\n id: \"mappers\",\n eventKey: \"mappers\",\n title: /* @__PURE__ */ React.createElement(TabTitleText, null, t(\"common:mappers\")),\n \"data-testid\": \"ldap-mappers-tab\"\n }, /* @__PURE__ */ React.createElement(LdapMapperList, null))) : addLdapFormContent()));\n}\n", "import {\n AlertVariant,\n ButtonVariant,\n Card,\n CardTitle,\n DropdownItem,\n Gallery,\n GalleryItem,\n PageSection,\n Split,\n SplitItem,\n Text,\n TextContent,\n TextVariants\n} from \"../_snowpack/pkg/@patternfly/react-core.js\";\nimport {DatabaseIcon} from \"../_snowpack/pkg/@patternfly/react-icons.js\";\nimport React, {useState} from \"../_snowpack/pkg/react.js\";\nimport {useTranslation} from \"../_snowpack/pkg/react-i18next.js\";\nimport {useHistory, useRouteMatch} from \"../_snowpack/pkg/react-router-dom.js\";\nimport {useAlerts} from \"../components/alert/Alerts.js\";\nimport {useConfirmDialog} from \"../components/confirm-dialog/ConfirmDialog.js\";\nimport {KeycloakCard} from \"../components/keycloak-card/KeycloakCard.js\";\nimport {ViewHeader} from \"../components/view-header/ViewHeader.js\";\nimport {useAdminClient, useFetch} from \"../context/auth/AdminClient.js\";\nimport {useRealm} from \"../context/realm-context/RealmContext.js\";\nimport \"./user-federation.css\";\nexport default function UserFederationSection() {\n const [userFederations, setUserFederations] = useState();\n const {addAlert, addError} = useAlerts();\n const {t} = useTranslation(\"user-federation\");\n const {realm} = useRealm();\n const adminClient = useAdminClient();\n const [key, setKey] = useState(0);\n const refresh = () => setKey(new Date().getTime());\n const {url} = useRouteMatch();\n const history = useHistory();\n useFetch(async () => {\n const realmModel = await adminClient.realms.findOne({realm});\n const testParams = {\n parentId: realmModel.id,\n type: \"org.keycloak.storage.UserStorageProvider\"\n };\n return adminClient.components.find(testParams);\n }, (userFederations2) => {\n setUserFederations(userFederations2);\n }, [key]);\n const ufAddProviderDropdownItems = [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"itemLDAP\",\n onClick: () => history.push(`${url}/ldap/new`)\n }, \"LDAP\"),\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: \"itemKerberos\",\n onClick: () => history.push(`${url}/kerberos/new`)\n }, \"Kerberos\")\n ];\n const learnMoreLinkProps = {\n title: t(\"common:learnMore\"),\n href: \"https://www.keycloak.org/docs/latest/server_admin/index.html#_user-storage-federation\"\n };\n let cards;\n const [currentCard, setCurrentCard] = useState(\"\");\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: t(\"userFedDeleteConfirmTitle\"),\n messageKey: t(\"userFedDeleteConfirm\"),\n continueButtonLabel: \"common:delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.components.del({id: currentCard});\n refresh();\n addAlert(t(\"userFedDeletedSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"user-federation:userFedDeleteError\", error);\n }\n }\n });\n const toggleDeleteForCard = (id) => {\n setCurrentCard(id);\n toggleDeleteDialog();\n };\n if (userFederations) {\n cards = userFederations.map((userFederation, index) => {\n const ufCardDropdownItems = [\n /* @__PURE__ */ React.createElement(DropdownItem, {\n key: `${index}-cardDelete`,\n onClick: () => {\n toggleDeleteForCard(userFederation.id);\n },\n \"data-testid\": \"card-delete\"\n }, t(\"common:delete\"))\n ];\n return /* @__PURE__ */ React.createElement(GalleryItem, {\n key: index,\n className: \"keycloak-admin--user-federation__gallery-item\"\n }, /* @__PURE__ */ React.createElement(KeycloakCard, {\n id: userFederation.id,\n dropdownItems: ufCardDropdownItems,\n providerId: userFederation.providerId,\n title: userFederation.name,\n footerText: userFederation.providerId === \"ldap\" ? \"LDAP\" : \"Kerberos\",\n labelText: userFederation.config[\"enabled\"][0] !== \"false\" ? `${t(\"common:enabled\")}` : `${t(\"common:disabled\")}`,\n labelColor: userFederation.config[\"enabled\"][0] !== \"false\" ? \"blue\" : \"gray\"\n }));\n });\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: \"userFederation\",\n subKey: \"user-federation:userFederationExplanation\",\n subKeyLinkProps: learnMoreLinkProps,\n ...userFederations && userFederations.length > 0 ? {\n lowerDropdownItems: ufAddProviderDropdownItems,\n lowerDropdownMenuTitle: \"user-federation:addNewProvider\"\n } : {}\n }), /* @__PURE__ */ React.createElement(PageSection, null, userFederations && userFederations.length > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeleteConfirm, null), /* @__PURE__ */ React.createElement(Gallery, {\n hasGutter: true\n }, cards)) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TextContent, null, /* @__PURE__ */ React.createElement(Text, {\n component: TextVariants.p\n }, t(\"getStarted\"))), /* @__PURE__ */ React.createElement(TextContent, null, /* @__PURE__ */ React.createElement(Text, {\n className: \"pf-u-mt-lg\",\n component: TextVariants.h2\n }, t(\"providers\"))), /* @__PURE__ */ React.createElement(\"hr\", {\n className: \"pf-u-mb-lg\"\n }), /* @__PURE__ */ React.createElement(Gallery, {\n hasGutter: true\n }, /* @__PURE__ */ React.createElement(Card, {\n className: \"keycloak-empty-state-card\",\n isHoverable: true,\n onClick: () => history.push(`${url}/kerberos/new`),\n \"data-testid\": \"kerberos-card\"\n }, /* @__PURE__ */ React.createElement(CardTitle, null, /* @__PURE__ */ React.createElement(Split, {\n hasGutter: true\n }, /* @__PURE__ */ React.createElement(SplitItem, null, /* @__PURE__ */ React.createElement(DatabaseIcon, {\n size: \"lg\"\n })), /* @__PURE__ */ React.createElement(SplitItem, {\n isFilled: true\n }, t(\"addKerberos\"))))), /* @__PURE__ */ React.createElement(Card, {\n className: \"keycloak-empty-state-card\",\n isHoverable: true,\n onClick: () => history.push(`${url}/ldap/new`),\n \"data-testid\": \"ldap-card\"\n }, /* @__PURE__ */ React.createElement(CardTitle, null, /* @__PURE__ */ React.createElement(Split, {\n hasGutter: true\n }, /* @__PURE__ */ React.createElement(SplitItem, null, /* @__PURE__ */ React.createElement(DatabaseIcon, {\n size: \"lg\"\n })), /* @__PURE__ */ React.createElement(SplitItem, {\n isFilled: true\n }, t(\"addLdap\")))))))));\n}\n", "import React, {useState} from \"../../../_snowpack/pkg/react.js\";\nimport {\n ActionGroup,\n AlertVariant,\n Button,\n Form,\n FormGroup,\n PageSection,\n Select,\n SelectOption,\n SelectVariant,\n TextInput,\n ValidatedOptions\n} from \"../../../_snowpack/pkg/@patternfly/react-core.js\";\nimport {convertFormValuesToObject, convertToFormValues} from \"../../../util.js\";\nimport {useAdminClient, useFetch} from \"../../../context/auth/AdminClient.js\";\nimport {ViewHeader} from \"../../../components/view-header/ViewHeader.js\";\nimport {useHistory, useParams} from \"../../../_snowpack/pkg/react-router-dom.js\";\nimport {Controller, FormProvider, useForm, useWatch} from \"../../../_snowpack/pkg/react-hook-form.js\";\nimport {useAlerts} from \"../../../components/alert/Alerts.js\";\nimport {useTranslation} from \"../../../_snowpack/pkg/react-i18next.js\";\nimport {HelpItem} from \"../../../components/help-enabler/HelpItem.js\";\nimport {FormAccess} from \"../../../components/form-access/FormAccess.js\";\nimport {DynamicComponents} from \"../../../components/dynamic/DynamicComponents.js\";\nimport {useRealm} from \"../../../context/realm-context/RealmContext.js\";\nimport {KeycloakSpinner} from \"../../../components/keycloak-spinner/KeycloakSpinner.js\";\nimport {toUserFederationLdap} from \"../../routes/UserFederationLdap.js\";\nexport default function LdapMapperDetails() {\n const form = useForm();\n const [mapping, setMapping] = useState();\n const [components, setComponents] = useState();\n const adminClient = useAdminClient();\n const {id, mapperId} = useParams();\n const history = useHistory();\n const {realm} = useRealm();\n const {t} = useTranslation(\"user-federation\");\n const {addAlert, addError} = useAlerts();\n const [isMapperDropdownOpen, setIsMapperDropdownOpen] = useState(false);\n useFetch(async () => {\n const components2 = await adminClient.components.listSubComponents({\n id,\n type: \"org.keycloak.storage.ldap.mappers.LDAPStorageMapper\"\n });\n if (mapperId && mapperId !== \"new\") {\n const fetchedMapper = await adminClient.components.findOne({\n id: mapperId\n });\n return {components: components2, fetchedMapper};\n }\n return {components: components2};\n }, ({components: components2, fetchedMapper}) => {\n setMapping(fetchedMapper);\n setComponents(components2);\n if (mapperId !== \"new\" && !fetchedMapper)\n throw new Error(t(\"common:notFound\"));\n if (fetchedMapper)\n setupForm(fetchedMapper);\n }, []);\n const setupForm = (mapper) => {\n convertToFormValues(mapper, form.setValue);\n };\n const save = async (mapper) => {\n const component = convertFormValuesToObject(mapper);\n const map = {\n ...component,\n config: Object.entries(component.config || {}).reduce((result, [key, value]) => {\n result[key] = Array.isArray(value) ? value : [value];\n return result;\n }, {})\n };\n try {\n if (mapperId === \"new\") {\n await adminClient.components.create(map);\n history.push(toUserFederationLdap({realm, id: mapper.parentId, tab: \"mappers\"}));\n } else {\n await adminClient.components.update({id: mapperId}, map);\n }\n setupForm(map);\n addAlert(t(mapperId === \"new\" ? \"common:mappingCreatedSuccess\" : \"common:mappingUpdatedSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(mapperId === \"new\" ? \"common:mappingCreatedError\" : \"common:mappingUpdatedError\", error);\n }\n };\n const mapperType = useWatch({\n control: form.control,\n name: \"providerId\"\n });\n const isNew = mapperId === \"new\";\n if (!components) {\n return /* @__PURE__ */ React.createElement(KeycloakSpinner, null);\n }\n return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ViewHeader, {\n titleKey: mapping ? mapping.name : t(\"common:createNewMapper\")\n }), /* @__PURE__ */ React.createElement(PageSection, {\n variant: \"light\",\n isFilled: true\n }, /* @__PURE__ */ React.createElement(FormAccess, {\n role: \"manage-realm\",\n isHorizontal: true\n }, !isNew && /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:id\"),\n fieldId: \"kc-ldap-mapper-id\"\n }, /* @__PURE__ */ React.createElement(TextInput, {\n isDisabled: true,\n type: \"text\",\n id: \"kc-ldap-mapper-id\",\n \"data-testid\": \"ldap-mapper-id\",\n name: \"id\",\n ref: form.register\n })), /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:name\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"user-federation-help:nameHelp\",\n fieldLabelId: \"name\"\n }),\n fieldId: \"kc-ldap-mapper-name\",\n isRequired: true\n }, /* @__PURE__ */ React.createElement(TextInput, {\n isDisabled: !isNew,\n isRequired: true,\n type: \"text\",\n id: \"kc-ldap-mapper-name\",\n \"data-testid\": \"ldap-mapper-name\",\n name: \"name\",\n ref: form.register({required: true}),\n validated: form.errors.name ? ValidatedOptions.error : ValidatedOptions.default\n }), /* @__PURE__ */ React.createElement(TextInput, {\n hidden: true,\n defaultValue: isNew ? id : mapping ? mapping.parentId : \"\",\n type: \"text\",\n id: \"kc-ldap-parentId\",\n \"data-testid\": \"ldap-mapper-parentId\",\n name: \"parentId\",\n ref: form.register\n }), /* @__PURE__ */ React.createElement(TextInput, {\n hidden: true,\n defaultValue: \"org.keycloak.storage.ldap.mappers.LDAPStorageMapper\",\n type: \"text\",\n id: \"kc-ldap-provider-type\",\n \"data-testid\": \"ldap-mapper-provider-type\",\n name: \"providerType\",\n ref: form.register\n })), !isNew ? /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:mapperType\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"user-federation-help:mapperTypeHelp\",\n fieldLabelId: \"mapperType\"\n }),\n fieldId: \"kc-ldap-mapper-type\",\n isRequired: true\n }, /* @__PURE__ */ React.createElement(TextInput, {\n isDisabled: !isNew,\n isRequired: true,\n type: \"text\",\n id: \"kc-ldap-mapper-type\",\n \"data-testid\": \"ldap-mapper-type-fld\",\n name: \"providerId\",\n ref: form.register\n })) : /* @__PURE__ */ React.createElement(FormGroup, {\n label: t(\"common:mapperType\"),\n labelIcon: /* @__PURE__ */ React.createElement(HelpItem, {\n helpText: \"user-federation-help:mapperTypeHelp\",\n fieldLabelId: \"mapperType\"\n }),\n fieldId: \"kc-providerId\",\n isRequired: true\n }, /* @__PURE__ */ React.createElement(Controller, {\n name: \"providerId\",\n defaultValue: \"\",\n control: form.control,\n \"data-testid\": \"ldap-mapper-type-select\",\n render: ({onChange, value}) => /* @__PURE__ */ React.createElement(Select, {\n toggleId: \"kc-providerId\",\n required: true,\n onToggle: () => setIsMapperDropdownOpen(!isMapperDropdownOpen),\n isOpen: isMapperDropdownOpen,\n onSelect: (_, value2) => {\n onChange(value2);\n setIsMapperDropdownOpen(false);\n },\n selections: value,\n variant: SelectVariant.typeahead\n }, components.map((c) => /* @__PURE__ */ React.createElement(SelectOption, {\n key: c.id,\n value: c.id\n })))\n })), /* @__PURE__ */ React.createElement(FormProvider, {\n ...form\n }, !!mapperType && /* @__PURE__ */ React.createElement(DynamicComponents, {\n properties: components.find((c) => c.id === mapperType)?.properties\n }))), /* @__PURE__ */ React.createElement(Form, {\n onSubmit: form.handleSubmit(() => save(form.getValues()))\n }, /* @__PURE__ */ React.createElement(ActionGroup, null, /* @__PURE__ */ React.createElement(Button, {\n isDisabled: !form.formState.isDirty,\n variant: \"primary\",\n type: \"submit\",\n \"data-testid\": \"ldap-mapper-save\"\n }, t(\"common:save\")), /* @__PURE__ */ React.createElement(Button, {\n variant: \"link\",\n onClick: () => isNew ? history.goBack() : history.push(`/${realm}/user-federation/ldap/${mapping.parentId}/mappers`),\n \"data-testid\": \"ldap-mapper-cancel\"\n }, t(\"common:cancel\"))))));\n}\n", "import { c as createCommonjsModule, a as commonjsGlobal, g as getDefaultExportFromCjs } from '../common/_commonjsHelpers-4f955397.js';\nimport { a as axios } from '../common/index-6c6617bd.js';\nimport { l as lodash } from '../common/lodash-63f0b2ce.js';\nimport { p as process } from '../common/process-2545f00a.js';\n\nvar requiredActionProviderRepresentation = createCommonjsModule(function (module, exports) {\nexports.__esModule = true;\nexports.RequiredActionAlias = void 0;\n(function (RequiredActionAlias) {\n RequiredActionAlias[\"VERIFY_EMAIL\"] = \"VERIFY_EMAIL\";\n RequiredActionAlias[\"UPDATE_PROFILE\"] = \"UPDATE_PROFILE\";\n RequiredActionAlias[\"CONFIGURE_TOTP\"] = \"CONFIGURE_TOTP\";\n RequiredActionAlias[\"UPDATE_PASSWORD\"] = \"UPDATE_PASSWORD\";\n RequiredActionAlias[\"terms_and_conditions\"] = \"terms_and_conditions\";\n})(exports.RequiredActionAlias || (exports.RequiredActionAlias = {}));\n\n});\n\n/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match words composed of alphanumeric characters. */\nvar reAsciiWord = /[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g;\n\n/** Used to match Latin Unicode letters (excluding mathematical operators). */\nvar reLatin = /[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g;\n\n/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe23',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20f0',\n rsDingbatRange = '\\\\u2700-\\\\u27bf',\n rsLowerRange = 'a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff',\n rsMathOpRange = '\\\\xac\\\\xb1\\\\xd7\\\\xf7',\n rsNonCharRange = '\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf',\n rsPunctuationRange = '\\\\u2000-\\\\u206f',\n rsSpaceRange = ' \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000',\n rsUpperRange = 'A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde',\n rsVarRange = '\\\\ufe0e\\\\ufe0f',\n rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;\n\n/** Used to compose unicode capture groups. */\nvar rsApos = \"['\\u2019]\",\n rsAstral = '[' + rsAstralRange + ']',\n rsBreak = '[' + rsBreakRange + ']',\n rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',\n rsDigits = '\\\\d+',\n rsDingbat = '[' + rsDingbatRange + ']',\n rsLower = '[' + rsLowerRange + ']',\n rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsUpper = '[' + rsUpperRange + ']',\n rsZWJ = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',\n rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',\n rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',\n rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',\n reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n/** Used to match apostrophes. */\nvar reApos = RegExp(rsApos, 'g');\n\n/**\n * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and\n * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).\n */\nvar reComboMark = RegExp(rsCombo, 'g');\n\n/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\nvar reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n/** Used to match complex or compound words. */\nvar reUnicodeWord = RegExp([\n rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',\n rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',\n rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,\n rsUpper + '+' + rsOptUpperContr,\n rsDigits,\n rsEmoji\n].join('|'), 'g');\n\n/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\nvar reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');\n\n/** Used to detect strings that need a more robust regexp to match words. */\nvar reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;\n\n/** Used to map Latin Unicode letters to basic Latin letters. */\nvar deburredLetters = {\n // Latin-1 Supplement block.\n '\\xc0': 'A', '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\n '\\xe0': 'a', '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\n '\\xc7': 'C', '\\xe7': 'c',\n '\\xd0': 'D', '\\xf0': 'd',\n '\\xc8': 'E', '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\n '\\xe8': 'e', '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\n '\\xcc': 'I', '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\n '\\xec': 'i', '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\n '\\xd1': 'N', '\\xf1': 'n',\n '\\xd2': 'O', '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\n '\\xf2': 'o', '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\n '\\xd9': 'U', '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\n '\\xf9': 'u', '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\n '\\xdd': 'Y', '\\xfd': 'y', '\\xff': 'y',\n '\\xc6': 'Ae', '\\xe6': 'ae',\n '\\xde': 'Th', '\\xfe': 'th',\n '\\xdf': 'ss',\n // Latin Extended-A block.\n '\\u0100': 'A', '\\u0102': 'A', '\\u0104': 'A',\n '\\u0101': 'a', '\\u0103': 'a', '\\u0105': 'a',\n '\\u0106': 'C', '\\u0108': 'C', '\\u010a': 'C', '\\u010c': 'C',\n '\\u0107': 'c', '\\u0109': 'c', '\\u010b': 'c', '\\u010d': 'c',\n '\\u010e': 'D', '\\u0110': 'D', '\\u010f': 'd', '\\u0111': 'd',\n '\\u0112': 'E', '\\u0114': 'E', '\\u0116': 'E', '\\u0118': 'E', '\\u011a': 'E',\n '\\u0113': 'e', '\\u0115': 'e', '\\u0117': 'e', '\\u0119': 'e', '\\u011b': 'e',\n '\\u011c': 'G', '\\u011e': 'G', '\\u0120': 'G', '\\u0122': 'G',\n '\\u011d': 'g', '\\u011f': 'g', '\\u0121': 'g', '\\u0123': 'g',\n '\\u0124': 'H', '\\u0126': 'H', '\\u0125': 'h', '\\u0127': 'h',\n '\\u0128': 'I', '\\u012a': 'I', '\\u012c': 'I', '\\u012e': 'I', '\\u0130': 'I',\n '\\u0129': 'i', '\\u012b': 'i', '\\u012d': 'i', '\\u012f': 'i', '\\u0131': 'i',\n '\\u0134': 'J', '\\u0135': 'j',\n '\\u0136': 'K', '\\u0137': 'k', '\\u0138': 'k',\n '\\u0139': 'L', '\\u013b': 'L', '\\u013d': 'L', '\\u013f': 'L', '\\u0141': 'L',\n '\\u013a': 'l', '\\u013c': 'l', '\\u013e': 'l', '\\u0140': 'l', '\\u0142': 'l',\n '\\u0143': 'N', '\\u0145': 'N', '\\u0147': 'N', '\\u014a': 'N',\n '\\u0144': 'n', '\\u0146': 'n', '\\u0148': 'n', '\\u014b': 'n',\n '\\u014c': 'O', '\\u014e': 'O', '\\u0150': 'O',\n '\\u014d': 'o', '\\u014f': 'o', '\\u0151': 'o',\n '\\u0154': 'R', '\\u0156': 'R', '\\u0158': 'R',\n '\\u0155': 'r', '\\u0157': 'r', '\\u0159': 'r',\n '\\u015a': 'S', '\\u015c': 'S', '\\u015e': 'S', '\\u0160': 'S',\n '\\u015b': 's', '\\u015d': 's', '\\u015f': 's', '\\u0161': 's',\n '\\u0162': 'T', '\\u0164': 'T', '\\u0166': 'T',\n '\\u0163': 't', '\\u0165': 't', '\\u0167': 't',\n '\\u0168': 'U', '\\u016a': 'U', '\\u016c': 'U', '\\u016e': 'U', '\\u0170': 'U', '\\u0172': 'U',\n '\\u0169': 'u', '\\u016b': 'u', '\\u016d': 'u', '\\u016f': 'u', '\\u0171': 'u', '\\u0173': 'u',\n '\\u0174': 'W', '\\u0175': 'w',\n '\\u0176': 'Y', '\\u0177': 'y', '\\u0178': 'Y',\n '\\u0179': 'Z', '\\u017b': 'Z', '\\u017d': 'Z',\n '\\u017a': 'z', '\\u017c': 'z', '\\u017e': 'z',\n '\\u0132': 'IJ', '\\u0133': 'ij',\n '\\u0152': 'Oe', '\\u0153': 'oe',\n '\\u0149': \"'n\", '\\u017f': 'ss'\n};\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array ? array.length : 0;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\n/**\n * Converts an ASCII `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction asciiToArray(string) {\n return string.split('');\n}\n\n/**\n * Splits an ASCII `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\nfunction asciiWords(string) {\n return string.match(reAsciiWord) || [];\n}\n\n/**\n * The base implementation of `_.propertyOf` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyOf(object) {\n return function(key) {\n return object == null ? undefined : object[key];\n };\n}\n\n/**\n * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A\n * letters to basic Latin letters.\n *\n * @private\n * @param {string} letter The matched letter to deburr.\n * @returns {string} Returns the deburred letter.\n */\nvar deburrLetter = basePropertyOf(deburredLetters);\n\n/**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\nfunction hasUnicode(string) {\n return reHasUnicode.test(string);\n}\n\n/**\n * Checks if `string` contains a word composed of Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a word is found, else `false`.\n */\nfunction hasUnicodeWord(string) {\n return reHasUnicodeWord.test(string);\n}\n\n/**\n * Converts `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction stringToArray(string) {\n return hasUnicode(string)\n ? unicodeToArray(string)\n : asciiToArray(string);\n}\n\n/**\n * Converts a Unicode `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction unicodeToArray(string) {\n return string.match(reUnicode) || [];\n}\n\n/**\n * Splits a Unicode `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\nfunction unicodeWords(string) {\n return string.match(reUnicodeWord) || [];\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar Symbol$1 = root.Symbol;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n}\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\n/**\n * Casts `array` to a slice if it's needed.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {number} start The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the cast slice.\n */\nfunction castSlice(array, start, end) {\n var length = array.length;\n end = end === undefined ? length : end;\n return (!start && end >= length) ? array : baseSlice(array, start, end);\n}\n\n/**\n * Creates a function like `_.lowerFirst`.\n *\n * @private\n * @param {string} methodName The name of the `String` case method to use.\n * @returns {Function} Returns the new case function.\n */\nfunction createCaseFirst(methodName) {\n return function(string) {\n string = toString(string);\n\n var strSymbols = hasUnicode(string)\n ? stringToArray(string)\n : undefined;\n\n var chr = strSymbols\n ? strSymbols[0]\n : string.charAt(0);\n\n var trailing = strSymbols\n ? castSlice(strSymbols, 1).join('')\n : string.slice(1);\n\n return chr[methodName]() + trailing;\n };\n}\n\n/**\n * Creates a function like `_.camelCase`.\n *\n * @private\n * @param {Function} callback The function to combine each word.\n * @returns {Function} Returns the new compounder function.\n */\nfunction createCompounder(callback) {\n return function(string) {\n return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');\n };\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\n/**\n * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the camel cased string.\n * @example\n *\n * _.camelCase('Foo Bar');\n * // => 'fooBar'\n *\n * _.camelCase('--foo-bar--');\n * // => 'fooBar'\n *\n * _.camelCase('__FOO_BAR__');\n * // => 'fooBar'\n */\nvar camelCase = createCompounder(function(result, word, index) {\n word = word.toLowerCase();\n return result + (index ? capitalize(word) : word);\n});\n\n/**\n * Converts the first character of `string` to upper case and the remaining\n * to lower case.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to capitalize.\n * @returns {string} Returns the capitalized string.\n * @example\n *\n * _.capitalize('FRED');\n * // => 'Fred'\n */\nfunction capitalize(string) {\n return upperFirst(toString(string).toLowerCase());\n}\n\n/**\n * Deburrs `string` by converting\n * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\n * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)\n * letters to basic Latin letters and removing\n * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to deburr.\n * @returns {string} Returns the deburred string.\n * @example\n *\n * _.deburr('déjà vu');\n * // => 'deja vu'\n */\nfunction deburr(string) {\n string = toString(string);\n return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');\n}\n\n/**\n * Converts the first character of `string` to upper case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.upperFirst('fred');\n * // => 'Fred'\n *\n * _.upperFirst('FRED');\n * // => 'FRED'\n */\nvar upperFirst = createCaseFirst('toUpperCase');\n\n/**\n * Splits `string` into an array of its words.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {RegExp|string} [pattern] The pattern to match words.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the words of `string`.\n * @example\n *\n * _.words('fred, barney, & pebbles');\n * // => ['fred', 'barney', 'pebbles']\n *\n * _.words('fred, barney, & pebbles', /[^, ]+/g);\n * // => ['fred', 'barney', '&', 'pebbles']\n */\nfunction words(string, pattern, guard) {\n string = toString(string);\n pattern = guard ? undefined : pattern;\n\n if (pattern === undefined) {\n return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);\n }\n return string.match(pattern) || [];\n}\n\nvar lodash_camelcase = camelCase;\n\nvar lodash_isdate = createCommonjsModule(function (module, exports) {\n/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** `Object#toString` result references. */\nvar dateTag = '[object Date]';\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;\n\n/** Detect free variable `exports`. */\nvar freeExports = exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n return freeProcess && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsDate = nodeUtil && nodeUtil.isDate;\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/**\n * The base implementation of `_.isDate` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a date object, else `false`.\n */\nfunction baseIsDate(value) {\n return isObjectLike(value) && objectToString.call(value) == dateTag;\n}\n\n/**\n * Checks if `value` is classified as a `Date` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a date object, else `false`.\n * @example\n *\n * _.isDate(new Date);\n * // => true\n *\n * _.isDate('Mon April 23 2012');\n * // => false\n */\nvar isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\nmodule.exports = isDate;\n});\n\nvar lodash_isregexp = createCommonjsModule(function (module, exports) {\n/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** `Object#toString` result references. */\nvar regexpTag = '[object RegExp]';\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;\n\n/** Detect free variable `exports`. */\nvar freeExports = exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n return freeProcess && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/**\n * The base implementation of `_.isRegExp` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n */\nfunction baseIsRegExp(value) {\n return isObject(value) && objectToString.call(value) == regexpTag;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is classified as a `RegExp` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n * @example\n *\n * _.isRegExp(/abc/);\n * // => true\n *\n * _.isRegExp('/abc/');\n * // => false\n */\nvar isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;\n\nmodule.exports = isRegExp;\n});\n\nvar dist = createCommonjsModule(function (module, exports) {\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst lodash_camelcase_1 = __importDefault(lodash_camelcase);\nconst lodash_isdate_1 = __importDefault(lodash_isdate);\nconst lodash_isregexp_1 = __importDefault(lodash_isregexp);\nfunction walk(obj) {\n if (!obj || typeof obj !== \"object\")\n return obj;\n if (lodash_isdate_1.default(obj) || lodash_isregexp_1.default(obj))\n return obj;\n if (Array.isArray(obj))\n return obj.map(walk);\n return Object.keys(obj).reduce((res, key) => {\n const camel = lodash_camelcase_1.default(key);\n res[camel] = walk(obj[key]);\n return res;\n }, {});\n}\nfunction camelize(obj) {\n return typeof obj === \"string\" ? lodash_camelcase_1.default(obj) : walk(obj);\n}\nexports.default = camelize;\n\n});\n\nvar strictUriEncode = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);\n\nvar token = '%[a-f0-9]{2}';\nvar singleMatcher = new RegExp(token, 'gi');\nvar multiMatcher = new RegExp('(' + token + ')+', 'gi');\n\nfunction decodeComponents(components, split) {\n\ttry {\n\t\t// Try to decode the entire string first\n\t\treturn decodeURIComponent(components.join(''));\n\t} catch (err) {\n\t\t// Do nothing\n\t}\n\n\tif (components.length === 1) {\n\t\treturn components;\n\t}\n\n\tsplit = split || 1;\n\n\t// Split the array in 2 parts\n\tvar left = components.slice(0, split);\n\tvar right = components.slice(split);\n\n\treturn Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));\n}\n\nfunction decode(input) {\n\ttry {\n\t\treturn decodeURIComponent(input);\n\t} catch (err) {\n\t\tvar tokens = input.match(singleMatcher);\n\n\t\tfor (var i = 1; i < tokens.length; i++) {\n\t\t\tinput = decodeComponents(tokens, i).join('');\n\n\t\t\ttokens = input.match(singleMatcher);\n\t\t}\n\n\t\treturn input;\n\t}\n}\n\nfunction customDecodeURIComponent(input) {\n\t// Keep track of all the replacements and prefill the map with the `BOM`\n\tvar replaceMap = {\n\t\t'%FE%FF': '\\uFFFD\\uFFFD',\n\t\t'%FF%FE': '\\uFFFD\\uFFFD'\n\t};\n\n\tvar match = multiMatcher.exec(input);\n\twhile (match) {\n\t\ttry {\n\t\t\t// Decode as big chunks as possible\n\t\t\treplaceMap[match[0]] = decodeURIComponent(match[0]);\n\t\t} catch (err) {\n\t\t\tvar result = decode(match[0]);\n\n\t\t\tif (result !== match[0]) {\n\t\t\t\treplaceMap[match[0]] = result;\n\t\t\t}\n\t\t}\n\n\t\tmatch = multiMatcher.exec(input);\n\t}\n\n\t// Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else\n\treplaceMap['%C2'] = '\\uFFFD';\n\n\tvar entries = Object.keys(replaceMap);\n\n\tfor (var i = 0; i < entries.length; i++) {\n\t\t// Replace all decoded components\n\t\tvar key = entries[i];\n\t\tinput = input.replace(new RegExp(key, 'g'), replaceMap[key]);\n\t}\n\n\treturn input;\n}\n\nvar decodeUriComponent = function (encodedURI) {\n\tif (typeof encodedURI !== 'string') {\n\t\tthrow new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');\n\t}\n\n\ttry {\n\t\tencodedURI = encodedURI.replace(/\\+/g, ' ');\n\n\t\t// Try the built in decoder first\n\t\treturn decodeURIComponent(encodedURI);\n\t} catch (err) {\n\t\t// Fallback to a more advanced decoder\n\t\treturn customDecodeURIComponent(encodedURI);\n\t}\n};\n\nvar splitOnFirst = (string, separator) => {\n\tif (!(typeof string === 'string' && typeof separator === 'string')) {\n\t\tthrow new TypeError('Expected the arguments to be of type `string`');\n\t}\n\n\tif (separator === '') {\n\t\treturn [string];\n\t}\n\n\tconst separatorIndex = string.indexOf(separator);\n\n\tif (separatorIndex === -1) {\n\t\treturn [string];\n\t}\n\n\treturn [\n\t\tstring.slice(0, separatorIndex),\n\t\tstring.slice(separatorIndex + separator.length)\n\t];\n};\n\nvar filterObj = function (obj, predicate) {\n\tvar ret = {};\n\tvar keys = Object.keys(obj);\n\tvar isArr = Array.isArray(predicate);\n\n\tfor (var i = 0; i < keys.length; i++) {\n\t\tvar key = keys[i];\n\t\tvar val = obj[key];\n\n\t\tif (isArr ? predicate.indexOf(key) !== -1 : predicate(key, val, obj)) {\n\t\t\tret[key] = val;\n\t\t}\n\t}\n\n\treturn ret;\n};\n\nvar queryString = createCommonjsModule(function (module, exports) {\n\n\n\n\n\nconst isNullOrUndefined = value => value === null || value === undefined;\n\nconst encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier');\n\nfunction encoderForArrayFormat(options) {\n\tswitch (options.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn key => (result, value) => {\n\t\t\t\tconst index = result.length;\n\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined ||\n\t\t\t\t\t(options.skipNull && value === null) ||\n\t\t\t\t\t(options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [...result, [encode(key, options), '[', index, ']'].join('')];\n\t\t\t\t}\n\n\t\t\t\treturn [\n\t\t\t\t\t...result,\n\t\t\t\t\t[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')\n\t\t\t\t];\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined ||\n\t\t\t\t\t(options.skipNull && value === null) ||\n\t\t\t\t\t(options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [...result, [encode(key, options), '[]'].join('')];\n\t\t\t\t}\n\n\t\t\t\treturn [...result, [encode(key, options), '[]=', encode(value, options)].join('')];\n\t\t\t};\n\n\t\tcase 'comma':\n\t\tcase 'separator':\n\t\tcase 'bracket-separator': {\n\t\t\tconst keyValueSep = options.arrayFormat === 'bracket-separator' ?\n\t\t\t\t'[]=' :\n\t\t\t\t'=';\n\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined ||\n\t\t\t\t\t(options.skipNull && value === null) ||\n\t\t\t\t\t(options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\t// Translate null to an empty string so that it doesn't serialize as 'null'\n\t\t\t\tvalue = value === null ? '' : value;\n\n\t\t\t\tif (result.length === 0) {\n\t\t\t\t\treturn [[encode(key, options), keyValueSep, encode(value, options)].join('')];\n\t\t\t\t}\n\n\t\t\t\treturn [[result, encode(value, options)].join(options.arrayFormatSeparator)];\n\t\t\t};\n\t\t}\n\n\t\tdefault:\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined ||\n\t\t\t\t\t(options.skipNull && value === null) ||\n\t\t\t\t\t(options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [...result, encode(key, options)];\n\t\t\t\t}\n\n\t\t\t\treturn [...result, [encode(key, options), '=', encode(value, options)].join('')];\n\t\t\t};\n\t}\n}\n\nfunction parserForArrayFormat(options) {\n\tlet result;\n\n\tswitch (options.arrayFormat) {\n\t\tcase 'index':\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tresult = /\\[(\\d*)\\]$/.exec(key);\n\n\t\t\t\tkey = key.replace(/\\[\\d*\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = {};\n\t\t\t\t}\n\n\t\t\t\taccumulator[key][result[1]] = value;\n\t\t\t};\n\n\t\tcase 'bracket':\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tresult = /(\\[\\])$/.exec(key);\n\t\t\t\tkey = key.replace(/\\[\\]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = [value];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\n\t\tcase 'comma':\n\t\tcase 'separator':\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tconst isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator);\n\t\t\t\tconst isEncodedArray = (typeof value === 'string' && !isArray && decode(value, options).includes(options.arrayFormatSeparator));\n\t\t\t\tvalue = isEncodedArray ? decode(value, options) : value;\n\t\t\t\tconst newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options);\n\t\t\t\taccumulator[key] = newValue;\n\t\t\t};\n\n\t\tcase 'bracket-separator':\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tconst isArray = /(\\[\\])$/.test(key);\n\t\t\t\tkey = key.replace(/\\[\\]$/, '');\n\n\t\t\t\tif (!isArray) {\n\t\t\t\t\taccumulator[key] = value ? decode(value, options) : value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst arrayValue = value === null ?\n\t\t\t\t\t[] :\n\t\t\t\t\tvalue.split(options.arrayFormatSeparator).map(item => decode(item, options));\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = arrayValue;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], arrayValue);\n\t\t\t};\n\n\t\tdefault:\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [].concat(accumulator[key], value);\n\t\t\t};\n\t}\n}\n\nfunction validateArrayFormatSeparator(value) {\n\tif (typeof value !== 'string' || value.length !== 1) {\n\t\tthrow new TypeError('arrayFormatSeparator must be single character string');\n\t}\n}\n\nfunction encode(value, options) {\n\tif (options.encode) {\n\t\treturn options.strict ? strictUriEncode(value) : encodeURIComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction decode(value, options) {\n\tif (options.decode) {\n\t\treturn decodeUriComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction keysSorter(input) {\n\tif (Array.isArray(input)) {\n\t\treturn input.sort();\n\t}\n\n\tif (typeof input === 'object') {\n\t\treturn keysSorter(Object.keys(input))\n\t\t\t.sort((a, b) => Number(a) - Number(b))\n\t\t\t.map(key => input[key]);\n\t}\n\n\treturn input;\n}\n\nfunction removeHash(input) {\n\tconst hashStart = input.indexOf('#');\n\tif (hashStart !== -1) {\n\t\tinput = input.slice(0, hashStart);\n\t}\n\n\treturn input;\n}\n\nfunction getHash(url) {\n\tlet hash = '';\n\tconst hashStart = url.indexOf('#');\n\tif (hashStart !== -1) {\n\t\thash = url.slice(hashStart);\n\t}\n\n\treturn hash;\n}\n\nfunction extract(input) {\n\tinput = removeHash(input);\n\tconst queryStart = input.indexOf('?');\n\tif (queryStart === -1) {\n\t\treturn '';\n\t}\n\n\treturn input.slice(queryStart + 1);\n}\n\nfunction parseValue(value, options) {\n\tif (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {\n\t\tvalue = Number(value);\n\t} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {\n\t\tvalue = value.toLowerCase() === 'true';\n\t}\n\n\treturn value;\n}\n\nfunction parse(query, options) {\n\toptions = Object.assign({\n\t\tdecode: true,\n\t\tsort: true,\n\t\tarrayFormat: 'none',\n\t\tarrayFormatSeparator: ',',\n\t\tparseNumbers: false,\n\t\tparseBooleans: false\n\t}, options);\n\n\tvalidateArrayFormatSeparator(options.arrayFormatSeparator);\n\n\tconst formatter = parserForArrayFormat(options);\n\n\t// Create an object with no prototype\n\tconst ret = Object.create(null);\n\n\tif (typeof query !== 'string') {\n\t\treturn ret;\n\t}\n\n\tquery = query.trim().replace(/^[?#&]/, '');\n\n\tif (!query) {\n\t\treturn ret;\n\t}\n\n\tfor (const param of query.split('&')) {\n\t\tif (param === '') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet [key, value] = splitOnFirst(options.decode ? param.replace(/\\+/g, ' ') : param, '=');\n\n\t\t// Missing `=` should be `null`:\n\t\t// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters\n\t\tvalue = value === undefined ? null : ['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options);\n\t\tformatter(decode(key, options), value, ret);\n\t}\n\n\tfor (const key of Object.keys(ret)) {\n\t\tconst value = ret[key];\n\t\tif (typeof value === 'object' && value !== null) {\n\t\t\tfor (const k of Object.keys(value)) {\n\t\t\t\tvalue[k] = parseValue(value[k], options);\n\t\t\t}\n\t\t} else {\n\t\t\tret[key] = parseValue(value, options);\n\t\t}\n\t}\n\n\tif (options.sort === false) {\n\t\treturn ret;\n\t}\n\n\treturn (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => {\n\t\tconst value = ret[key];\n\t\tif (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {\n\t\t\t// Sort object keys, not values\n\t\t\tresult[key] = keysSorter(value);\n\t\t} else {\n\t\t\tresult[key] = value;\n\t\t}\n\n\t\treturn result;\n\t}, Object.create(null));\n}\n\nexports.extract = extract;\nexports.parse = parse;\n\nexports.stringify = (object, options) => {\n\tif (!object) {\n\t\treturn '';\n\t}\n\n\toptions = Object.assign({\n\t\tencode: true,\n\t\tstrict: true,\n\t\tarrayFormat: 'none',\n\t\tarrayFormatSeparator: ','\n\t}, options);\n\n\tvalidateArrayFormatSeparator(options.arrayFormatSeparator);\n\n\tconst shouldFilter = key => (\n\t\t(options.skipNull && isNullOrUndefined(object[key])) ||\n\t\t(options.skipEmptyString && object[key] === '')\n\t);\n\n\tconst formatter = encoderForArrayFormat(options);\n\n\tconst objectCopy = {};\n\n\tfor (const key of Object.keys(object)) {\n\t\tif (!shouldFilter(key)) {\n\t\t\tobjectCopy[key] = object[key];\n\t\t}\n\t}\n\n\tconst keys = Object.keys(objectCopy);\n\n\tif (options.sort !== false) {\n\t\tkeys.sort(options.sort);\n\t}\n\n\treturn keys.map(key => {\n\t\tconst value = object[key];\n\n\t\tif (value === undefined) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (value === null) {\n\t\t\treturn encode(key, options);\n\t\t}\n\n\t\tif (Array.isArray(value)) {\n\t\t\tif (value.length === 0 && options.arrayFormat === 'bracket-separator') {\n\t\t\t\treturn encode(key, options) + '[]';\n\t\t\t}\n\n\t\t\treturn value\n\t\t\t\t.reduce(formatter(key), [])\n\t\t\t\t.join('&');\n\t\t}\n\n\t\treturn encode(key, options) + '=' + encode(value, options);\n\t}).filter(x => x.length > 0).join('&');\n};\n\nexports.parseUrl = (url, options) => {\n\toptions = Object.assign({\n\t\tdecode: true\n\t}, options);\n\n\tconst [url_, hash] = splitOnFirst(url, '#');\n\n\treturn Object.assign(\n\t\t{\n\t\t\turl: url_.split('?')[0] || '',\n\t\t\tquery: parse(extract(url), options)\n\t\t},\n\t\toptions && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}\n\t);\n};\n\nexports.stringifyUrl = (object, options) => {\n\toptions = Object.assign({\n\t\tencode: true,\n\t\tstrict: true,\n\t\t[encodeFragmentIdentifier]: true\n\t}, options);\n\n\tconst url = removeHash(object.url).split('?')[0] || '';\n\tconst queryFromUrl = exports.extract(object.url);\n\tconst parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false});\n\n\tconst query = Object.assign(parsedQueryFromUrl, object.query);\n\tlet queryString = exports.stringify(query, options);\n\tif (queryString) {\n\t\tqueryString = `?${queryString}`;\n\t}\n\n\tlet hash = getHash(object.url);\n\tif (object.fragmentIdentifier) {\n\t\thash = `#${options[encodeFragmentIdentifier] ? encode(object.fragmentIdentifier, options) : object.fragmentIdentifier}`;\n\t}\n\n\treturn `${url}${queryString}${hash}`;\n};\n\nexports.pick = (input, filter, options) => {\n\toptions = Object.assign({\n\t\tparseFragmentIdentifier: true,\n\t\t[encodeFragmentIdentifier]: false\n\t}, options);\n\n\tconst {url, query, fragmentIdentifier} = exports.parseUrl(input, options);\n\treturn exports.stringifyUrl({\n\t\turl,\n\t\tquery: filterObj(query, filter),\n\t\tfragmentIdentifier\n\t}, options);\n};\n\nexports.exclude = (input, filter, options) => {\n\tconst exclusionFilter = Array.isArray(filter) ? key => !filter.includes(key) : (key, value) => !filter(key, value);\n\n\treturn exports.pick(input, exclusionFilter, options);\n};\n});\n\nvar constants = createCommonjsModule(function (module, exports) {\nexports.__esModule = true;\nexports.defaultRealm = exports.defaultBaseUrl = void 0;\nexports.defaultBaseUrl = 'http://127.0.0.1:8080/auth';\nexports.defaultRealm = 'master';\n\n});\n\nvar auth = createCommonjsModule(function (module, exports) {\nvar __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.getToken = void 0;\nvar axios_1 = __importDefault(axios);\nvar camelize_ts_1 = __importDefault(dist);\nvar query_string_1 = __importDefault(queryString);\n\nvar getToken = function (settings) { return __awaiter(void 0, void 0, void 0, function () {\n var baseUrl, realmName, url, credentials, payload, config, data;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n baseUrl = settings.baseUrl || constants.defaultBaseUrl;\n realmName = settings.realmName || constants.defaultRealm;\n url = \"\".concat(baseUrl, \"/realms/\").concat(realmName, \"/protocol/openid-connect/token\");\n credentials = settings.credentials || {};\n payload = query_string_1[\"default\"].stringify(__assign(__assign({ username: credentials.username, password: credentials.password, grant_type: credentials.grantType, client_id: credentials.clientId, totp: credentials.totp }, (credentials.offlineToken ? { scope: 'offline_access' } : {})), (credentials.refreshToken ? {\n refresh_token: credentials.refreshToken,\n client_secret: credentials.clientSecret\n } : {})));\n config = __assign({}, settings.requestConfig);\n if (credentials.clientSecret) {\n config.auth = {\n username: credentials.clientId,\n password: credentials.clientSecret\n };\n }\n return [4, axios_1[\"default\"].post(url, payload, config)];\n case 1:\n data = (_a.sent()).data;\n return [2, (0, camelize_ts_1[\"default\"])(data)];\n }\n });\n}); };\nexports.getToken = getToken;\n\n});\n\nvar urlJoin = createCommonjsModule(function (module) {\n(function (name, context, definition) {\n if ( module.exports) module.exports = definition();\n else context[name] = definition();\n})('urljoin', commonjsGlobal, function () {\n\n function normalize (strArray) {\n var resultArray = [];\n if (strArray.length === 0) { return ''; }\n\n if (typeof strArray[0] !== 'string') {\n throw new TypeError('Url must be a string. Received ' + strArray[0]);\n }\n\n // If the first part is a plain protocol, we combine it with the next part.\n if (strArray[0].match(/^[^/:]+:\\/*$/) && strArray.length > 1) {\n var first = strArray.shift();\n strArray[0] = first + strArray[0];\n }\n\n // There must be two or three slashes in the file protocol, two slashes in anything else.\n if (strArray[0].match(/^file:\\/\\/\\//)) {\n strArray[0] = strArray[0].replace(/^([^/:]+):\\/*/, '$1:///');\n } else {\n strArray[0] = strArray[0].replace(/^([^/:]+):\\/*/, '$1://');\n }\n\n for (var i = 0; i < strArray.length; i++) {\n var component = strArray[i];\n\n if (typeof component !== 'string') {\n throw new TypeError('Url must be a string. Received ' + component);\n }\n\n if (component === '') { continue; }\n\n if (i > 0) {\n // Removing the starting slashes for each component but the first.\n component = component.replace(/^[\\/]+/, '');\n }\n if (i < strArray.length - 1) {\n // Removing the ending slashes for each component but the last.\n component = component.replace(/[\\/]+$/, '');\n } else {\n // For the last component we will combine multiple slashes to a single one.\n component = component.replace(/[\\/]+$/, '/');\n }\n\n resultArray.push(component);\n\n }\n\n var str = resultArray.join('/');\n // Each input component is now separated by a single slash except the possible first plain protocol part.\n\n // remove trailing slash before parameters or hash\n str = str.replace(/\\/(\\?|&|#[^!])/g, '$1');\n\n // replace ? in parameters with &\n var parts = str.split('?');\n str = parts.shift() + (parts.length > 0 ? '?': '') + parts.join('&');\n\n return str;\n }\n\n return function () {\n var input;\n\n if (typeof arguments[0] === 'object') {\n input = arguments[0];\n } else {\n input = [].slice.call(arguments);\n }\n\n return normalize(input);\n };\n\n});\n});\n\nvar urlTemplate = createCommonjsModule(function (module, exports) {\n(function (root, factory) {\n {\n module.exports = factory();\n }\n}(commonjsGlobal, function () {\n /**\n * @constructor\n */\n function UrlTemplate() {\n }\n\n /**\n * @private\n * @param {string} str\n * @return {string}\n */\n UrlTemplate.prototype.encodeReserved = function (str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, '[').replace(/%5D/g, ']');\n }\n return part;\n }).join('');\n };\n\n /**\n * @private\n * @param {string} str\n * @return {string}\n */\n UrlTemplate.prototype.encodeUnreserved = function (str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n return '%' + c.charCodeAt(0).toString(16).toUpperCase();\n });\n };\n\n /**\n * @private\n * @param {string} operator\n * @param {string} value\n * @param {string} key\n * @return {string}\n */\n UrlTemplate.prototype.encodeValue = function (operator, value, key) {\n value = (operator === '+' || operator === '#') ? this.encodeReserved(value) : this.encodeUnreserved(value);\n\n if (key) {\n return this.encodeUnreserved(key) + '=' + value;\n } else {\n return value;\n }\n };\n\n /**\n * @private\n * @param {*} value\n * @return {boolean}\n */\n UrlTemplate.prototype.isDefined = function (value) {\n return value !== undefined && value !== null;\n };\n\n /**\n * @private\n * @param {string}\n * @return {boolean}\n */\n UrlTemplate.prototype.isKeyOperator = function (operator) {\n return operator === ';' || operator === '&' || operator === '?';\n };\n\n /**\n * @private\n * @param {Object} context\n * @param {string} operator\n * @param {string} key\n * @param {string} modifier\n */\n UrlTemplate.prototype.getValues = function (context, operator, key, modifier) {\n var value = context[key],\n result = [];\n\n if (this.isDefined(value) && value !== '') {\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n value = value.toString();\n\n if (modifier && modifier !== '*') {\n value = value.substring(0, parseInt(modifier, 10));\n }\n\n result.push(this.encodeValue(operator, value, this.isKeyOperator(operator) ? key : null));\n } else {\n if (modifier === '*') {\n if (Array.isArray(value)) {\n value.filter(this.isDefined).forEach(function (value) {\n result.push(this.encodeValue(operator, value, this.isKeyOperator(operator) ? key : null));\n }, this);\n } else {\n Object.keys(value).forEach(function (k) {\n if (this.isDefined(value[k])) {\n result.push(this.encodeValue(operator, value[k], k));\n }\n }, this);\n }\n } else {\n var tmp = [];\n\n if (Array.isArray(value)) {\n value.filter(this.isDefined).forEach(function (value) {\n tmp.push(this.encodeValue(operator, value));\n }, this);\n } else {\n Object.keys(value).forEach(function (k) {\n if (this.isDefined(value[k])) {\n tmp.push(this.encodeUnreserved(k));\n tmp.push(this.encodeValue(operator, value[k].toString()));\n }\n }, this);\n }\n\n if (this.isKeyOperator(operator)) {\n result.push(this.encodeUnreserved(key) + '=' + tmp.join(','));\n } else if (tmp.length !== 0) {\n result.push(tmp.join(','));\n }\n }\n }\n } else {\n if (operator === ';') {\n if (this.isDefined(value)) {\n result.push(this.encodeUnreserved(key));\n }\n } else if (value === '' && (operator === '&' || operator === '?')) {\n result.push(this.encodeUnreserved(key) + '=');\n } else if (value === '') {\n result.push('');\n }\n }\n return result;\n };\n\n /**\n * @param {string} template\n * @return {function(Object):string}\n */\n UrlTemplate.prototype.parse = function (template) {\n var that = this;\n var operators = ['+', '#', '.', '/', ';', '?', '&'];\n\n return {\n expand: function (context) {\n return template.replace(/\\{([^\\{\\}]+)\\}|([^\\{\\}]+)/g, function (_, expression, literal) {\n if (expression) {\n var operator = null,\n values = [];\n\n if (operators.indexOf(expression.charAt(0)) !== -1) {\n operator = expression.charAt(0);\n expression = expression.substr(1);\n }\n\n expression.split(/,/g).forEach(function (variable) {\n var tmp = /([^:\\*]*)(?::(\\d+)|(\\*))?/.exec(variable);\n values.push.apply(values, that.getValues(context, operator, tmp[1], tmp[2] || tmp[3]));\n });\n\n if (operator && operator !== '+') {\n var separator = ',';\n\n if (operator === '?') {\n separator = '&';\n } else if (operator !== '#') {\n separator = operator;\n }\n return (values.length !== 0 ? operator : '') + values.join(separator);\n } else {\n return values.join(',');\n }\n } else {\n return that.encodeReserved(literal);\n }\n });\n }\n };\n };\n\n return new UrlTemplate();\n}));\n});\n\nvar agent = createCommonjsModule(function (module, exports) {\nvar __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.Agent = void 0;\nvar url_join_1 = __importDefault(urlJoin);\nvar url_template_1 = __importDefault(urlTemplate);\nvar axios_1 = __importDefault(axios);\nvar query_string_1 = __importDefault(queryString);\n\nvar SLASH = '/';\nvar Agent = (function () {\n function Agent(_a) {\n var client = _a.client, _b = _a.path, path = _b === void 0 ? '/' : _b, _c = _a.getUrlParams, getUrlParams = _c === void 0 ? function () { return ({}); } : _c, _d = _a.getBaseUrl, getBaseUrl = _d === void 0 ? function () { return client.baseUrl; } : _d;\n this.client = client;\n this.getBaseParams = getUrlParams;\n this.getBaseUrl = getBaseUrl;\n this.basePath = path;\n }\n Agent.prototype.request = function (_a) {\n var _this = this;\n var method = _a.method, _b = _a.path, path = _b === void 0 ? '' : _b, _c = _a.urlParamKeys, urlParamKeys = _c === void 0 ? [] : _c, _d = _a.queryParamKeys, queryParamKeys = _d === void 0 ? [] : _d, _e = _a.catchNotFound, catchNotFound = _e === void 0 ? false : _e, keyTransform = _a.keyTransform, payloadKey = _a.payloadKey, returnResourceIdInLocationHeader = _a.returnResourceIdInLocationHeader, ignoredKeys = _a.ignoredKeys, headers = _a.headers;\n return function (payload) {\n if (payload === void 0) { payload = {}; }\n return __awaiter(_this, void 0, void 0, function () {\n var baseParams, queryParams, allUrlParamKeys, urlParams, omittedKeys;\n var _a, _b;\n return __generator(this, function (_c) {\n baseParams = (_b = (_a = this.getBaseParams) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : {};\n queryParams = queryParamKeys ? (0, lodash.pick)(payload, queryParamKeys) : null;\n allUrlParamKeys = __spreadArray(__spreadArray([], Object.keys(baseParams), true), urlParamKeys, true);\n urlParams = __assign(__assign({}, baseParams), (0, lodash.pick)(payload, allUrlParamKeys));\n omittedKeys = ignoredKeys\n ? __spreadArray(__spreadArray([], allUrlParamKeys, true), queryParamKeys, true).filter(function (key) { return !ignoredKeys.includes(key); })\n : __spreadArray(__spreadArray([], allUrlParamKeys, true), queryParamKeys, true);\n payload = (0, lodash.omit)(payload, omittedKeys);\n if (keyTransform) {\n this.transformKey(payload, keyTransform);\n this.transformKey(queryParams, keyTransform);\n }\n return [2, this.requestWithParams({\n method: method,\n path: path,\n payload: payload,\n urlParams: urlParams,\n queryParams: queryParams,\n catchNotFound: catchNotFound,\n payloadKey: payloadKey,\n returnResourceIdInLocationHeader: returnResourceIdInLocationHeader,\n headers: headers\n })];\n });\n });\n };\n };\n Agent.prototype.updateRequest = function (_a) {\n var _this = this;\n var method = _a.method, _b = _a.path, path = _b === void 0 ? '' : _b, _c = _a.urlParamKeys, urlParamKeys = _c === void 0 ? [] : _c, _d = _a.queryParamKeys, queryParamKeys = _d === void 0 ? [] : _d, _e = _a.catchNotFound, catchNotFound = _e === void 0 ? false : _e, keyTransform = _a.keyTransform, payloadKey = _a.payloadKey, returnResourceIdInLocationHeader = _a.returnResourceIdInLocationHeader, headers = _a.headers;\n return function (query, payload) {\n if (query === void 0) { query = {}; }\n if (payload === void 0) { payload = {}; }\n return __awaiter(_this, void 0, void 0, function () {\n var baseParams, queryParams, allUrlParamKeys, urlParams;\n var _a, _b;\n return __generator(this, function (_c) {\n baseParams = (_b = (_a = this.getBaseParams) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : {};\n queryParams = queryParamKeys ? (0, lodash.pick)(query, queryParamKeys) : null;\n allUrlParamKeys = __spreadArray(__spreadArray([], Object.keys(baseParams), true), urlParamKeys, true);\n urlParams = __assign(__assign({}, baseParams), (0, lodash.pick)(query, allUrlParamKeys));\n if (keyTransform) {\n this.transformKey(queryParams, keyTransform);\n }\n return [2, this.requestWithParams({\n method: method,\n path: path,\n payload: payload,\n urlParams: urlParams,\n queryParams: queryParams,\n catchNotFound: catchNotFound,\n payloadKey: payloadKey,\n returnResourceIdInLocationHeader: returnResourceIdInLocationHeader,\n headers: headers\n })];\n });\n });\n };\n };\n Agent.prototype.requestWithParams = function (_a) {\n var _b, _c, _d;\n var method = _a.method, path = _a.path, payload = _a.payload, urlParams = _a.urlParams, queryParams = _a.queryParams, catchNotFound = _a.catchNotFound, payloadKey = _a.payloadKey, returnResourceIdInLocationHeader = _a.returnResourceIdInLocationHeader, headers = _a.headers;\n return __awaiter(this, void 0, void 0, function () {\n var newPath, pathTemplate, parsedPath, url, requestConfig, _e, _f, _g, res, locationHeader, resourceId, field, err_1;\n var _h, _j;\n return __generator(this, function (_k) {\n switch (_k.label) {\n case 0:\n newPath = (0, url_join_1[\"default\"])(this.basePath, path);\n pathTemplate = url_template_1[\"default\"].parse(newPath);\n parsedPath = pathTemplate.expand(urlParams);\n url = \"\".concat((_c = (_b = this.getBaseUrl) === null || _b === void 0 ? void 0 : _b.call(this)) !== null && _c !== void 0 ? _c : '').concat(parsedPath);\n requestConfig = __assign(__assign({ paramsSerializer: function (params) { return query_string_1[\"default\"].stringify(params); } }, (this.client.getRequestConfig() || {})), { method: method, url: url });\n _e = requestConfig;\n _f = [__assign({}, requestConfig.headers)];\n _h = {};\n _g = \"bearer \".concat;\n return [4, this.client.getAccessToken()];\n case 1:\n _e.headers = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_h.Authorization = _g.apply(\"bearer \", [_k.sent()]), _h)])), headers]);\n if (method === 'GET') {\n requestConfig.params = payload;\n }\n else {\n requestConfig.data = payloadKey ? payload[payloadKey] : payload;\n }\n if (queryParams) {\n requestConfig.params = requestConfig.params\n ? __assign(__assign({}, requestConfig.params), queryParams) : queryParams;\n }\n _k.label = 2;\n case 2:\n _k.trys.push([2, 4, , 5]);\n return [4, (0, axios_1[\"default\"])(requestConfig)];\n case 3:\n res = _k.sent();\n if (returnResourceIdInLocationHeader) {\n locationHeader = res.headers.location;\n if (typeof locationHeader !== 'string') {\n throw new Error(\"location header is not found in request: \".concat(res.config.url));\n }\n resourceId = (0, lodash.last)(locationHeader.split(SLASH));\n if (!resourceId) {\n throw new Error(\"resourceId is not found in Location header from request: \".concat(res.config.url));\n }\n field = returnResourceIdInLocationHeader.field;\n return [2, (_j = {}, _j[field] = resourceId, _j)];\n }\n return [2, res.data];\n case 4:\n err_1 = _k.sent();\n if (axios_1[\"default\"].isAxiosError(err_1) && ((_d = err_1.response) === null || _d === void 0 ? void 0 : _d.status) === 404 && catchNotFound) {\n return [2, null];\n }\n throw err_1;\n case 5: return [2];\n }\n });\n });\n };\n Agent.prototype.transformKey = function (payload, keyMapping) {\n if (!payload) {\n return;\n }\n Object.keys(keyMapping).some(function (key) {\n if ((0, lodash.isUndefined)(payload[key])) {\n return false;\n }\n var newKey = keyMapping[key];\n payload[newKey] = payload[key];\n delete payload[key];\n });\n };\n return Agent;\n}());\nexports.Agent = Agent;\n\n});\n\nvar resource = createCommonjsModule(function (module, exports) {\nvar __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nexports.__esModule = true;\n\nvar Resource = (function () {\n function Resource(client, settings) {\n var _this = this;\n if (settings === void 0) { settings = {}; }\n this.makeRequest = function (args) {\n return _this.agent.request(args);\n };\n this.makeUpdateRequest = function (args) {\n return _this.agent.updateRequest(args);\n };\n this.agent = new agent.Agent(__assign({ client: client }, settings));\n }\n return Resource;\n}());\nexports[\"default\"] = Resource;\n\n});\n\nvar cache = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.Cache = void 0;\nvar resource_1 = __importDefault(resource);\nvar Cache = (function (_super) {\n __extends(Cache, _super);\n function Cache(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms/{realm}',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.clearUserCache = _this.makeRequest({\n method: 'POST',\n path: '/clear-user-cache'\n });\n return _this;\n }\n return Cache;\n}(resource_1[\"default\"]));\nexports.Cache = Cache;\n\n});\n\nvar users = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.Users = void 0;\nvar resource_1 = __importDefault(resource);\nvar Users = (function (_super) {\n __extends(Users, _super);\n function Users(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms/{realm}/users',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.find = _this.makeRequest({\n method: 'GET'\n });\n _this.create = _this.makeRequest({\n method: 'POST',\n returnResourceIdInLocationHeader: { field: 'id' }\n });\n _this.findOne = _this.makeRequest({\n method: 'GET',\n path: '/{id}',\n urlParamKeys: ['id'],\n catchNotFound: true\n });\n _this.update = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{id}',\n urlParamKeys: ['id']\n });\n _this.del = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}',\n urlParamKeys: ['id']\n });\n _this.count = _this.makeRequest({\n method: 'GET',\n path: '/count'\n });\n _this.listRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings',\n urlParamKeys: ['id']\n });\n _this.addRealmRoleMappings = _this.makeRequest({\n method: 'POST',\n path: '/{id}/role-mappings/realm',\n urlParamKeys: ['id'],\n payloadKey: 'roles'\n });\n _this.listRealmRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings/realm',\n urlParamKeys: ['id']\n });\n _this.delRealmRoleMappings = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/role-mappings/realm',\n urlParamKeys: ['id'],\n payloadKey: 'roles'\n });\n _this.listAvailableRealmRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings/realm/available',\n urlParamKeys: ['id']\n });\n _this.listCompositeRealmRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings/realm/composite',\n urlParamKeys: ['id']\n });\n _this.listClientRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings/clients/{clientUniqueId}',\n urlParamKeys: ['id', 'clientUniqueId']\n });\n _this.addClientRoleMappings = _this.makeRequest({\n method: 'POST',\n path: '/{id}/role-mappings/clients/{clientUniqueId}',\n urlParamKeys: ['id', 'clientUniqueId'],\n payloadKey: 'roles'\n });\n _this.delClientRoleMappings = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/role-mappings/clients/{clientUniqueId}',\n urlParamKeys: ['id', 'clientUniqueId'],\n payloadKey: 'roles'\n });\n _this.listAvailableClientRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings/clients/{clientUniqueId}/available',\n urlParamKeys: ['id', 'clientUniqueId']\n });\n _this.listCompositeClientRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings/clients/{clientUniqueId}/composite',\n urlParamKeys: ['id', 'clientUniqueId']\n });\n _this.executeActionsEmail = _this.makeRequest({\n method: 'PUT',\n path: '/{id}/execute-actions-email',\n urlParamKeys: ['id'],\n payloadKey: 'actions',\n queryParamKeys: ['lifespan', 'redirectUri', 'clientId'],\n keyTransform: {\n clientId: 'client_id',\n redirectUri: 'redirect_uri'\n }\n });\n _this.listGroups = _this.makeRequest({\n method: 'GET',\n path: '/{id}/groups',\n urlParamKeys: ['id']\n });\n _this.addToGroup = _this.makeRequest({\n method: 'PUT',\n path: '/{id}/groups/{groupId}',\n urlParamKeys: ['id', 'groupId']\n });\n _this.delFromGroup = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/groups/{groupId}',\n urlParamKeys: ['id', 'groupId']\n });\n _this.countGroups = _this.makeRequest({\n method: 'GET',\n path: '/{id}/groups/count',\n urlParamKeys: ['id']\n });\n _this.listFederatedIdentities = _this.makeRequest({\n method: 'GET',\n path: '/{id}/federated-identity',\n urlParamKeys: ['id']\n });\n _this.addToFederatedIdentity = _this.makeRequest({\n method: 'POST',\n path: '/{id}/federated-identity/{federatedIdentityId}',\n urlParamKeys: ['id', 'federatedIdentityId'],\n payloadKey: 'federatedIdentity'\n });\n _this.delFromFederatedIdentity = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/federated-identity/{federatedIdentityId}',\n urlParamKeys: ['id', 'federatedIdentityId']\n });\n _this.removeTotp = _this.makeRequest({\n method: 'PUT',\n path: '/{id}/remove-totp',\n urlParamKeys: ['id']\n });\n _this.resetPassword = _this.makeRequest({\n method: 'PUT',\n path: '/{id}/reset-password',\n urlParamKeys: ['id'],\n payloadKey: 'credential'\n });\n _this.getCredentials = _this.makeRequest({\n method: 'GET',\n path: '/{id}/credentials',\n urlParamKeys: ['id']\n });\n _this.deleteCredential = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/credentials/{credentialId}',\n urlParamKeys: ['id', 'credentialId']\n });\n _this.updateCredentialLabel = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{id}/credentials/{credentialId}/userLabel',\n urlParamKeys: ['id', 'credentialId'],\n headers: { 'content-type': 'text/plain' }\n });\n _this.sendVerifyEmail = _this.makeRequest({\n method: 'PUT',\n path: '/{id}/send-verify-email',\n urlParamKeys: ['id'],\n queryParamKeys: ['clientId', 'redirectUri'],\n keyTransform: {\n clientId: 'client_id',\n redirectUri: 'redirect_uri'\n }\n });\n _this.listSessions = _this.makeRequest({\n method: 'GET',\n path: '/{id}/sessions',\n urlParamKeys: ['id']\n });\n _this.listOfflineSessions = _this.makeRequest({\n method: 'GET',\n path: '/{id}/offline-sessions/{clientId}',\n urlParamKeys: ['id', 'clientId']\n });\n _this.logout = _this.makeRequest({\n method: 'POST',\n path: '/{id}/logout',\n urlParamKeys: ['id']\n });\n _this.listConsents = _this.makeRequest({\n method: 'GET',\n path: '/{id}/consents',\n urlParamKeys: ['id']\n });\n _this.impersonation = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{id}/impersonation',\n urlParamKeys: ['id']\n });\n _this.revokeConsent = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/consents/{clientId}',\n urlParamKeys: ['id', 'clientId']\n });\n return _this;\n }\n return Users;\n}(resource_1[\"default\"]));\nexports.Users = Users;\n\n});\n\nvar groups = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.Groups = void 0;\nvar resource_1 = __importDefault(resource);\nvar Groups = (function (_super) {\n __extends(Groups, _super);\n function Groups(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms/{realm}/groups',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.find = _this.makeRequest({\n method: 'GET'\n });\n _this.create = _this.makeRequest({\n method: 'POST',\n returnResourceIdInLocationHeader: { field: 'id' }\n });\n _this.findOne = _this.makeRequest({\n method: 'GET',\n path: '/{id}',\n urlParamKeys: ['id'],\n catchNotFound: true\n });\n _this.update = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{id}',\n urlParamKeys: ['id']\n });\n _this.del = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}',\n urlParamKeys: ['id']\n });\n _this.count = _this.makeRequest({\n method: 'GET',\n path: '/count'\n });\n _this.setOrCreateChild = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{id}/children',\n urlParamKeys: ['id'],\n returnResourceIdInLocationHeader: { field: 'id' }\n });\n _this.listMembers = _this.makeRequest({\n method: 'GET',\n path: '/{id}/members',\n urlParamKeys: ['id'],\n catchNotFound: true\n });\n _this.listRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings',\n urlParamKeys: ['id']\n });\n _this.addRealmRoleMappings = _this.makeRequest({\n method: 'POST',\n path: '/{id}/role-mappings/realm',\n urlParamKeys: ['id'],\n payloadKey: 'roles'\n });\n _this.listRealmRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings/realm',\n urlParamKeys: ['id']\n });\n _this.delRealmRoleMappings = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/role-mappings/realm',\n urlParamKeys: ['id'],\n payloadKey: 'roles'\n });\n _this.listAvailableRealmRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings/realm/available',\n urlParamKeys: ['id']\n });\n _this.listCompositeRealmRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings/realm/composite',\n urlParamKeys: ['id']\n });\n _this.listClientRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings/clients/{clientUniqueId}',\n urlParamKeys: ['id', 'clientUniqueId']\n });\n _this.addClientRoleMappings = _this.makeRequest({\n method: 'POST',\n path: '/{id}/role-mappings/clients/{clientUniqueId}',\n urlParamKeys: ['id', 'clientUniqueId'],\n payloadKey: 'roles'\n });\n _this.delClientRoleMappings = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/role-mappings/clients/{clientUniqueId}',\n urlParamKeys: ['id', 'clientUniqueId'],\n payloadKey: 'roles'\n });\n _this.listAvailableClientRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings/clients/{clientUniqueId}/available',\n urlParamKeys: ['id', 'clientUniqueId']\n });\n _this.listCompositeClientRoleMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/role-mappings/clients/{clientUniqueId}/composite',\n urlParamKeys: ['id', 'clientUniqueId']\n });\n _this.updatePermission = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{id}/management/permissions',\n urlParamKeys: ['id']\n });\n _this.listPermissions = _this.makeRequest({\n method: 'GET',\n path: '/{id}/management/permissions',\n urlParamKeys: ['id']\n });\n return _this;\n }\n return Groups;\n}(resource_1[\"default\"]));\nexports.Groups = Groups;\n\n});\n\nvar roles = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.Roles = void 0;\nvar resource_1 = __importDefault(resource);\nvar Roles = (function (_super) {\n __extends(Roles, _super);\n function Roles(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms/{realm}',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.find = _this.makeRequest({\n method: 'GET',\n path: '/roles'\n });\n _this.create = _this.makeRequest({\n method: 'POST',\n path: '/roles',\n returnResourceIdInLocationHeader: { field: 'roleName' }\n });\n _this.findOneByName = _this.makeRequest({\n method: 'GET',\n path: '/roles/{name}',\n urlParamKeys: ['name'],\n catchNotFound: true\n });\n _this.updateByName = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/roles/{name}',\n urlParamKeys: ['name']\n });\n _this.delByName = _this.makeRequest({\n method: 'DELETE',\n path: '/roles/{name}',\n urlParamKeys: ['name']\n });\n _this.findUsersWithRole = _this.makeRequest({\n method: 'GET',\n path: '/roles/{name}/users',\n urlParamKeys: ['name'],\n catchNotFound: true\n });\n _this.findOneById = _this.makeRequest({\n method: 'GET',\n path: '/roles-by-id/{id}',\n urlParamKeys: ['id'],\n catchNotFound: true\n });\n _this.createComposite = _this.makeUpdateRequest({\n method: 'POST',\n path: '/roles-by-id/{roleId}/composites',\n urlParamKeys: ['roleId']\n });\n _this.getCompositeRoles = _this.makeRequest({\n method: 'GET',\n path: '/roles-by-id/{id}/composites',\n urlParamKeys: ['id']\n });\n _this.getCompositeRolesForRealm = _this.makeRequest({\n method: 'GET',\n path: '/roles-by-id/{id}/composites/realm',\n urlParamKeys: ['id']\n });\n _this.getCompositeRolesForClient = _this.makeRequest({\n method: 'GET',\n path: '/roles-by-id/{id}/composites/clients/{clientId}',\n urlParamKeys: ['id', 'clientId']\n });\n _this.delCompositeRoles = _this.makeUpdateRequest({\n method: 'DELETE',\n path: '/roles-by-id/{id}/composites',\n urlParamKeys: ['id']\n });\n _this.updateById = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/roles-by-id/{id}',\n urlParamKeys: ['id']\n });\n _this.delById = _this.makeRequest({\n method: 'DELETE',\n path: '/roles-by-id/{id}',\n urlParamKeys: ['id']\n });\n return _this;\n }\n return Roles;\n}(resource_1[\"default\"]));\nexports.Roles = Roles;\n\n});\n\nvar clients = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.Clients = void 0;\nvar resource_1 = __importDefault(resource);\nvar Clients = (function (_super) {\n __extends(Clients, _super);\n function Clients(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms/{realm}/clients',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.find = _this.makeRequest({\n method: 'GET'\n });\n _this.create = _this.makeRequest({\n method: 'POST',\n returnResourceIdInLocationHeader: { field: 'id' }\n });\n _this.findOne = _this.makeRequest({\n method: 'GET',\n path: '/{id}',\n urlParamKeys: ['id'],\n catchNotFound: true\n });\n _this.update = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{id}',\n urlParamKeys: ['id']\n });\n _this.del = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}',\n urlParamKeys: ['id']\n });\n _this.createRole = _this.makeRequest({\n method: 'POST',\n path: '/{id}/roles',\n urlParamKeys: ['id'],\n returnResourceIdInLocationHeader: { field: 'roleName' }\n });\n _this.listRoles = _this.makeRequest({\n method: 'GET',\n path: '/{id}/roles',\n urlParamKeys: ['id']\n });\n _this.findRole = _this.makeRequest({\n method: 'GET',\n path: '/{id}/roles/{roleName}',\n urlParamKeys: ['id', 'roleName'],\n catchNotFound: true\n });\n _this.updateRole = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{id}/roles/{roleName}',\n urlParamKeys: ['id', 'roleName']\n });\n _this.delRole = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/roles/{roleName}',\n urlParamKeys: ['id', 'roleName']\n });\n _this.findUsersWithRole = _this.makeRequest({\n method: 'GET',\n path: '/{id}/roles/{roleName}/users',\n urlParamKeys: ['id', 'roleName']\n });\n _this.getServiceAccountUser = _this.makeRequest({\n method: 'GET',\n path: '/{id}/service-account-user',\n urlParamKeys: ['id']\n });\n _this.generateNewClientSecret = _this.makeRequest({\n method: 'POST',\n path: '/{id}/client-secret',\n urlParamKeys: ['id']\n });\n _this.generateRegistrationAccessToken = _this.makeRequest({\n method: 'POST',\n path: '/{id}/registration-access-token',\n urlParamKeys: ['id']\n });\n _this.getClientSecret = _this.makeRequest({\n method: 'GET',\n path: '/{id}/client-secret',\n urlParamKeys: ['id']\n });\n _this.listDefaultClientScopes = _this.makeRequest({\n method: 'GET',\n path: '/{id}/default-client-scopes',\n urlParamKeys: ['id']\n });\n _this.addDefaultClientScope = _this.makeRequest({\n method: 'PUT',\n path: '/{id}/default-client-scopes/{clientScopeId}',\n urlParamKeys: ['id', 'clientScopeId']\n });\n _this.delDefaultClientScope = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/default-client-scopes/{clientScopeId}',\n urlParamKeys: ['id', 'clientScopeId']\n });\n _this.listOptionalClientScopes = _this.makeRequest({\n method: 'GET',\n path: '/{id}/optional-client-scopes',\n urlParamKeys: ['id']\n });\n _this.addOptionalClientScope = _this.makeRequest({\n method: 'PUT',\n path: '/{id}/optional-client-scopes/{clientScopeId}',\n urlParamKeys: ['id', 'clientScopeId']\n });\n _this.delOptionalClientScope = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/optional-client-scopes/{clientScopeId}',\n urlParamKeys: ['id', 'clientScopeId']\n });\n _this.addMultipleProtocolMappers = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{id}/protocol-mappers/add-models',\n urlParamKeys: ['id']\n });\n _this.addProtocolMapper = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{id}/protocol-mappers/models',\n urlParamKeys: ['id']\n });\n _this.listProtocolMappers = _this.makeRequest({\n method: 'GET',\n path: '/{id}/protocol-mappers/models',\n urlParamKeys: ['id']\n });\n _this.findProtocolMapperById = _this.makeRequest({\n method: 'GET',\n path: '/{id}/protocol-mappers/models/{mapperId}',\n urlParamKeys: ['id', 'mapperId'],\n catchNotFound: true\n });\n _this.findProtocolMappersByProtocol = _this.makeRequest({\n method: 'GET',\n path: '/{id}/protocol-mappers/protocol/{protocol}',\n urlParamKeys: ['id', 'protocol'],\n catchNotFound: true\n });\n _this.updateProtocolMapper = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{id}/protocol-mappers/models/{mapperId}',\n urlParamKeys: ['id', 'mapperId']\n });\n _this.delProtocolMapper = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/protocol-mappers/models/{mapperId}',\n urlParamKeys: ['id', 'mapperId']\n });\n _this.listScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/scope-mappings',\n urlParamKeys: ['id']\n });\n _this.addClientScopeMappings = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{id}/scope-mappings/clients/{client}',\n urlParamKeys: ['id', 'client']\n });\n _this.listClientScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/scope-mappings/clients/{client}',\n urlParamKeys: ['id', 'client']\n });\n _this.listAvailableClientScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/scope-mappings/clients/{client}/available',\n urlParamKeys: ['id', 'client']\n });\n _this.listCompositeClientScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/scope-mappings/clients/{client}/available',\n urlParamKeys: ['id', 'client']\n });\n _this.delClientScopeMappings = _this.makeUpdateRequest({\n method: 'DELETE',\n path: '/{id}/scope-mappings/clients/{client}',\n urlParamKeys: ['id', 'client']\n });\n _this.evaluatePermission = _this.makeRequest({\n method: 'GET',\n path: '/{id}/evaluate-scopes/scope-mappings/{roleContainer}/{type}',\n urlParamKeys: ['id', 'roleContainer', 'type'],\n queryParamKeys: ['scope']\n });\n _this.evaluateListProtocolMapper = _this.makeRequest({\n method: 'GET',\n path: '/{id}/evaluate-scopes/protocol-mappers',\n urlParamKeys: ['id'],\n queryParamKeys: ['scope']\n });\n _this.evaluateGenerateAccessToken = _this.makeRequest({\n method: 'GET',\n path: '/{id}/evaluate-scopes/generate-example-access-token',\n urlParamKeys: ['id'],\n queryParamKeys: ['scope', 'userId']\n });\n _this.addRealmScopeMappings = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{id}/scope-mappings/realm',\n urlParamKeys: ['id', 'client']\n });\n _this.listRealmScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/scope-mappings/realm',\n urlParamKeys: ['id']\n });\n _this.listAvailableRealmScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/scope-mappings/realm/available',\n urlParamKeys: ['id']\n });\n _this.listCompositeRealmScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/{id}/scope-mappings/realm/available',\n urlParamKeys: ['id']\n });\n _this.delRealmScopeMappings = _this.makeUpdateRequest({\n method: 'DELETE',\n path: '/{id}/scope-mappings/realm',\n urlParamKeys: ['id']\n });\n _this.listSessions = _this.makeRequest({\n method: 'GET',\n path: '/{id}/user-sessions',\n urlParamKeys: ['id']\n });\n _this.listOfflineSessions = _this.makeRequest({\n method: 'GET',\n path: '/{id}/offline-sessions',\n urlParamKeys: ['id']\n });\n _this.getSessionCount = _this.makeRequest({\n method: 'GET',\n path: '/{id}/session-count',\n urlParamKeys: ['id']\n });\n _this.getResourceServer = _this.makeRequest({\n method: 'GET',\n path: '{id}/authz/resource-server',\n urlParamKeys: ['id']\n });\n _this.updateResourceServer = _this.makeUpdateRequest({\n method: 'PUT',\n path: '{id}/authz/resource-server',\n urlParamKeys: ['id']\n });\n _this.listResources = _this.makeRequest({\n method: 'GET',\n path: '{id}/authz/resource-server/resource',\n urlParamKeys: ['id']\n });\n _this.createResource = _this.makeUpdateRequest({\n method: 'POST',\n path: '{id}/authz/resource-server/resource',\n urlParamKeys: ['id']\n });\n _this.getResource = _this.makeRequest({\n method: 'GET',\n path: '{id}/authz/resource-server/resource/{resourceId}',\n urlParamKeys: ['id', 'resourceId']\n });\n _this.updateResource = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{id}/authz/resource-server/resource/{resourceId}',\n urlParamKeys: ['id', 'resourceId']\n });\n _this.delResource = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/authz/resource-server/resource/{resourceId}',\n urlParamKeys: ['id', 'resourceId']\n });\n _this.importResource = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{id}/authz/resource-server/import',\n urlParamKeys: ['id']\n });\n _this.exportResource = _this.makeRequest({\n method: 'GET',\n path: '/{id}/authz/resource-server/settings',\n urlParamKeys: ['id']\n });\n _this.evaluateResource = _this.makeUpdateRequest({\n method: 'POST',\n path: '{id}/authz/resource-server/policy/evaluate',\n urlParamKeys: ['id']\n });\n _this.listPolicies = _this.makeRequest({\n method: 'GET',\n path: '{id}/authz/resource-server/policy',\n urlParamKeys: ['id']\n });\n _this.findPolicyByName = _this.makeRequest({\n method: 'GET',\n path: '{id}/authz/resource-server/policy/search',\n urlParamKeys: ['id']\n });\n _this.updatePolicy = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{id}/authz/resource-server/policy/{type}/{policyId}',\n urlParamKeys: ['id', 'type', 'policyId']\n });\n _this.createPolicy = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{id}/authz/resource-server/policy/{type}',\n urlParamKeys: ['id', 'type']\n });\n _this.findOnePolicy = _this.makeRequest({\n method: 'GET',\n path: '/{id}/authz/resource-server/policy/{type}/{policyId}',\n urlParamKeys: ['id', 'type', 'policyId'],\n catchNotFound: true\n });\n _this.delPolicy = _this.makeRequest({\n method: 'DELETE',\n path: '{id}/authz/resource-server/policy/{policyId}',\n urlParamKeys: ['id', 'policyId']\n });\n _this.listAllScopes = _this.makeRequest({\n method: 'GET',\n path: '/{id}/authz/resource-server/scope',\n urlParamKeys: ['id']\n });\n _this.listPermissionsByResource = _this.makeRequest({\n method: 'GET',\n path: '/{id}/authz/resource-server/resource/{resourceId}/permissions',\n urlParamKeys: ['id', 'resourceId']\n });\n _this.listScopesByResource = _this.makeRequest({\n method: 'GET',\n path: '/{id}/authz/resource-server/resource/{resourceName}/scopes',\n urlParamKeys: ['id', 'resourceName']\n });\n _this.createAuthorizationScope = _this.makeUpdateRequest({\n method: 'POST',\n path: '{id}/authz/resource-server/scope',\n urlParamKeys: ['id']\n });\n _this.findPermissions = _this.makeRequest({\n method: 'GET',\n path: '{id}/authz/resource-server/permission',\n urlParamKeys: ['id']\n });\n _this.createPermission = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{id}/authz/resource-server/permission/{type}',\n urlParamKeys: ['id', 'type']\n });\n _this.updatePermission = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{id}/authz/resource-server/permission/{type}/{permissionId}',\n urlParamKeys: ['id', 'type', 'permissionId']\n });\n _this.delPermission = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/authz/resource-server/permission/{type}/{permissionId}',\n urlParamKeys: ['id', 'type', 'permissionId']\n });\n _this.findOnePermission = _this.makeRequest({\n method: 'GET',\n path: '/{id}/authz/resource-server/permission/{type}/{permissionId}',\n urlParamKeys: ['id', 'type', 'permissionId']\n });\n _this.getAssociatedScopes = _this.makeRequest({\n method: 'GET',\n path: '/{id}/authz/resource-server/policy/{permissionId}/scopes',\n urlParamKeys: ['id', 'permissionId']\n });\n _this.getAssociatedResources = _this.makeRequest({\n method: 'GET',\n path: '/{id}/authz/resource-server/policy/{permissionId}/resources',\n urlParamKeys: ['id', 'permissionId']\n });\n _this.getOfflineSessionCount = _this.makeRequest({\n method: 'GET',\n path: '/{id}/offline-session-count',\n urlParamKeys: ['id']\n });\n _this.getInstallationProviders = _this.makeRequest({\n method: 'GET',\n path: '/{id}/installation/providers/{providerId}',\n urlParamKeys: ['id', 'providerId']\n });\n _this.pushRevocation = _this.makeRequest({\n method: 'POST',\n path: '/{id}/push-revocation',\n urlParamKeys: ['id']\n });\n _this.addClusterNode = _this.makeRequest({\n method: 'POST',\n path: '/{id}/nodes',\n urlParamKeys: ['id']\n });\n _this.deleteClusterNode = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}/nodes/{node}',\n urlParamKeys: ['id', 'node']\n });\n _this.testNodesAvailable = _this.makeRequest({\n method: 'GET',\n path: '/{id}/test-nodes-available',\n urlParamKeys: ['id']\n });\n _this.getKeyInfo = _this.makeRequest({\n method: 'GET',\n path: '/{id}/certificates/{attr}',\n urlParamKeys: ['id', 'attr']\n });\n _this.generateKey = _this.makeRequest({\n method: 'POST',\n path: '/{id}/certificates/{attr}/generate',\n urlParamKeys: ['id', 'attr']\n });\n _this.downloadKey = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{id}/certificates/{attr}/download',\n urlParamKeys: ['id', 'attr']\n });\n _this.generateAndDownloadKey = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{id}/certificates/{attr}/generate-and-download',\n urlParamKeys: ['id', 'attr']\n });\n _this.uploadKey = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{id}/certificates/{attr}/upload',\n urlParamKeys: ['id', 'attr']\n });\n _this.uploadCertificate = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{id}/certificates/{attr}/upload-certificate',\n urlParamKeys: ['id', 'attr']\n });\n return _this;\n }\n Clients.prototype.createOrUpdatePolicy = function (payload) {\n return __awaiter(this, void 0, void 0, function () {\n var policyFound;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4, this.findPolicyByName({\n id: payload.id,\n name: payload.policyName\n })];\n case 1:\n policyFound = _a.sent();\n if (!policyFound) return [3, 3];\n return [4, this.updatePolicy({ id: payload.id, policyId: policyFound.id, type: payload.policy.type }, payload.policy)];\n case 2:\n _a.sent();\n return [2, this.findPolicyByName({ id: payload.id, name: payload.policyName })];\n case 3: return [2, this.createPolicy({ id: payload.id, type: payload.policy.type }, payload.policy)];\n }\n });\n });\n };\n Clients.prototype.findProtocolMapperByName = function (payload) {\n return __awaiter(this, void 0, void 0, function () {\n var allProtocolMappers;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4, this.listProtocolMappers(__assign({ id: payload.id }, (payload.realm ? { realm: payload.realm } : {})))];\n case 1:\n allProtocolMappers = _a.sent();\n return [2, allProtocolMappers.find(function (mapper) { return mapper.name === payload.name; })];\n }\n });\n });\n };\n return Clients;\n}(resource_1[\"default\"]));\nexports.Clients = Clients;\n\n});\n\nvar realms = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.Realms = void 0;\nvar resource_1 = __importDefault(resource);\nvar Realms = (function (_super) {\n __extends(Realms, _super);\n function Realms(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms',\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.find = _this.makeRequest({\n method: 'GET'\n });\n _this.create = _this.makeRequest({\n method: 'POST',\n returnResourceIdInLocationHeader: { field: 'realmName' }\n });\n _this.findOne = _this.makeRequest({\n method: 'GET',\n path: '/{realm}',\n urlParamKeys: ['realm'],\n catchNotFound: true\n });\n _this.update = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{realm}',\n urlParamKeys: ['realm']\n });\n _this.del = _this.makeRequest({\n method: 'DELETE',\n path: '/{realm}',\n urlParamKeys: ['realm']\n });\n _this.partialImport = _this.makeRequest({\n method: 'POST',\n path: '/{realm}/partialImport',\n urlParamKeys: ['realm'],\n payloadKey: 'rep'\n });\n _this[\"export\"] = _this.makeRequest({\n method: 'POST',\n path: '/{realm}/partial-export',\n urlParamKeys: ['realm'],\n queryParamKeys: ['exportClients', 'exportGroupsAndRoles']\n });\n _this.findEvents = _this.makeRequest({\n method: 'GET',\n path: '/{realm}/events',\n urlParamKeys: ['realm'],\n queryParamKeys: [\n 'client',\n 'dateFrom',\n 'dateTo',\n 'first',\n 'ipAddress',\n 'max',\n 'type',\n 'user',\n ]\n });\n _this.getConfigEvents = _this.makeRequest({\n method: 'GET',\n path: '/{realm}/events/config',\n urlParamKeys: ['realm']\n });\n _this.updateConfigEvents = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{realm}/events/config',\n urlParamKeys: ['realm']\n });\n _this.clearEvents = _this.makeRequest({\n method: 'DELETE',\n path: '/{realm}/events',\n urlParamKeys: ['realm']\n });\n _this.clearAdminEvents = _this.makeRequest({\n method: 'DELETE',\n path: '/{realm}/admin-events',\n urlParamKeys: ['realm']\n });\n _this.getClientsInitialAccess = _this.makeRequest({\n method: 'GET',\n path: '/{realm}/clients-initial-access',\n urlParamKeys: ['realm']\n });\n _this.createClientsInitialAccess = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{realm}/clients-initial-access',\n urlParamKeys: ['realm']\n });\n _this.delClientsInitialAccess = _this.makeRequest({\n method: 'DELETE',\n path: '/{realm}/clients-initial-access/{id}',\n urlParamKeys: ['realm', 'id']\n });\n _this.removeSession = _this.makeRequest({\n method: 'DELETE',\n path: '/{realm}/sessions/{session}',\n urlParamKeys: ['realm', 'session'],\n catchNotFound: true\n });\n _this.findAdminEvents = _this.makeRequest({\n method: 'GET',\n path: '/{realm}/admin-events',\n urlParamKeys: ['realm'],\n queryParamKeys: [\n 'authClient',\n 'authIpAddress',\n 'authRealm',\n 'authUser',\n 'dateFrom',\n 'dateTo',\n 'max',\n 'first',\n 'operationTypes',\n 'resourcePath',\n 'resourceTypes',\n ]\n });\n _this.getUsersManagementPermissions = _this.makeRequest({\n method: 'GET',\n path: '/{realm}/users-management-permissions',\n urlParamKeys: ['realm']\n });\n _this.updateUsersManagementPermissions = _this.makeRequest({\n method: 'PUT',\n path: '/{realm}/users-management-permissions',\n urlParamKeys: ['realm']\n });\n _this.logoutAll = _this.makeRequest({\n method: 'POST',\n path: '/{realm}/logout-all',\n urlParamKeys: ['realm']\n });\n _this.deleteSession = _this.makeRequest({\n method: 'DELETE',\n path: '/{realm}/sessions/{session}',\n urlParamKeys: ['realm', 'session']\n });\n _this.pushRevocation = _this.makeRequest({\n method: 'POST',\n path: '/{realm}/push-revocation',\n urlParamKeys: ['realm'],\n ignoredKeys: ['realm']\n });\n _this.getKeys = _this.makeRequest({\n method: 'GET',\n path: '/{realm}/keys',\n urlParamKeys: ['realm']\n });\n _this.testLDAPConnection = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{realm}/testLDAPConnection',\n urlParamKeys: ['realm']\n });\n _this.testSMTPConnection = _this.makeUpdateRequest({\n method: 'POST',\n path: '/{realm}/testSMTPConnection',\n urlParamKeys: ['realm']\n });\n _this.getRealmSpecificLocales = _this.makeRequest({\n method: 'GET',\n path: '/{realm}/localization',\n urlParamKeys: ['realm']\n });\n _this.getRealmLocalizationTexts = _this.makeRequest({\n method: 'GET',\n path: '/{realm}/localization/{selectedLocale}',\n urlParamKeys: ['realm', 'selectedLocale']\n });\n _this.addLocalization = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{realm}/localization/{selectedLocale}/{key}',\n urlParamKeys: ['realm', 'selectedLocale', 'key'],\n headers: { 'content-type': 'text/plain' }\n });\n _this.deleteRealmLocalizationTexts = _this.makeRequest({\n method: 'DELETE',\n path: '/{realm}/localization/{selectedLocale}/{key}',\n urlParamKeys: ['realm', 'selectedLocale', 'key']\n });\n return _this;\n }\n return Realms;\n}(resource_1[\"default\"]));\nexports.Realms = Realms;\n\n});\n\nvar clientScopes = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.ClientScopes = void 0;\nvar resource_1 = __importDefault(resource);\nvar ClientScopes = (function (_super) {\n __extends(ClientScopes, _super);\n function ClientScopes(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms/{realm}',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.find = _this.makeRequest({\n method: 'GET',\n path: '/client-scopes'\n });\n _this.create = _this.makeRequest({\n method: 'POST',\n path: '/client-scopes'\n });\n _this.findOne = _this.makeRequest({\n method: 'GET',\n path: '/client-scopes/{id}',\n urlParamKeys: ['id'],\n catchNotFound: true\n });\n _this.update = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/client-scopes/{id}',\n urlParamKeys: ['id']\n });\n _this.del = _this.makeRequest({\n method: 'DELETE',\n path: '/client-scopes/{id}',\n urlParamKeys: ['id']\n });\n _this.listDefaultClientScopes = _this.makeRequest({\n method: 'GET',\n path: '/default-default-client-scopes'\n });\n _this.addDefaultClientScope = _this.makeRequest({\n method: 'PUT',\n path: '/default-default-client-scopes/{id}',\n urlParamKeys: ['id']\n });\n _this.delDefaultClientScope = _this.makeRequest({\n method: 'DELETE',\n path: '/default-default-client-scopes/{id}',\n urlParamKeys: ['id']\n });\n _this.listDefaultOptionalClientScopes = _this.makeRequest({\n method: 'GET',\n path: '/default-optional-client-scopes'\n });\n _this.addDefaultOptionalClientScope = _this.makeRequest({\n method: 'PUT',\n path: '/default-optional-client-scopes/{id}',\n urlParamKeys: ['id']\n });\n _this.delDefaultOptionalClientScope = _this.makeRequest({\n method: 'DELETE',\n path: '/default-optional-client-scopes/{id}',\n urlParamKeys: ['id']\n });\n _this.addMultipleProtocolMappers = _this.makeUpdateRequest({\n method: 'POST',\n path: '/client-scopes/{id}/protocol-mappers/add-models',\n urlParamKeys: ['id']\n });\n _this.addProtocolMapper = _this.makeUpdateRequest({\n method: 'POST',\n path: '/client-scopes/{id}/protocol-mappers/models',\n urlParamKeys: ['id']\n });\n _this.listProtocolMappers = _this.makeRequest({\n method: 'GET',\n path: '/client-scopes/{id}/protocol-mappers/models',\n urlParamKeys: ['id']\n });\n _this.findProtocolMapper = _this.makeRequest({\n method: 'GET',\n path: '/client-scopes/{id}/protocol-mappers/models/{mapperId}',\n urlParamKeys: ['id', 'mapperId'],\n catchNotFound: true\n });\n _this.findProtocolMappersByProtocol = _this.makeRequest({\n method: 'GET',\n path: '/client-scopes/{id}/protocol-mappers/protocol/{protocol}',\n urlParamKeys: ['id', 'protocol'],\n catchNotFound: true\n });\n _this.updateProtocolMapper = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/client-scopes/{id}/protocol-mappers/models/{mapperId}',\n urlParamKeys: ['id', 'mapperId']\n });\n _this.delProtocolMapper = _this.makeRequest({\n method: 'DELETE',\n path: '/client-scopes/{id}/protocol-mappers/models/{mapperId}',\n urlParamKeys: ['id', 'mapperId']\n });\n _this.listScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/client-scopes/{id}/scope-mappings',\n urlParamKeys: ['id']\n });\n _this.addClientScopeMappings = _this.makeUpdateRequest({\n method: 'POST',\n path: '/client-scopes/{id}/scope-mappings/clients/{client}',\n urlParamKeys: ['id', 'client']\n });\n _this.listClientScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/client-scopes/{id}/scope-mappings/clients/{client}',\n urlParamKeys: ['id', 'client']\n });\n _this.listAvailableClientScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/client-scopes/{id}/scope-mappings/clients/{client}/available',\n urlParamKeys: ['id', 'client']\n });\n _this.listCompositeClientScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/client-scopes/{id}/scope-mappings/clients/{client}/composite',\n urlParamKeys: ['id', 'client']\n });\n _this.delClientScopeMappings = _this.makeUpdateRequest({\n method: 'DELETE',\n path: '/client-scopes/{id}/scope-mappings/clients/{client}',\n urlParamKeys: ['id', 'client']\n });\n _this.addRealmScopeMappings = _this.makeUpdateRequest({\n method: 'POST',\n path: '/client-scopes/{id}/scope-mappings/realm',\n urlParamKeys: ['id']\n });\n _this.listRealmScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/client-scopes/{id}/scope-mappings/realm',\n urlParamKeys: ['id']\n });\n _this.listAvailableRealmScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/client-scopes/{id}/scope-mappings/realm/available',\n urlParamKeys: ['id']\n });\n _this.listCompositeRealmScopeMappings = _this.makeRequest({\n method: 'GET',\n path: '/client-scopes/{id}/scope-mappings/realm/composite',\n urlParamKeys: ['id']\n });\n _this.delRealmScopeMappings = _this.makeUpdateRequest({\n method: 'DELETE',\n path: '/client-scopes/{id}/scope-mappings/realm',\n urlParamKeys: ['id']\n });\n return _this;\n }\n ClientScopes.prototype.findOneByName = function (payload) {\n return __awaiter(this, void 0, void 0, function () {\n var allScopes;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4, this.find(__assign({}, (payload.realm ? { realm: payload.realm } : {})))];\n case 1:\n allScopes = _a.sent();\n return [2, allScopes.find(function (item) { return item.name === payload.name; })];\n }\n });\n });\n };\n ClientScopes.prototype.delByName = function (payload) {\n return __awaiter(this, void 0, void 0, function () {\n var scope;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4, this.findOneByName(payload)];\n case 1:\n scope = _a.sent();\n if (!scope) {\n throw new Error('Scope not found.');\n }\n return [4, this.del(__assign(__assign({}, (payload.realm ? { realm: payload.realm } : {})), { id: scope.id }))];\n case 2:\n _a.sent();\n return [2];\n }\n });\n });\n };\n ClientScopes.prototype.findProtocolMapperByName = function (payload) {\n return __awaiter(this, void 0, void 0, function () {\n var allProtocolMappers;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4, this.listProtocolMappers(__assign({ id: payload.id }, (payload.realm ? { realm: payload.realm } : {})))];\n case 1:\n allProtocolMappers = _a.sent();\n return [2, allProtocolMappers.find(function (mapper) { return mapper.name === payload.name; })];\n }\n });\n });\n };\n return ClientScopes;\n}(resource_1[\"default\"]));\nexports.ClientScopes = ClientScopes;\n\n});\n\nvar clientPolicies = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.ClientPolicies = void 0;\nvar resource_1 = __importDefault(resource);\nvar ClientPolicies = (function (_super) {\n __extends(ClientPolicies, _super);\n function ClientPolicies(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms/{realm}/client-policies',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.listProfiles = _this.makeRequest({\n method: 'GET',\n path: '/profiles',\n queryParamKeys: ['include-global-profiles'],\n keyTransform: {\n includeGlobalProfiles: 'include-global-profiles'\n }\n });\n _this.createProfiles = _this.makeRequest({\n method: 'PUT',\n path: '/profiles'\n });\n _this.listPolicies = _this.makeRequest({\n method: 'GET',\n path: '/policies'\n });\n _this.updatePolicy = _this.makeRequest({\n method: 'PUT',\n path: '/policies'\n });\n return _this;\n }\n return ClientPolicies;\n}(resource_1[\"default\"]));\nexports.ClientPolicies = ClientPolicies;\n\n});\n\nvar identityProviders = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.IdentityProviders = void 0;\nvar resource_1 = __importDefault(resource);\nvar IdentityProviders = (function (_super) {\n __extends(IdentityProviders, _super);\n function IdentityProviders(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms/{realm}/identity-provider',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.find = _this.makeRequest({\n method: 'GET',\n path: '/instances'\n });\n _this.create = _this.makeRequest({\n method: 'POST',\n path: '/instances',\n returnResourceIdInLocationHeader: { field: 'id' }\n });\n _this.findOne = _this.makeRequest({\n method: 'GET',\n path: '/instances/{alias}',\n urlParamKeys: ['alias'],\n catchNotFound: true\n });\n _this.update = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/instances/{alias}',\n urlParamKeys: ['alias']\n });\n _this.del = _this.makeRequest({\n method: 'DELETE',\n path: '/instances/{alias}',\n urlParamKeys: ['alias']\n });\n _this.findFactory = _this.makeRequest({\n method: 'GET',\n path: '/providers/{providerId}',\n urlParamKeys: ['providerId']\n });\n _this.findMappers = _this.makeRequest({\n method: 'GET',\n path: '/instances/{alias}/mappers',\n urlParamKeys: ['alias']\n });\n _this.findOneMapper = _this.makeRequest({\n method: 'GET',\n path: '/instances/{alias}/mappers/{id}',\n urlParamKeys: ['alias', 'id'],\n catchNotFound: true\n });\n _this.createMapper = _this.makeRequest({\n method: 'POST',\n path: '/instances/{alias}/mappers',\n urlParamKeys: ['alias'],\n payloadKey: 'identityProviderMapper',\n returnResourceIdInLocationHeader: { field: 'id' }\n });\n _this.updateMapper = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/instances/{alias}/mappers/{id}',\n urlParamKeys: ['alias', 'id']\n });\n _this.delMapper = _this.makeRequest({\n method: 'DELETE',\n path: '/instances/{alias}/mappers/{id}',\n urlParamKeys: ['alias', 'id']\n });\n _this.findMapperTypes = _this.makeRequest({\n method: 'GET',\n path: '/instances/{alias}/mapper-types',\n urlParamKeys: ['alias']\n });\n _this.importFromUrl = _this.makeRequest({\n method: 'POST',\n path: '/import-config'\n });\n return _this;\n }\n return IdentityProviders;\n}(resource_1[\"default\"]));\nexports.IdentityProviders = IdentityProviders;\n\n});\n\nvar components = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.Components = void 0;\nvar resource_1 = __importDefault(resource);\nvar Components = (function (_super) {\n __extends(Components, _super);\n function Components(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms/{realm}/components',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.find = _this.makeRequest({\n method: 'GET'\n });\n _this.create = _this.makeRequest({\n method: 'POST',\n returnResourceIdInLocationHeader: { field: 'id' }\n });\n _this.findOne = _this.makeRequest({\n method: 'GET',\n path: '/{id}',\n urlParamKeys: ['id'],\n catchNotFound: true\n });\n _this.update = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/{id}',\n urlParamKeys: ['id']\n });\n _this.del = _this.makeRequest({\n method: 'DELETE',\n path: '/{id}',\n urlParamKeys: ['id']\n });\n _this.listSubComponents = _this.makeRequest({\n method: 'GET',\n path: '/{id}/sub-component-types',\n urlParamKeys: ['id'],\n queryParamKeys: ['type']\n });\n return _this;\n }\n return Components;\n}(resource_1[\"default\"]));\nexports.Components = Components;\n\n});\n\nvar authenticationManagement = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.AuthenticationManagement = void 0;\nvar resource_1 = __importDefault(resource);\nvar AuthenticationManagement = (function (_super) {\n __extends(AuthenticationManagement, _super);\n function AuthenticationManagement(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms/{realm}/authentication',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.registerRequiredAction = _this.makeRequest({\n method: 'POST',\n path: '/register-required-action'\n });\n _this.getRequiredActions = _this.makeRequest({\n method: 'GET',\n path: '/required-actions'\n });\n _this.getRequiredActionForAlias = _this.makeRequest({\n method: 'GET',\n path: '/required-actions/{alias}',\n urlParamKeys: ['alias'],\n catchNotFound: true\n });\n _this.getClientAuthenticatorProviders = _this.makeRequest({\n method: 'GET',\n path: '/client-authenticator-providers'\n });\n _this.getAuthenticatorProviders = _this.makeRequest({\n method: 'GET',\n path: '/authenticator-providers'\n });\n _this.getFormActionProviders = _this.makeRequest({\n method: 'GET',\n path: '/form-action-providers'\n });\n _this.updateRequiredAction = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/required-actions/{alias}',\n urlParamKeys: ['alias']\n });\n _this.deleteRequiredAction = _this.makeRequest({\n method: 'DELETE',\n path: '/required-actions/{alias}',\n urlParamKeys: ['alias']\n });\n _this.lowerRequiredActionPriority = _this.makeRequest({\n method: 'POST',\n path: '/required-actions/{alias}/lower-priority',\n urlParamKeys: ['alias']\n });\n _this.raiseRequiredActionPriority = _this.makeRequest({\n method: 'POST',\n path: '/required-actions/{alias}/raise-priority',\n urlParamKeys: ['alias']\n });\n _this.getUnregisteredRequiredActions = _this.makeRequest({\n method: 'GET',\n path: '/unregistered-required-actions'\n });\n _this.getFlows = _this.makeRequest({\n method: 'GET',\n path: '/flows'\n });\n _this.getFlow = _this.makeRequest({\n method: 'GET',\n path: '/flows/{flowId}',\n urlParamKeys: ['flowId']\n });\n _this.getFormProviders = _this.makeRequest({\n method: 'GET',\n path: '/form-providers'\n });\n _this.createFlow = _this.makeRequest({\n method: 'POST',\n path: '/flows',\n returnResourceIdInLocationHeader: { field: 'id' }\n });\n _this.copyFlow = _this.makeRequest({\n method: 'POST',\n path: '/flows/{flow}/copy',\n urlParamKeys: ['flow']\n });\n _this.deleteFlow = _this.makeRequest({\n method: 'DELETE',\n path: '/flows/{flowId}',\n urlParamKeys: ['flowId']\n });\n _this.updateFlow = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/flows/{flowId}',\n urlParamKeys: ['flowId']\n });\n _this.getExecutions = _this.makeRequest({\n method: 'GET',\n path: '/flows/{flow}/executions',\n urlParamKeys: ['flow']\n });\n _this.addExecution = _this.makeUpdateRequest({\n method: 'POST',\n path: '/flows/{flow}/executions',\n urlParamKeys: ['flow']\n });\n _this.addExecutionToFlow = _this.makeRequest({\n method: 'POST',\n path: '/flows/{flow}/executions/execution',\n urlParamKeys: ['flow'],\n returnResourceIdInLocationHeader: { field: 'id' }\n });\n _this.addFlowToFlow = _this.makeRequest({\n method: 'POST',\n path: '/flows/{flow}/executions/flow',\n urlParamKeys: ['flow'],\n returnResourceIdInLocationHeader: { field: 'id' }\n });\n _this.updateExecution = _this.makeUpdateRequest({\n method: 'PUT',\n path: '/flows/{flow}/executions',\n urlParamKeys: ['flow']\n });\n _this.delExecution = _this.makeRequest({\n method: 'DELETE',\n path: '/executions/{id}',\n urlParamKeys: ['id']\n });\n _this.lowerPriorityExecution = _this.makeRequest({\n method: 'POST',\n path: '/executions/{id}/lower-priority',\n urlParamKeys: ['id']\n });\n _this.raisePriorityExecution = _this.makeRequest({\n method: 'POST',\n path: '/executions/{id}/raise-priority',\n urlParamKeys: ['id']\n });\n _this.getConfigDescription = _this.makeRequest({\n method: 'GET',\n path: 'config-description/{providerId}',\n urlParamKeys: ['providerId']\n });\n _this.createConfig = _this.makeRequest({\n method: 'POST',\n path: '/executions/{id}/config',\n urlParamKeys: ['id'],\n returnResourceIdInLocationHeader: { field: 'id' }\n });\n _this.updateConfig = _this.makeRequest({\n method: 'PUT',\n path: '/config/{id}',\n urlParamKeys: ['id']\n });\n _this.getConfig = _this.makeRequest({\n method: 'GET',\n path: '/config/{id}',\n urlParamKeys: ['id']\n });\n _this.delConfig = _this.makeRequest({\n method: 'DELETE',\n path: '/config/{id}',\n urlParamKeys: ['id']\n });\n return _this;\n }\n return AuthenticationManagement;\n}(resource_1[\"default\"]));\nexports.AuthenticationManagement = AuthenticationManagement;\n\n});\n\nvar serverInfo = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.ServerInfo = void 0;\nvar resource_1 = __importDefault(resource);\nvar ServerInfo = (function (_super) {\n __extends(ServerInfo, _super);\n function ServerInfo(client) {\n var _this = _super.call(this, client, {\n path: '/admin/serverinfo',\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.find = _this.makeRequest({\n method: 'GET',\n path: '/'\n });\n return _this;\n }\n return ServerInfo;\n}(resource_1[\"default\"]));\nexports.ServerInfo = ServerInfo;\n\n});\n\nvar whoAmI = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.WhoAmI = void 0;\nvar resource_1 = __importDefault(resource);\nvar WhoAmI = (function (_super) {\n __extends(WhoAmI, _super);\n function WhoAmI(client) {\n var _this = _super.call(this, client, {\n path: '/admin/{realm}/console',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.find = _this.makeRequest({\n method: 'GET',\n path: '/whoami'\n });\n return _this;\n }\n return WhoAmI;\n}(resource_1[\"default\"]));\nexports.WhoAmI = WhoAmI;\n\n});\n\nvar attackDetection = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.AttackDetection = void 0;\nvar resource_1 = __importDefault(resource);\nvar AttackDetection = (function (_super) {\n __extends(AttackDetection, _super);\n function AttackDetection(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms/{realm}/attack-detection/brute-force',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.findOne = _this.makeRequest({\n method: 'GET',\n path: '/users/{id}',\n urlParamKeys: ['id'],\n catchNotFound: true\n });\n _this.del = _this.makeRequest({\n method: 'DELETE',\n path: '/users/{id}',\n urlParamKeys: ['id']\n });\n _this.delAll = _this.makeRequest({\n method: 'DELETE',\n path: '/users'\n });\n return _this;\n }\n return AttackDetection;\n}(resource_1[\"default\"]));\nexports.AttackDetection = AttackDetection;\n\n});\n\nvar sessions = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.Sessions = void 0;\nvar resource_1 = __importDefault(resource);\nvar Sessions = (function (_super) {\n __extends(Sessions, _super);\n function Sessions(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms/{realm}/client-session-stats',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.find = _this.makeRequest({\n method: 'GET'\n });\n return _this;\n }\n return Sessions;\n}(resource_1[\"default\"]));\nexports.Sessions = Sessions;\n\n});\n\nvar userStorageProvider = createCommonjsModule(function (module, exports) {\nvar __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nexports.__esModule = true;\nexports.UserStorageProvider = void 0;\nvar resource_1 = __importDefault(resource);\nvar UserStorageProvider = (function (_super) {\n __extends(UserStorageProvider, _super);\n function UserStorageProvider(client) {\n var _this = _super.call(this, client, {\n path: '/admin/realms/{realm}/user-storage',\n getUrlParams: function () { return ({\n realm: client.realmName\n }); },\n getBaseUrl: function () { return client.baseUrl; }\n }) || this;\n _this.name = _this.makeRequest({\n method: 'GET',\n path: '/{id}/name',\n urlParamKeys: ['id']\n });\n _this.removeImportedUsers = _this.makeRequest({\n method: 'POST',\n path: '/{id}/remove-imported-users',\n urlParamKeys: ['id']\n });\n _this.sync = _this.makeRequest({\n method: 'POST',\n path: '/{id}/sync',\n urlParamKeys: ['id'],\n queryParamKeys: ['action']\n });\n _this.unlinkUsers = _this.makeRequest({\n method: 'POST',\n path: '/{id}/unlink-users',\n urlParamKeys: ['id']\n });\n _this.mappersSync = _this.makeRequest({\n method: 'POST',\n path: '/{parentId}/mappers/{id}/sync',\n urlParamKeys: ['id', 'parentId'],\n queryParamKeys: ['direction']\n });\n return _this;\n }\n return UserStorageProvider;\n}(resource_1[\"default\"]));\nexports.UserStorageProvider = UserStorageProvider;\n\n});\n\nvar sha256 = createCommonjsModule(function (module) {\n/**\n * [js-sha256]{@link https://github.com/emn178/js-sha256}\n *\n * @version 0.9.0\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\n * @copyright Chen, Yi-Cyuan 2014-2017\n * @license MIT\n */\n/*jslint bitwise: true */\n(function () {\n\n var ERROR = 'input is invalid type';\n var WINDOW = typeof window === 'object';\n var root = WINDOW ? window : {};\n if (root.JS_SHA256_NO_WINDOW) {\n WINDOW = false;\n }\n var WEB_WORKER = !WINDOW && typeof self === 'object';\n var NODE_JS = !root.JS_SHA256_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;\n if (NODE_JS) {\n root = commonjsGlobal;\n } else if (WEB_WORKER) {\n root = self;\n }\n var COMMON_JS = !root.JS_SHA256_NO_COMMON_JS && 'object' === 'object' && module.exports;\n var ARRAY_BUFFER = !root.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';\n var HEX_CHARS = '0123456789abcdef'.split('');\n var EXTRA = [-2147483648, 8388608, 32768, 128];\n var SHIFT = [24, 16, 8, 0];\n var K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n ];\n var OUTPUT_TYPES = ['hex', 'array', 'digest', 'arrayBuffer'];\n\n var blocks = [];\n\n if (root.JS_SHA256_NO_NODE_JS || !Array.isArray) {\n Array.isArray = function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n };\n }\n\n if (ARRAY_BUFFER && (root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {\n ArrayBuffer.isView = function (obj) {\n return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;\n };\n }\n\n var createOutputMethod = function (outputType, is224) {\n return function (message) {\n return new Sha256(is224, true).update(message)[outputType]();\n };\n };\n\n var createMethod = function (is224) {\n var method = createOutputMethod('hex', is224);\n if (NODE_JS) {\n method = nodeWrap(method, is224);\n }\n method.create = function () {\n return new Sha256(is224);\n };\n method.update = function (message) {\n return method.create().update(message);\n };\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\n var type = OUTPUT_TYPES[i];\n method[type] = createOutputMethod(type, is224);\n }\n return method;\n };\n\n var nodeWrap = function (method, is224) {\n var crypto = eval(\"require('crypto')\");\n var Buffer = eval(\"require('buffer').Buffer\");\n var algorithm = is224 ? 'sha224' : 'sha256';\n var nodeMethod = function (message) {\n if (typeof message === 'string') {\n return crypto.createHash(algorithm).update(message, 'utf8').digest('hex');\n } else {\n if (message === null || message === undefined) {\n throw new Error(ERROR);\n } else if (message.constructor === ArrayBuffer) {\n message = new Uint8Array(message);\n }\n }\n if (Array.isArray(message) || ArrayBuffer.isView(message) ||\n message.constructor === Buffer) {\n return crypto.createHash(algorithm).update(new Buffer(message)).digest('hex');\n } else {\n return method(message);\n }\n };\n return nodeMethod;\n };\n\n var createHmacOutputMethod = function (outputType, is224) {\n return function (key, message) {\n return new HmacSha256(key, is224, true).update(message)[outputType]();\n };\n };\n\n var createHmacMethod = function (is224) {\n var method = createHmacOutputMethod('hex', is224);\n method.create = function (key) {\n return new HmacSha256(key, is224);\n };\n method.update = function (key, message) {\n return method.create(key).update(message);\n };\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\n var type = OUTPUT_TYPES[i];\n method[type] = createHmacOutputMethod(type, is224);\n }\n return method;\n };\n\n function Sha256(is224, sharedMemory) {\n if (sharedMemory) {\n blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] =\n blocks[4] = blocks[5] = blocks[6] = blocks[7] =\n blocks[8] = blocks[9] = blocks[10] = blocks[11] =\n blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;\n this.blocks = blocks;\n } else {\n this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n }\n\n if (is224) {\n this.h0 = 0xc1059ed8;\n this.h1 = 0x367cd507;\n this.h2 = 0x3070dd17;\n this.h3 = 0xf70e5939;\n this.h4 = 0xffc00b31;\n this.h5 = 0x68581511;\n this.h6 = 0x64f98fa7;\n this.h7 = 0xbefa4fa4;\n } else { // 256\n this.h0 = 0x6a09e667;\n this.h1 = 0xbb67ae85;\n this.h2 = 0x3c6ef372;\n this.h3 = 0xa54ff53a;\n this.h4 = 0x510e527f;\n this.h5 = 0x9b05688c;\n this.h6 = 0x1f83d9ab;\n this.h7 = 0x5be0cd19;\n }\n\n this.block = this.start = this.bytes = this.hBytes = 0;\n this.finalized = this.hashed = false;\n this.first = true;\n this.is224 = is224;\n }\n\n Sha256.prototype.update = function (message) {\n if (this.finalized) {\n return;\n }\n var notString, type = typeof message;\n if (type !== 'string') {\n if (type === 'object') {\n if (message === null) {\n throw new Error(ERROR);\n } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {\n message = new Uint8Array(message);\n } else if (!Array.isArray(message)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {\n throw new Error(ERROR);\n }\n }\n } else {\n throw new Error(ERROR);\n }\n notString = true;\n }\n var code, index = 0, i, length = message.length, blocks = this.blocks;\n\n while (index < length) {\n if (this.hashed) {\n this.hashed = false;\n blocks[0] = this.block;\n blocks[16] = blocks[1] = blocks[2] = blocks[3] =\n blocks[4] = blocks[5] = blocks[6] = blocks[7] =\n blocks[8] = blocks[9] = blocks[10] = blocks[11] =\n blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;\n }\n\n if (notString) {\n for (i = this.start; index < length && i < 64; ++index) {\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\n }\n } else {\n for (i = this.start; index < length && i < 64; ++index) {\n code = message.charCodeAt(index);\n if (code < 0x80) {\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\n } else if (code < 0x800) {\n blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));\n blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n }\n }\n }\n\n this.lastByteIndex = i;\n this.bytes += i - this.start;\n if (i >= 64) {\n this.block = blocks[16];\n this.start = i - 64;\n this.hash();\n this.hashed = true;\n } else {\n this.start = i;\n }\n }\n if (this.bytes > 4294967295) {\n this.hBytes += this.bytes / 4294967296 << 0;\n this.bytes = this.bytes % 4294967296;\n }\n return this;\n };\n\n Sha256.prototype.finalize = function () {\n if (this.finalized) {\n return;\n }\n this.finalized = true;\n var blocks = this.blocks, i = this.lastByteIndex;\n blocks[16] = this.block;\n blocks[i >> 2] |= EXTRA[i & 3];\n this.block = blocks[16];\n if (i >= 56) {\n if (!this.hashed) {\n this.hash();\n }\n blocks[0] = this.block;\n blocks[16] = blocks[1] = blocks[2] = blocks[3] =\n blocks[4] = blocks[5] = blocks[6] = blocks[7] =\n blocks[8] = blocks[9] = blocks[10] = blocks[11] =\n blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;\n }\n blocks[14] = this.hBytes << 3 | this.bytes >>> 29;\n blocks[15] = this.bytes << 3;\n this.hash();\n };\n\n Sha256.prototype.hash = function () {\n var a = this.h0, b = this.h1, c = this.h2, d = this.h3, e = this.h4, f = this.h5, g = this.h6,\n h = this.h7, blocks = this.blocks, j, s0, s1, maj, t1, t2, ch, ab, da, cd, bc;\n\n for (j = 16; j < 64; ++j) {\n // rightrotate\n t1 = blocks[j - 15];\n s0 = ((t1 >>> 7) | (t1 << 25)) ^ ((t1 >>> 18) | (t1 << 14)) ^ (t1 >>> 3);\n t1 = blocks[j - 2];\n s1 = ((t1 >>> 17) | (t1 << 15)) ^ ((t1 >>> 19) | (t1 << 13)) ^ (t1 >>> 10);\n blocks[j] = blocks[j - 16] + s0 + blocks[j - 7] + s1 << 0;\n }\n\n bc = b & c;\n for (j = 0; j < 64; j += 4) {\n if (this.first) {\n if (this.is224) {\n ab = 300032;\n t1 = blocks[0] - 1413257819;\n h = t1 - 150054599 << 0;\n d = t1 + 24177077 << 0;\n } else {\n ab = 704751109;\n t1 = blocks[0] - 210244248;\n h = t1 - 1521486534 << 0;\n d = t1 + 143694565 << 0;\n }\n this.first = false;\n } else {\n s0 = ((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10));\n s1 = ((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7));\n ab = a & b;\n maj = ab ^ (a & c) ^ bc;\n ch = (e & f) ^ (~e & g);\n t1 = h + s1 + ch + K[j] + blocks[j];\n t2 = s0 + maj;\n h = d + t1 << 0;\n d = t1 + t2 << 0;\n }\n s0 = ((d >>> 2) | (d << 30)) ^ ((d >>> 13) | (d << 19)) ^ ((d >>> 22) | (d << 10));\n s1 = ((h >>> 6) | (h << 26)) ^ ((h >>> 11) | (h << 21)) ^ ((h >>> 25) | (h << 7));\n da = d & a;\n maj = da ^ (d & b) ^ ab;\n ch = (h & e) ^ (~h & f);\n t1 = g + s1 + ch + K[j + 1] + blocks[j + 1];\n t2 = s0 + maj;\n g = c + t1 << 0;\n c = t1 + t2 << 0;\n s0 = ((c >>> 2) | (c << 30)) ^ ((c >>> 13) | (c << 19)) ^ ((c >>> 22) | (c << 10));\n s1 = ((g >>> 6) | (g << 26)) ^ ((g >>> 11) | (g << 21)) ^ ((g >>> 25) | (g << 7));\n cd = c & d;\n maj = cd ^ (c & a) ^ da;\n ch = (g & h) ^ (~g & e);\n t1 = f + s1 + ch + K[j + 2] + blocks[j + 2];\n t2 = s0 + maj;\n f = b + t1 << 0;\n b = t1 + t2 << 0;\n s0 = ((b >>> 2) | (b << 30)) ^ ((b >>> 13) | (b << 19)) ^ ((b >>> 22) | (b << 10));\n s1 = ((f >>> 6) | (f << 26)) ^ ((f >>> 11) | (f << 21)) ^ ((f >>> 25) | (f << 7));\n bc = b & c;\n maj = bc ^ (b & d) ^ cd;\n ch = (f & g) ^ (~f & h);\n t1 = e + s1 + ch + K[j + 3] + blocks[j + 3];\n t2 = s0 + maj;\n e = a + t1 << 0;\n a = t1 + t2 << 0;\n }\n\n this.h0 = this.h0 + a << 0;\n this.h1 = this.h1 + b << 0;\n this.h2 = this.h2 + c << 0;\n this.h3 = this.h3 + d << 0;\n this.h4 = this.h4 + e << 0;\n this.h5 = this.h5 + f << 0;\n this.h6 = this.h6 + g << 0;\n this.h7 = this.h7 + h << 0;\n };\n\n Sha256.prototype.hex = function () {\n this.finalize();\n\n var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5,\n h6 = this.h6, h7 = this.h7;\n\n var hex = HEX_CHARS[(h0 >> 28) & 0x0F] + HEX_CHARS[(h0 >> 24) & 0x0F] +\n HEX_CHARS[(h0 >> 20) & 0x0F] + HEX_CHARS[(h0 >> 16) & 0x0F] +\n HEX_CHARS[(h0 >> 12) & 0x0F] + HEX_CHARS[(h0 >> 8) & 0x0F] +\n HEX_CHARS[(h0 >> 4) & 0x0F] + HEX_CHARS[h0 & 0x0F] +\n HEX_CHARS[(h1 >> 28) & 0x0F] + HEX_CHARS[(h1 >> 24) & 0x0F] +\n HEX_CHARS[(h1 >> 20) & 0x0F] + HEX_CHARS[(h1 >> 16) & 0x0F] +\n HEX_CHARS[(h1 >> 12) & 0x0F] + HEX_CHARS[(h1 >> 8) & 0x0F] +\n HEX_CHARS[(h1 >> 4) & 0x0F] + HEX_CHARS[h1 & 0x0F] +\n HEX_CHARS[(h2 >> 28) & 0x0F] + HEX_CHARS[(h2 >> 24) & 0x0F] +\n HEX_CHARS[(h2 >> 20) & 0x0F] + HEX_CHARS[(h2 >> 16) & 0x0F] +\n HEX_CHARS[(h2 >> 12) & 0x0F] + HEX_CHARS[(h2 >> 8) & 0x0F] +\n HEX_CHARS[(h2 >> 4) & 0x0F] + HEX_CHARS[h2 & 0x0F] +\n HEX_CHARS[(h3 >> 28) & 0x0F] + HEX_CHARS[(h3 >> 24) & 0x0F] +\n HEX_CHARS[(h3 >> 20) & 0x0F] + HEX_CHARS[(h3 >> 16) & 0x0F] +\n HEX_CHARS[(h3 >> 12) & 0x0F] + HEX_CHARS[(h3 >> 8) & 0x0F] +\n HEX_CHARS[(h3 >> 4) & 0x0F] + HEX_CHARS[h3 & 0x0F] +\n HEX_CHARS[(h4 >> 28) & 0x0F] + HEX_CHARS[(h4 >> 24) & 0x0F] +\n HEX_CHARS[(h4 >> 20) & 0x0F] + HEX_CHARS[(h4 >> 16) & 0x0F] +\n HEX_CHARS[(h4 >> 12) & 0x0F] + HEX_CHARS[(h4 >> 8) & 0x0F] +\n HEX_CHARS[(h4 >> 4) & 0x0F] + HEX_CHARS[h4 & 0x0F] +\n HEX_CHARS[(h5 >> 28) & 0x0F] + HEX_CHARS[(h5 >> 24) & 0x0F] +\n HEX_CHARS[(h5 >> 20) & 0x0F] + HEX_CHARS[(h5 >> 16) & 0x0F] +\n HEX_CHARS[(h5 >> 12) & 0x0F] + HEX_CHARS[(h5 >> 8) & 0x0F] +\n HEX_CHARS[(h5 >> 4) & 0x0F] + HEX_CHARS[h5 & 0x0F] +\n HEX_CHARS[(h6 >> 28) & 0x0F] + HEX_CHARS[(h6 >> 24) & 0x0F] +\n HEX_CHARS[(h6 >> 20) & 0x0F] + HEX_CHARS[(h6 >> 16) & 0x0F] +\n HEX_CHARS[(h6 >> 12) & 0x0F] + HEX_CHARS[(h6 >> 8) & 0x0F] +\n HEX_CHARS[(h6 >> 4) & 0x0F] + HEX_CHARS[h6 & 0x0F];\n if (!this.is224) {\n hex += HEX_CHARS[(h7 >> 28) & 0x0F] + HEX_CHARS[(h7 >> 24) & 0x0F] +\n HEX_CHARS[(h7 >> 20) & 0x0F] + HEX_CHARS[(h7 >> 16) & 0x0F] +\n HEX_CHARS[(h7 >> 12) & 0x0F] + HEX_CHARS[(h7 >> 8) & 0x0F] +\n HEX_CHARS[(h7 >> 4) & 0x0F] + HEX_CHARS[h7 & 0x0F];\n }\n return hex;\n };\n\n Sha256.prototype.toString = Sha256.prototype.hex;\n\n Sha256.prototype.digest = function () {\n this.finalize();\n\n var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5,\n h6 = this.h6, h7 = this.h7;\n\n var arr = [\n (h0 >> 24) & 0xFF, (h0 >> 16) & 0xFF, (h0 >> 8) & 0xFF, h0 & 0xFF,\n (h1 >> 24) & 0xFF, (h1 >> 16) & 0xFF, (h1 >> 8) & 0xFF, h1 & 0xFF,\n (h2 >> 24) & 0xFF, (h2 >> 16) & 0xFF, (h2 >> 8) & 0xFF, h2 & 0xFF,\n (h3 >> 24) & 0xFF, (h3 >> 16) & 0xFF, (h3 >> 8) & 0xFF, h3 & 0xFF,\n (h4 >> 24) & 0xFF, (h4 >> 16) & 0xFF, (h4 >> 8) & 0xFF, h4 & 0xFF,\n (h5 >> 24) & 0xFF, (h5 >> 16) & 0xFF, (h5 >> 8) & 0xFF, h5 & 0xFF,\n (h6 >> 24) & 0xFF, (h6 >> 16) & 0xFF, (h6 >> 8) & 0xFF, h6 & 0xFF\n ];\n if (!this.is224) {\n arr.push((h7 >> 24) & 0xFF, (h7 >> 16) & 0xFF, (h7 >> 8) & 0xFF, h7 & 0xFF);\n }\n return arr;\n };\n\n Sha256.prototype.array = Sha256.prototype.digest;\n\n Sha256.prototype.arrayBuffer = function () {\n this.finalize();\n\n var buffer = new ArrayBuffer(this.is224 ? 28 : 32);\n var dataView = new DataView(buffer);\n dataView.setUint32(0, this.h0);\n dataView.setUint32(4, this.h1);\n dataView.setUint32(8, this.h2);\n dataView.setUint32(12, this.h3);\n dataView.setUint32(16, this.h4);\n dataView.setUint32(20, this.h5);\n dataView.setUint32(24, this.h6);\n if (!this.is224) {\n dataView.setUint32(28, this.h7);\n }\n return buffer;\n };\n\n function HmacSha256(key, is224, sharedMemory) {\n var i, type = typeof key;\n if (type === 'string') {\n var bytes = [], length = key.length, index = 0, code;\n for (i = 0; i < length; ++i) {\n code = key.charCodeAt(i);\n if (code < 0x80) {\n bytes[index++] = code;\n } else if (code < 0x800) {\n bytes[index++] = (0xc0 | (code >> 6));\n bytes[index++] = (0x80 | (code & 0x3f));\n } else if (code < 0xd800 || code >= 0xe000) {\n bytes[index++] = (0xe0 | (code >> 12));\n bytes[index++] = (0x80 | ((code >> 6) & 0x3f));\n bytes[index++] = (0x80 | (code & 0x3f));\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (key.charCodeAt(++i) & 0x3ff));\n bytes[index++] = (0xf0 | (code >> 18));\n bytes[index++] = (0x80 | ((code >> 12) & 0x3f));\n bytes[index++] = (0x80 | ((code >> 6) & 0x3f));\n bytes[index++] = (0x80 | (code & 0x3f));\n }\n }\n key = bytes;\n } else {\n if (type === 'object') {\n if (key === null) {\n throw new Error(ERROR);\n } else if (ARRAY_BUFFER && key.constructor === ArrayBuffer) {\n key = new Uint8Array(key);\n } else if (!Array.isArray(key)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(key)) {\n throw new Error(ERROR);\n }\n }\n } else {\n throw new Error(ERROR);\n }\n }\n\n if (key.length > 64) {\n key = (new Sha256(is224, true)).update(key).array();\n }\n\n var oKeyPad = [], iKeyPad = [];\n for (i = 0; i < 64; ++i) {\n var b = key[i] || 0;\n oKeyPad[i] = 0x5c ^ b;\n iKeyPad[i] = 0x36 ^ b;\n }\n\n Sha256.call(this, is224, sharedMemory);\n\n this.update(iKeyPad);\n this.oKeyPad = oKeyPad;\n this.inner = true;\n this.sharedMemory = sharedMemory;\n }\n HmacSha256.prototype = new Sha256();\n\n HmacSha256.prototype.finalize = function () {\n Sha256.prototype.finalize.call(this);\n if (this.inner) {\n this.inner = false;\n var innerHash = this.array();\n Sha256.call(this, this.is224, this.sharedMemory);\n this.update(this.oKeyPad);\n this.update(innerHash);\n Sha256.prototype.finalize.call(this);\n }\n };\n\n var exports = createMethod();\n exports.sha256 = exports;\n exports.sha224 = createMethod(true);\n exports.sha256.hmac = createHmacMethod();\n exports.sha224.hmac = createHmacMethod(true);\n\n if (COMMON_JS) {\n module.exports = exports;\n } else {\n root.sha256 = exports.sha256;\n root.sha224 = exports.sha224;\n }\n})();\n});\n\nvar byteLength_1 = byteLength;\nvar toByteArray_1 = toByteArray;\nvar fromByteArray_1 = fromByteArray;\n\nvar lookup = [];\nvar revLookup = [];\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62;\nrevLookup['_'.charCodeAt(0)] = 63;\n\nfunction getLens (b64) {\n var len = b64.length;\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=');\n if (validLen === -1) validLen = len;\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4);\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n\n var curByte = 0;\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen;\n\n var i;\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)];\n arr[curByte++] = (tmp >> 16) & 0xFF;\n arr[curByte++] = (tmp >> 8) & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4);\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2);\n arr[curByte++] = (tmp >> 8) & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp;\n var output = [];\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF);\n output.push(tripletToBase64(tmp));\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp;\n var len = uint8.length;\n var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes\n var parts = [];\n var maxChunkLength = 16383; // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ));\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1];\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n );\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1];\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n );\n }\n\n return parts.join('')\n}\n\nvar base64Js = {\n\tbyteLength: byteLength_1,\n\ttoByteArray: toByteArray_1,\n\tfromByteArray: fromByteArray_1\n};\n\nvar keycloak = createCommonjsModule(function (module, exports) {\n/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n(function(root, factory) {\n {\n {\n module.exports = factory( sha256, base64Js );\n }\n }\n})(window, function (sha256_imported, base64js_imported) {\n if (typeof Promise === 'undefined') {\n throw Error('Keycloak requires an environment that supports Promises. Make sure that you include the appropriate polyfill.');\n }\n\n var loggedPromiseDeprecation = false;\n\n function logPromiseDeprecation() {\n if (!loggedPromiseDeprecation) {\n loggedPromiseDeprecation = true;\n console.warn('[KEYCLOAK] Usage of legacy style promise methods such as `.error()` and `.success()` has been deprecated and support will be removed in future versions. Use standard style promise methods such as `.then() and `.catch()` instead.');\n }\n }\n\n function Keycloak (config) {\n if (!(this instanceof Keycloak)) {\n return new Keycloak(config);\n }\n\n var kc = this;\n var adapter;\n var refreshQueue = [];\n var callbackStorage;\n\n var loginIframe = {\n enable: true,\n callbackList: [],\n interval: 5\n };\n\n var scripts = document.getElementsByTagName('script');\n for (var i = 0; i < scripts.length; i++) {\n if ((scripts[i].src.indexOf('keycloak.js') !== -1 || scripts[i].src.indexOf('keycloak.min.js') !== -1) && scripts[i].src.indexOf('version=') !== -1) {\n kc.iframeVersion = scripts[i].src.substring(scripts[i].src.indexOf('version=') + 8).split('&')[0];\n }\n }\n\n var useNonce = true;\n var logInfo = createLogger(console.info);\n var logWarn = createLogger(console.warn);\n\n kc.init = function (initOptions) {\n kc.authenticated = false;\n\n callbackStorage = createCallbackStorage();\n var adapters = ['default', 'cordova', 'cordova-native'];\n\n if (initOptions && adapters.indexOf(initOptions.adapter) > -1) {\n adapter = loadAdapter(initOptions.adapter);\n } else if (initOptions && typeof initOptions.adapter === \"object\") {\n adapter = initOptions.adapter;\n } else {\n if (window.Cordova || window.cordova) {\n adapter = loadAdapter('cordova');\n } else {\n adapter = loadAdapter();\n }\n }\n\n if (initOptions) {\n if (typeof initOptions.useNonce !== 'undefined') {\n useNonce = initOptions.useNonce;\n }\n\n if (typeof initOptions.checkLoginIframe !== 'undefined') {\n loginIframe.enable = initOptions.checkLoginIframe;\n }\n\n if (initOptions.checkLoginIframeInterval) {\n loginIframe.interval = initOptions.checkLoginIframeInterval;\n }\n\n if (initOptions.onLoad === 'login-required') {\n kc.loginRequired = true;\n }\n\n if (initOptions.responseMode) {\n if (initOptions.responseMode === 'query' || initOptions.responseMode === 'fragment') {\n kc.responseMode = initOptions.responseMode;\n } else {\n throw 'Invalid value for responseMode';\n }\n }\n\n if (initOptions.flow) {\n switch (initOptions.flow) {\n case 'standard':\n kc.responseType = 'code';\n break;\n case 'implicit':\n kc.responseType = 'id_token token';\n break;\n case 'hybrid':\n kc.responseType = 'code id_token token';\n break;\n default:\n throw 'Invalid value for flow';\n }\n kc.flow = initOptions.flow;\n }\n\n if (initOptions.timeSkew != null) {\n kc.timeSkew = initOptions.timeSkew;\n }\n\n if(initOptions.redirectUri) {\n kc.redirectUri = initOptions.redirectUri;\n }\n\n if (initOptions.silentCheckSsoRedirectUri) {\n kc.silentCheckSsoRedirectUri = initOptions.silentCheckSsoRedirectUri;\n }\n\n if (typeof initOptions.silentCheckSsoFallback === 'boolean') {\n kc.silentCheckSsoFallback = initOptions.silentCheckSsoFallback;\n } else {\n kc.silentCheckSsoFallback = true;\n }\n\n if (initOptions.pkceMethod) {\n if (initOptions.pkceMethod !== \"S256\") {\n throw 'Invalid value for pkceMethod';\n }\n kc.pkceMethod = initOptions.pkceMethod;\n }\n\n if (typeof initOptions.enableLogging === 'boolean') {\n kc.enableLogging = initOptions.enableLogging;\n } else {\n kc.enableLogging = false;\n }\n\n if (typeof initOptions.scope === 'string') {\n kc.scope = initOptions.scope;\n }\n\n if (typeof initOptions.messageReceiveTimeout === 'number' && initOptions.messageReceiveTimeout > 0) {\n kc.messageReceiveTimeout = initOptions.messageReceiveTimeout;\n } else {\n kc.messageReceiveTimeout = 10000;\n }\n }\n\n if (!kc.responseMode) {\n kc.responseMode = 'fragment';\n }\n if (!kc.responseType) {\n kc.responseType = 'code';\n kc.flow = 'standard';\n }\n\n var promise = createPromise();\n\n var initPromise = createPromise();\n initPromise.promise.then(function() {\n kc.onReady && kc.onReady(kc.authenticated);\n promise.setSuccess(kc.authenticated);\n }).catch(function(error) {\n promise.setError(error);\n });\n\n var configPromise = loadConfig();\n\n function onLoad() {\n var doLogin = function(prompt) {\n if (!prompt) {\n options.prompt = 'none';\n }\n\n kc.login(options).then(function () {\n initPromise.setSuccess();\n }).catch(function (error) {\n initPromise.setError(error);\n });\n };\n\n var checkSsoSilently = function() {\n var ifrm = document.createElement(\"iframe\");\n var src = kc.createLoginUrl({prompt: 'none', redirectUri: kc.silentCheckSsoRedirectUri});\n ifrm.setAttribute(\"src\", src);\n ifrm.setAttribute(\"title\", \"keycloak-silent-check-sso\");\n ifrm.style.display = \"none\";\n document.body.appendChild(ifrm);\n\n var messageCallback = function(event) {\n if (event.origin !== window.location.origin || ifrm.contentWindow !== event.source) {\n return;\n }\n\n var oauth = parseCallback(event.data);\n processCallback(oauth, initPromise);\n\n document.body.removeChild(ifrm);\n window.removeEventListener(\"message\", messageCallback);\n };\n\n window.addEventListener(\"message\", messageCallback);\n };\n\n var options = {};\n switch (initOptions.onLoad) {\n case 'check-sso':\n if (loginIframe.enable) {\n setupCheckLoginIframe().then(function() {\n checkLoginIframe().then(function (unchanged) {\n if (!unchanged) {\n kc.silentCheckSsoRedirectUri ? checkSsoSilently() : doLogin(false);\n } else {\n initPromise.setSuccess();\n }\n }).catch(function (error) {\n initPromise.setError(error);\n });\n });\n } else {\n kc.silentCheckSsoRedirectUri ? checkSsoSilently() : doLogin(false);\n }\n break;\n case 'login-required':\n doLogin(true);\n break;\n default:\n throw 'Invalid value for onLoad';\n }\n }\n\n function processInit() {\n var callback = parseCallback(window.location.href);\n\n if (callback) {\n window.history.replaceState(window.history.state, null, callback.newUrl);\n }\n\n if (callback && callback.valid) {\n return setupCheckLoginIframe().then(function() {\n processCallback(callback, initPromise);\n }).catch(function (error) {\n initPromise.setError(error);\n });\n } else if (initOptions) {\n if (initOptions.token && initOptions.refreshToken) {\n setToken(initOptions.token, initOptions.refreshToken, initOptions.idToken);\n\n if (loginIframe.enable) {\n setupCheckLoginIframe().then(function() {\n checkLoginIframe().then(function (unchanged) {\n if (unchanged) {\n kc.onAuthSuccess && kc.onAuthSuccess();\n initPromise.setSuccess();\n scheduleCheckIframe();\n } else {\n initPromise.setSuccess();\n }\n }).catch(function (error) {\n initPromise.setError(error);\n });\n });\n } else {\n kc.updateToken(-1).then(function() {\n kc.onAuthSuccess && kc.onAuthSuccess();\n initPromise.setSuccess();\n }).catch(function(error) {\n kc.onAuthError && kc.onAuthError();\n if (initOptions.onLoad) {\n onLoad();\n } else {\n initPromise.setError(error);\n }\n });\n }\n } else if (initOptions.onLoad) {\n onLoad();\n } else {\n initPromise.setSuccess();\n }\n } else {\n initPromise.setSuccess();\n }\n }\n\n function domReady() {\n var promise = createPromise();\n\n var checkReadyState = function () {\n if (document.readyState === 'interactive' || document.readyState === 'complete') {\n document.removeEventListener('readystatechange', checkReadyState);\n promise.setSuccess();\n }\n };\n document.addEventListener('readystatechange', checkReadyState);\n\n checkReadyState(); // just in case the event was already fired and we missed it (in case the init is done later than at the load time, i.e. it's done from code)\n\n return promise.promise;\n }\n\n configPromise.then(function () {\n domReady()\n .then(check3pCookiesSupported)\n .then(processInit)\n .catch(function (error) {\n promise.setError(error);\n });\n });\n configPromise.catch(function (error) {\n promise.setError(error);\n });\n\n return promise.promise;\n };\n\n kc.login = function (options) {\n return adapter.login(options);\n };\n\n function generateRandomData(len) {\n // use web crypto APIs if possible\n var array = null;\n var crypto = window.crypto || window.msCrypto;\n if (crypto && crypto.getRandomValues && window.Uint8Array) {\n array = new Uint8Array(len);\n crypto.getRandomValues(array);\n return array;\n }\n\n // fallback to Math random\n array = new Array(len);\n for (var j = 0; j < array.length; j++) {\n array[j] = Math.floor(256 * Math.random());\n }\n return array;\n }\n\n function generateCodeVerifier(len) {\n return generateRandomString(len, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789');\n }\n\n function generateRandomString(len, alphabet){\n var randomData = generateRandomData(len);\n var chars = new Array(len);\n for (var i = 0; i < len; i++) {\n chars[i] = alphabet.charCodeAt(randomData[i] % alphabet.length);\n }\n return String.fromCharCode.apply(null, chars);\n }\n\n function generatePkceChallenge(pkceMethod, codeVerifier) {\n switch (pkceMethod) {\n // The use of the \"plain\" method is considered insecure and therefore not supported.\n case \"S256\":\n // hash codeVerifier, then encode as url-safe base64 without padding\n var hashBytes = new Uint8Array(sha256_imported.arrayBuffer(codeVerifier));\n var encodedHash = base64js_imported.fromByteArray(hashBytes)\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/\\=/g, '');\n return encodedHash;\n default:\n throw 'Invalid value for pkceMethod';\n }\n }\n\n kc.createLoginUrl = function(options) {\n var state = createUUID();\n var nonce = createUUID();\n\n var redirectUri = adapter.redirectUri(options);\n\n var callbackState = {\n state: state,\n nonce: nonce,\n redirectUri: encodeURIComponent(redirectUri)\n };\n\n if (options && options.prompt) {\n callbackState.prompt = options.prompt;\n }\n\n var baseUrl;\n if (options && options.action == 'register') {\n baseUrl = kc.endpoints.register();\n } else {\n baseUrl = kc.endpoints.authorize();\n }\n\n var scope = options && options.scope || kc.scope;\n if (!scope) {\n // if scope is not set, default to \"openid\"\n scope = \"openid\";\n } else if (scope.indexOf(\"openid\") === -1) {\n // if openid scope is missing, prefix the given scopes with it\n scope = \"openid \" + scope;\n }\n\n var url = baseUrl\n + '?client_id=' + encodeURIComponent(kc.clientId)\n + '&redirect_uri=' + encodeURIComponent(redirectUri)\n + '&state=' + encodeURIComponent(state)\n + '&response_mode=' + encodeURIComponent(kc.responseMode)\n + '&response_type=' + encodeURIComponent(kc.responseType)\n + '&scope=' + encodeURIComponent(scope);\n if (useNonce) {\n url = url + '&nonce=' + encodeURIComponent(nonce);\n }\n\n if (options && options.prompt) {\n url += '&prompt=' + encodeURIComponent(options.prompt);\n }\n\n if (options && options.maxAge) {\n url += '&max_age=' + encodeURIComponent(options.maxAge);\n }\n\n if (options && options.loginHint) {\n url += '&login_hint=' + encodeURIComponent(options.loginHint);\n }\n\n if (options && options.idpHint) {\n url += '&kc_idp_hint=' + encodeURIComponent(options.idpHint);\n }\n\n if (options && options.action && options.action != 'register') {\n url += '&kc_action=' + encodeURIComponent(options.action);\n }\n\n if (options && options.locale) {\n url += '&ui_locales=' + encodeURIComponent(options.locale);\n }\n\n if (kc.pkceMethod) {\n var codeVerifier = generateCodeVerifier(96);\n callbackState.pkceCodeVerifier = codeVerifier;\n var pkceChallenge = generatePkceChallenge(kc.pkceMethod, codeVerifier);\n url += '&code_challenge=' + pkceChallenge;\n url += '&code_challenge_method=' + kc.pkceMethod;\n }\n\n callbackStorage.add(callbackState);\n\n return url;\n };\n\n kc.logout = function(options) {\n return adapter.logout(options);\n };\n\n kc.createLogoutUrl = function(options) {\n var url = kc.endpoints.logout()\n + '?redirect_uri=' + encodeURIComponent(adapter.redirectUri(options, false));\n\n return url;\n };\n\n kc.register = function (options) {\n return adapter.register(options);\n };\n\n kc.createRegisterUrl = function(options) {\n if (!options) {\n options = {};\n }\n options.action = 'register';\n return kc.createLoginUrl(options);\n };\n\n kc.createAccountUrl = function(options) {\n var realm = getRealmUrl();\n var url = undefined;\n if (typeof realm !== 'undefined') {\n url = realm\n + '/account'\n + '?referrer=' + encodeURIComponent(kc.clientId)\n + '&referrer_uri=' + encodeURIComponent(adapter.redirectUri(options));\n }\n return url;\n };\n\n kc.accountManagement = function() {\n return adapter.accountManagement();\n };\n\n kc.hasRealmRole = function (role) {\n var access = kc.realmAccess;\n return !!access && access.roles.indexOf(role) >= 0;\n };\n\n kc.hasResourceRole = function(role, resource) {\n if (!kc.resourceAccess) {\n return false;\n }\n\n var access = kc.resourceAccess[resource || kc.clientId];\n return !!access && access.roles.indexOf(role) >= 0;\n };\n\n kc.loadUserProfile = function() {\n var url = getRealmUrl() + '/account';\n var req = new XMLHttpRequest();\n req.open('GET', url, true);\n req.setRequestHeader('Accept', 'application/json');\n req.setRequestHeader('Authorization', 'bearer ' + kc.token);\n\n var promise = createPromise();\n\n req.onreadystatechange = function () {\n if (req.readyState == 4) {\n if (req.status == 200) {\n kc.profile = JSON.parse(req.responseText);\n promise.setSuccess(kc.profile);\n } else {\n promise.setError();\n }\n }\n };\n\n req.send();\n\n return promise.promise;\n };\n\n kc.loadUserInfo = function() {\n var url = kc.endpoints.userinfo();\n var req = new XMLHttpRequest();\n req.open('GET', url, true);\n req.setRequestHeader('Accept', 'application/json');\n req.setRequestHeader('Authorization', 'bearer ' + kc.token);\n\n var promise = createPromise();\n\n req.onreadystatechange = function () {\n if (req.readyState == 4) {\n if (req.status == 200) {\n kc.userInfo = JSON.parse(req.responseText);\n promise.setSuccess(kc.userInfo);\n } else {\n promise.setError();\n }\n }\n };\n\n req.send();\n\n return promise.promise;\n };\n\n kc.isTokenExpired = function(minValidity) {\n if (!kc.tokenParsed || (!kc.refreshToken && kc.flow != 'implicit' )) {\n throw 'Not authenticated';\n }\n\n if (kc.timeSkew == null) {\n logInfo('[KEYCLOAK] Unable to determine if token is expired as timeskew is not set');\n return true;\n }\n\n var expiresIn = kc.tokenParsed['exp'] - Math.ceil(new Date().getTime() / 1000) + kc.timeSkew;\n if (minValidity) {\n if (isNaN(minValidity)) {\n throw 'Invalid minValidity';\n }\n expiresIn -= minValidity;\n }\n return expiresIn < 0;\n };\n\n kc.updateToken = function(minValidity) {\n var promise = createPromise();\n\n if (!kc.refreshToken) {\n promise.setError();\n return promise.promise;\n }\n\n minValidity = minValidity || 5;\n\n var exec = function() {\n var refreshToken = false;\n if (minValidity == -1) {\n refreshToken = true;\n logInfo('[KEYCLOAK] Refreshing token: forced refresh');\n } else if (!kc.tokenParsed || kc.isTokenExpired(minValidity)) {\n refreshToken = true;\n logInfo('[KEYCLOAK] Refreshing token: token expired');\n }\n\n if (!refreshToken) {\n promise.setSuccess(false);\n } else {\n var params = 'grant_type=refresh_token&' + 'refresh_token=' + kc.refreshToken;\n var url = kc.endpoints.token();\n\n refreshQueue.push(promise);\n\n if (refreshQueue.length == 1) {\n var req = new XMLHttpRequest();\n req.open('POST', url, true);\n req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n req.withCredentials = true;\n\n params += '&client_id=' + encodeURIComponent(kc.clientId);\n\n var timeLocal = new Date().getTime();\n\n req.onreadystatechange = function () {\n if (req.readyState == 4) {\n if (req.status == 200) {\n logInfo('[KEYCLOAK] Token refreshed');\n\n timeLocal = (timeLocal + new Date().getTime()) / 2;\n\n var tokenResponse = JSON.parse(req.responseText);\n\n setToken(tokenResponse['access_token'], tokenResponse['refresh_token'], tokenResponse['id_token'], timeLocal);\n\n kc.onAuthRefreshSuccess && kc.onAuthRefreshSuccess();\n for (var p = refreshQueue.pop(); p != null; p = refreshQueue.pop()) {\n p.setSuccess(true);\n }\n } else {\n logWarn('[KEYCLOAK] Failed to refresh token');\n\n if (req.status == 400) {\n kc.clearToken();\n }\n\n kc.onAuthRefreshError && kc.onAuthRefreshError();\n for (var p = refreshQueue.pop(); p != null; p = refreshQueue.pop()) {\n p.setError(true);\n }\n }\n }\n };\n\n req.send(params);\n }\n }\n };\n\n if (loginIframe.enable) {\n var iframePromise = checkLoginIframe();\n iframePromise.then(function() {\n exec();\n }).catch(function(error) {\n promise.setError(error);\n });\n } else {\n exec();\n }\n\n return promise.promise;\n };\n\n kc.clearToken = function() {\n if (kc.token) {\n setToken(null, null, null);\n kc.onAuthLogout && kc.onAuthLogout();\n if (kc.loginRequired) {\n kc.login();\n }\n }\n };\n\n function getRealmUrl() {\n if (typeof kc.authServerUrl !== 'undefined') {\n if (kc.authServerUrl.charAt(kc.authServerUrl.length - 1) == '/') {\n return kc.authServerUrl + 'realms/' + encodeURIComponent(kc.realm);\n } else {\n return kc.authServerUrl + '/realms/' + encodeURIComponent(kc.realm);\n }\n } else {\n \treturn undefined;\n }\n }\n\n function getOrigin() {\n if (!window.location.origin) {\n return window.location.protocol + \"//\" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');\n } else {\n return window.location.origin;\n }\n }\n\n function processCallback(oauth, promise) {\n var code = oauth.code;\n var error = oauth.error;\n var prompt = oauth.prompt;\n\n var timeLocal = new Date().getTime();\n\n if (oauth['kc_action_status']) {\n kc.onActionUpdate && kc.onActionUpdate(oauth['kc_action_status']);\n }\n\n if (error) {\n if (prompt != 'none') {\n var errorData = { error: error, error_description: oauth.error_description };\n kc.onAuthError && kc.onAuthError(errorData);\n promise && promise.setError(errorData);\n } else {\n promise && promise.setSuccess();\n }\n return;\n } else if ((kc.flow != 'standard') && (oauth.access_token || oauth.id_token)) {\n authSuccess(oauth.access_token, null, oauth.id_token, true);\n }\n\n if ((kc.flow != 'implicit') && code) {\n var params = 'code=' + code + '&grant_type=authorization_code';\n var url = kc.endpoints.token();\n\n var req = new XMLHttpRequest();\n req.open('POST', url, true);\n req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n\n params += '&client_id=' + encodeURIComponent(kc.clientId);\n params += '&redirect_uri=' + oauth.redirectUri;\n\n if (oauth.pkceCodeVerifier) {\n params += '&code_verifier=' + oauth.pkceCodeVerifier;\n }\n\n req.withCredentials = true;\n\n req.onreadystatechange = function() {\n if (req.readyState == 4) {\n if (req.status == 200) {\n\n var tokenResponse = JSON.parse(req.responseText);\n authSuccess(tokenResponse['access_token'], tokenResponse['refresh_token'], tokenResponse['id_token'], kc.flow === 'standard');\n scheduleCheckIframe();\n } else {\n kc.onAuthError && kc.onAuthError();\n promise && promise.setError();\n }\n }\n };\n\n req.send(params);\n }\n\n function authSuccess(accessToken, refreshToken, idToken, fulfillPromise) {\n timeLocal = (timeLocal + new Date().getTime()) / 2;\n\n setToken(accessToken, refreshToken, idToken, timeLocal);\n\n if (useNonce && ((kc.tokenParsed && kc.tokenParsed.nonce != oauth.storedNonce) ||\n (kc.refreshTokenParsed && kc.refreshTokenParsed.nonce != oauth.storedNonce) ||\n (kc.idTokenParsed && kc.idTokenParsed.nonce != oauth.storedNonce))) {\n\n logInfo('[KEYCLOAK] Invalid nonce, clearing token');\n kc.clearToken();\n promise && promise.setError();\n } else {\n if (fulfillPromise) {\n kc.onAuthSuccess && kc.onAuthSuccess();\n promise && promise.setSuccess();\n }\n }\n }\n\n }\n\n function loadConfig(url) {\n var promise = createPromise();\n var configUrl;\n\n if (!config) {\n configUrl = 'keycloak.json';\n } else if (typeof config === 'string') {\n configUrl = config;\n }\n\n function setupOidcEndoints(oidcConfiguration) {\n if (! oidcConfiguration) {\n kc.endpoints = {\n authorize: function() {\n return getRealmUrl() + '/protocol/openid-connect/auth';\n },\n token: function() {\n return getRealmUrl() + '/protocol/openid-connect/token';\n },\n logout: function() {\n return getRealmUrl() + '/protocol/openid-connect/logout';\n },\n checkSessionIframe: function() {\n var src = getRealmUrl() + '/protocol/openid-connect/login-status-iframe.html';\n if (kc.iframeVersion) {\n src = src + '?version=' + kc.iframeVersion;\n }\n return src;\n },\n thirdPartyCookiesIframe: function() {\n var src = getRealmUrl() + '/protocol/openid-connect/3p-cookies/step1.html';\n if (kc.iframeVersion) {\n src = src + '?version=' + kc.iframeVersion;\n }\n return src;\n },\n register: function() {\n return getRealmUrl() + '/protocol/openid-connect/registrations';\n },\n userinfo: function() {\n return getRealmUrl() + '/protocol/openid-connect/userinfo';\n }\n };\n } else {\n kc.endpoints = {\n authorize: function() {\n return oidcConfiguration.authorization_endpoint;\n },\n token: function() {\n return oidcConfiguration.token_endpoint;\n },\n logout: function() {\n if (!oidcConfiguration.end_session_endpoint) {\n throw \"Not supported by the OIDC server\";\n }\n return oidcConfiguration.end_session_endpoint;\n },\n checkSessionIframe: function() {\n if (!oidcConfiguration.check_session_iframe) {\n throw \"Not supported by the OIDC server\";\n }\n return oidcConfiguration.check_session_iframe;\n },\n register: function() {\n throw 'Redirection to \"Register user\" page not supported in standard OIDC mode';\n },\n userinfo: function() {\n if (!oidcConfiguration.userinfo_endpoint) {\n throw \"Not supported by the OIDC server\";\n }\n return oidcConfiguration.userinfo_endpoint;\n }\n };\n }\n }\n\n if (configUrl) {\n var req = new XMLHttpRequest();\n req.open('GET', configUrl, true);\n req.setRequestHeader('Accept', 'application/json');\n\n req.onreadystatechange = function () {\n if (req.readyState == 4) {\n if (req.status == 200 || fileLoaded(req)) {\n var config = JSON.parse(req.responseText);\n\n kc.authServerUrl = config['auth-server-url'];\n kc.realm = config['realm'];\n kc.clientId = config['resource'];\n setupOidcEndoints(null);\n promise.setSuccess();\n } else {\n promise.setError();\n }\n }\n };\n\n req.send();\n } else {\n if (!config.clientId) {\n throw 'clientId missing';\n }\n\n kc.clientId = config.clientId;\n\n var oidcProvider = config['oidcProvider'];\n if (!oidcProvider) {\n if (!config['url']) {\n var scripts = document.getElementsByTagName('script');\n for (var i = 0; i < scripts.length; i++) {\n if (scripts[i].src.match(/.*keycloak\\.js/)) {\n config.url = scripts[i].src.substr(0, scripts[i].src.indexOf('/js/keycloak.js'));\n break;\n }\n }\n }\n if (!config.realm) {\n throw 'realm missing';\n }\n\n kc.authServerUrl = config.url;\n kc.realm = config.realm;\n setupOidcEndoints(null);\n promise.setSuccess();\n } else {\n if (typeof oidcProvider === 'string') {\n var oidcProviderConfigUrl;\n if (oidcProvider.charAt(oidcProvider.length - 1) == '/') {\n oidcProviderConfigUrl = oidcProvider + '.well-known/openid-configuration';\n } else {\n oidcProviderConfigUrl = oidcProvider + '/.well-known/openid-configuration';\n }\n var req = new XMLHttpRequest();\n req.open('GET', oidcProviderConfigUrl, true);\n req.setRequestHeader('Accept', 'application/json');\n\n req.onreadystatechange = function () {\n if (req.readyState == 4) {\n if (req.status == 200 || fileLoaded(req)) {\n var oidcProviderConfig = JSON.parse(req.responseText);\n setupOidcEndoints(oidcProviderConfig);\n promise.setSuccess();\n } else {\n promise.setError();\n }\n }\n };\n\n req.send();\n } else {\n setupOidcEndoints(oidcProvider);\n promise.setSuccess();\n }\n }\n }\n\n return promise.promise;\n }\n\n function fileLoaded(xhr) {\n return xhr.status == 0 && xhr.responseText && xhr.responseURL.startsWith('file:');\n }\n\n function setToken(token, refreshToken, idToken, timeLocal) {\n if (kc.tokenTimeoutHandle) {\n clearTimeout(kc.tokenTimeoutHandle);\n kc.tokenTimeoutHandle = null;\n }\n\n if (refreshToken) {\n kc.refreshToken = refreshToken;\n kc.refreshTokenParsed = decodeToken(refreshToken);\n } else {\n delete kc.refreshToken;\n delete kc.refreshTokenParsed;\n }\n\n if (idToken) {\n kc.idToken = idToken;\n kc.idTokenParsed = decodeToken(idToken);\n } else {\n delete kc.idToken;\n delete kc.idTokenParsed;\n }\n\n if (token) {\n kc.token = token;\n kc.tokenParsed = decodeToken(token);\n kc.sessionId = kc.tokenParsed.session_state;\n kc.authenticated = true;\n kc.subject = kc.tokenParsed.sub;\n kc.realmAccess = kc.tokenParsed.realm_access;\n kc.resourceAccess = kc.tokenParsed.resource_access;\n\n if (timeLocal) {\n kc.timeSkew = Math.floor(timeLocal / 1000) - kc.tokenParsed.iat;\n }\n\n if (kc.timeSkew != null) {\n logInfo('[KEYCLOAK] Estimated time difference between browser and server is ' + kc.timeSkew + ' seconds');\n\n if (kc.onTokenExpired) {\n var expiresIn = (kc.tokenParsed['exp'] - (new Date().getTime() / 1000) + kc.timeSkew) * 1000;\n logInfo('[KEYCLOAK] Token expires in ' + Math.round(expiresIn / 1000) + ' s');\n if (expiresIn <= 0) {\n kc.onTokenExpired();\n } else {\n kc.tokenTimeoutHandle = setTimeout(kc.onTokenExpired, expiresIn);\n }\n }\n }\n } else {\n delete kc.token;\n delete kc.tokenParsed;\n delete kc.subject;\n delete kc.realmAccess;\n delete kc.resourceAccess;\n\n kc.authenticated = false;\n }\n }\n\n function decodeToken(str) {\n str = str.split('.')[1];\n\n str = str.replace(/-/g, '+');\n str = str.replace(/_/g, '/');\n switch (str.length % 4) {\n case 0:\n break;\n case 2:\n str += '==';\n break;\n case 3:\n str += '=';\n break;\n default:\n throw 'Invalid token';\n }\n\n str = decodeURIComponent(escape(atob(str)));\n\n str = JSON.parse(str);\n return str;\n }\n\n function createUUID() {\n var hexDigits = '0123456789abcdef';\n var s = generateRandomString(36, hexDigits).split(\"\");\n s[14] = '4';\n s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);\n s[8] = s[13] = s[18] = s[23] = '-';\n var uuid = s.join('');\n return uuid;\n }\n\n function parseCallback(url) {\n var oauth = parseCallbackUrl(url);\n if (!oauth) {\n return;\n }\n\n var oauthState = callbackStorage.get(oauth.state);\n\n if (oauthState) {\n oauth.valid = true;\n oauth.redirectUri = oauthState.redirectUri;\n oauth.storedNonce = oauthState.nonce;\n oauth.prompt = oauthState.prompt;\n oauth.pkceCodeVerifier = oauthState.pkceCodeVerifier;\n }\n\n return oauth;\n }\n\n function parseCallbackUrl(url) {\n var supportedParams;\n switch (kc.flow) {\n case 'standard':\n supportedParams = ['code', 'state', 'session_state', 'kc_action_status'];\n break;\n case 'implicit':\n supportedParams = ['access_token', 'token_type', 'id_token', 'state', 'session_state', 'expires_in', 'kc_action_status'];\n break;\n case 'hybrid':\n supportedParams = ['access_token', 'token_type', 'id_token', 'code', 'state', 'session_state', 'expires_in', 'kc_action_status'];\n break;\n }\n\n supportedParams.push('error');\n supportedParams.push('error_description');\n supportedParams.push('error_uri');\n\n var queryIndex = url.indexOf('?');\n var fragmentIndex = url.indexOf('#');\n\n var newUrl;\n var parsed;\n\n if (kc.responseMode === 'query' && queryIndex !== -1) {\n newUrl = url.substring(0, queryIndex);\n parsed = parseCallbackParams(url.substring(queryIndex + 1, fragmentIndex !== -1 ? fragmentIndex : url.length), supportedParams);\n if (parsed.paramsString !== '') {\n newUrl += '?' + parsed.paramsString;\n }\n if (fragmentIndex !== -1) {\n newUrl += url.substring(fragmentIndex);\n }\n } else if (kc.responseMode === 'fragment' && fragmentIndex !== -1) {\n newUrl = url.substring(0, fragmentIndex);\n parsed = parseCallbackParams(url.substring(fragmentIndex + 1), supportedParams);\n if (parsed.paramsString !== '') {\n newUrl += '#' + parsed.paramsString;\n }\n }\n\n if (parsed && parsed.oauthParams) {\n if (kc.flow === 'standard' || kc.flow === 'hybrid') {\n if ((parsed.oauthParams.code || parsed.oauthParams.error) && parsed.oauthParams.state) {\n parsed.oauthParams.newUrl = newUrl;\n return parsed.oauthParams;\n }\n } else if (kc.flow === 'implicit') {\n if ((parsed.oauthParams.access_token || parsed.oauthParams.error) && parsed.oauthParams.state) {\n parsed.oauthParams.newUrl = newUrl;\n return parsed.oauthParams;\n }\n }\n }\n }\n\n function parseCallbackParams(paramsString, supportedParams) {\n var p = paramsString.split('&');\n var result = {\n paramsString: '',\n oauthParams: {}\n };\n for (var i = 0; i < p.length; i++) {\n var split = p[i].indexOf(\"=\");\n var key = p[i].slice(0, split);\n if (supportedParams.indexOf(key) !== -1) {\n result.oauthParams[key] = p[i].slice(split + 1);\n } else {\n if (result.paramsString !== '') {\n result.paramsString += '&';\n }\n result.paramsString += p[i];\n }\n }\n return result;\n }\n\n function createPromise() {\n // Need to create a native Promise which also preserves the\n // interface of the custom promise type previously used by the API\n var p = {\n setSuccess: function(result) {\n p.resolve(result);\n },\n\n setError: function(result) {\n p.reject(result);\n }\n };\n p.promise = new Promise(function(resolve, reject) {\n p.resolve = resolve;\n p.reject = reject;\n });\n\n p.promise.success = function(callback) {\n logPromiseDeprecation();\n\n this.then(function handleSuccess(value) {\n callback(value);\n });\n\n return this;\n };\n\n p.promise.error = function(callback) {\n logPromiseDeprecation();\n\n this.catch(function handleError(error) {\n callback(error);\n });\n\n return this;\n };\n\n return p;\n }\n\n // Function to extend existing native Promise with timeout\n function applyTimeoutToPromise(promise, timeout, errorMessage) {\n var timeoutHandle = null;\n var timeoutPromise = new Promise(function (resolve, reject) {\n timeoutHandle = setTimeout(function () {\n reject({ \"error\": errorMessage || \"Promise is not settled within timeout of \" + timeout + \"ms\" });\n }, timeout);\n });\n\n return Promise.race([promise, timeoutPromise]).finally(function () {\n clearTimeout(timeoutHandle);\n });\n }\n\n function setupCheckLoginIframe() {\n var promise = createPromise();\n\n if (!loginIframe.enable) {\n promise.setSuccess();\n return promise.promise;\n }\n\n if (loginIframe.iframe) {\n promise.setSuccess();\n return promise.promise;\n }\n\n var iframe = document.createElement('iframe');\n loginIframe.iframe = iframe;\n\n iframe.onload = function() {\n var authUrl = kc.endpoints.authorize();\n if (authUrl.charAt(0) === '/') {\n loginIframe.iframeOrigin = getOrigin();\n } else {\n loginIframe.iframeOrigin = authUrl.substring(0, authUrl.indexOf('/', 8));\n }\n promise.setSuccess();\n };\n\n var src = kc.endpoints.checkSessionIframe();\n iframe.setAttribute('src', src );\n iframe.setAttribute('title', 'keycloak-session-iframe' );\n iframe.style.display = 'none';\n document.body.appendChild(iframe);\n\n var messageCallback = function(event) {\n if ((event.origin !== loginIframe.iframeOrigin) || (loginIframe.iframe.contentWindow !== event.source)) {\n return;\n }\n\n if (!(event.data == 'unchanged' || event.data == 'changed' || event.data == 'error')) {\n return;\n }\n\n\n if (event.data != 'unchanged') {\n kc.clearToken();\n }\n\n var callbacks = loginIframe.callbackList.splice(0, loginIframe.callbackList.length);\n\n for (var i = callbacks.length - 1; i >= 0; --i) {\n var promise = callbacks[i];\n if (event.data == 'error') {\n promise.setError();\n } else {\n promise.setSuccess(event.data == 'unchanged');\n }\n }\n };\n\n window.addEventListener('message', messageCallback, false);\n\n return promise.promise;\n }\n\n function scheduleCheckIframe() {\n if (loginIframe.enable) {\n if (kc.token) {\n setTimeout(function() {\n checkLoginIframe().then(function(unchanged) {\n if (unchanged) {\n scheduleCheckIframe();\n }\n });\n }, loginIframe.interval * 1000);\n }\n }\n }\n\n function checkLoginIframe() {\n var promise = createPromise();\n\n if (loginIframe.iframe && loginIframe.iframeOrigin ) {\n var msg = kc.clientId + ' ' + (kc.sessionId ? kc.sessionId : '');\n loginIframe.callbackList.push(promise);\n var origin = loginIframe.iframeOrigin;\n if (loginIframe.callbackList.length == 1) {\n loginIframe.iframe.contentWindow.postMessage(msg, origin);\n }\n } else {\n promise.setSuccess();\n }\n\n return promise.promise;\n }\n\n function check3pCookiesSupported() {\n var promise = createPromise();\n\n if (loginIframe.enable || kc.silentCheckSsoRedirectUri) {\n var iframe = document.createElement('iframe');\n iframe.setAttribute('src', kc.endpoints.thirdPartyCookiesIframe());\n iframe.setAttribute('title', 'keycloak-3p-check-iframe' );\n iframe.style.display = 'none';\n document.body.appendChild(iframe);\n\n var messageCallback = function(event) {\n if (iframe.contentWindow !== event.source) {\n return;\n }\n\n if (event.data !== \"supported\" && event.data !== \"unsupported\") {\n return;\n } else if (event.data === \"unsupported\") {\n loginIframe.enable = false;\n if (kc.silentCheckSsoFallback) {\n kc.silentCheckSsoRedirectUri = false;\n }\n logWarn(\"[KEYCLOAK] 3rd party cookies aren't supported by this browser. checkLoginIframe and \" +\n \"silent check-sso are not available.\");\n }\n\n document.body.removeChild(iframe);\n window.removeEventListener(\"message\", messageCallback);\n promise.setSuccess();\n };\n\n window.addEventListener('message', messageCallback, false);\n } else {\n promise.setSuccess();\n }\n\n return applyTimeoutToPromise(promise.promise, kc.messageReceiveTimeout, \"Timeout when waiting for 3rd party check iframe message.\");\n }\n\n function loadAdapter(type) {\n if (!type || type == 'default') {\n return {\n login: function(options) {\n window.location.replace(kc.createLoginUrl(options));\n return createPromise().promise;\n },\n\n logout: function(options) {\n window.location.replace(kc.createLogoutUrl(options));\n return createPromise().promise;\n },\n\n register: function(options) {\n window.location.replace(kc.createRegisterUrl(options));\n return createPromise().promise;\n },\n\n accountManagement : function() {\n var accountUrl = kc.createAccountUrl();\n if (typeof accountUrl !== 'undefined') {\n window.location.href = accountUrl;\n } else {\n throw \"Not supported by the OIDC server\";\n }\n return createPromise().promise;\n },\n\n redirectUri: function(options, encodeHash) {\n\n if (options && options.redirectUri) {\n return options.redirectUri;\n } else if (kc.redirectUri) {\n return kc.redirectUri;\n } else {\n return location.href;\n }\n }\n };\n }\n\n if (type == 'cordova') {\n loginIframe.enable = false;\n var cordovaOpenWindowWrapper = function(loginUrl, target, options) {\n if (window.cordova && window.cordova.InAppBrowser) {\n // Use inappbrowser for IOS and Android if available\n return window.cordova.InAppBrowser.open(loginUrl, target, options);\n } else {\n return window.open(loginUrl, target, options);\n }\n };\n\n var shallowCloneCordovaOptions = function (userOptions) {\n if (userOptions && userOptions.cordovaOptions) {\n return Object.keys(userOptions.cordovaOptions).reduce(function (options, optionName) {\n options[optionName] = userOptions.cordovaOptions[optionName];\n return options;\n }, {});\n } else {\n return {};\n }\n };\n\n var formatCordovaOptions = function (cordovaOptions) {\n return Object.keys(cordovaOptions).reduce(function (options, optionName) {\n options.push(optionName+\"=\"+cordovaOptions[optionName]);\n return options;\n }, []).join(\",\");\n };\n\n var createCordovaOptions = function (userOptions) {\n var cordovaOptions = shallowCloneCordovaOptions(userOptions);\n cordovaOptions.location = 'no';\n if (userOptions && userOptions.prompt == 'none') {\n cordovaOptions.hidden = 'yes';\n }\n return formatCordovaOptions(cordovaOptions);\n };\n\n return {\n login: function(options) {\n var promise = createPromise();\n\n var cordovaOptions = createCordovaOptions(options);\n var loginUrl = kc.createLoginUrl(options);\n var ref = cordovaOpenWindowWrapper(loginUrl, '_blank', cordovaOptions);\n var completed = false;\n\n var closed = false;\n var closeBrowser = function() {\n closed = true;\n ref.close();\n };\n\n ref.addEventListener('loadstart', function(event) {\n if (event.url.indexOf('http://localhost') == 0) {\n var callback = parseCallback(event.url);\n processCallback(callback, promise);\n closeBrowser();\n completed = true;\n }\n });\n\n ref.addEventListener('loaderror', function(event) {\n if (!completed) {\n if (event.url.indexOf('http://localhost') == 0) {\n var callback = parseCallback(event.url);\n processCallback(callback, promise);\n closeBrowser();\n completed = true;\n } else {\n promise.setError();\n closeBrowser();\n }\n }\n });\n\n ref.addEventListener('exit', function(event) {\n if (!closed) {\n promise.setError({\n reason: \"closed_by_user\"\n });\n }\n });\n\n return promise.promise;\n },\n\n logout: function(options) {\n var promise = createPromise();\n\n var logoutUrl = kc.createLogoutUrl(options);\n var ref = cordovaOpenWindowWrapper(logoutUrl, '_blank', 'location=no,hidden=yes');\n\n var error;\n\n ref.addEventListener('loadstart', function(event) {\n if (event.url.indexOf('http://localhost') == 0) {\n ref.close();\n }\n });\n\n ref.addEventListener('loaderror', function(event) {\n if (event.url.indexOf('http://localhost') == 0) {\n ref.close();\n } else {\n error = true;\n ref.close();\n }\n });\n\n ref.addEventListener('exit', function(event) {\n if (error) {\n promise.setError();\n } else {\n kc.clearToken();\n promise.setSuccess();\n }\n });\n\n return promise.promise;\n },\n\n register : function(options) {\n var promise = createPromise();\n var registerUrl = kc.createRegisterUrl();\n var cordovaOptions = createCordovaOptions(options);\n var ref = cordovaOpenWindowWrapper(registerUrl, '_blank', cordovaOptions);\n ref.addEventListener('loadstart', function(event) {\n if (event.url.indexOf('http://localhost') == 0) {\n ref.close();\n var oauth = parseCallback(event.url);\n processCallback(oauth, promise);\n }\n });\n return promise.promise;\n },\n\n accountManagement : function() {\n var accountUrl = kc.createAccountUrl();\n if (typeof accountUrl !== 'undefined') {\n var ref = cordovaOpenWindowWrapper(accountUrl, '_blank', 'location=no');\n ref.addEventListener('loadstart', function(event) {\n if (event.url.indexOf('http://localhost') == 0) {\n ref.close();\n }\n });\n } else {\n throw \"Not supported by the OIDC server\";\n }\n },\n\n redirectUri: function(options) {\n return 'http://localhost';\n }\n }\n }\n\n if (type == 'cordova-native') {\n loginIframe.enable = false;\n\n return {\n login: function(options) {\n var promise = createPromise();\n var loginUrl = kc.createLoginUrl(options);\n\n universalLinks.subscribe('keycloak', function(event) {\n universalLinks.unsubscribe('keycloak');\n window.cordova.plugins.browsertab.close();\n var oauth = parseCallback(event.url);\n processCallback(oauth, promise);\n });\n\n window.cordova.plugins.browsertab.openUrl(loginUrl);\n return promise.promise;\n },\n\n logout: function(options) {\n var promise = createPromise();\n var logoutUrl = kc.createLogoutUrl(options);\n\n universalLinks.subscribe('keycloak', function(event) {\n universalLinks.unsubscribe('keycloak');\n window.cordova.plugins.browsertab.close();\n kc.clearToken();\n promise.setSuccess();\n });\n\n window.cordova.plugins.browsertab.openUrl(logoutUrl);\n return promise.promise;\n },\n\n register : function(options) {\n var promise = createPromise();\n var registerUrl = kc.createRegisterUrl(options);\n universalLinks.subscribe('keycloak' , function(event) {\n universalLinks.unsubscribe('keycloak');\n window.cordova.plugins.browsertab.close();\n var oauth = parseCallback(event.url);\n processCallback(oauth, promise);\n });\n window.cordova.plugins.browsertab.openUrl(registerUrl);\n return promise.promise;\n\n },\n\n accountManagement : function() {\n var accountUrl = kc.createAccountUrl();\n if (typeof accountUrl !== 'undefined') {\n window.cordova.plugins.browsertab.openUrl(accountUrl);\n } else {\n throw \"Not supported by the OIDC server\";\n }\n },\n\n redirectUri: function(options) {\n if (options && options.redirectUri) {\n return options.redirectUri;\n } else if (kc.redirectUri) {\n return kc.redirectUri;\n } else {\n return \"http://localhost\";\n }\n }\n }\n }\n\n throw 'invalid adapter type: ' + type;\n }\n\n var LocalStorage = function() {\n if (!(this instanceof LocalStorage)) {\n return new LocalStorage();\n }\n\n localStorage.setItem('kc-test', 'test');\n localStorage.removeItem('kc-test');\n\n var cs = this;\n\n function clearExpired() {\n var time = new Date().getTime();\n for (var i = 0; i < localStorage.length; i++) {\n var key = localStorage.key(i);\n if (key && key.indexOf('kc-callback-') == 0) {\n var value = localStorage.getItem(key);\n if (value) {\n try {\n var expires = JSON.parse(value).expires;\n if (!expires || expires < time) {\n localStorage.removeItem(key);\n }\n } catch (err) {\n localStorage.removeItem(key);\n }\n }\n }\n }\n }\n\n cs.get = function(state) {\n if (!state) {\n return;\n }\n\n var key = 'kc-callback-' + state;\n var value = localStorage.getItem(key);\n if (value) {\n localStorage.removeItem(key);\n value = JSON.parse(value);\n }\n\n clearExpired();\n return value;\n };\n\n cs.add = function(state) {\n clearExpired();\n\n var key = 'kc-callback-' + state.state;\n state.expires = new Date().getTime() + (60 * 60 * 1000);\n localStorage.setItem(key, JSON.stringify(state));\n };\n };\n\n var CookieStorage = function() {\n if (!(this instanceof CookieStorage)) {\n return new CookieStorage();\n }\n\n var cs = this;\n\n cs.get = function(state) {\n if (!state) {\n return;\n }\n\n var value = getCookie('kc-callback-' + state);\n setCookie('kc-callback-' + state, '', cookieExpiration(-100));\n if (value) {\n return JSON.parse(value);\n }\n };\n\n cs.add = function(state) {\n setCookie('kc-callback-' + state.state, JSON.stringify(state), cookieExpiration(60));\n };\n\n cs.removeItem = function(key) {\n setCookie(key, '', cookieExpiration(-100));\n };\n\n var cookieExpiration = function (minutes) {\n var exp = new Date();\n exp.setTime(exp.getTime() + (minutes*60*1000));\n return exp;\n };\n\n var getCookie = function (key) {\n var name = key + '=';\n var ca = document.cookie.split(';');\n for (var i = 0; i < ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0) == ' ') {\n c = c.substring(1);\n }\n if (c.indexOf(name) == 0) {\n return c.substring(name.length, c.length);\n }\n }\n return '';\n };\n\n var setCookie = function (key, value, expirationDate) {\n var cookie = key + '=' + value + '; '\n + 'expires=' + expirationDate.toUTCString() + '; ';\n document.cookie = cookie;\n };\n };\n\n function createCallbackStorage() {\n try {\n return new LocalStorage();\n } catch (err) {\n }\n\n return new CookieStorage();\n }\n\n function createLogger(fn) {\n return function() {\n if (kc.enableLogging) {\n fn.apply(console, Array.prototype.slice.call(arguments));\n }\n };\n }\n }\n\n return Keycloak;\n});\n});\n\nvar client = createCommonjsModule(function (module, exports) {\nvar __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nexports.__esModule = true;\nexports.KeycloakAdminClient = void 0;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar KeycloakAdminClient = (function () {\n function KeycloakAdminClient(connectionConfig) {\n this.baseUrl =\n (connectionConfig && connectionConfig.baseUrl) || constants.defaultBaseUrl;\n this.realmName =\n (connectionConfig && connectionConfig.realmName) || constants.defaultRealm;\n this.requestConfig = connectionConfig && connectionConfig.requestConfig;\n this.users = new users.Users(this);\n this.userStorageProvider = new userStorageProvider.UserStorageProvider(this);\n this.groups = new groups.Groups(this);\n this.roles = new roles.Roles(this);\n this.clients = new clients.Clients(this);\n this.realms = new realms.Realms(this);\n this.clientScopes = new clientScopes.ClientScopes(this);\n this.clientPolicies = new clientPolicies.ClientPolicies(this);\n this.identityProviders = new identityProviders.IdentityProviders(this);\n this.components = new components.Components(this);\n this.authenticationManagement = new authenticationManagement.AuthenticationManagement(this);\n this.serverInfo = new serverInfo.ServerInfo(this);\n this.whoAmI = new whoAmI.WhoAmI(this);\n this.sessions = new sessions.Sessions(this);\n this.attackDetection = new attackDetection.AttackDetection(this);\n this.cache = new cache.Cache(this);\n }\n KeycloakAdminClient.prototype.auth = function (credentials) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, accessToken, refreshToken;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4, (0, auth.getToken)({\n baseUrl: this.baseUrl,\n realmName: this.realmName,\n credentials: credentials,\n requestConfig: this.requestConfig\n })];\n case 1:\n _a = _b.sent(), accessToken = _a.accessToken, refreshToken = _a.refreshToken;\n this.accessToken = accessToken;\n this.refreshToken = refreshToken;\n return [2];\n }\n });\n });\n };\n KeycloakAdminClient.prototype.init = function (init, config) {\n return __awaiter(this, void 0, void 0, function () {\n var Keycloak;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (typeof window === 'undefined') {\n return [2];\n }\n return [4, Promise.resolve().then(function () { return __importStar(keycloak); })];\n case 1:\n Keycloak = (_a.sent())[\"default\"];\n this.keycloak = Keycloak(config);\n if (!init) return [3, 3];\n return [4, this.keycloak.init(init)];\n case 2:\n _a.sent();\n _a.label = 3;\n case 3:\n if (this.keycloak.authServerUrl) {\n this.baseUrl = this.keycloak.authServerUrl;\n }\n return [2];\n }\n });\n });\n };\n KeycloakAdminClient.prototype.setAccessToken = function (token) {\n this.accessToken = token;\n };\n KeycloakAdminClient.prototype.getAccessToken = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.keycloak) return [3, 5];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4, this.keycloak.updateToken(5)];\n case 2:\n _a.sent();\n return [3, 4];\n case 3:\n _a.sent();\n this.keycloak.login();\n return [3, 4];\n case 4: return [2, this.keycloak.token];\n case 5: return [2, this.accessToken];\n }\n });\n });\n };\n KeycloakAdminClient.prototype.getRequestConfig = function () {\n return this.requestConfig;\n };\n KeycloakAdminClient.prototype.setConfig = function (connectionConfig) {\n if (typeof connectionConfig.baseUrl === 'string' &&\n connectionConfig.baseUrl) {\n this.baseUrl = connectionConfig.baseUrl;\n }\n if (typeof connectionConfig.realmName === 'string' &&\n connectionConfig.realmName) {\n this.realmName = connectionConfig.realmName;\n }\n this.requestConfig = connectionConfig.requestConfig;\n };\n return KeycloakAdminClient;\n}());\nexports.KeycloakAdminClient = KeycloakAdminClient;\n\n});\n\nvar lib = createCommonjsModule(function (module, exports) {\nexports.__esModule = true;\nexports.requiredAction = void 0;\n\n\nexports.requiredAction = requiredActionProviderRepresentation.RequiredActionAlias;\nexports[\"default\"] = client.KeycloakAdminClient;\n\n});\n\nvar __pika_web_default_export_for_treeshaking__ = /*@__PURE__*/getDefaultExportFromCjs(lib);\n\nexport default __pika_web_default_export_for_treeshaking__;\n", "export const MODE = \"production\";\nexport const NODE_ENV = \"production\";\nexport const SSR = false;", "var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nfunction getDefaultExportFromCjs (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nfunction createCommonjsModule(fn, basedir, module) {\n\treturn module = {\n\t\tpath: basedir,\n\t\texports: {},\n\t\trequire: function (path, base) {\n\t\t\treturn commonjsRequire(path, (base === undefined || base === null) ? module.path : base);\n\t\t}\n\t}, fn(module, module.exports), module.exports;\n}\n\nfunction commonjsRequire () {\n\tthrow new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');\n}\n\nexport { commonjsGlobal as a, commonjsRequire as b, createCommonjsModule as c, getDefaultExportFromCjs as g };\n", "import { c as createCommonjsModule } from './_commonjsHelpers-4f955397.js';\n\n/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nvar objectAssign = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\nvar react_production_min = createCommonjsModule(function (module, exports) {\nvar n=60103,p=60106;exports.Fragment=60107;exports.StrictMode=60108;exports.Profiler=60114;var q=60109,r=60110,t=60112;exports.Suspense=60113;var u=60115,v=60116;\nif(\"function\"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w(\"react.element\");p=w(\"react.portal\");exports.Fragment=w(\"react.fragment\");exports.StrictMode=w(\"react.strict_mode\");exports.Profiler=w(\"react.profiler\");q=w(\"react.provider\");r=w(\"react.context\");t=w(\"react.forward_ref\");exports.Suspense=w(\"react.suspense\");u=w(\"react.memo\");v=w(\"react.lazy\");}var x=\"function\"===typeof Symbol&&Symbol.iterator;\nfunction y(a){if(null===a||\"object\"!==typeof a)return null;a=x&&a[x]||a[\"@@iterator\"];return \"function\"===typeof a?a:null}function z(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;c=\nE};k=function(){};exports.unstable_forceFrameRate=function(a){0>a||125>>1,e=a[d];if(void 0!==e&&0I(n,c))void 0!==r&&0>I(r,n)?(a[d]=r,a[v]=c,d=v):(a[d]=n,a[m]=c,d=m);else if(void 0!==r&&0>I(r,c))a[d]=r,a[v]=c,d=v;else break a}}return b}return null}function I(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var L=[],M=[],N=1,O=null,P=3,Q=!1,R=!1,S=!1;\nfunction T(a){for(var b=J(M);null!==b;){if(null===b.callback)K(M);else if(b.startTime<=a)K(M),b.sortIndex=b.expirationTime,H(L,b);else break;b=J(M);}}function U(a){S=!1;T(a);if(!R)if(null!==J(L))R=!0,f(V);else {var b=J(M);null!==b&&g(U,b.startTime-a);}}\nfunction V(a,b){R=!1;S&&(S=!1,h());Q=!0;var c=P;try{T(b);for(O=J(L);null!==O&&(!(O.expirationTime>b)||a&&!exports.unstable_shouldYield());){var d=O.callback;if(\"function\"===typeof d){O.callback=null;P=O.priorityLevel;var e=d(O.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?O.callback=e:O===J(L)&&K(L);T(b);}else K(L);O=J(L);}if(null!==O)var m=!0;else {var n=J(M);null!==n&&g(U,n.startTime-b);m=!1;}return m}finally{O=null,P=c,Q=!1;}}var W=k;exports.unstable_IdlePriority=5;\nexports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null;};exports.unstable_continueExecution=function(){R||Q||(R=!0,f(V));};exports.unstable_getCurrentPriorityLevel=function(){return P};exports.unstable_getFirstCallbackNode=function(){return J(L)};\nexports.unstable_next=function(a){switch(P){case 1:case 2:case 3:var b=3;break;default:b=P;}var c=P;P=b;try{return a()}finally{P=c;}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=W;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3;}var c=P;P=a;try{return b()}finally{P=c;}};\nexports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();\"object\"===typeof c&&null!==c?(c=c.delay,c=\"number\"===typeof c&&0d?(a.sortIndex=c,H(M,a),null===J(L)&&a===J(M)&&(S?h():S=!0,g(U,c-d))):(a.sortIndex=e,H(L,a),R||Q||(R=!0,f(V)));return a};\nexports.unstable_wrapCallback=function(a){var b=P;return function(){var c=P;P=b;try{return a.apply(this,arguments)}finally{P=c;}}};\n});\n\nvar scheduler = createCommonjsModule(function (module) {\n\n{\n module.exports = scheduler_production_min;\n}\n});\n\nfunction y(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cb}return !1}function B(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g;}var D={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){D[a]=new B(a,0,!1,a,null,!1,!1);});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];D[b]=new B(b,1,!1,a[1],null,!1,!1);});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){D[a]=new B(a,2,!1,a.toLowerCase(),null,!1,!1);});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){D[a]=new B(a,2,!1,a,null,!1,!1);});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){D[a]=new B(a,3,!1,a.toLowerCase(),null,!1,!1);});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){D[a]=new B(a,3,!0,a,null,!1,!1);});[\"capture\",\"download\"].forEach(function(a){D[a]=new B(a,4,!1,a,null,!1,!1);});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){D[a]=new B(a,6,!1,a,null,!1,!1);});[\"rowSpan\",\"start\"].forEach(function(a){D[a]=new B(a,5,!1,a.toLowerCase(),null,!1,!1);});var oa=/[\\-:]([a-z])/g;function pa(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(oa,\npa);D[b]=new B(b,1,!1,a,null,!1,!1);});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1);});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1);});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!1,!1);});\nD.xlinkHref=new B(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!0,!0);});\nfunction qa(a,b,c,d){var e=D.hasOwnProperty(b)?D[b]:null;var f=null!==e?0===e.type:d?!1:!(2h||e[g]!==f[h])return \"\\n\"+e[g].replace(\" at new \",\" at \");while(1<=g&&0<=h)}break}}}finally{Oa=!1,Error.prepareStackTrace=c;}return (a=a?a.displayName||a.name:\"\")?Na(a):\"\"}\nfunction Qa(a){switch(a.tag){case 5:return Na(a.type);case 16:return Na(\"Lazy\");case 13:return Na(\"Suspense\");case 19:return Na(\"SuspenseList\");case 0:case 2:case 15:return a=Pa(a.type,!1),a;case 11:return a=Pa(a.type.render,!1),a;case 22:return a=Pa(a.type._render,!1),a;case 1:return a=Pa(a.type,!0),a;default:return \"\"}}\nfunction Ra(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ua:return \"Fragment\";case ta:return \"Portal\";case xa:return \"Profiler\";case wa:return \"StrictMode\";case Ba:return \"Suspense\";case Ca:return \"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case za:return (a.displayName||\"Context\")+\".Consumer\";case ya:return (a._context.displayName||\"Context\")+\".Provider\";case Aa:var b=a.render;b=b.displayName||b.name||\"\";\nreturn a.displayName||(\"\"!==b?\"ForwardRef(\"+b+\")\":\"ForwardRef\");case Da:return Ra(a.type);case Fa:return Ra(a._render);case Ea:b=a._payload;a=a._init;try{return Ra(a(b))}catch(c){}}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"object\":case \"string\":case \"undefined\":return a;default:return \"\"}}function Ta(a){var b=a.type;return (a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a);}});Object.defineProperty(a,b,{enumerable:c.enumerable});return {getValue:function(){return d},setValue:function(a){d=\"\"+a;},stopTracking:function(){a._valueTracker=\nnull;delete a[b];}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a));}function Wa(a){if(!a)return !1;var b=a._valueTracker;if(!b)return !0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return objectAssign({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value};}function $a(a,b){b=b.checked;null!=b&&qa(a,\"checked\",b,!1);}\nfunction ab(a,b){$a(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c;}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?bb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&bb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked);}\nfunction cb(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b;}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c);}\nfunction bb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c);}function db(a){var b=\"\";react.Children.forEach(a,function(a){null!=a&&(b+=a);});return b}function eb(a,b){a=objectAssign({children:void 0},b);if(b=db(b.children))a.children=b;return a}\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e=c.length))throw Error(y(93));c=c[0];}b=c;}null==b&&(b=\"\");c=b;}a._wrapperState={initialValue:Sa(c)};}\nfunction ib(a,b){var c=Sa(b.value),d=Sa(b.defaultValue);null!=c&&(c=\"\"+c,c!==a.value&&(a.value=c),null==b.defaultValue&&a.defaultValue!==c&&(a.defaultValue=c));null!=d&&(a.defaultValue=\"\"+d);}function jb(a){var b=a.textContent;b===a._wrapperState.initialValue&&\"\"!==b&&null!==b&&(a.value=b);}var kb={html:\"http://www.w3.org/1999/xhtml\",mathml:\"http://www.w3.org/1998/Math/MathML\",svg:\"http://www.w3.org/2000/svg\"};\nfunction lb(a){switch(a){case \"svg\":return \"http://www.w3.org/2000/svg\";case \"math\":return \"http://www.w3.org/1998/Math/MathML\";default:return \"http://www.w3.org/1999/xhtml\"}}function mb(a,b){return null==a||\"http://www.w3.org/1999/xhtml\"===a?lb(b):\"http://www.w3.org/2000/svg\"===a&&\"foreignObject\"===b?\"http://www.w3.org/1999/xhtml\":a}\nvar nb,ob=function(a){return \"undefined\"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(b,c,d,e){MSApp.execUnsafeLocalFunction(function(){return a(b,c,d,e)});}:a}(function(a,b){if(a.namespaceURI!==kb.svg||\"innerHTML\"in a)a.innerHTML=b;else {nb=nb||document.createElement(\"div\");nb.innerHTML=\"\"+b.valueOf().toString()+\"\";for(b=nb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild);}});\nfunction pb(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b;}\nvar qb={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,\nfloodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rb=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(qb).forEach(function(a){rb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);qb[b]=qb[a];});});function sb(a,b,c){return null==b||\"boolean\"===typeof b||\"\"===b?\"\":c||\"number\"!==typeof b||0===b||qb.hasOwnProperty(a)&&qb[a]?(\"\"+b).trim():b+\"px\"}\nfunction tb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf(\"--\"),e=sb(c,b[c],d);\"float\"===c&&(c=\"cssFloat\");d?a.setProperty(c,e):a[c]=e;}}var ub=objectAssign({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});\nfunction vb(a,b){if(b){if(ub[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(y(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(y(60));if(!(\"object\"===typeof b.dangerouslySetInnerHTML&&\"__html\"in b.dangerouslySetInnerHTML))throw Error(y(61));}if(null!=b.style&&\"object\"!==typeof b.style)throw Error(y(62));}}\nfunction wb(a,b){if(-1===a.indexOf(\"-\"))return \"string\"===typeof b.is;switch(a){case \"annotation-xml\":case \"color-profile\":case \"font-face\":case \"font-face-src\":case \"font-face-uri\":case \"font-face-format\":case \"font-face-name\":case \"missing-glyph\":return !1;default:return !0}}function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;\nfunction Bb(a){if(a=Cb(a)){if(\"function\"!==typeof yb)throw Error(y(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b));}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a;}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;ad?0:1<c;c++)b.push(a);return b}\nfunction $c(a,b,c){a.pendingLanes|=b;var d=b-1;a.suspendedLanes&=d;a.pingedLanes&=d;a=a.eventTimes;b=31-Vc(b);a[b]=c;}var Vc=Math.clz32?Math.clz32:ad,bd=Math.log,cd=Math.LN2;function ad(a){return 0===a?32:31-(bd(a)/cd|0)|0}var dd=scheduler.unstable_UserBlockingPriority,ed=scheduler.unstable_runWithPriority,fd=!0;function gd(a,b,c,d){Kb||Ib();var e=hd,f=Kb;Kb=!0;try{Hb(e,a,b,c,d);}finally{(Kb=f)||Mb();}}function id(a,b,c,d){ed(dd,hd.bind(null,a,b,c,d));}\nfunction hd(a,b,c,d){if(fd){var e;if((e=0===(b&4))&&0=be),ee=String.fromCharCode(32),fe=!1;\nfunction ge(a,b){switch(a){case \"keyup\":return -1!==$d.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"focusout\":return !0;default:return !1}}function he(a){a=a.detail;return \"object\"===typeof a&&\"data\"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case \"compositionend\":return he(b);case \"keypress\":if(32!==b.which)return null;fe=!0;return ee;case \"textInput\":return a=b.data,a===ee&&fe?null:a;default:return null}}\nfunction ke(a,b){if(ie)return \"compositionend\"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return {node:c,offset:b-a};a=d;}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode;}c=void 0;}c=Ke(c);}}function Me(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Me(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}\nfunction Ne(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href;}catch(d){c=!1;}if(c)a=b.contentWindow;else break;b=Xa(a.document);}return b}function Oe(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}\nvar Pe=fa&&\"documentMode\"in document&&11>=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;\nfunction Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,\"selectionStart\"in d&&Oe(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Je(Se,d)||(Se=d,d=oe(Re,\"onSelect\"),0Af||(a.current=zf[Af],zf[Af]=null,Af--);}function I(a,b){Af++;zf[Af]=a.current;a.current=b;}var Cf={},M=Bf(Cf),N=Bf(!1),Df=Cf;\nfunction Ef(a,b){var c=a.type.contextTypes;if(!c)return Cf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function Ff(a){a=a.childContextTypes;return null!==a&&void 0!==a}function Gf(){H(N);H(M);}function Hf(a,b,c){if(M.current!==Cf)throw Error(y(168));I(M,b);I(N,c);}\nfunction If(a,b,c){var d=a.stateNode;a=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in a))throw Error(y(108,Ra(b)||\"Unknown\",e));return objectAssign({},c,d)}function Jf(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Cf;Df=M.current;I(M,a);I(N,N.current);return !0}function Kf(a,b,c){var d=a.stateNode;if(!d)throw Error(y(169));c?(a=If(a,b,Df),d.__reactInternalMemoizedMergedChildContext=a,H(N),H(M),I(M,a)):H(N);I(N,c);}\nvar Lf=null,Mf=null,Nf=scheduler.unstable_runWithPriority,Of=scheduler.unstable_scheduleCallback,Pf=scheduler.unstable_cancelCallback,Qf=scheduler.unstable_shouldYield,Rf=scheduler.unstable_requestPaint,Sf=scheduler.unstable_now,Tf=scheduler.unstable_getCurrentPriorityLevel,Uf=scheduler.unstable_ImmediatePriority,Vf=scheduler.unstable_UserBlockingPriority,Wf=scheduler.unstable_NormalPriority,Xf=scheduler.unstable_LowPriority,Yf=scheduler.unstable_IdlePriority,Zf={},$f=void 0!==Rf?Rf:function(){},ag=null,bg=null,cg=!1,dg=Sf(),O=1E4>dg?Sf:function(){return Sf()-dg};\nfunction eg(){switch(Tf()){case Uf:return 99;case Vf:return 98;case Wf:return 97;case Xf:return 96;case Yf:return 95;default:throw Error(y(332));}}function fg(a){switch(a){case 99:return Uf;case 98:return Vf;case 97:return Wf;case 96:return Xf;case 95:return Yf;default:throw Error(y(332));}}function gg(a,b){a=fg(a);return Nf(a,b)}function hg(a,b,c){a=fg(a);return Of(a,b,c)}function ig(){if(null!==bg){var a=bg;bg=null;Pf(a);}jg();}\nfunction jg(){if(!cg&&null!==ag){cg=!0;var a=0;try{var b=ag;gg(99,function(){for(;az?(q=u,u=null):q=u.sibling;var n=p(e,u,h[z],k);if(null===n){null===u&&(u=q);break}a&&u&&null===\nn.alternate&&b(e,u);g=f(n,g,z);null===t?l=n:t.sibling=n;t=n;u=q;}if(z===h.length)return c(e,u),l;if(null===u){for(;zz?(q=u,u=null):q=u.sibling;var w=p(e,u,n.value,k);if(null===w){null===u&&(u=q);break}a&&u&&null===w.alternate&&b(e,u);g=f(w,g,z);null===t?l=w:t.sibling=w;t=w;u=q;}if(n.done)return c(e,u),l;if(null===u){for(;!n.done;z++,n=h.next())n=A(e,n.value,k),null!==n&&(g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);return l}for(u=d(e,u);!n.done;z++,n=h.next())n=C(u,e,z,n.value,k),null!==n&&(a&&null!==n.alternate&&\nu.delete(null===n.key?z:n.key),g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);a&&u.forEach(function(a){return b(e,a)});return l}return function(a,d,f,h){var k=\"object\"===typeof f&&null!==f&&f.type===ua&&null===f.key;k&&(f=f.props.children);var l=\"object\"===typeof f&&null!==f;if(l)switch(f.$$typeof){case sa:a:{l=f.key;for(k=d;null!==k;){if(k.key===l){switch(k.tag){case 7:if(f.type===ua){c(a,k.sibling);d=e(k,f.props.children);d.return=a;a=d;break a}break;default:if(k.elementType===f.type){c(a,k.sibling);\nd=e(k,f.props);d.ref=Qg(a,k,f);d.return=a;a=d;break a}}c(a,k);break}else b(a,k);k=k.sibling;}f.type===ua?(d=Xg(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Vg(f.type,f.key,f.props,null,a.mode,h),h.ref=Qg(a,d,f),h.return=a,a=h);}return g(a);case ta:a:{for(k=f.key;null!==d;){if(d.key===k)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else {c(a,d);break}else b(a,d);d=d.sibling;}d=\nWg(f,a.mode,h);d.return=a;a=d;}return g(a)}if(\"string\"===typeof f||\"number\"===typeof f)return f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):(c(a,d),d=Ug(f,a.mode,h),d.return=a,a=d),g(a);if(Pg(f))return x(a,d,f,h);if(La(f))return w(a,d,f,h);l&&Rg(a,f);if(\"undefined\"===typeof f&&!k)switch(a.tag){case 1:case 22:case 0:case 11:case 15:throw Error(y(152,Ra(a.type)||\"Component\"));}return c(a,d)}}var Yg=Sg(!0),Zg=Sg(!1),$g={},ah=Bf($g),bh=Bf($g),ch=Bf($g);\nfunction dh(a){if(a===$g)throw Error(y(174));return a}function eh(a,b){I(ch,b);I(bh,a);I(ah,$g);a=b.nodeType;switch(a){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:mb(null,\"\");break;default:a=8===a?b.parentNode:b,b=a.namespaceURI||null,a=a.tagName,b=mb(b,a);}H(ah);I(ah,b);}function fh(){H(ah);H(bh);H(ch);}function gh(a){dh(ch.current);var b=dh(ah.current);var c=mb(b,a.type);b!==c&&(I(bh,a),I(ah,c));}function hh(a){bh.current===a&&(H(ah),H(bh));}var P=Bf(0);\nfunction ih(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||\"$?\"===c.data||\"$!\"===c.data))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&64))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return;}b.sibling.return=b.return;b=b.sibling;}return null}var jh=null,kh=null,lh=!1;\nfunction mh(a,b){var c=nh(5,null,null,0);c.elementType=\"DELETED\";c.type=\"DELETED\";c.stateNode=b;c.return=a;c.flags=8;null!==a.lastEffect?(a.lastEffect.nextEffect=c,a.lastEffect=c):a.firstEffect=a.lastEffect=c;}function oh(a,b){switch(a.tag){case 5:var c=a.type;b=1!==b.nodeType||c.toLowerCase()!==b.nodeName.toLowerCase()?null:b;return null!==b?(a.stateNode=b,!0):!1;case 6:return b=\"\"===a.pendingProps||3!==b.nodeType?null:b,null!==b?(a.stateNode=b,!0):!1;case 13:return !1;default:return !1}}\nfunction ph(a){if(lh){var b=kh;if(b){var c=b;if(!oh(a,b)){b=rf(c.nextSibling);if(!b||!oh(a,b)){a.flags=a.flags&-1025|2;lh=!1;jh=a;return}mh(jh,c);}jh=a;kh=rf(b.firstChild);}else a.flags=a.flags&-1025|2,lh=!1,jh=a;}}function qh(a){for(a=a.return;null!==a&&5!==a.tag&&3!==a.tag&&13!==a.tag;)a=a.return;jh=a;}\nfunction rh(a){if(a!==jh)return !1;if(!lh)return qh(a),lh=!0,!1;var b=a.type;if(5!==a.tag||\"head\"!==b&&\"body\"!==b&&!nf(b,a.memoizedProps))for(b=kh;b;)mh(a,b),b=rf(b.nextSibling);qh(a);if(13===a.tag){a=a.memoizedState;a=null!==a?a.dehydrated:null;if(!a)throw Error(y(317));a:{a=a.nextSibling;for(b=0;a;){if(8===a.nodeType){var c=a.data;if(\"/$\"===c){if(0===b){kh=rf(a.nextSibling);break a}b--;}else \"$\"!==c&&\"$!\"!==c&&\"$?\"!==c||b++;}a=a.nextSibling;}kh=null;}}else kh=jh?rf(a.stateNode.nextSibling):null;return !0}\nfunction sh(){kh=jh=null;lh=!1;}var th=[];function uh(){for(var a=0;af))throw Error(y(301));f+=1;T=S=null;b.updateQueue=null;vh.current=Fh;a=c(d,e);}while(zh)}vh.current=Gh;b=null!==S&&null!==S.next;xh=0;T=S=R=null;yh=!1;if(b)throw Error(y(300));return a}function Hh(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};null===T?R.memoizedState=T=a:T=T.next=a;return T}\nfunction Ih(){if(null===S){var a=R.alternate;a=null!==a?a.memoizedState:null;}else a=S.next;var b=null===T?R.memoizedState:T.next;if(null!==b)T=b,S=a;else {if(null===a)throw Error(y(310));S=a;a={memoizedState:S.memoizedState,baseState:S.baseState,baseQueue:S.baseQueue,queue:S.queue,next:null};null===T?R.memoizedState=T=a:T=T.next=a;}return T}function Jh(a,b){return \"function\"===typeof b?b(a):b}\nfunction Kh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y(311));c.lastRenderedReducer=a;var d=S,e=d.baseQueue,f=c.pending;if(null!==f){if(null!==e){var g=e.next;e.next=f.next;f.next=g;}d.baseQueue=e=f;c.pending=null;}if(null!==e){e=e.next;d=d.baseState;var h=g=f=null,k=e;do{var l=k.lane;if((xh&l)===l)null!==h&&(h=h.next={lane:0,action:k.action,eagerReducer:k.eagerReducer,eagerState:k.eagerState,next:null}),d=k.eagerReducer===a?k.eagerState:a(d,k.action);else {var n={lane:l,action:k.action,eagerReducer:k.eagerReducer,\neagerState:k.eagerState,next:null};null===h?(g=h=n,f=d):h=h.next=n;R.lanes|=l;Dg|=l;}k=k.next;}while(null!==k&&k!==e);null===h?f=d:h.next=g;He(d,b.memoizedState)||(ug=!0);b.memoizedState=d;b.baseState=f;b.baseQueue=h;c.lastRenderedState=d;}return [b.memoizedState,c.dispatch]}\nfunction Lh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y(311));c.lastRenderedReducer=a;var d=c.dispatch,e=c.pending,f=b.memoizedState;if(null!==e){c.pending=null;var g=e=e.next;do f=a(f,g.action),g=g.next;while(g!==e);He(f,b.memoizedState)||(ug=!0);b.memoizedState=f;null===b.baseQueue&&(b.baseState=f);c.lastRenderedState=f;}return [f,d]}\nfunction Mh(a,b,c){var d=b._getVersion;d=d(b._source);var e=b._workInProgressVersionPrimary;if(null!==e)a=e===d;else if(a=a.mutableReadLanes,a=(xh&a)===a)b._workInProgressVersionPrimary=d,th.push(b);if(a)return c(b._source);th.push(b);throw Error(y(350));}\nfunction Nh(a,b,c,d){var e=U;if(null===e)throw Error(y(349));var f=b._getVersion,g=f(b._source),h=vh.current,k=h.useState(function(){return Mh(e,b,c)}),l=k[1],n=k[0];k=T;var A=a.memoizedState,p=A.refs,C=p.getSnapshot,x=A.source;A=A.subscribe;var w=R;a.memoizedState={refs:p,source:b,subscribe:d};h.useEffect(function(){p.getSnapshot=c;p.setSnapshot=l;var a=f(b._source);if(!He(g,a)){a=c(b._source);He(n,a)||(l(a),a=Ig(w),e.mutableReadLanes|=a&e.pendingLanes);a=e.mutableReadLanes;e.entangledLanes|=a;for(var d=\ne.entanglements,h=a;0c?98:c,function(){a(!0);});gg(97\\x3c/script>\",a=a.removeChild(a.firstChild)):\"string\"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),\"select\"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[wf]=b;a[xf]=d;Bi(a,b,!1,!1);b.stateNode=a;g=wb(c,d);switch(c){case \"dialog\":G(\"cancel\",a);G(\"close\",a);\ne=d;break;case \"iframe\":case \"object\":case \"embed\":G(\"load\",a);e=d;break;case \"video\":case \"audio\":for(e=0;eJi&&(b.flags|=64,f=!0,Fi(d,!1),b.lanes=33554432);}else {if(!f)if(a=ih(g),null!==a){if(b.flags|=64,f=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Fi(d,!0),null===d.tail&&\"hidden\"===d.tailMode&&!g.alternate&&!lh)return b=b.lastEffect=d.lastEffect,null!==b&&(b.nextEffect=null),null}else 2*O()-d.renderingStartTime>Ji&&1073741824!==c&&(b.flags|=\n64,f=!0,Fi(d,!1),b.lanes=33554432);d.isBackwards?(g.sibling=b.child,b.child=g):(c=d.last,null!==c?c.sibling=g:b.child=g,d.last=g);}return null!==d.tail?(c=d.tail,d.rendering=c,d.tail=c.sibling,d.lastEffect=b.lastEffect,d.renderingStartTime=O(),c.sibling=null,b=P.current,I(P,f?b&1|2:b&1),c):null;case 23:case 24:return Ki(),null!==a&&null!==a.memoizedState!==(null!==b.memoizedState)&&\"unstable-defer-without-hiding\"!==d.mode&&(b.flags|=4),null}throw Error(y(156,b.tag));}\nfunction Li(a){switch(a.tag){case 1:Ff(a.type)&&Gf();var b=a.flags;return b&4096?(a.flags=b&-4097|64,a):null;case 3:fh();H(N);H(M);uh();b=a.flags;if(0!==(b&64))throw Error(y(285));a.flags=b&-4097|64;return a;case 5:return hh(a),null;case 13:return H(P),b=a.flags,b&4096?(a.flags=b&-4097|64,a):null;case 19:return H(P),null;case 4:return fh(),null;case 10:return rg(a),null;case 23:case 24:return Ki(),null;default:return null}}\nfunction Mi(a,b){try{var c=\"\",d=b;do c+=Qa(d),d=d.return;while(d);var e=c;}catch(f){e=\"\\nError generating stack: \"+f.message+\"\\n\"+f.stack;}return {value:a,source:b,stack:e}}function Ni(a,b){try{console.error(b.value);}catch(c){setTimeout(function(){throw c;});}}var Oi=\"function\"===typeof WeakMap?WeakMap:Map;function Pi(a,b,c){c=zg(-1,c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){Qi||(Qi=!0,Ri=d);Ni(a,b);};return c}\nfunction Si(a,b,c){c=zg(-1,c);c.tag=3;var d=a.type.getDerivedStateFromError;if(\"function\"===typeof d){var e=b.value;c.payload=function(){Ni(a,b);return d(e)};}var f=a.stateNode;null!==f&&\"function\"===typeof f.componentDidCatch&&(c.callback=function(){\"function\"!==typeof d&&(null===Ti?Ti=new Set([this]):Ti.add(this),Ni(a,b));var c=b.stack;this.componentDidCatch(b.value,{componentStack:null!==c?c:\"\"});});return c}var Ui=\"function\"===typeof WeakSet?WeakSet:Set;\nfunction Vi(a){var b=a.ref;if(null!==b)if(\"function\"===typeof b)try{b(null);}catch(c){Wi(a,c);}else b.current=null;}function Xi(a,b){switch(b.tag){case 0:case 11:case 15:case 22:return;case 1:if(b.flags&256&&null!==a){var c=a.memoizedProps,d=a.memoizedState;a=b.stateNode;b=a.getSnapshotBeforeUpdate(b.elementType===b.type?c:lg(b.type,c),d);a.__reactInternalSnapshotBeforeUpdate=b;}return;case 3:b.flags&256&&qf(b.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(y(163));}\nfunction Yi(a,b,c){switch(c.tag){case 0:case 11:case 15:case 22:b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{if(3===(a.tag&3)){var d=a.create;a.destroy=d();}a=a.next;}while(a!==b)}b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{var e=a;d=e.next;e=e.tag;0!==(e&4)&&0!==(e&1)&&(Zi(c,a),$i(c,a));a=d;}while(a!==b)}return;case 1:a=c.stateNode;c.flags&4&&(null===b?a.componentDidMount():(d=c.elementType===c.type?b.memoizedProps:lg(c.type,b.memoizedProps),a.componentDidUpdate(d,\nb.memoizedState,a.__reactInternalSnapshotBeforeUpdate)));b=c.updateQueue;null!==b&&Eg(c,b,a);return;case 3:b=c.updateQueue;if(null!==b){a=null;if(null!==c.child)switch(c.child.tag){case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode;}Eg(c,b,a);}return;case 5:a=c.stateNode;null===b&&c.flags&4&&mf(c.type,c.memoizedProps)&&a.focus();return;case 6:return;case 4:return;case 12:return;case 13:null===c.memoizedState&&(c=c.alternate,null!==c&&(c=c.memoizedState,null!==c&&(c=c.dehydrated,null!==c&&Cc(c))));\nreturn;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(y(163));}\nfunction aj(a,b){for(var c=a;;){if(5===c.tag){var d=c.stateNode;if(b)d=d.style,\"function\"===typeof d.setProperty?d.setProperty(\"display\",\"none\",\"important\"):d.display=\"none\";else {d=c.stateNode;var e=c.memoizedProps.style;e=void 0!==e&&null!==e&&e.hasOwnProperty(\"display\")?e.display:null;d.style.display=sb(\"display\",e);}}else if(6===c.tag)c.stateNode.nodeValue=b?\"\":c.memoizedProps;else if((23!==c.tag&&24!==c.tag||null===c.memoizedState||c===a)&&null!==c.child){c.child.return=c;c=c.child;continue}if(c===\na)break;for(;null===c.sibling;){if(null===c.return||c.return===a)return;c=c.return;}c.sibling.return=c.return;c=c.sibling;}}\nfunction bj(a,b){if(Mf&&\"function\"===typeof Mf.onCommitFiberUnmount)try{Mf.onCommitFiberUnmount(Lf,b);}catch(f){}switch(b.tag){case 0:case 11:case 14:case 15:case 22:a=b.updateQueue;if(null!==a&&(a=a.lastEffect,null!==a)){var c=a=a.next;do{var d=c,e=d.destroy;d=d.tag;if(void 0!==e)if(0!==(d&4))Zi(b,c);else {d=b;try{e();}catch(f){Wi(d,f);}}c=c.next;}while(c!==a)}break;case 1:Vi(b);a=b.stateNode;if(\"function\"===typeof a.componentWillUnmount)try{a.props=b.memoizedProps,a.state=b.memoizedState,a.componentWillUnmount();}catch(f){Wi(b,\nf);}break;case 5:Vi(b);break;case 4:cj(a,b);}}function dj(a){a.alternate=null;a.child=null;a.dependencies=null;a.firstEffect=null;a.lastEffect=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.return=null;a.updateQueue=null;}function ej(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction fj(a){a:{for(var b=a.return;null!==b;){if(ej(b))break a;b=b.return;}throw Error(y(160));}var c=b;b=c.stateNode;switch(c.tag){case 5:var d=!1;break;case 3:b=b.containerInfo;d=!0;break;case 4:b=b.containerInfo;d=!0;break;default:throw Error(y(161));}c.flags&16&&(pb(b,\"\"),c.flags&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c.return||ej(c.return)){c=null;break a}c=c.return;}c.sibling.return=c.return;for(c=c.sibling;5!==c.tag&&6!==c.tag&&18!==c.tag;){if(c.flags&2)continue b;if(null===\nc.child||4===c.tag)continue b;else c.child.return=c,c=c.child;}if(!(c.flags&2)){c=c.stateNode;break a}}d?gj(a,c,b):hj(a,c,b);}\nfunction gj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=jf));else if(4!==d&&(a=a.child,null!==a))for(gj(a,b,c),a=a.sibling;null!==a;)gj(a,b,c),a=a.sibling;}\nfunction hj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(hj(a,b,c),a=a.sibling;null!==a;)hj(a,b,c),a=a.sibling;}\nfunction cj(a,b){for(var c=b,d=!1,e,f;;){if(!d){d=c.return;a:for(;;){if(null===d)throw Error(y(160));e=d.stateNode;switch(d.tag){case 5:f=!1;break a;case 3:e=e.containerInfo;f=!0;break a;case 4:e=e.containerInfo;f=!0;break a}d=d.return;}d=!0;}if(5===c.tag||6===c.tag){a:for(var g=a,h=c,k=h;;)if(bj(g,k),null!==k.child&&4!==k.tag)k.child.return=k,k=k.child;else {if(k===h)break a;for(;null===k.sibling;){if(null===k.return||k.return===h)break a;k=k.return;}k.sibling.return=k.return;k=k.sibling;}f?(g=e,h=c.stateNode,\n8===g.nodeType?g.parentNode.removeChild(h):g.removeChild(h)):e.removeChild(c.stateNode);}else if(4===c.tag){if(null!==c.child){e=c.stateNode.containerInfo;f=!0;c.child.return=c;c=c.child;continue}}else if(bj(a,c),null!==c.child){c.child.return=c;c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return;4===c.tag&&(d=!1);}c.sibling.return=c.return;c=c.sibling;}}\nfunction ij(a,b){switch(b.tag){case 0:case 11:case 14:case 15:case 22:var c=b.updateQueue;c=null!==c?c.lastEffect:null;if(null!==c){var d=c=c.next;do 3===(d.tag&3)&&(a=d.destroy,d.destroy=void 0,void 0!==a&&a()),d=d.next;while(d!==c)}return;case 1:return;case 5:c=b.stateNode;if(null!=c){d=b.memoizedProps;var e=null!==a?a.memoizedProps:d;a=b.type;var f=b.updateQueue;b.updateQueue=null;if(null!==f){c[xf]=d;\"input\"===a&&\"radio\"===d.type&&null!=d.name&&$a(c,d);wb(a,e);b=wb(a,d);for(e=0;ee&&(e=g);c&=~f;}c=e;c=O()-c;c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3E3>c?3E3:4320>\nc?4320:1960*nj(c/1960))-c;if(10 component higher in the tree to provide a loading indicator or placeholder to display.\");}5!==V&&(V=2);k=Mi(k,h);p=\ng;do{switch(p.tag){case 3:f=k;p.flags|=4096;b&=-b;p.lanes|=b;var J=Pi(p,f,b);Bg(p,J);break a;case 1:f=k;var K=p.type,Q=p.stateNode;if(0===(p.flags&64)&&(\"function\"===typeof K.getDerivedStateFromError||null!==Q&&\"function\"===typeof Q.componentDidCatch&&(null===Ti||!Ti.has(Q)))){p.flags|=4096;b&=-b;p.lanes|=b;var L=Si(p,f,b);Bg(p,L);break a}}p=p.return;}while(null!==p)}Zj(c);}catch(va){b=va;Y===c&&null!==c&&(Y=c=c.return);continue}break}while(1)}\nfunction Pj(){var a=oj.current;oj.current=Gh;return null===a?Gh:a}function Tj(a,b){var c=X;X|=16;var d=Pj();U===a&&W===b||Qj(a,b);do try{ak();break}catch(e){Sj(a,e);}while(1);qg();X=c;oj.current=d;if(null!==Y)throw Error(y(261));U=null;W=0;return V}function ak(){for(;null!==Y;)bk(Y);}function Rj(){for(;null!==Y&&!Qf();)bk(Y);}function bk(a){var b=ck(a.alternate,a,qj);a.memoizedProps=a.pendingProps;null===b?Zj(a):Y=b;pj.current=null;}\nfunction Zj(a){var b=a;do{var c=b.alternate;a=b.return;if(0===(b.flags&2048)){c=Gi(c,b,qj);if(null!==c){Y=c;return}c=b;if(24!==c.tag&&23!==c.tag||null===c.memoizedState||0!==(qj&1073741824)||0===(c.mode&4)){for(var d=0,e=c.child;null!==e;)d|=e.lanes|e.childLanes,e=e.sibling;c.childLanes=d;}null!==a&&0===(a.flags&2048)&&(null===a.firstEffect&&(a.firstEffect=b.firstEffect),null!==b.lastEffect&&(null!==a.lastEffect&&(a.lastEffect.nextEffect=b.firstEffect),a.lastEffect=b.lastEffect),1g&&(h=g,g=J,J=h),h=Le(t,J),f=Le(t,g),h&&f&&(1!==v.rangeCount||v.anchorNode!==h.node||v.anchorOffset!==h.offset||v.focusNode!==f.node||v.focusOffset!==f.offset)&&(q=q.createRange(),q.setStart(h.node,h.offset),v.removeAllRanges(),J>g?(v.addRange(q),v.extend(f.node,f.offset)):(q.setEnd(f.node,f.offset),v.addRange(q))))));q=[];for(v=t;v=v.parentNode;)1===v.nodeType&&q.push({element:v,left:v.scrollLeft,top:v.scrollTop});\"function\"===typeof t.focus&&t.focus();for(t=\n0;tO()-jj?Qj(a,0):uj|=c);Mj(a,b);}function lj(a,b){var c=a.stateNode;null!==c&&c.delete(b);b=0;0===b&&(b=a.mode,0===(b&2)?b=1:0===(b&4)?b=99===eg()?1:2:(0===Gj&&(Gj=tj),b=Yc(62914560&~Gj),0===b&&(b=4194304)));c=Hg();a=Kj(a,b);null!==a&&($c(a,b,c),Mj(a,c));}var ck;\nck=function(a,b,c){var d=b.lanes;if(null!==a)if(a.memoizedProps!==b.pendingProps||N.current)ug=!0;else if(0!==(c&d))ug=0!==(a.flags&16384)?!0:!1;else {ug=!1;switch(b.tag){case 3:ri(b);sh();break;case 5:gh(b);break;case 1:Ff(b.type)&&Jf(b);break;case 4:eh(b,b.stateNode.containerInfo);break;case 10:d=b.memoizedProps.value;var e=b.type._context;I(mg,e._currentValue);e._currentValue=d;break;case 13:if(null!==b.memoizedState){if(0!==(c&b.child.childLanes))return ti(a,b,c);I(P,P.current&1);b=hi(a,b,c);return null!==\nb?b.sibling:null}I(P,P.current&1);break;case 19:d=0!==(c&b.childLanes);if(0!==(a.flags&64)){if(d)return Ai(a,b,c);b.flags|=64;}e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);I(P,P.current);if(d)break;else return null;case 23:case 24:return b.lanes=0,mi(a,b,c)}return hi(a,b,c)}else ug=!1;b.lanes=0;switch(b.tag){case 2:d=b.type;null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;e=Ef(b,M.current);tg(b,c);e=Ch(null,b,d,a,e,c);b.flags|=1;if(\"object\"===\ntypeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof){b.tag=1;b.memoizedState=null;b.updateQueue=null;if(Ff(d)){var f=!0;Jf(b);}else f=!1;b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null;xg(b);var g=d.getDerivedStateFromProps;\"function\"===typeof g&&Gg(b,d,g,a);e.updater=Kg;b.stateNode=e;e._reactInternals=b;Og(b,d,a,c);b=qi(null,b,d,!0,f,c);}else b.tag=0,fi(null,b,e,c),b=b.child;return b;case 16:e=b.elementType;a:{null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);\na=b.pendingProps;f=e._init;e=f(e._payload);b.type=e;f=b.tag=hk(e);a=lg(e,a);switch(f){case 0:b=li(null,b,e,a,c);break a;case 1:b=pi(null,b,e,a,c);break a;case 11:b=gi(null,b,e,a,c);break a;case 14:b=ii(null,b,e,lg(e.type,a),d,c);break a}throw Error(y(306,e,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),li(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),pi(a,b,d,e,c);case 3:ri(b);d=b.updateQueue;if(null===a||null===d)throw Error(y(282));\nd=b.pendingProps;e=b.memoizedState;e=null!==e?e.element:null;yg(a,b);Cg(b,d,null,c);d=b.memoizedState.element;if(d===e)sh(),b=hi(a,b,c);else {e=b.stateNode;if(f=e.hydrate)kh=rf(b.stateNode.containerInfo.firstChild),jh=b,f=lh=!0;if(f){a=e.mutableSourceEagerHydrationData;if(null!=a)for(e=0;e 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nfunction __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\n\nvar IconSize;\n(function (IconSize) {\n IconSize[\"sm\"] = \"sm\";\n IconSize[\"md\"] = \"md\";\n IconSize[\"lg\"] = \"lg\";\n IconSize[\"xl\"] = \"xl\";\n})(IconSize || (IconSize = {}));\nconst getSize = (size) => {\n switch (size) {\n case IconSize.sm:\n return '1em';\n case IconSize.md:\n return '1.5em';\n case IconSize.lg:\n return '2em';\n case IconSize.xl:\n return '3em';\n default:\n return '1em';\n }\n};\nlet currentId = 0;\n/**\n * Factory to create Icon class components for consumers\n */\nfunction createIcon({ name, xOffset = 0, yOffset = 0, width, height, svgPath }) {\n var _a;\n return _a = class SVGIcon extends react.Component {\n constructor() {\n super(...arguments);\n this.id = `icon-title-${currentId++}`;\n }\n render() {\n const _a = this.props, { size, color, title, noVerticalAlign } = _a, props = __rest(_a, [\"size\", \"color\", \"title\", \"noVerticalAlign\"]);\n const hasTitle = Boolean(title);\n const heightWidth = getSize(size);\n const baseAlign = -0.125 * Number.parseFloat(heightWidth);\n const style = noVerticalAlign ? null : { verticalAlign: `${baseAlign}em` };\n const viewBox = [xOffset, yOffset, width, height].join(' ');\n return (react.createElement(\"svg\", Object.assign({ style: style, fill: color, height: heightWidth, width: heightWidth, viewBox: viewBox, \"aria-labelledby\": hasTitle ? this.id : null, \"aria-hidden\": hasTitle ? null : true, role: \"img\" }, props),\n hasTitle && react.createElement(\"title\", { id: this.id }, title),\n react.createElement(\"path\", { d: svgPath })));\n }\n },\n _a.displayName = name,\n _a.defaultProps = {\n color: 'currentColor',\n size: IconSize.sm,\n noVerticalAlign: false\n },\n _a;\n}\n\nexport { __rest as _, __awaiter as a, __generator as b, createIcon as c, __spread as d };\n", "import { _ as __rest } from './createIcon-1a4b25a9.js';\nimport { r as react } from './index-7cda8b13.js';\nimport { g as getDefaultExportFromCjs, c as createCommonjsModule } from './_commonjsHelpers-4f955397.js';\nimport { r as reactDom } from './index-916de6ed.js';\n\n/** Joins args into a className string\n *\n * @param {any} args list of objects, string, or arrays to reduce\n */\nfunction css(...args) {\n // Adapted from https://github.com/JedWatson/classnames/blob/master/index.js\n const classes = [];\n const hasOwn = {}.hasOwnProperty;\n args.filter(Boolean).forEach((arg) => {\n const argType = typeof arg;\n if (argType === 'string' || argType === 'number') {\n classes.push(arg);\n }\n else if (Array.isArray(arg) && arg.length) {\n const inner = css(...arg);\n if (inner) {\n classes.push(inner);\n }\n }\n else if (argType === 'object') {\n for (const key in arg) {\n if (hasOwn.call(arg, key) && arg[key]) {\n classes.push(key);\n }\n }\n }\n });\n return classes.join(' ');\n}\n\nconst KEY_CODES = { ARROW_UP: 38, ARROW_DOWN: 40, ESCAPE_KEY: 27, TAB: 9, ENTER: 13, SPACE: 32 };\nconst KEYHANDLER_DIRECTION = { UP: 'up', DOWN: 'down', RIGHT: 'right', LEFT: 'left' };\nvar ValidatedOptions;\n(function (ValidatedOptions) {\n ValidatedOptions[\"success\"] = \"success\";\n ValidatedOptions[\"error\"] = \"error\";\n ValidatedOptions[\"warning\"] = \"warning\";\n ValidatedOptions[\"default\"] = \"default\";\n})(ValidatedOptions || (ValidatedOptions = {}));\n\nlet uid = 0;\nconst ouiaPrefix = 'OUIA-Generated-';\nconst ouiaIdByRoute = {};\n/** Get props to conform to OUIA spec\n *\n * For functional components, use the useOUIAProps function instead\n *\n * In class based components, create a state variable ouiaStateId to create a static generated ID:\n * state = {\n * ouiaStateId: getDefaultOUIAId(Chip.displayName)\n * }\n * This generated ID should remain alive as long as the component is not unmounted.\n *\n * Then add the attributes to the component\n * {...getOUIAProps('OverflowChip', this.props.ouiaId !== undefined ? this.props.ouiaId : this.state.ouiaStateId)}\n *\n * @param {string} componentType OUIA component type\n * @param {number|string} id OUIA component id\n * @param {boolean} ouiaSafe false if in animation\n */\nfunction getOUIAProps(componentType, id, ouiaSafe = true) {\n return {\n 'data-ouia-component-type': `PF4/${componentType}`,\n 'data-ouia-safe': ouiaSafe,\n 'data-ouia-component-id': id\n };\n}\n/**\n * Hooks version of the getOUIAProps function that also memoizes the generated ID\n * Can only be used in functional components\n *\n * @param {string} componentType OUIA component type\n * @param {number|string} id OUIA component id\n * @param {boolean} ouiaSafe false if in animation\n * @param {string} variant Optional variant to add to the generated ID\n */\nconst useOUIAProps = (componentType, id, ouiaSafe = true, variant) => ({\n 'data-ouia-component-type': `PF4/${componentType}`,\n 'data-ouia-safe': ouiaSafe,\n 'data-ouia-component-id': useOUIAId(componentType, id, variant)\n});\n/**\n * Returns the ID or the memoized generated ID\n *\n * @param {string} componentType OUIA component type\n * @param {number|string} id OUIA component id\n * @param {string} variant Optional variant to add to the generated ID\n */\nconst useOUIAId = (componentType, id, variant) => {\n if (id !== undefined) {\n return id;\n }\n return react.useMemo(() => getDefaultOUIAId(componentType, variant), [componentType, variant]);\n};\n/**\n * Returns a generated id based on the URL location\n *\n * @param {string} componentType OUIA component type\n * @param {string} variant Optional variant to add to the generated ID\n */\nfunction getDefaultOUIAId(componentType, variant) {\n /*\n ouiaIdByRoute = {\n [route+componentType]: [number]\n }\n */\n try {\n const key = `${window.location.href}-${componentType}-${variant || ''}`;\n if (!ouiaIdByRoute[key]) {\n ouiaIdByRoute[key] = 0;\n }\n return `${ouiaPrefix}${componentType}-${variant ? `${variant}-` : ''}${++ouiaIdByRoute[key]}`;\n }\n catch (exception) {\n return `${ouiaPrefix}${componentType}-${variant ? `${variant}-` : ''}${++uid}`;\n }\n}\n\n/**\n * @param {string} input - String to capitalize first letter\n */\nfunction capitalize(input) {\n return input[0].toUpperCase() + input.substring(1);\n}\n/**\n * @param {string} prefix - String to prefix ID with\n */\nfunction getUniqueId(prefix = 'pf') {\n const uid = new Date().getTime() +\n Math.random()\n .toString(36)\n .slice(2);\n return `${prefix}-${uid}`;\n}\n/**\n * @param { any } this - \"This\" reference\n * @param { Function } func - Function to debounce\n * @param { number } wait - Debounce amount\n */\nfunction debounce(func, wait) {\n let timeout;\n return (...args) => {\n clearTimeout(timeout);\n timeout = setTimeout(() => func.apply(this, args), wait);\n };\n}\n/** This function returns whether or not an element is within the viewable area of a container. If partial is true,\n * then this function will return true even if only part of the element is in view.\n *\n * @param {HTMLElement} container The container to check if the element is in view of.\n * @param {HTMLElement} element The element to check if it is view\n * @param {boolean} partial true if partial view is allowed\n *\n * @returns { boolean } True if the component is in View.\n */\nfunction isElementInView(container, element, partial) {\n if (!container || !element) {\n return false;\n }\n const containerBounds = container.getBoundingClientRect();\n const elementBounds = element.getBoundingClientRect();\n const containerBoundsLeft = Math.floor(containerBounds.left);\n const containerBoundsRight = Math.floor(containerBounds.right);\n const elementBoundsLeft = Math.floor(elementBounds.left);\n const elementBoundsRight = Math.floor(elementBounds.right);\n // Check if in view\n const isTotallyInView = elementBoundsLeft >= containerBoundsLeft && elementBoundsRight <= containerBoundsRight;\n const isPartiallyInView = partial &&\n ((elementBoundsLeft < containerBoundsLeft && elementBoundsRight > containerBoundsLeft) ||\n (elementBoundsRight > containerBoundsRight && elementBoundsLeft < containerBoundsRight));\n // Return outcome\n return isTotallyInView || isPartiallyInView;\n}\n/** Interpolates a parameterized templateString using values from a templateVars object.\n * The templateVars object should have keys and values which match the templateString's parameters.\n * Example:\n * const templateString: 'My name is ${firstName} ${lastName}';\n * const templateVars: {\n * firstName: 'Jon'\n * lastName: 'Dough'\n * };\n * const result = fillTemplate(templateString, templateVars);\n * // \"My name is Jon Dough\"\n *\n * @param {string} templateString The string passed by the consumer\n * @param {object} templateVars The variables passed to the string\n *\n * @returns {string} The template string literal result\n */\nfunction fillTemplate(templateString, templateVars) {\n return templateString.replace(/\\${(.*?)}/g, (_, match) => templateVars[match] || '');\n}\n/**\n * This function allows for keyboard navigation through dropdowns. The custom argument is optional.\n *\n * @param {number} index The index of the element you're on\n * @param {number} innerIndex Inner index number\n * @param {string} position The orientation of the dropdown\n * @param {string[]} refsCollection Array of refs to the items in the dropdown\n * @param {object[]} kids Array of items in the dropdown\n * @param {boolean} [custom] Allows for handling of flexible content\n */\nfunction keyHandler(index, innerIndex, position, refsCollection, kids, custom = false) {\n if (!Array.isArray(kids)) {\n return;\n }\n const isMultiDimensional = refsCollection.filter(ref => ref)[0].constructor === Array;\n let nextIndex = index;\n let nextInnerIndex = innerIndex;\n if (position === 'up') {\n if (index === 0) {\n // loop back to end\n nextIndex = kids.length - 1;\n }\n else {\n nextIndex = index - 1;\n }\n }\n else if (position === 'down') {\n if (index === kids.length - 1) {\n // loop back to beginning\n nextIndex = 0;\n }\n else {\n nextIndex = index + 1;\n }\n }\n else if (position === 'left') {\n if (innerIndex === 0) {\n nextInnerIndex = refsCollection[index].length - 1;\n }\n else {\n nextInnerIndex = innerIndex - 1;\n }\n }\n else if (position === 'right') {\n if (innerIndex === refsCollection[index].length - 1) {\n nextInnerIndex = 0;\n }\n else {\n nextInnerIndex = innerIndex + 1;\n }\n }\n if (refsCollection[nextIndex] === null ||\n refsCollection[nextIndex] === undefined ||\n (isMultiDimensional &&\n (refsCollection[nextIndex][nextInnerIndex] === null || refsCollection[nextIndex][nextInnerIndex] === undefined))) {\n keyHandler(nextIndex, nextInnerIndex, position, refsCollection, kids, custom);\n }\n else if (custom) {\n if (refsCollection[nextIndex].focus) {\n refsCollection[nextIndex].focus();\n }\n // eslint-disable-next-line react/no-find-dom-node\n const element = reactDom.findDOMNode(refsCollection[nextIndex]);\n element.focus();\n }\n else if (position !== 'tab') {\n if (isMultiDimensional) {\n refsCollection[nextIndex][nextInnerIndex].focus();\n }\n else {\n refsCollection[nextIndex].focus();\n }\n }\n}\n/** This function is a helper for keyboard navigation through dropdowns.\n *\n * @param {number} index The index of the element you're on\n * @param {string} position The orientation of the dropdown\n * @param {string[]} collection Array of refs to the items in the dropdown\n */\nfunction getNextIndex(index, position, collection) {\n let nextIndex;\n if (position === 'up') {\n if (index === 0) {\n // loop back to end\n nextIndex = collection.length - 1;\n }\n else {\n nextIndex = index - 1;\n }\n }\n else if (index === collection.length - 1) {\n // loop back to beginning\n nextIndex = 0;\n }\n else {\n nextIndex = index + 1;\n }\n if (collection[nextIndex] === undefined || collection[nextIndex][0] === null) {\n return getNextIndex(nextIndex, position, collection);\n }\n else {\n return nextIndex;\n }\n}\n/** This function is a helper for pluralizing strings.\n *\n * @param {number} i The quantity of the string you want to pluralize\n * @param {string} singular The singular version of the string\n * @param {string} plural The change to the string that should occur if the quantity is not equal to 1.\n * Defaults to adding an 's'.\n */\nfunction pluralize(i, singular, plural) {\n if (!plural) {\n plural = `${singular}s`;\n }\n return `${i || 0} ${i === 1 ? singular : plural}`;\n}\n/**\n * This function is a helper for turning arrays of breakpointMod objects for flex and grid into style object\n *\n * @param {object} mods The modifiers object\n * @param {string} css-variable The appropriate css variable for the component\n */\nconst setBreakpointCssVars = (mods, cssVar) => Object.entries(mods || {}).reduce((acc, [breakpoint, value]) => breakpoint === 'default' ? Object.assign(Object.assign({}, acc), { [cssVar]: value }) : Object.assign(Object.assign({}, acc), { [`${cssVar}-on-${breakpoint}`]: value }), {});\n/**\n * This function is a helper for turning arrays of breakpointMod objects for data toolbar and flex into classes\n *\n * @param {object} mods The modifiers object\n * @param {any} styles The appropriate styles object for the component\n */\nconst formatBreakpointMods = (mods, styles, stylePrefix = '') => Object.entries(mods || {})\n .map(([breakpoint, mod]) => `${stylePrefix}${mod}${breakpoint !== 'default' ? `-on-${breakpoint}` : ''}`)\n .map(toCamel)\n .map(mod => mod.replace(/-?(\\dxl)/gi, (_res, group) => `_${group}`))\n .map(modifierKey => styles.modifiers[modifierKey])\n .filter(Boolean)\n .join(' ');\nconst camelize = (s) => s\n .toUpperCase()\n .replace('-', '')\n .replace('_', '');\n/**\n *\n * @param {string} s string to make camelCased\n */\nconst toCamel = (s) => s.replace(/([-_][a-z])/gi, camelize);\n/**\n * Copied from exenv\n */\nconst canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\n/**\n * Calculate the width of the text\n * Example:\n * getTextWidth('my text', node)\n *\n * @param {string} text The text to calculate the width for\n * @param {HTMLElement} node The HTML element\n */\nconst getTextWidth = (text, node) => {\n const computedStyle = getComputedStyle(node);\n // Firefox returns the empty string for .font, so this function creates the .font property manually\n const getFontFromComputedStyle = () => {\n let computedFont = '';\n // Firefox uses percentages for font-stretch, but Canvas does not accept percentages\n // so convert to keywords, as listed at:\n // https://developer.mozilla.org/en-US/docs/Web/CSS/font-stretch\n const fontStretchLookupTable = {\n '50%': 'ultra-condensed',\n '62.5%': 'extra-condensed',\n '75%': 'condensed',\n '87.5%': 'semi-condensed',\n '100%': 'normal',\n '112.5%': 'semi-expanded',\n '125%': 'expanded',\n '150%': 'extra-expanded',\n '200%': 'ultra-expanded'\n };\n // If the retrieved font-stretch percentage isn't found in the lookup table, use\n // 'normal' as a last resort.\n let fontStretch;\n if (computedStyle.fontStretch in fontStretchLookupTable) {\n fontStretch = fontStretchLookupTable[computedStyle.fontStretch];\n }\n else {\n fontStretch = 'normal';\n }\n computedFont =\n computedStyle.fontStyle +\n ' ' +\n computedStyle.fontVariant +\n ' ' +\n computedStyle.fontWeight +\n ' ' +\n fontStretch +\n ' ' +\n computedStyle.fontSize +\n '/' +\n computedStyle.lineHeight +\n ' ' +\n computedStyle.fontFamily;\n return computedFont;\n };\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n context.font = computedStyle.font || getFontFromComputedStyle();\n return context.measureText(text).width;\n};\n/**\n * Get the inner dimensions of an element\n *\n * @param {HTMLElement} node HTML element to calculate the inner dimensions for\n */\nconst innerDimensions = (node) => {\n const computedStyle = getComputedStyle(node);\n let width = node.clientWidth; // width with padding\n let height = node.clientHeight; // height with padding\n height -= parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom);\n width -= parseFloat(computedStyle.paddingLeft) + parseFloat(computedStyle.paddingRight);\n return { height, width };\n};\n/**\n * This function is a helper for truncating text content on the left, leaving the right side of the content in view\n *\n * @param {HTMLElement} node HTML element\n * @param {string} value The original text value\n */\nconst trimLeft = (node, value) => {\n const availableWidth = innerDimensions(node).width;\n let newValue = value;\n if (getTextWidth(value, node) > availableWidth) {\n // we have text overflow, trim the text to the left and add ... in the front until it fits\n while (getTextWidth(`...${newValue}`, node) > availableWidth) {\n newValue = newValue.substring(1);\n }\n // replace text with our truncated text\n if (node.value) {\n node.value = `...${newValue}`;\n }\n else {\n node.innerText = `...${newValue}`;\n }\n }\n else {\n if (node.value) {\n node.value = value;\n }\n else {\n node.innerText = value;\n }\n }\n};\n/**\n * @param {string[]} events - Operations to prevent when disabled\n */\nconst preventedEvents = (events) => events.reduce((handlers, eventToPrevent) => (Object.assign(Object.assign({}, handlers), { [eventToPrevent]: (event) => {\n event.preventDefault();\n } })), {});\n\n/**\n * This component wraps any ReactNode and finds its ref\n * It has to be a class for findDOMNode to work\n * Ideally, all components used as triggers/toggles are either:\n * - class based components we can assign our own ref to\n * - functional components that have forwardRef implemented\n * However, there is no guarantee that is what will get passed in as trigger/toggle in the case of tooltips and popovers\n */\nclass FindRefWrapper extends react.Component {\n componentDidMount() {\n // eslint-disable-next-line react/no-find-dom-node\n const root = reactDom.findDOMNode(this);\n this.props.onFoundRef(root);\n }\n render() {\n return this.props.children || null;\n }\n}\nFindRefWrapper.displayName = 'FindRefWrapper';\n\n/**\n * @param element\n */\nfunction getBoundingClientRect(element) {\n const rect = element.getBoundingClientRect();\n return {\n width: rect.width,\n height: rect.height,\n top: rect.top,\n right: rect.right,\n bottom: rect.bottom,\n left: rect.left,\n x: rect.left,\n y: rect.top\n };\n}\n\n// @ts-nocheck\n/* :: import type { Window } from '../types'; */\n/* :: declare function getWindow(node: Node | Window): Window; */\n/**\n * @param node\n */\nfunction getWindow(node) {\n if (node.toString() !== '[object Window]') {\n const ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView : window;\n }\n return node;\n}\n\n// @ts-nocheck\n/**\n * @param node\n */\nfunction getWindowScroll(node) {\n const win = getWindow(node);\n const scrollLeft = win.pageXOffset;\n const scrollTop = win.pageYOffset;\n return {\n scrollLeft,\n scrollTop\n };\n}\n\n// @ts-nocheck\n/* :: declare function isElement(node: mixed): boolean %checks(node instanceof\n Element); */\n/**\n * @param node\n */\nfunction isElement(node) {\n const OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n/* :: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof\n HTMLElement); */\n/**\n * @param node\n */\nfunction isHTMLElement(node) {\n const OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\n// @ts-nocheck\n/**\n * @param element\n */\nfunction getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}\n\n// @ts-nocheck\n/**\n * @param node\n */\nfunction getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n }\n else {\n return getHTMLElementScroll(node);\n }\n}\n\n/**\n * @param element\n */\nfunction getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}\n\n// @ts-nocheck\n/**\n * @param element\n */\nfunction getDocumentElement(element) {\n // $FlowFixMe: assume body is always available\n return (isElement(element) ? element.ownerDocument : element.document).documentElement;\n}\n\n// @ts-nocheck\n/**\n * @param element\n */\nfunction getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}\n\n// @ts-nocheck\n/**\n * @param element\n */\nfunction getComputedStyle$1(element) {\n return getWindow(element).getComputedStyle(element);\n}\n\n// @ts-nocheck\n/**\n * @param element\n */\nfunction isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n const { overflow, overflowX, overflowY } = getComputedStyle$1(element);\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}\n\n// Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n/**\n * @param elementOrVirtualElement\n * @param offsetParent\n * @param isFixed\n */\nfunction getCompositeRect(elementOrVirtualElement, offsetParent, isFixed = false) {\n const documentElement = getDocumentElement(offsetParent);\n const rect = getBoundingClientRect(elementOrVirtualElement);\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n let scroll = { scrollLeft: 0, scrollTop: 0 };\n let offsets = { x: 0, y: 0 };\n if (isOffsetParentAnElement || (!isOffsetParentAnElement && !isFixed)) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n }\n else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}\n\n// Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n/**\n * @param element\n */\nfunction getLayoutRect(element) {\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: element.offsetWidth,\n height: element.offsetHeight\n };\n}\n\n// @ts-nocheck\n/**\n * @param element\n */\nfunction getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n return (\n // $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || // DOM Element detected\n // $FlowFixMe: need a better way to handle this...\n element.host || // ShadowRoot detected\n // $FlowFixMe: HTMLElement is a Node\n getDocumentElement(element) // fallback\n );\n}\n\n// @ts-nocheck\n/**\n * @param node\n */\nfunction getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe: assume body is always available\n return node.ownerDocument.body;\n }\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n return getScrollParent(getParentNode(node));\n}\n\n// @ts-nocheck\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n/**\n * @param element\n * @param list\n */\nfunction listScrollParents(element, list = []) {\n const scrollParent = getScrollParent(element);\n const isBody = getNodeName(scrollParent) === 'body';\n const win = getWindow(scrollParent);\n const target = isBody\n ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : [])\n : scrollParent;\n const updatedList = list.concat(target);\n return isBody\n ? updatedList // $FlowFixMe: isBody tells us target will be an HTMLElement here\n : updatedList.concat(listScrollParents(getParentNode(target)));\n}\n\n// @ts-nocheck\n/**\n * @param element\n */\nfunction isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}\n\n// @ts-nocheck\n/**\n * @param element\n */\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle$1(element).position === 'fixed') {\n return null;\n }\n const offsetParent = element.offsetParent;\n if (offsetParent) {\n const html = getDocumentElement(offsetParent);\n if (getNodeName(offsetParent) === 'body' &&\n getComputedStyle$1(offsetParent).position === 'static' &&\n getComputedStyle$1(html).position !== 'static') {\n return html;\n }\n }\n return offsetParent;\n}\n// `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n/**\n * @param element\n */\nfunction getContainingBlock(element) {\n let currentNode = getParentNode(element);\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n const css = getComputedStyle$1(currentNode);\n // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n if (css.transform !== 'none' || css.perspective !== 'none' || (css.willChange && css.willChange !== 'auto')) {\n return currentNode;\n }\n else {\n currentNode = currentNode.parentNode;\n }\n }\n return null;\n}\n// Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n/**\n * @param element\n */\nfunction getOffsetParent(element) {\n const window = getWindow(element);\n let offsetParent = getTrueOffsetParent(element);\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static') {\n return window;\n }\n return offsetParent || getContainingBlock(element) || window;\n}\n\n// @ts-nocheck\nconst top = 'top';\nconst bottom = 'bottom';\nconst right = 'right';\nconst left = 'left';\nconst auto = 'auto';\nconst basePlacements = [top, bottom, right, left];\nconst start = 'start';\nconst end = 'end';\nconst clippingParents = 'clippingParents';\nconst viewport = 'viewport';\nconst popper = 'popper';\nconst reference = 'reference';\nconst variationPlacements = basePlacements.reduce((acc, placement) => acc.concat([`${placement}-${start}`, `${placement}-${end}`]), []);\nconst placements = [...basePlacements, auto].reduce((acc, placement) => acc.concat([placement, `${placement}-${start}`, `${placement}-${end}`]), []);\n// modifiers that need to read the DOM\nconst beforeRead = 'beforeRead';\nconst read = 'read';\nconst afterRead = 'afterRead';\n// pure-logic modifiers\nconst beforeMain = 'beforeMain';\nconst main = 'main';\nconst afterMain = 'afterMain';\n// modifier with the purpose to write to the DOM (or write into a framework state)\nconst beforeWrite = 'beforeWrite';\nconst write = 'write';\nconst afterWrite = 'afterWrite';\nconst modifierPhases = [\n beforeRead,\n read,\n afterRead,\n beforeMain,\n main,\n afterMain,\n beforeWrite,\n write,\n afterWrite\n];\n\n// source: https://stackoverflow.com/questions/49875255\n/**\n * @param modifiers\n */\nfunction order(modifiers) {\n const map = new Map();\n const visited = new Set();\n const result = [];\n modifiers.forEach(modifier => {\n map.set(modifier.name, modifier);\n });\n // On visiting object, check for its dependencies and visit them recursively\n /**\n * @param modifier\n */\n function sort(modifier) {\n visited.add(modifier.name);\n const requires = [...(modifier.requires || []), ...(modifier.requiresIfExists || [])];\n requires.forEach(dep => {\n if (!visited.has(dep)) {\n const depModifier = map.get(dep);\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n modifiers.forEach(modifier => {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n/**\n * @param modifiers\n */\nfunction orderModifiers(modifiers) {\n // order based on dependencies\n const orderedModifiers = order(modifiers);\n // order based on phase\n return modifierPhases.reduce((acc, phase) => acc.concat(orderedModifiers.filter(modifier => modifier.phase === phase)), []);\n}\n\n// @ts-nocheck\n/**\n * @param fn\n */\nfunction debounce$1(fn) {\n let pending;\n return () => {\n if (!pending) {\n pending = new Promise(resolve => {\n Promise.resolve().then(() => {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n return pending;\n };\n}\n\n/**\n * @param placement\n */\nfunction getBasePlacement(placement) {\n return placement.split('-')[0];\n}\n\n/**\n * @param modifiers\n */\nfunction mergeByName(modifiers) {\n const merged = modifiers.reduce((merged, current) => {\n const existing = merged[current.name];\n merged[current.name] = existing\n ? Object.assign(Object.assign(Object.assign({}, existing), current), { options: Object.assign(Object.assign({}, existing.options), current.options), data: Object.assign(Object.assign({}, existing.data), current.data) }) : current;\n return merged;\n }, {});\n // IE11 does not support Object.values\n return Object.keys(merged).map(key => merged[key]);\n}\n\n// @ts-nocheck\n/**\n * @param element\n */\nfunction getViewportRect(element) {\n const win = getWindow(element);\n const html = getDocumentElement(element);\n const visualViewport = win.visualViewport;\n let width = html.clientWidth;\n let height = html.clientHeight;\n let x = 0;\n let y = 0;\n // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper\n // can be obscured underneath it.\n // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even\n // if it isn't open, so if this isn't available, the popper will be detected\n // to overflow the bottom of the screen too early.\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n // Uses Layout Viewport (like Chrome; Safari does not currently)\n // In Chrome, it returns a value very close to 0 (+/-) but contains rounding\n // errors due to floating point numbers, so we need to check precision.\n // Safari returns a number <= 0, usually < -1 when pinch-zoomed\n // Feature detection fails in mobile emulation mode in Chrome.\n // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <\n // 0.001\n // Fallback here: \"Not Safari\" userAgent\n if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n return {\n width,\n height,\n x: x + getWindowScrollBarX(element),\n y\n };\n}\n\n// Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n/**\n * @param element\n */\nfunction getDocumentRect(element) {\n const html = getDocumentElement(element);\n const winScroll = getWindowScroll(element);\n const body = element.ownerDocument.body;\n const width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n const height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n let x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n const y = -winScroll.scrollTop;\n if (getComputedStyle$1(body || html).direction === 'rtl') {\n x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n return { width, height, x, y };\n}\n\n// @ts-nocheck\n/**\n * @param parent\n * @param child\n */\nfunction contains(parent, child) {\n // $FlowFixMe: hasOwnProperty doesn't seem to work in tests\n const isShadow = Boolean(child.getRootNode && child.getRootNode().host);\n // First, attempt with faster native method\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (isShadow) {\n let next = child;\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n }\n // $FlowFixMe: need a better way to handle this...\n next = next.parentNode || next.host;\n } while (next);\n }\n // Give up, the result is false\n return false;\n}\n\n/**\n * @param rect\n */\nfunction rectToClientRect(rect) {\n return Object.assign(Object.assign({}, rect), { left: rect.x, top: rect.y, right: rect.x + rect.width, bottom: rect.y + rect.height });\n}\n\n/**\n * @param element\n */\nfunction getInnerBoundingClientRect(element) {\n const rect = getBoundingClientRect(element);\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n/**\n * @param element\n * @param clippingParent\n */\nfunction getClientRectFromMixedType(element, clippingParent) {\n return clippingParent === viewport\n ? rectToClientRect(getViewportRect(element))\n : isHTMLElement(clippingParent)\n ? getInnerBoundingClientRect(clippingParent)\n : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n}\n// A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n/**\n * @param element\n */\nfunction getClippingParents(element) {\n const clippingParents = listScrollParents(getParentNode(element));\n const canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0;\n const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n if (!isElement(clipperElement)) {\n return [];\n }\n // $FlowFixMe: https://github.com/facebook/flow/issues/1414\n return clippingParents.filter(clippingParent => isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body');\n}\n// Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n/**\n * @param element\n * @param boundary\n * @param rootBoundary\n */\nfunction getClippingRect(element, boundary, rootBoundary) {\n const mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n const clippingParents = [...mainClippingParents, rootBoundary];\n const firstClippingParent = clippingParents[0];\n const clippingRect = clippingParents.reduce((accRect, clippingParent) => {\n const rect = getClientRectFromMixedType(element, clippingParent);\n accRect.top = Math.max(rect.top, accRect.top);\n accRect.right = Math.min(rect.right, accRect.right);\n accRect.bottom = Math.min(rect.bottom, accRect.bottom);\n accRect.left = Math.max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}\n\n/**\n * @param placement\n */\nfunction getVariation(placement) {\n return placement.split('-')[1];\n}\n\n/**\n * @param placement\n */\nfunction getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}\n\n// @ts-nocheck\n/**\n *\n */\nfunction computeOffsets({ reference, element, placement }) {\n const basePlacement = placement ? getBasePlacement(placement) : null;\n const variation = placement ? getVariation(placement) : null;\n const commonX = reference.x + reference.width / 2 - element.width / 2;\n const commonY = reference.y + reference.height / 2 - element.height / 2;\n let offsets;\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n const mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n if (mainAxis != null) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n switch (variation) {\n case start:\n offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);\n break;\n case end:\n offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2);\n break;\n }\n }\n return offsets;\n}\n\n/**\n *\n */\nfunction getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}\n\n/**\n * @param paddingObject\n */\nfunction mergePaddingObject(paddingObject) {\n return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);\n}\n\n// @ts-nocheck\n/**\n * @param value\n * @param keys\n */\nfunction expandToHashMap(value, keys) {\n return keys.reduce((hashMap, key) => {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}\n\n/**\n * @param state\n * @param options\n */\nfunction detectOverflow(state, options = {}) {\n const { placement = state.placement, boundary = clippingParents, rootBoundary = viewport, elementContext = popper, altBoundary = false, padding = 0 } = options;\n const paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n const altContext = elementContext === popper ? reference : popper;\n const referenceElement = state.elements.reference;\n const popperRect = state.rects.popper;\n const element = state.elements[altBoundary ? altContext : elementContext];\n const clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);\n const referenceClientRect = getBoundingClientRect(referenceElement);\n const popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement\n });\n const popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));\n const elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;\n // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n const overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n const offsetData = state.modifiersData.offset;\n // Offsets can be applied only to the popper element\n if (elementContext === popper && offsetData) {\n const offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(key => {\n const multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n const axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n return overflowOffsets;\n}\n\nconst DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n/**\n * @param args\n */\nfunction areValidElements(...args) {\n return !args.some(element => !(element && typeof element.getBoundingClientRect === 'function'));\n}\n/**\n * @param generatorOptions\n */\nfunction popperGenerator(generatorOptions = {}) {\n const { defaultModifiers = [], defaultOptions = DEFAULT_OPTIONS } = generatorOptions;\n return function createPopper(reference, popper, options = defaultOptions) {\n let state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),\n modifiersData: {},\n elements: {\n reference,\n popper\n },\n attributes: {},\n styles: {}\n };\n let effectCleanupFns = [];\n let isDestroyed = false;\n const instance = {\n state,\n setOptions(options) {\n cleanupModifierEffects();\n state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);\n state.scrollParents = {\n reference: isElement(reference)\n ? listScrollParents(reference)\n : reference.contextElement\n ? listScrollParents(reference.contextElement)\n : [],\n popper: listScrollParents(popper)\n };\n // Orders the modifiers based on their dependencies and `phase`\n // properties\n const orderedModifiers = orderModifiers(mergeByName([...defaultModifiers, ...state.options.modifiers]));\n // Strip out disabled modifiers\n state.orderedModifiers = orderedModifiers.filter(m => m.enabled);\n runModifierEffects();\n return instance.update();\n },\n // Sync update – it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate() {\n if (isDestroyed) {\n return;\n }\n const { reference, popper } = state.elements;\n // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n if (!areValidElements(reference, popper)) {\n return;\n }\n // Store the reference and popper rects to be read by modifiers\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n };\n // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n state.reset = false;\n state.placement = state.options.placement;\n // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n state.orderedModifiers.forEach(modifier => (state.modifiersData[modifier.name] = Object.assign({}, modifier.data)));\n for (let index = 0; index < state.orderedModifiers.length; index++) {\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n const { fn, options = {}, name } = state.orderedModifiers[index];\n if (typeof fn === 'function') {\n state = fn({ state, options, name, instance }) || state;\n }\n }\n },\n // Async and optimistically optimized update – it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce$1(() => new Promise(resolve => {\n instance.forceUpdate();\n resolve(state);\n })),\n destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n if (!areValidElements(reference, popper)) {\n return instance;\n }\n instance.setOptions(options).then(state => {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n });\n // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n /**\n *\n */\n function runModifierEffects() {\n state.orderedModifiers.forEach(({ name, options = {}, effect }) => {\n if (typeof effect === 'function') {\n const cleanupFn = effect({ state, name, instance, options });\n const noopFn = () => { };\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n /**\n *\n */\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(fn => fn());\n effectCleanupFns = [];\n }\n return instance;\n };\n}\n\nconst passive = { passive: true };\n/**\n *\n */\nfunction effect({ state, instance, options }) {\n const { scroll = true, resize = true } = options;\n const window = getWindow(state.elements.popper);\n const scrollParents = [...state.scrollParents.reference, ...state.scrollParents.popper];\n if (scroll) {\n scrollParents.forEach(scrollParent => {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n return () => {\n if (scroll) {\n scrollParents.forEach(scrollParent => {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n}\nvar eventListeners = {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: () => { },\n effect,\n data: {}\n};\n\n/**\n *\n */\nfunction popperOffsets({ state, name }) {\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n}\nvar popperOffsets$1 = {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};\n\nconst unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n};\n// Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n/**\n *\n */\nfunction roundOffsets({ x, y }) {\n const win = window;\n const dpr = win.devicePixelRatio || 1;\n return {\n x: Math.round(x * dpr) / dpr || 0,\n y: Math.round(y * dpr) / dpr || 0\n };\n}\n/**\n *\n */\nfunction mapToStyles({ popper, popperRect, placement, offsets, position, gpuAcceleration, adaptive }) {\n let { x, y } = roundOffsets(offsets);\n const hasX = offsets.hasOwnProperty('x');\n const hasY = offsets.hasOwnProperty('y');\n let sideX = left;\n let sideY = top;\n const win = window;\n if (adaptive) {\n let offsetParent = getOffsetParent(popper);\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n }\n // $FlowFixMe: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n /* :: offsetParent = (offsetParent: Element); */\n if (placement === top) {\n sideY = bottom;\n y -= offsetParent.clientHeight - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n if (placement === left) {\n sideX = right;\n x -= offsetParent.clientWidth - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n const commonStyles = Object.assign({ position }, (adaptive && unsetSides));\n if (gpuAcceleration) {\n return Object.assign(Object.assign({}, commonStyles), { [sideY]: hasY ? '0' : '', [sideX]: hasX ? '0' : '', \n // Layer acceleration can disable subpixel rendering which causes slightly\n // blurry text on low PPI displays, so we want to use 2D transforms\n // instead\n transform: (win.devicePixelRatio || 1) < 2 ? `translate(${x}px, ${y}px)` : `translate3d(${x}px, ${y}px, 0)` });\n }\n return Object.assign(Object.assign({}, commonStyles), { [sideY]: hasY ? `${y}px` : '', [sideX]: hasX ? `${x}px` : '', transform: '' });\n}\n/**\n *\n */\nfunction computeStyles({ state, options }) {\n const { gpuAcceleration = true, adaptive = true } = options;\n const commonStyles = {\n placement: getBasePlacement(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration\n };\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), { offsets: state.modifiersData.popperOffsets, position: state.options.strategy, adaptive })));\n }\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), { offsets: state.modifiersData.arrow, position: 'absolute', adaptive: false })));\n }\n state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), { 'data-popper-placement': state.placement });\n}\nvar computeStyles$1 = {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};\n\n// This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n/**\n *\n */\nfunction applyStyles({ state }) {\n Object.keys(state.elements).forEach(name => {\n const style = state.styles[name] || {};\n const attributes = state.attributes[name] || {};\n const element = state.elements[name];\n // arrow is optional + virtual elements\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(name => {\n const value = attributes[name];\n if (value === false) {\n element.removeAttribute(name);\n }\n else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n/**\n *\n */\nfunction effect$1({ state }) {\n const initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n return () => {\n Object.keys(state.elements).forEach(name => {\n const element = state.elements[name];\n const attributes = state.attributes[name] || {};\n const styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);\n // Set all values to an empty string to unset them\n const style = styleProperties.reduce((style, property) => {\n style[property] = '';\n return style;\n }, {});\n // arrow is optional + virtual elements\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(attribute => {\n element.removeAttribute(attribute);\n });\n });\n };\n}\nvar applyStyles$1 = {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect$1,\n requires: ['computeStyles']\n};\n\n/**\n * @param placement\n * @param rects\n * @param offset\n */\nfunction distanceAndSkiddingToXY(placement, rects, offset) {\n const basePlacement = getBasePlacement(placement);\n const invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n let [skidding, distance] = typeof offset === 'function'\n ? offset(Object.assign(Object.assign({}, rects), { placement }))\n : offset;\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? { x: distance, y: skidding } : { x: skidding, y: distance };\n}\n/**\n *\n */\nfunction offset({ state, options, name }) {\n const { offset = [0, 0] } = options;\n const data = placements.reduce((acc, placement) => {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n const { x, y } = data[state.placement];\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n state.modifiersData[name] = data;\n}\nvar offset$1 = {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};\n\nconst hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };\n/**\n * @param placement\n */\nfunction getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, matched => hash[matched]);\n}\n\nconst hash$1 = { start: 'end', end: 'start' };\n/**\n * @param placement\n */\nfunction getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, matched => hash$1[matched]);\n}\n\n/* :: type OverflowsMap = { [ComputedPlacement]: number }; */\n/* ;; type OverflowsMap = { [key in ComputedPlacement]: number }; */\n/**\n * @param state\n * @param options\n */\nfunction computeAutoPlacement(state, options = {}) {\n const { placement, boundary, rootBoundary, padding, flipVariations, allowedAutoPlacements = placements } = options;\n const variation = getVariation(placement);\n const placements$1 = variation\n ? flipVariations\n ? variationPlacements\n : variationPlacements.filter(placement => getVariation(placement) === variation)\n : basePlacements;\n // $FlowFixMe\n let allowedPlacements = placements$1.filter(placement => allowedAutoPlacements.indexOf(placement) >= 0);\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements$1;\n }\n // $FlowFixMe: Flow seems to have problems with two array unions...\n const overflows = allowedPlacements.reduce((acc, placement) => {\n acc[placement] = detectOverflow(state, {\n placement,\n boundary,\n rootBoundary,\n padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort((a, b) => overflows[a] - overflows[b]);\n}\n\n/**\n * @param placement\n */\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n const oppositePlacement = getOppositePlacement(placement);\n return [\n getOppositeVariationPlacement(placement),\n oppositePlacement,\n getOppositeVariationPlacement(oppositePlacement)\n ];\n}\n/**\n *\n */\nfunction flip({ state, options, name }) {\n if (state.modifiersData[name]._skip) {\n return;\n }\n const { mainAxis: checkMainAxis = true, altAxis: checkAltAxis = true, fallbackPlacements: specifiedFallbackPlacements, padding, boundary, rootBoundary, altBoundary, flipVariations = true, allowedAutoPlacements } = options;\n const preferredPlacement = state.options.placement;\n const basePlacement = getBasePlacement(preferredPlacement);\n const isBasePlacement = basePlacement === preferredPlacement;\n const fallbackPlacements = specifiedFallbackPlacements ||\n (isBasePlacement || !flipVariations\n ? [getOppositePlacement(preferredPlacement)]\n : getExpandedFallbackPlacements(preferredPlacement));\n const placements = [preferredPlacement, ...fallbackPlacements].reduce((acc, placement) => acc.concat(getBasePlacement(placement) === auto\n ? computeAutoPlacement(state, {\n placement,\n boundary,\n rootBoundary,\n padding,\n flipVariations,\n allowedAutoPlacements\n })\n : placement), []);\n const referenceRect = state.rects.reference;\n const popperRect = state.rects.popper;\n const checksMap = new Map();\n let makeFallbackChecks = true;\n let firstFittingPlacement = placements[0];\n for (let i = 0; i < placements.length; i++) {\n const placement = placements[i];\n const basePlacement = getBasePlacement(placement);\n const isStartVariation = getVariation(placement) === start;\n const isVertical = [top, bottom].indexOf(basePlacement) >= 0;\n const len = isVertical ? 'width' : 'height';\n const overflow = detectOverflow(state, {\n placement,\n boundary,\n rootBoundary,\n altBoundary,\n padding\n });\n let mainVariationSide = isVertical ? (isStartVariation ? right : left) : isStartVariation ? bottom : top;\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n const altVariationSide = getOppositePlacement(mainVariationSide);\n const checks = [];\n if (checkMainAxis) {\n checks.push(overflow[basePlacement] <= 0);\n }\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n if (checks.every(check => check)) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n checksMap.set(placement, checks);\n }\n if (makeFallbackChecks) {\n // `2` may be desired in some cases – research later\n const numberOfChecks = flipVariations ? 3 : 1;\n for (let i = numberOfChecks; i > 0; i--) {\n const fittingPlacement = placements.find(placement => {\n const checks = checksMap.get(placement);\n if (checks) {\n return checks.slice(0, i).every(check => check);\n }\n });\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n break;\n }\n }\n }\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n}\nvar flip$1 = {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: { _skip: false }\n};\n\n// @ts-nocheck\n/**\n * @param axis\n */\nfunction getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\n\n// @ts-nocheck\n/**\n * @param min\n * @param value\n * @param max\n */\nfunction within(min, value, max) {\n return Math.max(min, Math.min(value, max));\n}\n\n// @ts-nocheck\n/**\n *\n */\nfunction preventOverflow({ state, options, name }) {\n const { mainAxis: checkMainAxis = true, altAxis: checkAltAxis = false, boundary, rootBoundary, altBoundary, padding, tether = true, tetherOffset = 0 } = options;\n const overflow = detectOverflow(state, {\n boundary,\n rootBoundary,\n padding,\n altBoundary\n });\n const basePlacement = getBasePlacement(state.placement);\n const variation = getVariation(state.placement);\n const isBasePlacement = !variation;\n const mainAxis = getMainAxisFromPlacement(basePlacement);\n const altAxis = getAltAxis(mainAxis);\n const popperOffsets = state.modifiersData.popperOffsets;\n const referenceRect = state.rects.reference;\n const popperRect = state.rects.popper;\n const tetherOffsetValue = typeof tetherOffset === 'function'\n ? tetherOffset(Object.assign(Object.assign({}, state.rects), { placement: state.placement }))\n : tetherOffset;\n const data = { x: 0, y: 0 };\n if (!popperOffsets) {\n return;\n }\n if (checkMainAxis) {\n const mainSide = mainAxis === 'y' ? top : left;\n const altSide = mainAxis === 'y' ? bottom : right;\n const len = mainAxis === 'y' ? 'height' : 'width';\n const offset = popperOffsets[mainAxis];\n const min = popperOffsets[mainAxis] + overflow[mainSide];\n const max = popperOffsets[mainAxis] - overflow[altSide];\n const additive = tether ? -popperRect[len] / 2 : 0;\n const minLen = variation === start ? referenceRect[len] : popperRect[len];\n const maxLen = variation === start ? -popperRect[len] : -referenceRect[len];\n // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n const arrowElement = state.elements.arrow;\n const arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : { width: 0, height: 0 };\n const arrowPaddingObject = state.modifiersData['arrow#persistent']\n ? state.modifiersData['arrow#persistent'].padding\n : getFreshSideObject();\n const arrowPaddingMin = arrowPaddingObject[mainSide];\n const arrowPaddingMax = arrowPaddingObject[altSide];\n // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n const arrowLen = within(0, referenceRect[len], arrowRect[len]);\n const minOffset = isBasePlacement\n ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue\n : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;\n const maxOffset = isBasePlacement\n ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue\n : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;\n const arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n const clientOffset = arrowOffsetParent\n ? mainAxis === 'y'\n ? arrowOffsetParent.clientTop || 0\n : arrowOffsetParent.clientLeft || 0\n : 0;\n const offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;\n const tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;\n const tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;\n const preventedOffset = within(tether ? Math.min(min, tetherMin) : min, offset, tether ? Math.max(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n if (checkAltAxis) {\n const mainSide = mainAxis === 'x' ? top : left;\n const altSide = mainAxis === 'x' ? bottom : right;\n const offset = popperOffsets[altAxis];\n const min = offset + overflow[mainSide];\n const max = offset - overflow[altSide];\n const preventedOffset = within(min, offset, max);\n popperOffsets[altAxis] = preventedOffset;\n data[altAxis] = preventedOffset - offset;\n }\n state.modifiersData[name] = data;\n}\nvar preventOverflow$1 = {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};\n\n/**\n *\n */\nfunction arrow({ state, name }) {\n const arrowElement = state.elements.arrow;\n const popperOffsets = state.modifiersData.popperOffsets;\n const basePlacement = getBasePlacement(state.placement);\n const axis = getMainAxisFromPlacement(basePlacement);\n const isVertical = [left, right].indexOf(basePlacement) >= 0;\n const len = isVertical ? 'height' : 'width';\n if (!arrowElement || !popperOffsets) {\n return;\n }\n const paddingObject = state.modifiersData[`${name}#persistent`].padding;\n const arrowRect = getLayoutRect(arrowElement);\n const minProp = axis === 'y' ? top : left;\n const maxProp = axis === 'y' ? bottom : right;\n const endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n const startDiff = popperOffsets[axis] - state.rects.reference[axis];\n const arrowOffsetParent = getOffsetParent(arrowElement);\n const clientSize = arrowOffsetParent\n ? axis === 'y'\n ? arrowOffsetParent.clientHeight || 0\n : arrowOffsetParent.clientWidth || 0\n : 0;\n const centerToReference = endDiff / 2 - startDiff / 2;\n // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n const min = paddingObject[minProp];\n const max = clientSize - arrowRect[len] - paddingObject[maxProp];\n const center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n const offset = within(min, center, max);\n // Prevents breaking syntax highlighting...\n const axisProp = axis;\n state.modifiersData[name] = {\n [axisProp]: offset,\n centerOffset: offset - center\n };\n}\n/**\n *\n */\nfunction effect$2({ state, options, name }) {\n let { element: arrowElement = '[data-popper-arrow]', padding = 0 } = options;\n if (arrowElement == null) {\n return;\n }\n // CSS selector\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n if (!arrowElement) {\n return;\n }\n }\n if (!contains(state.elements.popper, arrowElement)) {\n return;\n }\n state.elements.arrow = arrowElement;\n state.modifiersData[`${name}#persistent`] = {\n padding: mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements))\n };\n}\nvar arrow$1 = {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect$2,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};\n\n/**\n * @param overflow\n * @param rect\n * @param preventedOffsets\n */\nfunction getSideOffsets(overflow, rect, preventedOffsets = { x: 0, y: 0 }) {\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n/**\n * @param overflow\n */\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(side => overflow[side] >= 0);\n}\n/**\n *\n */\nfunction hide({ state, name }) {\n const referenceRect = state.rects.reference;\n const popperRect = state.rects.popper;\n const preventedOffsets = state.modifiersData.preventOverflow;\n const referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n const popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n const referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n const popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n const isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n const hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets,\n popperEscapeOffsets,\n isReferenceHidden,\n hasPopperEscaped\n };\n state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), { 'data-popper-reference-hidden': isReferenceHidden, 'data-popper-escaped': hasPopperEscaped });\n}\nvar hide$1 = {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};\n\n// @ts-nocheck\nconst defaultModifiers = [\n eventListeners,\n popperOffsets$1,\n computeStyles$1,\n applyStyles$1,\n offset$1,\n flip$1,\n preventOverflow$1,\n arrow$1,\n hide$1\n];\nconst createPopper = popperGenerator({ defaultModifiers });\n\n/**\n * Small wrapper around `useLayoutEffect` to get rid of the warning on SSR envs\n */\nconst useIsomorphicLayoutEffect = canUseDOM ? react.useLayoutEffect : react.useEffect;\n\n/* eslint-disable @typescript-eslint/consistent-type-definitions */\nconst isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);\n/**\n * Simple ponyfill for Object.fromEntries\n */\nconst fromEntries = (entries) => entries.reduce((acc, [key, value]) => {\n acc[key] = value;\n return acc;\n}, {});\nconst EMPTY_MODIFIERS = [];\nconst usePopper = (referenceElement, popperElement, options = {}) => {\n const prevOptions = react.useRef(null);\n const optionsWithDefaults = {\n onFirstUpdate: options.onFirstUpdate,\n placement: options.placement || 'bottom',\n strategy: options.strategy || 'absolute',\n modifiers: options.modifiers || EMPTY_MODIFIERS\n };\n const [state, setState] = react.useState({\n styles: {\n popper: {\n position: optionsWithDefaults.strategy,\n left: '0',\n top: '0'\n }\n },\n attributes: {}\n });\n const updateStateModifier = react.useMemo(() => ({\n name: 'updateState',\n enabled: true,\n phase: 'write',\n // eslint-disable-next-line no-shadow\n fn: ({ state }) => {\n const elements = Object.keys(state.elements);\n setState({\n styles: fromEntries(elements.map(element => [element, state.styles[element] || {}])),\n attributes: fromEntries(elements.map(element => [element, state.attributes[element]]))\n });\n },\n requires: ['computeStyles']\n }), []);\n const popperOptions = react.useMemo(() => {\n const newOptions = {\n onFirstUpdate: optionsWithDefaults.onFirstUpdate,\n placement: optionsWithDefaults.placement,\n strategy: optionsWithDefaults.strategy,\n modifiers: [...optionsWithDefaults.modifiers, updateStateModifier, { name: 'applyStyles', enabled: false }]\n };\n if (isEqual(prevOptions.current, newOptions)) {\n return prevOptions.current || newOptions;\n }\n else {\n prevOptions.current = newOptions;\n return newOptions;\n }\n }, [\n optionsWithDefaults.onFirstUpdate,\n optionsWithDefaults.placement,\n optionsWithDefaults.strategy,\n optionsWithDefaults.modifiers,\n updateStateModifier\n ]);\n const popperInstanceRef = react.useRef();\n useIsomorphicLayoutEffect(() => {\n if (popperInstanceRef && popperInstanceRef.current) {\n popperInstanceRef.current.setOptions(popperOptions);\n }\n }, [popperOptions]);\n useIsomorphicLayoutEffect(() => {\n if (referenceElement == null || popperElement == null) {\n return;\n }\n const createPopper$1 = options.createPopper || createPopper;\n const popperInstance = createPopper$1(referenceElement, popperElement, popperOptions);\n popperInstanceRef.current = popperInstance;\n return () => {\n popperInstance.destroy();\n popperInstanceRef.current = null;\n };\n }, [referenceElement, popperElement, options.createPopper]);\n return {\n state: popperInstanceRef.current ? popperInstanceRef.current.state : null,\n styles: state.styles,\n attributes: state.attributes,\n update: popperInstanceRef.current ? popperInstanceRef.current.update : null,\n forceUpdate: popperInstanceRef.current ? popperInstanceRef.current.forceUpdate : null\n };\n};\n\nconst hash$2 = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };\nconst getOppositePlacement$1 = (placement) => placement.replace(/left|right|bottom|top/g, (matched) => hash$2[matched]);\nconst getOpacityTransition = (animationDuration) => `opacity ${animationDuration}ms cubic-bezier(.54, 1.5, .38, 1.11)`;\nconst Popper = ({ trigger, popper, popperMatchesTriggerWidth = true, direction = 'down', position = 'left', placement, appendTo = () => document.body, zIndex = 9999, isVisible = true, positionModifiers, distance = 0, onMouseEnter, onMouseLeave, onFocus, onBlur, onDocumentClick, onTriggerClick, onTriggerEnter, onPopperClick, onDocumentKeyDown, enableFlip = true, flipBehavior = 'flip', reference }) => {\n const [triggerElement, setTriggerElement] = react.useState(null);\n const [refElement, setRefElement] = react.useState(null);\n const [popperElement, setPopperElement] = react.useState(null);\n const [ready, setReady] = react.useState(false);\n const refOrTrigger = refElement || triggerElement;\n const onDocumentClickCallback = react.useCallback(event => onDocumentClick(event, refOrTrigger, popperElement), [\n isVisible,\n triggerElement,\n refElement,\n popperElement,\n onDocumentClick\n ]);\n react.useEffect(() => {\n setReady(true);\n }, []);\n react.useEffect(() => {\n if (reference) {\n if (reference.current) {\n setRefElement(reference.current);\n }\n else if (typeof reference === 'function') {\n setRefElement(reference());\n }\n }\n }, [reference]);\n const addEventListener = (listener, element, event) => {\n if (listener && element) {\n element.addEventListener(event, listener);\n }\n };\n const removeEventListener = (listener, element, event) => {\n if (listener && element) {\n element.removeEventListener(event, listener);\n }\n };\n react.useEffect(() => {\n addEventListener(onMouseEnter, refOrTrigger, 'mouseenter');\n addEventListener(onMouseLeave, refOrTrigger, 'mouseleave');\n addEventListener(onFocus, refOrTrigger, 'focus');\n addEventListener(onBlur, refOrTrigger, 'blur');\n addEventListener(onTriggerClick, refOrTrigger, 'click');\n addEventListener(onTriggerEnter, refOrTrigger, 'keydown');\n addEventListener(onPopperClick, popperElement, 'click');\n onDocumentClick && addEventListener(onDocumentClickCallback, document, 'click');\n addEventListener(onDocumentKeyDown, document, 'keydown');\n return () => {\n removeEventListener(onMouseEnter, refOrTrigger, 'mouseenter');\n removeEventListener(onMouseLeave, refOrTrigger, 'mouseleave');\n removeEventListener(onFocus, refOrTrigger, 'focus');\n removeEventListener(onBlur, refOrTrigger, 'blur');\n removeEventListener(onTriggerClick, refOrTrigger, 'click');\n removeEventListener(onTriggerEnter, refOrTrigger, 'keydown');\n removeEventListener(onPopperClick, popperElement, 'click');\n onDocumentClick && removeEventListener(onDocumentClickCallback, document, 'click');\n removeEventListener(onDocumentKeyDown, document, 'keydown');\n };\n }, [\n triggerElement,\n popperElement,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n onTriggerClick,\n onTriggerEnter,\n onPopperClick,\n onDocumentClick,\n onDocumentKeyDown,\n refElement\n ]);\n const getPlacement = () => {\n if (placement) {\n return placement;\n }\n let convertedPlacement = direction === 'up' ? 'top' : 'bottom';\n if (position !== 'center') {\n convertedPlacement = `${convertedPlacement}-${position === 'right' ? 'end' : 'start'}`;\n }\n return convertedPlacement;\n };\n const getPlacementMemo = react.useMemo(getPlacement, [direction, position, placement]);\n const getOppositePlacementMemo = react.useMemo(() => getOppositePlacement$1(getPlacement()), [\n direction,\n position,\n placement\n ]);\n const sameWidthMod = react.useMemo(() => ({\n name: 'sameWidth',\n enabled: popperMatchesTriggerWidth,\n phase: 'beforeWrite',\n requires: ['computeStyles'],\n fn: ({ state }) => {\n state.styles.popper.width = `${state.rects.reference.width}px`;\n },\n effect: ({ state }) => {\n state.elements.popper.style.width = `${state.elements.reference.offsetWidth}px`;\n return () => { };\n }\n }), [popperMatchesTriggerWidth]);\n const { styles: popperStyles, attributes, forceUpdate } = usePopper(refOrTrigger, popperElement, {\n placement: getPlacementMemo,\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, distance]\n }\n },\n {\n name: 'preventOverflow',\n enabled: false\n },\n {\n // adds attribute [data-popper-reference-hidden] to the popper element which can be used to hide it using CSS\n name: 'hide',\n enabled: true\n },\n {\n name: 'flip',\n enabled: getPlacementMemo.startsWith('auto') || enableFlip,\n options: {\n fallbackPlacements: flipBehavior === 'flip' ? [getOppositePlacementMemo] : flipBehavior\n }\n },\n sameWidthMod\n ]\n });\n // force update when content changes\n // https://github.com/patternfly/patternfly-react/issues/5620\n react.useEffect(() => {\n forceUpdate && forceUpdate();\n }, [popper]);\n // Returns the CSS modifier class in order to place the Popper's arrow properly\n // Depends on the position of the Popper relative to the reference element\n const modifierFromPopperPosition = () => {\n if (attributes && attributes.popper && attributes.popper['data-popper-placement']) {\n const popperPlacement = attributes.popper['data-popper-placement'];\n return positionModifiers[popperPlacement];\n }\n return positionModifiers.top;\n };\n const menuWithPopper = react.cloneElement(popper, Object.assign({ className: css(popper.props && popper.props.className, positionModifiers && modifierFromPopperPosition()), style: Object.assign(Object.assign(Object.assign({}, ((popper.props && popper.props.style) || {})), popperStyles.popper), { zIndex }) }, attributes.popper));\n const getTarget = () => {\n if (typeof appendTo === 'function') {\n return appendTo();\n }\n return appendTo;\n };\n return (react.createElement(react.Fragment, null,\n !reference && trigger && (react.createElement(FindRefWrapper, { onFoundRef: (foundRef) => setTriggerElement(foundRef) }, trigger)),\n ready &&\n isVisible &&\n reactDom.createPortal(react.createElement(FindRefWrapper, { onFoundRef: (foundRef) => setPopperElement(foundRef) }, menuWithPopper), getTarget())));\n};\nPopper.displayName = 'Popper';\n\nvar title = createCommonjsModule(function (module, exports) {\nexports.__esModule = true;\n\nexports.default = {\n \"modifiers\": {\n \"4xl\": \"pf-m-4xl\",\n \"3xl\": \"pf-m-3xl\",\n \"2xl\": \"pf-m-2xl\",\n \"xl\": \"pf-m-xl\",\n \"lg\": \"pf-m-lg\",\n \"md\": \"pf-m-md\",\n \"overpassFont\": \"pf-m-overpass-font\"\n },\n \"title\": \"pf-c-title\"\n};\n});\n\nvar styles = /*@__PURE__*/getDefaultExportFromCjs(title);\n\nvar TitleSizes;\n(function (TitleSizes) {\n TitleSizes[\"md\"] = \"md\";\n TitleSizes[\"lg\"] = \"lg\";\n TitleSizes[\"xl\"] = \"xl\";\n TitleSizes[\"2xl\"] = \"2xl\";\n TitleSizes[\"3xl\"] = \"3xl\";\n TitleSizes[\"4xl\"] = \"4xl\";\n})(TitleSizes || (TitleSizes = {}));\nvar headingLevelSizeMap;\n(function (headingLevelSizeMap) {\n headingLevelSizeMap[\"h1\"] = \"2xl\";\n headingLevelSizeMap[\"h2\"] = \"xl\";\n headingLevelSizeMap[\"h3\"] = \"lg\";\n headingLevelSizeMap[\"h4\"] = \"md\";\n headingLevelSizeMap[\"h5\"] = \"md\";\n headingLevelSizeMap[\"h6\"] = \"md\";\n})(headingLevelSizeMap || (headingLevelSizeMap = {}));\nconst Title = (_a) => {\n var { className = '', children = '', headingLevel: HeadingLevel, size = headingLevelSizeMap[HeadingLevel], ouiaId, ouiaSafe = true } = _a, props = __rest(_a, [\"className\", \"children\", \"headingLevel\", \"size\", \"ouiaId\", \"ouiaSafe\"]);\n const ouiaProps = useOUIAProps(Title.displayName, ouiaId, ouiaSafe);\n return (react.createElement(HeadingLevel, Object.assign({}, ouiaProps, props, { className: css(styles.title, size && styles.modifiers[size], className) }), children));\n};\nTitle.displayName = 'Title';\n\nvar button = createCommonjsModule(function (module, exports) {\nexports.__esModule = true;\n\nexports.default = {\n \"button\": \"pf-c-button\",\n \"buttonIcon\": \"pf-c-button__icon\",\n \"buttonProgress\": \"pf-c-button__progress\",\n \"modifiers\": {\n \"active\": \"pf-m-active\",\n \"block\": \"pf-m-block\",\n \"small\": \"pf-m-small\",\n \"primary\": \"pf-m-primary\",\n \"displayLg\": \"pf-m-display-lg\",\n \"secondary\": \"pf-m-secondary\",\n \"tertiary\": \"pf-m-tertiary\",\n \"link\": \"pf-m-link\",\n \"inline\": \"pf-m-inline\",\n \"danger\": \"pf-m-danger\",\n \"warning\": \"pf-m-warning\",\n \"control\": \"pf-m-control\",\n \"expanded\": \"pf-m-expanded\",\n \"plain\": \"pf-m-plain\",\n \"disabled\": \"pf-m-disabled\",\n \"ariaDisabled\": \"pf-m-aria-disabled\",\n \"progress\": \"pf-m-progress\",\n \"inProgress\": \"pf-m-in-progress\",\n \"start\": \"pf-m-start\",\n \"end\": \"pf-m-end\",\n \"overpassFont\": \"pf-m-overpass-font\"\n },\n \"spinner\": \"pf-c-spinner\"\n};\n});\n\nvar buttonStyles = /*@__PURE__*/getDefaultExportFromCjs(button);\n\nvar spinner = createCommonjsModule(function (module, exports) {\nexports.__esModule = true;\n\nexports.default = {\n \"modifiers\": {\n \"sm\": \"pf-m-sm\",\n \"md\": \"pf-m-md\",\n \"lg\": \"pf-m-lg\",\n \"xl\": \"pf-m-xl\"\n },\n \"spinner\": \"pf-c-spinner\",\n \"spinnerClipper\": \"pf-c-spinner__clipper\",\n \"spinnerLeadBall\": \"pf-c-spinner__lead-ball\",\n \"spinnerPath\": \"pf-c-spinner__path\",\n \"spinnerTailBall\": \"pf-c-spinner__tail-ball\"\n};\n});\n\nvar styles$1 = /*@__PURE__*/getDefaultExportFromCjs(spinner);\n\nvar spinnerSize;\n(function (spinnerSize) {\n spinnerSize[\"sm\"] = \"sm\";\n spinnerSize[\"md\"] = \"md\";\n spinnerSize[\"lg\"] = \"lg\";\n spinnerSize[\"xl\"] = \"xl\";\n})(spinnerSize || (spinnerSize = {}));\nconst Spinner = (_a) => {\n var { \n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n className = '', size = 'xl', 'aria-valuetext': ariaValueText = 'Loading...', isSVG = false, diameter } = _a, props = __rest(_a, [\"className\", \"size\", 'aria-valuetext', \"isSVG\", \"diameter\"]);\n const Component = isSVG ? 'svg' : 'span';\n return (react.createElement(Component, Object.assign({ className: css(styles$1.spinner, styles$1.modifiers[size], className), role: \"progressbar\", \"aria-valuetext\": ariaValueText }, (isSVG && { viewBox: '0 0 100 100' }), (diameter && { style: { '--pf-c-spinner--diameter': diameter } }), props), isSVG ? (react.createElement(\"circle\", { className: styles$1.spinnerPath, cx: \"50\", cy: \"50\", r: \"45\", fill: \"none\" })) : (react.createElement(react.Fragment, null,\n react.createElement(\"span\", { className: css(styles$1.spinnerClipper) }),\n react.createElement(\"span\", { className: css(styles$1.spinnerLeadBall) }),\n react.createElement(\"span\", { className: css(styles$1.spinnerTailBall) })))));\n};\nSpinner.displayName = 'Spinner';\n\nvar ButtonVariant;\n(function (ButtonVariant) {\n ButtonVariant[\"primary\"] = \"primary\";\n ButtonVariant[\"secondary\"] = \"secondary\";\n ButtonVariant[\"tertiary\"] = \"tertiary\";\n ButtonVariant[\"danger\"] = \"danger\";\n ButtonVariant[\"warning\"] = \"warning\";\n ButtonVariant[\"link\"] = \"link\";\n ButtonVariant[\"plain\"] = \"plain\";\n ButtonVariant[\"control\"] = \"control\";\n})(ButtonVariant || (ButtonVariant = {}));\nvar ButtonType;\n(function (ButtonType) {\n ButtonType[\"button\"] = \"button\";\n ButtonType[\"submit\"] = \"submit\";\n ButtonType[\"reset\"] = \"reset\";\n})(ButtonType || (ButtonType = {}));\nconst ButtonBase = (_a) => {\n var { children = null, className = '', component = 'button', isActive = false, isBlock = false, isDisabled = false, isAriaDisabled = false, isLoading = null, isDanger = false, spinnerAriaValueText, isSmall = false, isLarge = false, inoperableEvents = ['onClick', 'onKeyPress'], isInline = false, type = ButtonType.button, variant = ButtonVariant.primary, iconPosition = 'left', 'aria-label': ariaLabel = null, icon = null, ouiaId, ouiaSafe = true, tabIndex = null, innerRef } = _a, props = __rest(_a, [\"children\", \"className\", \"component\", \"isActive\", \"isBlock\", \"isDisabled\", \"isAriaDisabled\", \"isLoading\", \"isDanger\", \"spinnerAriaValueText\", \"isSmall\", \"isLarge\", \"inoperableEvents\", \"isInline\", \"type\", \"variant\", \"iconPosition\", 'aria-label', \"icon\", \"ouiaId\", \"ouiaSafe\", \"tabIndex\", \"innerRef\"]);\n const ouiaProps = useOUIAProps(Button.displayName, ouiaId, ouiaSafe, variant);\n const Component = component;\n const isButtonElement = Component === 'button';\n const isInlineSpan = isInline && Component === 'span';\n const preventedEvents = inoperableEvents.reduce((handlers, eventToPrevent) => (Object.assign(Object.assign({}, handlers), { [eventToPrevent]: (event) => {\n event.preventDefault();\n } })), {});\n const getDefaultTabIdx = () => {\n if (isDisabled) {\n return isButtonElement ? null : -1;\n }\n else if (isAriaDisabled) {\n return null;\n }\n else if (isInlineSpan) {\n return 0;\n }\n };\n return (react.createElement(Component, Object.assign({}, props, (isAriaDisabled ? preventedEvents : null), { \"aria-disabled\": isDisabled || isAriaDisabled, \"aria-label\": ariaLabel, className: css(buttonStyles.button, buttonStyles.modifiers[variant], isBlock && buttonStyles.modifiers.block, isDisabled && buttonStyles.modifiers.disabled, isAriaDisabled && buttonStyles.modifiers.ariaDisabled, isActive && buttonStyles.modifiers.active, isInline && variant === ButtonVariant.link && buttonStyles.modifiers.inline, isDanger && (variant === ButtonVariant.secondary || variant === ButtonVariant.link) && buttonStyles.modifiers.danger, isLoading !== null && buttonStyles.modifiers.progress, isLoading && buttonStyles.modifiers.inProgress, isSmall && buttonStyles.modifiers.small, isLarge && buttonStyles.modifiers.displayLg, className), disabled: isButtonElement ? isDisabled : null, tabIndex: tabIndex !== null ? tabIndex : getDefaultTabIdx(), type: isButtonElement || isInlineSpan ? type : null, role: isInlineSpan ? 'button' : null, ref: innerRef }, ouiaProps),\n isLoading && (react.createElement(\"span\", { className: css(buttonStyles.buttonProgress) },\n react.createElement(Spinner, { size: spinnerSize.md, \"aria-valuetext\": spinnerAriaValueText }))),\n variant !== ButtonVariant.plain && icon && iconPosition === 'left' && (react.createElement(\"span\", { className: css(buttonStyles.buttonIcon, buttonStyles.modifiers.start) }, icon)),\n children,\n variant !== ButtonVariant.plain && icon && iconPosition === 'right' && (react.createElement(\"span\", { className: css(buttonStyles.buttonIcon, buttonStyles.modifiers.end) }, icon))));\n};\nconst Button = react.forwardRef((props, ref) => (react.createElement(ButtonBase, Object.assign({ innerRef: ref }, props))));\nButton.displayName = 'Button';\n\nvar tooltip = createCommonjsModule(function (module, exports) {\nexports.__esModule = true;\n\nexports.default = {\n \"modifiers\": {\n \"top\": \"pf-m-top\",\n \"topLeft\": \"pf-m-top-left\",\n \"topRight\": \"pf-m-top-right\",\n \"bottom\": \"pf-m-bottom\",\n \"bottomLeft\": \"pf-m-bottom-left\",\n \"bottomRight\": \"pf-m-bottom-right\",\n \"left\": \"pf-m-left\",\n \"leftTop\": \"pf-m-left-top\",\n \"leftBottom\": \"pf-m-left-bottom\",\n \"right\": \"pf-m-right\",\n \"rightTop\": \"pf-m-right-top\",\n \"rightBottom\": \"pf-m-right-bottom\",\n \"textAlignLeft\": \"pf-m-text-align-left\"\n },\n \"tooltip\": \"pf-c-tooltip\",\n \"tooltipArrow\": \"pf-c-tooltip__arrow\",\n \"tooltipContent\": \"pf-c-tooltip__content\"\n};\n});\n\nvar styles$2 = /*@__PURE__*/getDefaultExportFromCjs(tooltip);\n\nconst TooltipContent = (_a) => {\n var { className, children, isLeftAligned } = _a, props = __rest(_a, [\"className\", \"children\", \"isLeftAligned\"]);\n return (react.createElement(\"div\", Object.assign({ className: css(styles$2.tooltipContent, isLeftAligned && styles$2.modifiers.textAlignLeft, className) }, props), children));\n};\nTooltipContent.displayName = 'TooltipContent';\n\nconst TooltipArrow = (_a) => {\n var { className } = _a, props = __rest(_a, [\"className\"]);\n return react.createElement(\"div\", Object.assign({ className: css(styles$2.tooltipArrow, className) }, props));\n};\nTooltipArrow.displayName = 'TooltipArrow';\n\nconst c_tooltip_MaxWidth = {\n \"name\": \"--pf-c-tooltip--MaxWidth\",\n \"value\": \"18.75rem\",\n \"var\": \"var(--pf-c-tooltip--MaxWidth)\"\n};\n\nvar TooltipPosition;\n(function (TooltipPosition) {\n TooltipPosition[\"auto\"] = \"auto\";\n TooltipPosition[\"top\"] = \"top\";\n TooltipPosition[\"bottom\"] = \"bottom\";\n TooltipPosition[\"left\"] = \"left\";\n TooltipPosition[\"right\"] = \"right\";\n})(TooltipPosition || (TooltipPosition = {}));\n// id for associating trigger with the content aria-describedby or aria-labelledby\nlet pfTooltipIdCounter = 1;\nconst Tooltip = (_a) => {\n var { content: bodyContent, position = 'top', trigger = 'mouseenter focus', isVisible = false, isContentLeftAligned = false, enableFlip = true, className = '', entryDelay = 300, exitDelay = 0, appendTo = () => document.body, zIndex = 9999, maxWidth = c_tooltip_MaxWidth.value, distance = 15, aria = 'describedby', \n // For every initial starting position, there are 3 escape positions\n flipBehavior = ['top', 'right', 'bottom', 'left', 'top', 'right', 'bottom'], id = `pf-tooltip-${pfTooltipIdCounter++}`, children, animationDuration = 300, reference, boundary, isAppLauncher, tippyProps } = _a, rest = __rest(_a, [\"content\", \"position\", \"trigger\", \"isVisible\", \"isContentLeftAligned\", \"enableFlip\", \"className\", \"entryDelay\", \"exitDelay\", \"appendTo\", \"zIndex\", \"maxWidth\", \"distance\", \"aria\", \"flipBehavior\", \"id\", \"children\", \"animationDuration\", \"reference\", \"boundary\", \"isAppLauncher\", \"tippyProps\"]);\n const triggerOnMouseenter = trigger.includes('mouseenter');\n const triggerOnFocus = trigger.includes('focus');\n const triggerOnClick = trigger.includes('click');\n const triggerManually = trigger === 'manual';\n const [visible, setVisible] = react.useState(false);\n const [opacity, setOpacity] = react.useState(0);\n const transitionTimerRef = react.useRef(null);\n const showTimerRef = react.useRef(null);\n const hideTimerRef = react.useRef(null);\n const clearTimeouts = (timeoutRefs) => {\n timeoutRefs.forEach(ref => {\n if (ref.current) {\n clearTimeout(ref.current);\n }\n });\n };\n // Cancel all timers on unmount\n react.useEffect(() => () => {\n clearTimeouts([transitionTimerRef, hideTimerRef, showTimerRef]);\n }, []);\n const onDocumentKeyDown = (event) => {\n if (!triggerManually) {\n if (event.keyCode === KEY_CODES.ESCAPE_KEY && visible) {\n hide();\n }\n }\n };\n const onTriggerEnter = (event) => {\n if (event.keyCode === KEY_CODES.ENTER) {\n if (!visible) {\n show();\n }\n else {\n hide();\n }\n }\n };\n react.useEffect(() => {\n if (isVisible) {\n show();\n }\n else {\n hide();\n }\n }, [isVisible]);\n const show = () => {\n clearTimeouts([transitionTimerRef, hideTimerRef]);\n showTimerRef.current = setTimeout(() => {\n setVisible(true);\n setOpacity(1);\n }, entryDelay);\n };\n const hide = () => {\n clearTimeouts([showTimerRef]);\n hideTimerRef.current = setTimeout(() => {\n setOpacity(0);\n transitionTimerRef.current = setTimeout(() => setVisible(false), animationDuration);\n }, exitDelay);\n };\n const positionModifiers = {\n top: styles$2.modifiers.top,\n bottom: styles$2.modifiers.bottom,\n left: styles$2.modifiers.left,\n right: styles$2.modifiers.right\n };\n const hasCustomMaxWidth = maxWidth !== c_tooltip_MaxWidth.value;\n const content = (react.createElement(\"div\", Object.assign({ className: css(styles$2.tooltip, className), role: \"tooltip\", id: id, style: {\n maxWidth: hasCustomMaxWidth ? maxWidth : null,\n opacity,\n transition: getOpacityTransition(animationDuration)\n } }, rest),\n react.createElement(TooltipArrow, null),\n react.createElement(TooltipContent, { isLeftAligned: isContentLeftAligned }, bodyContent)));\n const onDocumentClick = (event, triggerElement) => {\n // event.currentTarget = document\n // event.target could be triggerElement or something else\n {\n // hide on inside the toggle as well as on outside clicks\n if (visible) {\n hide();\n }\n else if (event.target === triggerElement) {\n show();\n }\n }\n };\n const addAriaToTrigger = () => {\n if (aria === 'describedby' && children && children.props && !children.props['aria-describedby']) {\n return react.cloneElement(children, { 'aria-describedby': id });\n }\n else if (aria === 'labelledby' && children.props && !children.props['aria-labelledby']) {\n return react.cloneElement(children, { 'aria-labelledby': id });\n }\n return children;\n };\n return (react.createElement(Popper, { trigger: aria !== 'none' && visible ? addAriaToTrigger() : children, reference: reference, popper: content, popperMatchesTriggerWidth: false, appendTo: appendTo, isVisible: visible, positionModifiers: positionModifiers, distance: distance, placement: position, onMouseEnter: triggerOnMouseenter && show, onMouseLeave: triggerOnMouseenter && hide, onFocus: triggerOnFocus && show, onBlur: triggerOnFocus && hide, onDocumentClick: triggerOnClick && onDocumentClick, onDocumentKeyDown: triggerManually ? null : onDocumentKeyDown, onTriggerEnter: triggerManually ? null : onTriggerEnter, enableFlip: enableFlip, zIndex: zIndex, flipBehavior: flipBehavior }));\n};\nTooltip.displayName = 'Tooltip';\n\nvar emptyState = createCommonjsModule(function (module, exports) {\nexports.__esModule = true;\n\nexports.default = {\n \"button\": \"pf-c-button\",\n \"emptyState\": \"pf-c-empty-state\",\n \"emptyStateBody\": \"pf-c-empty-state__body\",\n \"emptyStateContent\": \"pf-c-empty-state__content\",\n \"emptyStateIcon\": \"pf-c-empty-state__icon\",\n \"emptyStatePrimary\": \"pf-c-empty-state__primary\",\n \"emptyStateSecondary\": \"pf-c-empty-state__secondary\",\n \"modifiers\": {\n \"xs\": \"pf-m-xs\",\n \"sm\": \"pf-m-sm\",\n \"lg\": \"pf-m-lg\",\n \"xl\": \"pf-m-xl\",\n \"fullHeight\": \"pf-m-full-height\",\n \"primary\": \"pf-m-primary\",\n \"overpassFont\": \"pf-m-overpass-font\"\n },\n \"title\": \"pf-c-title\"\n};\n});\n\nvar styles$3 = /*@__PURE__*/getDefaultExportFromCjs(emptyState);\n\nvar EmptyStateVariant;\n(function (EmptyStateVariant) {\n EmptyStateVariant[\"xs\"] = \"xs\";\n EmptyStateVariant[\"small\"] = \"small\";\n EmptyStateVariant[\"large\"] = \"large\";\n EmptyStateVariant[\"xl\"] = \"xl\";\n EmptyStateVariant[\"full\"] = \"full\";\n})(EmptyStateVariant || (EmptyStateVariant = {}));\nconst EmptyState = (_a) => {\n var { children, className = '', variant = EmptyStateVariant.full, isFullHeight } = _a, props = __rest(_a, [\"children\", \"className\", \"variant\", \"isFullHeight\"]);\n return (react.createElement(\"div\", Object.assign({ className: css(styles$3.emptyState, variant === 'xs' && styles$3.modifiers.xs, variant === 'small' && styles$3.modifiers.sm, variant === 'large' && styles$3.modifiers.lg, variant === 'xl' && styles$3.modifiers.xl, isFullHeight && styles$3.modifiers.fullHeight, className) }, props),\n react.createElement(\"div\", { className: css(styles$3.emptyStateContent) }, children)));\n};\nEmptyState.displayName = 'EmptyState';\n\nexport { useOUIAId as A, Button as B, KEYHANDLER_DIRECTION as C, preventedEvents as D, EmptyState as E, FindRefWrapper as F, getOpacityTransition as G, KEY_CODES as K, Popper as P, Spinner as S, Title as T, ValidatedOptions as V, EmptyStateVariant as a, Tooltip as b, css as c, canUseDOM as d, ButtonVariant as e, capitalize as f, getDefaultOUIAId as g, getOUIAProps as h, getUniqueId as i, buttonStyles as j, fillTemplate as k, keyHandler as l, getNextIndex as m, TooltipPosition as n, formatBreakpointMods as o, spinnerSize as p, useIsomorphicLayoutEffect as q, debounce as r, styles$3 as s, trimLeft as t, useOUIAProps as u, isElementInView as v, pluralize as w, toCamel as x, setBreakpointCssVars as y, TitleSizes as z };\n", "import { c as createIcon } from './createIcon-1a4b25a9.js';\n\nconst TimesIconConfig = {\n name: 'TimesIcon',\n height: 512,\n width: 352,\n svgPath: 'M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z',\n yOffset: 0,\n xOffset: 0,\n};\n\nconst TimesIcon = createIcon(TimesIconConfig);\n\nconst CheckIconConfig = {\n name: 'CheckIcon',\n height: 512,\n width: 512,\n svgPath: 'M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z',\n yOffset: 0,\n xOffset: 0,\n};\n\nconst CheckIcon = createIcon(CheckIconConfig);\n\nexport { CheckIcon as C, TimesIcon as T };\n", "import { g as getDefaultExportFromCjs, c as createCommonjsModule } from './_commonjsHelpers-4f955397.js';\nimport { _ as __rest, c as createIcon } from './createIcon-1a4b25a9.js';\nimport { r as react } from './index-7cda8b13.js';\nimport { l as keyHandler, c as css, o as formatBreakpointMods, h as getOUIAProps, P as Popper, A as useOUIAId, C as KEYHANDLER_DIRECTION, D as preventedEvents, b as Tooltip, u as useOUIAProps, K as KEY_CODES, g as getDefaultOUIAId, T as Title, z as TitleSizes, F as FindRefWrapper, B as Button, i as getUniqueId, G as getOpacityTransition } from './EmptyState-cea4cc03.js';\nimport { r as reactDom } from './index-916de6ed.js';\nimport { T as TimesIcon } from './check-icon-e536b517.js';\n\n/*!\n* tabbable 5.2.1\n* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE\n*/\nvar candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable=\"false\"])', 'details>summary:first-of-type', 'details'];\nvar candidateSelector = /* #__PURE__ */candidateSelectors.join(',');\nvar matches = typeof Element === 'undefined' ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;\n\nvar getCandidates = function getCandidates(el, includeContainer, filter) {\n var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));\n\n if (includeContainer && matches.call(el, candidateSelector)) {\n candidates.unshift(el);\n }\n\n candidates = candidates.filter(filter);\n return candidates;\n};\n\nvar isContentEditable = function isContentEditable(node) {\n return node.contentEditable === 'true';\n};\n\nvar getTabindex = function getTabindex(node) {\n var tabindexAttr = parseInt(node.getAttribute('tabindex'), 10);\n\n if (!isNaN(tabindexAttr)) {\n return tabindexAttr;\n } // Browsers do not return `tabIndex` correctly for contentEditable nodes;\n // so if they don't have a tabindex attribute specifically set, assume it's 0.\n\n\n if (isContentEditable(node)) {\n return 0;\n } // in Chrome,
,