{"version":3,"file":"react-sdk.es.min.mjs","sources":["../.build/logger/ReactLogger.js","../.build/logger/createLogger.js","../.build/client/createInstance.js","../.build/provider/ProviderStateStore.js","../.build/utils/helpers.js","../.build/utils/UserContextManager.js","../.build/provider/OptimizelyProvider.js","../.build/hooks/useOptimizelyContext.js","../.build/hooks/useOptimizelyClient.js","../.build/hooks/useOptimizelyUserContext.js","../.build/hooks/useProviderState.js","../.build/hooks/useStableArray.js","../.build/hooks/useDecide.js","../.build/hooks/useDecideForKeys.js","../.build/hooks/useDecideAll.js","../.build/hooks/useAsyncDecision.js","../.build/hooks/useDecideAsync.js","../.build/hooks/useDecideForKeysAsync.js","../.build/hooks/useDecideAllAsync.js"],"sourcesContent":["/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { LogLevel } from '@optimizely/optimizely-sdk';\nconst LOG_PREFIX = '[OPTIMIZELY - REACT]';\nconst defaultLogHandler = {\n    log(level, message) {\n        switch (level) {\n            case LogLevel.Debug:\n                console.debug(message);\n                break;\n            case LogLevel.Info:\n                console.info(message);\n                break;\n            case LogLevel.Warn:\n                console.warn(message);\n                break;\n            case LogLevel.Error:\n                console.error(message);\n                break;\n        }\n    },\n};\nexport function createReactLogger(config) {\n    var _a;\n    const handler = (_a = config.logHandler) !== null && _a !== void 0 ? _a : defaultLogHandler;\n    const level = config.logLevel;\n    return {\n        debug: (msg) => {\n            if (level <= LogLevel.Debug)\n                handler.log(LogLevel.Debug, `${LOG_PREFIX} - DEBUG ${msg}`);\n        },\n        info: (msg) => {\n            if (level <= LogLevel.Info)\n                handler.log(LogLevel.Info, `${LOG_PREFIX} - INFO ${msg}`);\n        },\n        warn: (msg) => {\n            if (level <= LogLevel.Warn)\n                handler.log(LogLevel.Warn, `${LOG_PREFIX} - WARN ${msg}`);\n        },\n        error: (msg) => {\n            if (level <= LogLevel.Error)\n                handler.log(LogLevel.Error, `${LOG_PREFIX} - ERROR ${msg}`);\n        },\n    };\n}\n//# sourceMappingURL=ReactLogger.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { createLogger as jsCreateLogger, LogLevel, DEBUG, INFO, WARN, ERROR } from '@optimizely/optimizely-sdk';\nimport { createReactLogger } from './ReactLogger';\nexport const REACT_LOGGER = Symbol('react-logger');\nfunction resolveLogLevel(preset) {\n    if (preset === DEBUG)\n        return LogLevel.Debug;\n    if (preset === INFO)\n        return LogLevel.Info;\n    if (preset === WARN)\n        return LogLevel.Warn;\n    if (preset === ERROR)\n        return LogLevel.Error;\n    return LogLevel.Error;\n}\nexport function createLogger(config) {\n    const opaqueLogger = jsCreateLogger(config);\n    const reactLogger = createReactLogger({\n        logLevel: resolveLogLevel(config.level),\n        logHandler: config.logHandler,\n    });\n    opaqueLogger[REACT_LOGGER] = reactLogger;\n    return opaqueLogger;\n}\n//# sourceMappingURL=createLogger.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { createInstance as jsCreateInstance } from '@optimizely/optimizely-sdk';\nimport { REACT_LOGGER } from '../logger/createLogger';\nexport const CLIENT_ENGINE = 'react-sdk';\nexport const CLIENT_VERSION = '4.0.0';\nexport const REACT_CLIENT_META = Symbol('react-client-meta');\n/**\n * Creates an Optimizely client instance for use with React SDK.\n *\n * Uses prototype delegation so the returned object inherits all methods\n * from the JS SDK client while carrying React-specific metadata.\n *\n * @param config - Configuration object for the Optimizely client\n * @returns An OptimizelyClient instance with React SDK metadata\n */\nexport function createInstance(config) {\n    let reactLogger;\n    if (config.logger) {\n        reactLogger = config.logger[REACT_LOGGER];\n        delete config.logger[REACT_LOGGER];\n    }\n    const jsClient = jsCreateInstance(Object.assign(Object.assign({}, config), { clientEngine: CLIENT_ENGINE, clientVersion: CLIENT_VERSION }));\n    const reactClient = Object.create(jsClient);\n    reactClient[REACT_CLIENT_META] = {\n        hasOdpManager: !!config.odpManager,\n        hasVuidManager: !!config.vuidManager,\n        logger: reactLogger,\n    };\n    return reactClient;\n}\n//# sourceMappingURL=createInstance.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 * Initial state for the provider store.\n */\nconst initialState = {\n    userContext: null,\n    error: null,\n};\n/**\n * Observable store holding shared Provider state.\n *\n * The store follows a simple observable pattern:\n * - Hooks subscribe via `subscribe()` and receive state updates\n * - Provider updates state via setter methods\n * - Listeners are notified on state changes via callbacks\n */\nexport class ProviderStateStore {\n    constructor() {\n        this.notifyScheduled = false;\n        this.state = Object.assign({}, initialState);\n        this.listeners = new Set();\n        this.forcedDecisionListeners = new Map();\n        this.allForcedDecisionListeners = new Set();\n    }\n    /**\n     * Get the current state snapshot.\n     * Each state change creates a new object, so reference equality\n     * can be used to detect changes.\n     */\n    getState() {\n        return this.state;\n    }\n    /**\n     * Subscribe to state changes.\n     *\n     * @param listener - Callback invoked with new state on each change\n     * @returns Unsubscribe function to remove the listener\n     */\n    subscribe(listener) {\n        this.listeners.add(listener);\n        // Return unsubscribe function\n        return () => {\n            this.listeners.delete(listener);\n        };\n    }\n    /**\n     * Set the current user context.\n     * e.g: Called by UserContextManager when user context is created.\n     *\n     * When a non-null context is provided, its forced decision methods\n     * (setForcedDecision, removeForcedDecision, removeAllForcedDecisions)\n     * are wrapped to trigger per-flagKey notifications, enabling React\n     * hooks to re-evaluate only the affected flag.\n     */\n    setUserContext(ctx) {\n        if (ctx) {\n            this.wrapForcedDecisionMethods(ctx);\n        }\n        // Always update userContext even if same reference -\n        // user attributes may have changed\n        this.state = Object.assign(Object.assign({}, this.state), { userContext: ctx });\n        this.notifyListeners();\n    }\n    /**\n     * Set an error that occurred during initialization.\n     * Setting an error does NOT clear userContext.\n     */\n    setError(error) {\n        if (this.state.error === error) {\n            return; // No change, skip notification\n        }\n        this.state = Object.assign(Object.assign({}, this.state), { error });\n        this.notifyListeners();\n    }\n    /**\n     * Batch update multiple state properties at once.\n     * Useful when multiple state changes should trigger a single notification.\n     */\n    setState(partialState) {\n        this.state = Object.assign(Object.assign({}, this.state), partialState);\n        this.notifyListeners();\n    }\n    /**\n     * Signal that external state (e.g. client config) has changed.\n     * Creates a new state reference so useSyncExternalStore triggers\n     * re-renders and hooks re-evaluate decisions.\n     */\n    refresh() {\n        this.state = Object.assign({}, this.state);\n        this.notifyListeners();\n    }\n    /**\n     * Reset store to initial state.\n     * Useful for testing or when Provider unmounts.\n     */\n    reset() {\n        this.state = Object.assign({}, initialState);\n        this.forcedDecisionListeners.clear();\n        this.allForcedDecisionListeners.clear();\n        this.notifyListeners();\n    }\n    /**\n     * Subscribe to forced decision changes for a specific flagKey.\n     * Hooks use this to re-evaluate decisions only when their flag is affected.\n     *\n     * @param flagKey - The flag key to watch\n     * @param callback - Called when a forced decision for this flagKey changes\n     * @returns Unsubscribe function\n     */\n    subscribeForcedDecision(flagKey, callback) {\n        if (!this.forcedDecisionListeners.has(flagKey)) {\n            this.forcedDecisionListeners.set(flagKey, new Set());\n        }\n        const listeners = this.forcedDecisionListeners.get(flagKey);\n        listeners.add(callback);\n        return () => {\n            listeners.delete(callback);\n            if (listeners.size === 0) {\n                this.forcedDecisionListeners.delete(flagKey);\n            }\n        };\n    }\n    /**\n     * Subscribe to forced decision changes for all flagKeys.\n     * Used by hooks like useDecideAll that need to react to any forced decision change.\n     *\n     * @param callback - Called when any forced decision changes\n     * @returns Unsubscribe function\n     */\n    subscribeAllForcedDecisions(callback) {\n        this.allForcedDecisionListeners.add(callback);\n        return () => {\n            this.allForcedDecisionListeners.delete(callback);\n        };\n    }\n    /**\n     * Notify listeners subscribed to a specific flagKey\n     * and broadcast to \"all\" forced decision listeners.\n     * Called by wrapped setForcedDecision / removeForcedDecision.\n     */\n    notifyForcedDecision(flagKey) {\n        this.notifyPerKeyForcedDecision(flagKey);\n        this.notifyAllForcedDecisionListeners();\n    }\n    /**\n     * Notify only per-key listeners (no broadcast).\n     * Used internally by removeAllForcedDecisions to avoid\n     * firing \"all\" listeners once per key.\n     */\n    notifyPerKeyForcedDecision(flagKey) {\n        const listeners = this.forcedDecisionListeners.get(flagKey);\n        if (listeners) {\n            listeners.forEach((cb) => cb());\n        }\n    }\n    /**\n     * Notify broadcast (\"all\") forced decision listeners once.\n     */\n    notifyAllForcedDecisionListeners() {\n        this.allForcedDecisionListeners.forEach((cb) => cb());\n    }\n    /**\n     * Wrap forced decision methods on a user context to trigger per-flagKey\n     * notifications on mutation. This enables React hooks to re-evaluate\n     * only when the specific flag they watch has a forced decision change.\n     *\n     * Each wrapped context gets its own `forcedDecisionFlagKeys` set (via closure)\n     * so that `removeAllForcedDecisions` can notify all relevant hooks.\n     *\n     * A staleness guard (`store.state.userContext === ctx`) prevents stale\n     * contexts captured in React closures from triggering spurious re-renders\n     * and impression events on the wrong user context.\n     */\n    wrapForcedDecisionMethods(ctx) {\n        const forcedDecisionFlagKeys = new Set();\n        const originalSet = ctx.setForcedDecision.bind(ctx);\n        const originalRemove = ctx.removeForcedDecision.bind(ctx);\n        const originalRemoveAll = ctx.removeAllForcedDecisions.bind(ctx);\n        ctx.setForcedDecision = (context, decision) => {\n            const result = originalSet(context, decision);\n            if (result) {\n                forcedDecisionFlagKeys.add(context.flagKey);\n                if (this.state.userContext === ctx) {\n                    this.notifyForcedDecision(context.flagKey);\n                }\n            }\n            return result;\n        };\n        ctx.removeForcedDecision = (context) => {\n            const result = originalRemove(context);\n            if (result) {\n                forcedDecisionFlagKeys.delete(context.flagKey);\n                if (this.state.userContext === ctx) {\n                    this.notifyForcedDecision(context.flagKey);\n                }\n            }\n            return result;\n        };\n        ctx.removeAllForcedDecisions = () => {\n            const result = originalRemoveAll();\n            if (result) {\n                if (this.state.userContext === ctx) {\n                    // Notify per-key listeners individually, then broadcast once\n                    forcedDecisionFlagKeys.forEach((flagKey) => this.notifyPerKeyForcedDecision(flagKey));\n                    this.notifyAllForcedDecisionListeners();\n                }\n                forcedDecisionFlagKeys.clear();\n            }\n            return result;\n        };\n    }\n    /**\n     * Notify all listeners of state change.\n     *\n     * Notifications are deferred via queueMicrotask to avoid triggering\n     * setState in subscriber hooks (e.g. useDecide -> useSyncExternalStore)\n     * while the Provider component is still rendering.\n     *\n     * The state itself is updated synchronously so getState() returns the correct value\n     * immediately (required for SSR).\n     *\n     * Multiple synchronous state changes are batched into a single notification.\n     */\n    notifyListeners() {\n        if (this.notifyScheduled)\n            return;\n        this.notifyScheduled = true;\n        queueMicrotask(() => {\n            this.notifyScheduled = false;\n            this.listeners.forEach((listener) => {\n                listener(this.state);\n            });\n        });\n    }\n}\n//# sourceMappingURL=ProviderStateStore.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { __awaiter } from \"tslib\";\n/**\n * Compares two string arrays for value equality (order-insensitive).\n * Used to prevent redundant user context creation when the segments prop\n * is referentially different but value-equal.\n */\nexport function areSegmentsEqual(a, b) {\n    if (a === b)\n        return true;\n    if (!a || !b)\n        return false;\n    if (a.length !== b.length)\n        return false;\n    const sortedA = [...a].sort();\n    const sortedB = [...b].sort();\n    return sortedA.every((val, i) => val === sortedB[i]);\n}\n/**\n * Compares two UserInfo objects for value equality.\n * Used to prevent redundant user context creation when the user prop\n * is referentially different but value-equal.\n */\nexport function areUsersEqual(user1, user2) {\n    if (user1 === user2)\n        return true;\n    if (!user1 && !user2)\n        return true;\n    if (!user1 || !user2)\n        return false;\n    if (user1.id !== user2.id)\n        return false;\n    const attrs1 = user1.attributes || {};\n    const attrs2 = user2.attributes || {};\n    const keys1 = Object.keys(attrs1);\n    const keys2 = Object.keys(attrs2);\n    if (keys1.length !== keys2.length)\n        return false;\n    for (const key of keys1) {\n        if (attrs1[key] !== attrs2[key])\n            return false;\n    }\n    return true;\n}\nconst QUALIFIED = 'qualified';\n/**\n * Extracts ODP segments from audience conditions in the datafile.\n * Looks for conditions with `match: 'qualified'` and collects their values.\n */\nfunction extractSegmentsFromConditions(condition) {\n    if (Array.isArray(condition)) {\n        return condition.flatMap(extractSegmentsFromConditions);\n    }\n    if (condition && typeof condition === 'object' && condition['match'] === QUALIFIED) {\n        const value = condition['value'];\n        return typeof value === 'string' && value.length > 0 ? [value] : [];\n    }\n    return [];\n}\n/**\n * Builds the GraphQL query payload for fetching audience segments from ODP.\n */\nfunction buildGraphQLQuery(userId, segmentsToCheck) {\n    const segmentsList = segmentsToCheck.map((s) => `\"${s}\"`).join(',');\n    const query = `query {customer(fs_user_id : \"${userId}\") {audiences(subset: [${segmentsList}]) {edges {node {name state}}}}}`;\n    return JSON.stringify({ query });\n}\n/**\n * Fetches qualified ODP segments for a user given a datafile and user ID.\n *\n * This is a standalone, self-contained utility that:\n * 1. Parses the datafile to extract ODP configuration (apiKey, apiHost)\n * 2. Collects all ODP segments referenced in audience conditions\n * 3. Queries the ODP GraphQL API\n * 4. Returns only the segments where the user is qualified\n *\n * @param userId - The user ID to fetch qualified segments for\n * @param datafile - The Optimizely datafile (JSON object or string)\n * @returns Object with `segments` (qualified segment names) and `error` (null on success).\n *\n * @example\n * ```ts\n * const { segments, error } = await getQualifiedSegments('user-123', datafile);\n * if (!error) {\n *   console.log('Qualified segments:', segments);\n * }\n * ```\n */\nexport function getQualifiedSegments(userId, datafile) {\n    return __awaiter(this, void 0, void 0, function* () {\n        var _a, _b, _c, _d;\n        let datafileObj;\n        if (typeof datafile === 'string') {\n            try {\n                datafileObj = JSON.parse(datafile);\n            }\n            catch (_e) {\n                return { segments: [], error: new Error('Invalid datafile: failed to parse JSON string') };\n            }\n        }\n        else if (typeof datafile === 'object' && datafile !== null) {\n            datafileObj = datafile;\n        }\n        else {\n            return { segments: [], error: new Error('Invalid datafile: expected a JSON string or object') };\n        }\n        // Extract ODP integration config from datafile\n        const odpIntegration = Array.isArray(datafileObj.integrations)\n            ? datafileObj.integrations.find((i) => i.key === 'odp')\n            : undefined;\n        const apiKey = odpIntegration === null || odpIntegration === void 0 ? void 0 : odpIntegration.publicKey;\n        const apiHost = odpIntegration === null || odpIntegration === void 0 ? void 0 : odpIntegration.host;\n        if (!apiKey || !apiHost) {\n            return { segments: [], error: new Error('ODP integration not found or missing publicKey/host') };\n        }\n        // Collect all ODP segments from audience conditions\n        const allSegments = new Set();\n        const audiences = [...(datafileObj.audiences || []), ...(datafileObj.typedAudiences || [])];\n        for (const audience of audiences) {\n            if (audience.conditions) {\n                let conditions = audience.conditions;\n                if (typeof conditions === 'string') {\n                    try {\n                        conditions = JSON.parse(conditions);\n                    }\n                    catch (_f) {\n                        continue;\n                    }\n                }\n                extractSegmentsFromConditions(conditions).forEach((s) => allSegments.add(s));\n            }\n        }\n        const segmentsToCheck = Array.from(allSegments);\n        if (segmentsToCheck.length === 0) {\n            return { segments: [], error: null };\n        }\n        const endpoint = `${apiHost}/v3/graphql`;\n        const query = buildGraphQLQuery(userId, segmentsToCheck);\n        try {\n            const response = yield fetch(endpoint, {\n                method: 'POST',\n                headers: {\n                    'Content-Type': 'application/json',\n                    'x-api-key': apiKey,\n                },\n                body: query,\n            });\n            if (!response.ok) {\n                return { segments: [], error: new Error(`ODP request failed with status ${response.status}`) };\n            }\n            const json = yield response.json();\n            if (((_a = json.errors) === null || _a === void 0 ? void 0 : _a.length) > 0) {\n                return { segments: [], error: new Error(`ODP GraphQL error: ${json.errors[0].message}`) };\n            }\n            const edges = (_d = (_c = (_b = json === null || json === void 0 ? void 0 : json.data) === null || _b === void 0 ? void 0 : _b.customer) === null || _c === void 0 ? void 0 : _c.audiences) === null || _d === void 0 ? void 0 : _d.edges;\n            if (!edges) {\n                return { segments: [], error: new Error('ODP response missing audience edges') };\n            }\n            // eslint-disable-next-line @typescript-eslint/no-explicit-any\n            const segments = edges.filter((edge) => edge.node.state === QUALIFIED).map((edge) => edge.node.name);\n            return { segments, error: null };\n        }\n        catch (e) {\n            return { segments: [], error: e instanceof Error ? e : new Error('ODP request failed') };\n        }\n    });\n}\n//# sourceMappingURL=helpers.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { __awaiter } from \"tslib\";\nimport { REACT_CLIENT_META } from '../client';\nimport { areSegmentsEqual, areUsersEqual } from './helpers';\n/**\n * Manages user context creation, VUID resolution, and ODP segment fetching.\n *\n * Handles async operations with staleness checks so that rapid user changes\n * only result in the latest request's callback being fired. Previous in-flight\n * operations are abandoned via a requestId counter.\n *\n * Internally tracks previous user, segments, and skipSegments values to\n * short-circuit when nothing has changed.\n */\nexport class UserContextManager {\n    constructor(config) {\n        this.requestId = 0;\n        this.disposed = false;\n        this.initialized = false;\n        this.skipSegments = false;\n        this.client = config.client;\n        this.onUserContextChange = config.onUserContextChange;\n        this.onError = config.onError;\n        this.meta = this.client[REACT_CLIENT_META];\n    }\n    /**\n     * Resolves whether user context needs to be (re)created based on\n     * value-equality of user, qualifiedSegments, and skipSegments.\n     * Short-circuits if nothing has changed since the previous call.\n     *\n     * @param user - Optional user info (id and attributes)\n     * @param qualifiedSegments - Optional pre-fetched segments. When provided,\n     * @param skipSegments - Whether to skip ODP segment fetching (default: false)\n     */\n    resolveUserContext(user, qualifiedSegments, skipSegments = false) {\n        if (this.initialized &&\n            this.skipSegments === skipSegments &&\n            areUsersEqual(this.prevUser, user) &&\n            areSegmentsEqual(this.prevSegments, qualifiedSegments)) {\n            return;\n        }\n        this.initialized = true;\n        this.skipSegments = skipSegments;\n        this.prevUser = user;\n        this.prevSegments = qualifiedSegments;\n        const requestId = ++this.requestId;\n        if (!user) {\n            this.onUserContextChange(null);\n            return;\n        }\n        this.createUserContext(requestId, user, qualifiedSegments).catch((error) => {\n            if (this.isStale(requestId))\n                return;\n            this.onError(error instanceof Error ? error : new Error(String(error)));\n        });\n    }\n    /**\n     * Disposes the manager, preventing any future callbacks from firing.\n     */\n    dispose() {\n        this.disposed = true;\n    }\n    createUserContext(requestId, user, qualifiedSegments) {\n        return __awaiter(this, void 0, void 0, function* () {\n            if (!(user === null || user === void 0 ? void 0 : user.id) && this.meta.hasVuidManager) {\n                yield this.client.onReady();\n                if (this.isStale(requestId))\n                    return;\n            }\n            const ctx = this.client.createUserContext(user === null || user === void 0 ? void 0 : user.id, user === null || user === void 0 ? void 0 : user.attributes);\n            if (qualifiedSegments !== undefined) {\n                ctx.qualifiedSegments = qualifiedSegments;\n                this.onUserContextChange(ctx); // immediate callback for sync decision with pre-set segments\n                if (this.skipSegments)\n                    return;\n                // Background fetch — only when ODP manager exists\n                if (this.meta.hasOdpManager) {\n                    yield this.client.onReady();\n                    if (this.isStale(requestId))\n                        return;\n                    if (this.client.isOdpIntegrated()) {\n                        const snapshot = [...qualifiedSegments];\n                        yield ctx.fetchQualifiedSegments();\n                        if (this.isStale(requestId))\n                            return;\n                        // update only if different\n                        if (!areSegmentsEqual(snapshot, ctx.qualifiedSegments)) {\n                            this.onUserContextChange(ctx);\n                        }\n                    }\n                }\n                return;\n            }\n            //  odpManager and no qualifiedSegments\n            if (!this.skipSegments && this.meta.hasOdpManager) {\n                yield this.client.onReady();\n                if (this.isStale(requestId))\n                    return;\n                if (this.client.isOdpIntegrated()) {\n                    yield ctx.fetchQualifiedSegments();\n                    if (this.isStale(requestId))\n                        return;\n                }\n            }\n            this.onUserContextChange(ctx);\n        });\n    }\n    isStale(requestId) {\n        return this.disposed || requestId !== this.requestId;\n    }\n}\n//# sourceMappingURL=UserContextManager.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport React, { createContext, useRef, useMemo, useEffect } from 'react';\nimport { NOTIFICATION_TYPES } from '@optimizely/optimizely-sdk';\nimport { ProviderStateStore } from './ProviderStateStore';\nimport { UserContextManager } from '../utils/UserContextManager';\n/**\n * React Context for Optimizely.\n */\nexport const OptimizelyContext = createContext(null);\nexport function OptimizelyProvider({ client, user, timeout, skipSegments = false, qualifiedSegments, children, }) {\n    var _a;\n    const storeRef = useRef(null);\n    const userManagerRef = useRef(null);\n    const prevClientRef = useRef();\n    const revisionAtRender = useMemo(() => { var _a; return (_a = client === null || client === void 0 ? void 0 : client.getOptimizelyConfig()) === null || _a === void 0 ? void 0 : _a.revision; }, [client]);\n    if (storeRef.current === null) {\n        storeRef.current = new ProviderStateStore();\n    }\n    const store = storeRef.current;\n    const contextValue = useMemo(() => ({\n        store,\n        client,\n    }), [client, store]);\n    if (client) {\n        // Create UserContextManager if not exists or if client has changed\n        if (userManagerRef.current === null || prevClientRef.current !== client) {\n            (_a = userManagerRef.current) === null || _a === void 0 ? void 0 : _a.dispose();\n            userManagerRef.current = new UserContextManager({\n                client,\n                onUserContextChange: (ctx) => store.setUserContext(ctx),\n                onError: (error) => store.setError(error),\n            });\n            prevClientRef.current = client;\n        }\n        // UCM internally checks for user/segments/skipSegments changes\n        userManagerRef.current.resolveUserContext(user, qualifiedSegments, skipSegments);\n    }\n    // Effect: Client readiness + config update subscription.\n    // Handles both initial datafile fetch and subsequent polling updates.\n    useEffect(() => {\n        if (!client) {\n            console.error('[OPTIMIZELY - REACT] OptimizelyProvider must be passed an Optimizely client instance');\n            store.setError(new Error('Optimizely client is required'));\n            return;\n        }\n        let isMounted = true;\n        let listenerId;\n        client\n            .onReady({ timeout })\n            .then(() => {\n            var _a;\n            if (!isMounted)\n                return;\n            const currentRevision = (_a = client.getOptimizelyConfig()) === null || _a === void 0 ? void 0 : _a.revision;\n            if (currentRevision !== revisionAtRender) {\n                store.refresh();\n            }\n            listenerId = client.notificationCenter.addNotificationListener(NOTIFICATION_TYPES.OPTIMIZELY_CONFIG_UPDATE, () => store.refresh());\n        })\n            .catch((error) => {\n            if (!isMounted)\n                return;\n            const err = error instanceof Error ? error : new Error(String(error));\n            store.setError(err);\n        });\n        return () => {\n            isMounted = false;\n            if (listenerId !== undefined) {\n                client.notificationCenter.removeNotificationListener(listenerId);\n            }\n        };\n    }, [client, timeout, store, revisionAtRender]);\n    return React.createElement(OptimizelyContext.Provider, { value: contextValue }, children);\n}\n//# sourceMappingURL=OptimizelyProvider.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { useContext } from 'react';\nimport { OptimizelyContext } from '../provider';\n/**\n * Returns the Optimizely context value from the nearest `<OptimizelyProvider>`.\n * Throws if used outside of a Provider.\n *\n * Internal hook — shared by all public hooks to avoid duplicating\n * the context access + validation pattern.\n */\nexport function useOptimizelyContext() {\n    const context = useContext(OptimizelyContext);\n    if (!context) {\n        throw new Error('Optimizely hooks must be used within an <OptimizelyProvider>');\n    }\n    return context;\n}\n//# sourceMappingURL=useOptimizelyContext.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { useOptimizelyContext } from './useOptimizelyContext';\n/**\n * Returns the Optimizely client instance from the nearest `<OptimizelyProvider>`.\n */\nexport function useOptimizelyClient() {\n    return useOptimizelyContext().client;\n}\n//# sourceMappingURL=useOptimizelyClient.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { useCallback, useMemo } from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { useOptimizelyContext } from './useOptimizelyContext';\n/**\n * Returns the current {@link OptimizelyUserContext} for the nearest `<OptimizelyProvider>`.\n *\n * The user context gives access to the user's identity (user ID and attributes)\n * and methods for working with forced decisions (`setForcedDecision`,\n * `removeForcedDecision`, `removeAllForcedDecisions`).\n */\nexport function useOptimizelyUserContext() {\n    const { store } = useOptimizelyContext();\n    const subscribe = useCallback((onStoreChange) => store.subscribe(onStoreChange), [store]);\n    const getSnapshot = useCallback(() => store.getState(), [store]);\n    const state = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n    return useMemo(() => {\n        const { userContext, error } = state;\n        if (error) {\n            return { userContext: null, isLoading: false, error };\n        }\n        if (userContext === null) {\n            return { userContext: null, isLoading: true, error: null };\n        }\n        return { userContext, isLoading: false, error: null };\n    }, [state]);\n}\n//# sourceMappingURL=useOptimizelyUserContext.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { useCallback } from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\n/**\n * Subscribes to the `ProviderStateStore` via `useSyncExternalStore`\n * and returns the current provider state.\n */\nexport function useProviderState(store) {\n    const subscribeState = useCallback((onStoreChange) => store.subscribe(onStoreChange), [store]);\n    const getStateSnapshot = useCallback(() => store.getState(), [store]);\n    return useSyncExternalStore(subscribeState, getStateSnapshot, getStateSnapshot);\n}\n//# sourceMappingURL=useProviderState.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { useRef } from 'react';\nexport function useStableArray(arr) {\n    const ref = useRef(arr);\n    if (!shallowEqualArrays(ref.current, arr)) {\n        ref.current = arr;\n    }\n    return ref.current;\n}\nfunction shallowEqualArrays(a, b) {\n    if (a === b)\n        return true;\n    if (a === undefined || b === undefined)\n        return false;\n    if (a.length !== b.length)\n        return false;\n    const sortedA = [...a].sort();\n    const sortedB = [...b].sort();\n    for (let i = 0; i < sortedA.length; i++) {\n        if (sortedA[i] !== sortedB[i])\n            return false;\n    }\n    return true;\n}\n//# sourceMappingURL=useStableArray.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { useEffect, useMemo, useState } from 'react';\nimport { useOptimizelyContext } from './useOptimizelyContext';\nimport { useProviderState } from './useProviderState';\nimport { useStableArray } from './useStableArray';\n/**\n * Returns a feature flag decision for the given flag key.\n *\n * Subscribes to `ProviderStateStore` via `useSyncExternalStore` and\n * re-evaluates the decision whenever the store state changes\n * (client ready, user context set, error).\n *\n * @param flagKey - The feature flag key to evaluate\n * @param config - Optional configuration (decideOptions)\n */\nexport function useDecide(flagKey, config) {\n    const { store, client } = useOptimizelyContext();\n    const decideOptions = useStableArray(config === null || config === void 0 ? void 0 : config.decideOptions);\n    const state = useProviderState(store);\n    // --- Forced decision subscription ---\n    // Forced decisions don't change store state, so we use a version counter\n    // to trigger useMemo recomputation. Per-flagKey granularity prevents\n    // unrelated hooks from re-evaluating.\n    const [fdVersion, setFdVersion] = useState(0);\n    useEffect(() => {\n        return store.subscribeForcedDecision(flagKey, () => {\n            setFdVersion((v) => v + 1);\n        });\n    }, [store, flagKey]);\n    // --- Derive decision ---\n    return useMemo(() => {\n        void fdVersion; // referenced to satisfy exhaustive-deps; triggers recomputation on forced decision changes\n        const { userContext, error } = state;\n        const hasConfig = client.getOptimizelyConfig() !== null;\n        if (error) {\n            return { decision: null, isLoading: false, error };\n        }\n        if (!hasConfig || userContext === null) {\n            return { decision: null, isLoading: true, error: null };\n        }\n        const decision = userContext.decide(flagKey, decideOptions);\n        return { decision, isLoading: false, error: null };\n    }, [fdVersion, state, client, flagKey, decideOptions]);\n}\n//# sourceMappingURL=useDecide.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { useEffect, useMemo, useState } from 'react';\nimport { useOptimizelyContext } from './useOptimizelyContext';\nimport { useProviderState } from './useProviderState';\nimport { useStableArray } from './useStableArray';\n/**\n * Returns feature flag decisions for the given flag keys.\n *\n * Subscribes to `ProviderStateStore` via `useSyncExternalStore` and\n * re-evaluates decisions whenever the store state changes\n * (client ready, user context set, error) or a forced decision\n * changes for any of the watched keys.\n *\n * @param flagKeys - The feature flag keys to evaluate\n * @param config - Optional configuration (decideOptions)\n */\nexport function useDecideForKeys(flagKeys, config) {\n    const { store, client } = useOptimizelyContext();\n    const stableKeys = useStableArray(flagKeys);\n    const decideOptions = useStableArray(config === null || config === void 0 ? void 0 : config.decideOptions);\n    const state = useProviderState(store);\n    // --- Forced decision subscription — per-key with shared version counter ---\n    const [fdVersion, setFdVersion] = useState(0);\n    useEffect(() => {\n        const unsubscribes = stableKeys.map((key) => store.subscribeForcedDecision(key, () => setFdVersion((v) => v + 1)));\n        return () => unsubscribes.forEach((unsub) => unsub());\n    }, [store, stableKeys]);\n    // --- Derive decisions ---\n    return useMemo(() => {\n        void fdVersion; // referenced to satisfy exhaustive-deps; triggers recomputation on forced decision changes\n        const { userContext, error } = state;\n        const hasConfig = client.getOptimizelyConfig() !== null;\n        if (error) {\n            return { decisions: {}, isLoading: false, error };\n        }\n        if (!hasConfig || userContext === null) {\n            return { decisions: {}, isLoading: true, error: null };\n        }\n        const decisions = userContext.decideForKeys(stableKeys, decideOptions);\n        return { decisions, isLoading: false, error: null };\n    }, [fdVersion, state, client, stableKeys, decideOptions]);\n}\n//# sourceMappingURL=useDecideForKeys.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { useEffect, useMemo, useState } from 'react';\nimport { useOptimizelyContext } from './useOptimizelyContext';\nimport { useProviderState } from './useProviderState';\nimport { useStableArray } from './useStableArray';\n/**\n * Returns feature flag decisions for all flags.\n *\n * Subscribes to `ProviderStateStore` via `useSyncExternalStore` and\n * re-evaluates decisions whenever the store state changes\n * (client ready, user context set, error) or any forced decision changes.\n *\n * @param config - Optional configuration (decideOptions)\n */\nexport function useDecideAll(config) {\n    const { store, client } = useOptimizelyContext();\n    const decideOptions = useStableArray(config === null || config === void 0 ? void 0 : config.decideOptions);\n    const state = useProviderState(store);\n    // --- Forced decision subscription — any flag key ---\n    const [fdVersion, setFdVersion] = useState(0);\n    useEffect(() => {\n        return store.subscribeAllForcedDecisions(() => setFdVersion((v) => v + 1));\n    }, [store]);\n    // --- Derive decisions ---\n    return useMemo(() => {\n        void fdVersion; // referenced to satisfy exhaustive-deps; triggers recomputation on forced decision changes\n        const { userContext, error } = state;\n        const hasConfig = client.getOptimizelyConfig() !== null;\n        if (error) {\n            return { decisions: {}, isLoading: false, error };\n        }\n        if (!hasConfig || userContext === null) {\n            return { decisions: {}, isLoading: true, error: null };\n        }\n        const decisions = userContext.decideAll(decideOptions);\n        return { decisions, isLoading: false, error: null };\n    }, [fdVersion, state, client, decideOptions]);\n}\n//# sourceMappingURL=useDecideAll.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { useEffect, useState } from 'react';\n/**\n * Shared async decision state machine used by useDecideAsync,\n * useDecideForKeysAsync, and useDecideAllAsync.\n *\n * Handles: loading state, error propagation, cancellation of stale promises,\n * and redundant re-render avoidance on first mount.\n *\n * @param state - Provider state from useProviderState\n * @param client - Optimizely client instance\n * @param fdVersion - Forced decision version counter (triggers re-evaluation)\n * @param emptyResult - Default/empty result value (null for single, {} for multi)\n * @param execute - Callback that performs the async SDK call\n */\nexport function useAsyncDecision(state, client, fdVersion, emptyResult, execute) {\n    const [asyncState, setAsyncState] = useState({\n        result: emptyResult,\n        error: null,\n        isLoading: true,\n    });\n    useEffect(() => {\n        const { userContext, error } = state;\n        const hasConfig = client.getOptimizelyConfig() !== null;\n        // Store-level error — no async call needed\n        if (error) {\n            setAsyncState({ result: emptyResult, error, isLoading: false });\n            return;\n        }\n        // Ensure loading state (skip if already loading to avoid re-render)\n        setAsyncState((prev) => {\n            if (prev.isLoading)\n                return prev;\n            return { result: emptyResult, error: null, isLoading: true };\n        });\n        // Store not ready — wait for config/user context\n        if (!hasConfig || userContext === null) {\n            return;\n        }\n        // Store is ready — fire async decision\n        let cancelled = false;\n        execute(userContext).then((result) => {\n            if (!cancelled) {\n                setAsyncState({ result, error: null, isLoading: false });\n            }\n        }, (err) => {\n            if (!cancelled) {\n                setAsyncState({\n                    result: emptyResult,\n                    error: err instanceof Error ? err : new Error(String(err)),\n                    isLoading: false,\n                });\n            }\n        });\n        return () => {\n            cancelled = true;\n        };\n    }, [state, fdVersion, client, execute, emptyResult]);\n    return asyncState;\n}\n//# sourceMappingURL=useAsyncDecision.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { useCallback, useEffect, useState } from 'react';\nimport { useOptimizelyContext } from './useOptimizelyContext';\nimport { useProviderState } from './useProviderState';\nimport { useStableArray } from './useStableArray';\nimport { useAsyncDecision } from './useAsyncDecision';\n/**\n * Returns a feature flag decision for the given flag key using the async\n * `decideAsync` API. Required for CMAB (Contextual Multi-Armed Bandit) support.\n *\n * Client-side only — `decideAsync` returns a Promise which cannot resolve\n * during server render.\n *\n * @param flagKey - The feature flag key to evaluate\n * @param config - Optional configuration (decideOptions)\n */\nexport function useDecideAsync(flagKey, config) {\n    const { store, client } = useOptimizelyContext();\n    const decideOptions = useStableArray(config === null || config === void 0 ? void 0 : config.decideOptions);\n    const state = useProviderState(store);\n    // --- Forced decision subscription ---\n    const [fdVersion, setFdVersion] = useState(0);\n    useEffect(() => {\n        return store.subscribeForcedDecision(flagKey, () => {\n            setFdVersion((v) => v + 1);\n        });\n    }, [store, flagKey]);\n    const execute = useCallback((uc) => uc.decideAsync(flagKey, decideOptions), [flagKey, decideOptions]);\n    const { result, error, isLoading } = useAsyncDecision(state, client, fdVersion, null, execute);\n    return { decision: result, error, isLoading };\n}\n//# sourceMappingURL=useDecideAsync.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { useCallback, useEffect, useState } from 'react';\nimport { useOptimizelyContext } from './useOptimizelyContext';\nimport { useProviderState } from './useProviderState';\nimport { useStableArray } from './useStableArray';\nimport { useAsyncDecision } from './useAsyncDecision';\nconst EMPTY_DECISIONS = {};\n/**\n * Returns feature flag decisions for the given flag keys using the async\n * `decideForKeysAsync` API. Required for CMAB (Contextual Multi-Armed Bandit) support.\n *\n * Client-side only — `decideForKeysAsync` returns a Promise which cannot resolve\n * during server render.\n *\n * @param flagKeys - The feature flag keys to evaluate\n * @param config - Optional configuration (decideOptions)\n */\nexport function useDecideForKeysAsync(flagKeys, config) {\n    const { store, client } = useOptimizelyContext();\n    const stableKeys = useStableArray(flagKeys);\n    const decideOptions = useStableArray(config === null || config === void 0 ? void 0 : config.decideOptions);\n    const state = useProviderState(store);\n    // --- Forced decision subscription — per-key with shared version counter ---\n    const [fdVersion, setFdVersion] = useState(0);\n    useEffect(() => {\n        const unsubscribes = stableKeys.map((key) => store.subscribeForcedDecision(key, () => setFdVersion((v) => v + 1)));\n        return () => unsubscribes.forEach((unsub) => unsub());\n    }, [store, stableKeys]);\n    const execute = useCallback((uc) => uc.decideForKeysAsync(stableKeys, decideOptions), [stableKeys, decideOptions]);\n    const { result, error, isLoading } = useAsyncDecision(state, client, fdVersion, EMPTY_DECISIONS, execute);\n    return { decisions: result, error, isLoading };\n}\n//# sourceMappingURL=useDecideForKeysAsync.js.map","/**\n * Copyright 2026, Optimizely\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 * https://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 */\nimport { useCallback, useEffect, useState } from 'react';\nimport { useOptimizelyContext } from './useOptimizelyContext';\nimport { useProviderState } from './useProviderState';\nimport { useStableArray } from './useStableArray';\nimport { useAsyncDecision } from './useAsyncDecision';\nconst EMPTY_DECISIONS = {};\n/**\n * Returns feature flag decisions for all flags using the async\n * `decideAllAsync` API. Required for CMAB (Contextual Multi-Armed Bandit) support.\n *\n * Client-side only — `decideAllAsync` returns a Promise which cannot resolve\n * during server render.\n *\n * @param config - Optional configuration (decideOptions)\n */\nexport function useDecideAllAsync(config) {\n    const { store, client } = useOptimizelyContext();\n    const decideOptions = useStableArray(config === null || config === void 0 ? void 0 : config.decideOptions);\n    const state = useProviderState(store);\n    // --- Forced decision subscription — any flag key ---\n    const [fdVersion, setFdVersion] = useState(0);\n    useEffect(() => {\n        return store.subscribeAllForcedDecisions(() => setFdVersion((v) => v + 1));\n    }, [store]);\n    const execute = useCallback((uc) => uc.decideAllAsync(decideOptions), [decideOptions]);\n    const { result, error, isLoading } = useAsyncDecision(state, client, fdVersion, EMPTY_DECISIONS, execute);\n    return { decisions: result, error, isLoading };\n}\n//# sourceMappingURL=useDecideAllAsync.js.map"],"names":["LOG_PREFIX","defaultLogHandler","log","level","message","LogLevel","Debug","console","debug","Info","info","Warn","warn","Error","error","REACT_LOGGER","Symbol","createLogger","config","opaqueLogger","jsCreateLogger","reactLogger","_a","handler","logHandler","logLevel","msg","createReactLogger","preset","DEBUG","INFO","WARN","REACT_CLIENT_META","createInstance","logger","jsClient","jsCreateInstance","Object","assign","clientEngine","clientVersion","reactClient","create","hasOdpManager","odpManager","hasVuidManager","vuidManager","initialState","userContext","ProviderStateStore","constructor","this","notifyScheduled","state","listeners","Set","forcedDecisionListeners","Map","allForcedDecisionListeners","getState","subscribe","listener","add","delete","setUserContext","ctx","wrapForcedDecisionMethods","notifyListeners","setError","setState","partialState","refresh","reset","clear","subscribeForcedDecision","flagKey","callback","has","set","get","size","subscribeAllForcedDecisions","notifyForcedDecision","notifyPerKeyForcedDecision","notifyAllForcedDecisionListeners","forEach","cb","forcedDecisionFlagKeys","originalSet","setForcedDecision","bind","originalRemove","removeForcedDecision","originalRemoveAll","removeAllForcedDecisions","context","decision","result","queueMicrotask","areSegmentsEqual","a","b","length","sortedA","sort","sortedB","every","val","i","QUALIFIED","extractSegmentsFromConditions","condition","Array","isArray","flatMap","value","getQualifiedSegments","userId","datafile","__awaiter","_b","_c","_d","datafileObj","JSON","parse","_e","segments","odpIntegration","integrations","find","key","undefined","apiKey","publicKey","apiHost","host","allSegments","audiences","typedAudiences","audience","conditions","_f","s","segmentsToCheck","from","endpoint","query","map","join","stringify","buildGraphQLQuery","response","fetch","method","headers","body","ok","status","json","errors","edges","data","customer","filter","edge","node","name","e","UserContextManager","requestId","disposed","initialized","skipSegments","client","onUserContextChange","onError","meta","resolveUserContext","user","qualifiedSegments","user1","user2","id","attrs1","attributes","attrs2","keys1","keys","keys2","areUsersEqual","prevUser","prevSegments","createUserContext","catch","isStale","String","dispose","onReady","isOdpIntegrated","fetchQualifiedSegments","snapshot","OptimizelyContext","createContext","OptimizelyProvider","timeout","children","storeRef","useRef","userManagerRef","prevClientRef","revisionAtRender","useMemo","getOptimizelyConfig","revision","current","store","contextValue","useEffect","listenerId","isMounted","then","notificationCenter","addNotificationListener","NOTIFICATION_TYPES","OPTIMIZELY_CONFIG_UPDATE","err","removeNotificationListener","React","createElement","Provider","useOptimizelyContext","useContext","useOptimizelyClient","useOptimizelyUserContext","useCallback","onStoreChange","getSnapshot","useSyncExternalStore","isLoading","useProviderState","subscribeState","getStateSnapshot","useStableArray","arr","ref","shallowEqualArrays","useDecide","decideOptions","fdVersion","setFdVersion","useState","v","hasConfig","decide","useDecideForKeys","flagKeys","stableKeys","unsubscribes","unsub","decisions","decideForKeys","useDecideAll","decideAll","useAsyncDecision","emptyResult","execute","asyncState","setAsyncState","prev","cancelled","useDecideAsync","uc","decideAsync","EMPTY_DECISIONS","useDecideForKeysAsync","decideForKeysAsync","useDecideAllAsync","decideAllAsync"],"mappings":"kwBAgBA,MAAMA,EAAa,uBACbC,EAAoB,CACtB,GAAAC,CAAIC,EAAOC,GACP,OAAQD,GACJ,KAAKE,EAASC,MACVC,QAAQC,MAAMJ,GACd,MACJ,KAAKC,EAASI,KACVF,QAAQG,KAAKN,GACb,MACJ,KAAKC,EAASM,KACVJ,QAAQK,KAAKR,GACb,MACJ,KAAKC,EAASQ,MACVN,QAAQO,MAAMV,GAG1B,GChBG,MAAMW,EAAeC,OAAO,gBAY5B,SAASC,EAAaC,GACzB,MAAMC,EAAeC,EAAeF,GAC9BG,EDIH,SAA2BH,GAC9B,IAAII,EACJ,MAAMC,EAAuC,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