{"version":3,"file":"auto.mjs","sources":["../../loader/dist/index.mjs","../src/factory.tsx","../src/auto.tsx"],"sourcesContent":["const e=\"__humanbehaviorLoader\";function n(e){return/^(get|has|is)[A-Z]/.test(e)}function t(e){return new Proxy({},{get(t,o){if(\"string\"!=typeof o)return;const r=e.real;if(r){const e=r[o];return\"function\"==typeof e?e.bind(r):e}const i=function(e,n){return\"then\"===n||\"catch\"===n||\"finally\"===n?{value:void 0}:\"initializationPromise\"===n?{value:e.ready}:null}(e,o);return i?i.value:(...t)=>{if(!n(o))return e.failed?Promise.resolve(void 0):new Promise((n,r)=>{e.q.push({m:o,a:t,res:n,rej:r})})}}})}function o(e){e.failed=!0;const n=e.q.splice(0,e.q.length);for(const e of n)e.res(void 0);console.warn(\"[HumanBehavior] recorder could not be loaded, so nothing will be recorded. This is usually a blocked request (ad blocker, content blocker) or a Content-Security-Policy that does not allow the CDN.\"),e.settle?.()}const r=\"undefined\"!=typeof window&&\"undefined\"!=typeof document;const i={init(i,c={}){if(!r)return new Proxy({},{get(e,t){if(\"string\"==typeof t&&\"then\"!==t&&\"catch\"!==t&&\"finally\"!==t){if(\"initializationPromise\"===t)return Promise.resolve();if(!n(t))return()=>Promise.resolve(void 0)}}});const l=function(){const n=window;let t=n[e];if(!t){let o;t={v:1,q:[],cfg:null,real:null,failed:!1,ready:new Promise(e=>{o=e}),settle:o},n[e]=t}return t}();if(l.cfg)return t(l);const{cdnUrl:s,version:a,...u}=c;return l.cfg={apiKey:i,options:u,cdnUrl:s||\"https://cdn.humanbehavior.co\",version:a},function(e,n){const t=document.createElement(\"script\");t.async=!0,t.src=e.replace(/\\/$/,\"\")+\"/v1/loader.js\",t.onerror=()=>o(n),(document.head||document.documentElement).appendChild(t),setTimeout(()=>{n.real||n.failed||o(n)},15e3)}(l.cfg.cdnUrl,l),t(l)}};export{i as HumanBehaviorTracker,i as default};\n//# sourceMappingURL=index.mjs.map\n","import React, { useEffect, useState, createContext, useContext, ReactNode, useCallback, useMemo, useRef } from \"react\";\nimport type { HumanBehaviorTracker } from \"humanbehavior-js\";\n\n/**\n * The React surface, with the recorder held at arm's length.\n *\n * Everything here used to import the bundled tracker directly, which meant any\n * app importing the provider also shipped rrweb and the whole recorder in its\n * own build - and could only get SDK fixes by reinstalling. The logic is\n * unchanged; it now receives whatever provides `init`, so the same provider can\n * be bound to the bundled recorder (`humanbehavior-js/react`) or to the\n * auto-updating loader (`humanbehavior-js/react/auto`).\n *\n * The tracker type is imported for types only, so it is erased at build time and\n * never pulls the recorder into a bundle.\n */\n\n/** Anything that can produce a tracker: the bundled class, or the CDN loader stub. */\nexport interface TrackerHost {\n  init(apiKey: string, options: Record<string, any>): any;\n}\n\nexport interface FactoryLogger {\n  error: (...args: any[]) => void;\n  warn: (...args: any[]) => void;\n  debug: (...args: any[]) => void;\n}\n\n// Check if we're in a browser environment\nconst isBrowser = () => typeof window !== 'undefined';\n\n// `identityToken` is minted by the app's own backend for a user it has already\n// authenticated. Projects that require identity verification reject an identify\n// that claims an externalUserId without one.\nexport interface IdentifyUserArgs {\n  userProperties: Record<string, any>;\n  identityToken?: string;\n}\n\n// Define the public interface that components will interact with\nexport interface HumanBehaviorInterface {\n  addEvent: (event: any) => void;\n  identifyUser: (args: IdentifyUserArgs) => Promise<string>;\n  start: () => void;\n  stop: () => void;\n  logout: () => void;\n  viewLogs: () => void;\n  setUnredactedFields: (fields: string[]) => void;\n  hasUnredactedFields: () => boolean;\n  getUnredactedFields: () => string[];\n  trackPageView: () => void;\n}\n\nexport interface HumanBehaviorProviderProps {\n  // Either provide an apiKey to create a new client, or provide an existing client\n  apiKey?: string;\n  client?: HumanBehaviorTracker;\n  children: ReactNode;\n  options?: {\n    ingestionUrl?: string;\n    logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';\n    redactFields?: string[]; // DEPRECATED: Use redactionStrategy instead\n    redactionStrategy?: {\n      mode: 'privacy-first' | 'visibility-first'; // Default: 'privacy-first'\n      unredactFields?: string[]; // Fields to make visible (when mode: 'privacy-first')\n      redactFields?: string[];   // Fields to hide (when mode: 'visibility-first')\n    };\n    enableAutomaticTracking?: boolean;\n    suppressConsoleErrors?: boolean;\n    recordCanvas?: boolean; // Enable canvas recording with protection\n    enableAutomaticProperties?: boolean; // Enable automatic property detection\n    propertyDenylist?: string[]; // Properties to exclude from tracking\n    automaticTrackingOptions?: {\n      trackButtons?: boolean;\n      trackLinks?: boolean;\n      trackForms?: boolean;\n      includeText?: boolean;\n      includeClasses?: boolean;\n    };\n    maxQueueSize?: number; // Configurable queue size\n    enableConsoleTracking?: boolean; // Enable console warn/error tracking (default: true, set to false to opt-out)\n    enableNetworkTracking?: boolean; // Enable network error tracking (default: true, set to false to opt-out)\n    enableErrorTracking?: boolean; // Enable crash/error capture (default: true, set to false to opt-out)\n    enableWebVitals?: boolean; // Enable Core Web Vitals tracking (FCP/LCP/CLS/INP/TTFB) (default: true, set to false to opt-out)\n    enableTracing?: boolean; // Enable distributed tracing (page-load/resource/custom spans) (default: true, set to false to opt-out)\n    release?: string; // App release/version stamped on each error\n    environment?: string; // Deployment environment stamped on each error\n    commitSha?: string; // Git commit SHA stamped on each error report (enables GitHub blob links)\n    dist?: string; // Build/dist discriminator stamped on each error report (pairs with release for source-map lookup)\n    captureRequestBodies?: boolean; // Opt-in: attach redacted request/response bodies + headers to error-correlated requests (default: false)\n    /** Auto-updating installs only: serve the loader from your own origin. */\n    cdnUrl?: string;\n    /** Auto-updating installs only: pin an exact recorder build. */\n    version?: string;\n  };\n}\n\nexport interface ErrorBoundaryProps {\n  children: ReactNode;\n  fallback?: ReactNode;\n  client?: HumanBehaviorTracker;\n  onError?: (error: Error, componentStack: string | null) => void;\n}\n\nexport interface ErrorBoundaryState {\n  hasError: boolean;\n}\n\nexport function createHumanBehaviorReact(host: TrackerHost, log: FactoryLogger) {\n  const HumanBehaviorContext = createContext<HumanBehaviorTracker | HumanBehaviorInterface | null>(null);\n\n  // Memoized queuing implementation for initialization period\n  const createQueuingImplementation = (queueEvent: (event: any) => void): HumanBehaviorInterface => ({\n    addEvent: (event: any) => {\n      queueEvent(event);\n    },\n    identifyUser: async ({ userProperties, identityToken }: IdentifyUserArgs) => {\n      queueEvent({\n        type: 'identify',\n        userProperties,\n        identityToken,\n      });\n      return ''; // Return empty string to match interface\n    },\n    start: () => {\n      // Start will be called automatically when initialized\n    },\n    stop: () => {\n      // Stop is a no-op when not initialized\n    },\n    logout: () => {\n      // Logout is a no-op when not initialized\n    },\n    viewLogs: () => {\n      log.warn('Logs are not available until HumanBehaviorTracker is initialized');\n    },\n    setUnredactedFields: () => {},\n    hasUnredactedFields: () => false,\n    getUnredactedFields: () => [],\n    trackPageView: () => {},\n  });\n\n  // Automatic page tracking component\n  function HumanBehaviorPageView() {\n    const tracker = useContext(HumanBehaviorContext);\n\n    useEffect(() => {\n      if (tracker && typeof window !== 'undefined') {\n        // Track initial page load\n        tracker.trackPageView();\n\n        // Listen for route changes (for SPAs)\n        const handleRouteChange = () => {\n          tracker.trackPageView();\n        };\n\n        // Listen for popstate (back/forward navigation)\n        window.addEventListener('popstate', handleRouteChange);\n\n        // Listen for pushstate/replacestate (programmatic navigation)\n        const originalPushState = history.pushState;\n        const originalReplaceState = history.replaceState;\n\n        history.pushState = function(...args) {\n          originalPushState.apply(this, args);\n          handleRouteChange();\n        };\n\n        history.replaceState = function(...args) {\n          originalReplaceState.apply(this, args);\n          handleRouteChange();\n        };\n\n        return () => {\n          window.removeEventListener('popstate', handleRouteChange);\n          history.pushState = originalPushState;\n          history.replaceState = originalReplaceState;\n        };\n      }\n    }, [tracker]);\n\n    return null;\n  }\n\n  const HumanBehaviorProvider = ({ apiKey, client, children, options }: HumanBehaviorProviderProps) => {\n    const [humanBehavior, setHumanBehavior] = useState<HumanBehaviorTracker | null>(client || null);\n    const [eventQueue, setEventQueue] = useState<any[]>([]);\n    const [isMounted, setIsMounted] = useState(false);\n    const [isInitialized, setIsInitialized] = useState(false);\n\n    // Use refs to avoid dependency issues in useEffect\n    const apiKeyRef = useRef(apiKey);\n    const clientRef = useRef(client);\n    const eventQueueRef = useRef(eventQueue);\n\n    // Update refs when props change\n    useEffect(() => {\n      apiKeyRef.current = apiKey;\n      clientRef.current = client;\n    }, [apiKey, client]);\n\n    // Update eventQueue ref when queue changes\n    useEffect(() => {\n      eventQueueRef.current = eventQueue;\n    }, [eventQueue]);\n\n    // Memoized queueEvent function to prevent unnecessary re-renders\n    const queueEvent = useCallback((event: any) => {\n      setEventQueue(prev => [...prev, event]);\n    }, []);\n\n    // Handle mounting state\n    useEffect(() => {\n      setIsMounted(true);\n    }, []);\n\n    useEffect(() => {\n      // Only run in browser\n      if (!(isBrowser())) {\n        return;\n      }\n\n      // If client is provided, use that\n      if (clientRef.current) {\n        setHumanBehavior(clientRef.current);\n        setIsInitialized(true);\n        return;\n      }\n\n      // If no client is provided, apiKey is required\n      if (!apiKeyRef.current || apiKeyRef.current.trim() === '') {\n        log.error(\"An apiKey is required when no client is provided\");\n        return;\n      }\n\n      // Prevent multiple initializations\n      if (humanBehavior !== null) {\n        return;\n      }\n\n      try {\n\n        // Create new tracker instance with the validated apiKey and options\n        const tracker = host.init(\n          apiKeyRef.current.trim(),\n          {\n            ingestionUrl: options?.ingestionUrl,\n            logLevel: options?.logLevel,\n            redactFields: options?.redactFields, // Legacy support\n            redactionStrategy: options?.redactionStrategy, // New redaction strategy\n            enableAutomaticTracking: options?.enableAutomaticTracking,\n            suppressConsoleErrors: options?.suppressConsoleErrors,\n            recordCanvas: options?.recordCanvas,\n            enableAutomaticProperties: options?.enableAutomaticProperties,\n            propertyDenylist: options?.propertyDenylist,\n            automaticTrackingOptions: options?.automaticTrackingOptions,\n            maxQueueSize: options?.maxQueueSize,\n            enableConsoleTracking: options?.enableConsoleTracking,\n            enableNetworkTracking: options?.enableNetworkTracking,\n            enableErrorTracking: options?.enableErrorTracking,\n            enableWebVitals: options?.enableWebVitals,\n            enableTracing: options?.enableTracing,\n            release: options?.release,\n            environment: options?.environment,\n            commitSha: options?.commitSha,\n            dist: options?.dist,\n            captureRequestBodies: options?.captureRequestBodies,\n            cdnUrl: options?.cdnUrl,\n            version: options?.version,\n          }\n        );\n\n        setHumanBehavior(tracker);\n\n        // Mark as initialized immediately (don't wait for server init)\n        setIsInitialized(true);\n\n        // Start tracking in background\n        tracker.initializationPromise?.then(async () => {\n            // Only start if not already started\n            if (!tracker.isTrackerStarted) {\n                await tracker.start();\n            }\n\n          // Process any queued events\n          const currentQueue = eventQueueRef.current;\n          if (currentQueue.length > 0) {\n            for (const event of currentQueue) {\n              if (event.type === 'identify') {\n                log.debug('Processing queued identify event', event);\n                try {\n                  await tracker.identifyUser({\n                    userProperties: event.userProperties,\n                    identityToken: event.identityToken,\n                  });\n                } catch (error) {\n                  log.error('Failed to process queued user info:', error);\n                }\n              } else {\n                tracker.addEvent(event);\n              }\n            }\n            setEventQueue([]); // Clear the queue\n          }\n        }).catch((error: unknown) => {\n          log.error('Failed to initialize HumanBehaviorTracker:', error);\n        });\n      } catch (error) {\n        log.error('Failed to create HumanBehaviorTracker:', error);\n      }\n    }, [isMounted]); // Removed humanBehavior from dependencies to prevent infinite loop\n\n    // Memoized context value to prevent unnecessary re-renders\n    const contextValue = useMemo(() => {\n      if (!isMounted) {\n        return createQueuingImplementation(queueEvent);\n      }\n\n      if (!isInitialized) {\n        return createQueuingImplementation(queueEvent);\n      }\n\n      return humanBehavior;\n    }, [isMounted, isInitialized, humanBehavior, queueEvent]);\n\n    // If not in browser, render children without context\n    if (!(isBrowser())) {\n      return <>{children}</>;\n    }\n\n    return (\n      <HumanBehaviorContext.Provider value={contextValue}>\n        <HumanBehaviorPageView />\n        {children}\n      </HumanBehaviorContext.Provider>\n    );\n  };\n\n  const useHumanBehavior = () => {\n    const tracker = useContext(HumanBehaviorContext);\n    if (!tracker) {\n      throw new Error('useHumanBehavior must be used within a HumanBehaviorProvider');\n    }\n    return tracker;\n  };\n\n  // Custom hook for managing unredaction fields dynamically\n  const useRedaction = () => {\n    const tracker = useHumanBehavior();\n\n    const setUnredactedFields = useCallback((fields: string[]) => {\n      tracker.setUnredactedFields(fields);\n    }, [tracker]);\n\n    const hasUnredactedFields = useCallback(() => {\n      return tracker.hasUnredactedFields();\n    }, [tracker]);\n\n    const getUnredactedFields = useCallback(() => {\n      return tracker.getUnredactedFields();\n    }, [tracker]);\n\n    return {\n      setUnredactedFields,\n      hasUnredactedFields,\n      getUnredactedFields\n    };\n  };\n\n  // Custom hook for managing user info\n  const useUserTracking = () => {\n    const tracker = useHumanBehavior();\n\n    const identifyUser = useCallback(async ({ userProperties, identityToken }: IdentifyUserArgs) => {\n      try {\n        await tracker.identifyUser({ userProperties, identityToken });\n        return { success: true };\n      } catch (error) {\n        log.error('Failed to identify user:', error);\n        return { success: false, error };\n      }\n    }, [tracker]);\n\n    return {\n      identifyUser\n    };\n  };\n\n  // Error boundary that reports React render crashes (with the component stack)\n  // to HumanBehavior, then renders an optional fallback. Wrap any subtree:\n  //   <HumanBehaviorErrorBoundary fallback={<Oops />}> ... </HumanBehaviorErrorBoundary>\n  // It reads the tracker from context (or an explicit `client` prop) and calls\n  // `tracker.captureException(error, { componentStack, mechanism: 'react' })`.\n  class HumanBehaviorErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n    static contextType = HumanBehaviorContext;\n    declare context: React.ContextType<typeof HumanBehaviorContext>;\n\n    constructor(props: ErrorBoundaryProps) {\n      super(props);\n      this.state = { hasError: false };\n    }\n\n    static getDerivedStateFromError(): ErrorBoundaryState {\n      return { hasError: true };\n    }\n\n    componentDidCatch(error: Error, info: React.ErrorInfo) {\n      const componentStack = info?.componentStack ?? null;\n      try {\n        const tracker = this.props.client ?? this.context;\n        if (tracker && typeof (tracker as HumanBehaviorTracker).captureException === 'function') {\n          (tracker as HumanBehaviorTracker).captureException(error, {\n            componentStack: componentStack ?? undefined,\n            mechanism: 'react',\n          });\n        }\n      } catch {\n        // Reporting must never break the host app.\n      }\n      try {\n        this.props.onError?.(error, componentStack);\n      } catch {\n        // Ignore consumer callback errors.\n      }\n    }\n\n    render() {\n      if (this.state.hasError) {\n        return this.props.fallback ?? null;\n      }\n      return this.props.children;\n    }\n  }\n\n  return {\n    HumanBehaviorContext,\n    HumanBehaviorProvider,\n    useHumanBehavior,\n    useRedaction,\n    useUserTracking,\n    // Annotated, not inferred. A class created inside a function infers to a\n    // structural constructor type that has lost its relationship to\n    // React.Component, and TypeScript then rejects `<HumanBehaviorErrorBoundary>`\n    // with TS2786 in the consumer's build.\n    HumanBehaviorErrorBoundary:\n      HumanBehaviorErrorBoundary as React.ComponentClass<ErrorBoundaryProps, ErrorBoundaryState>,\n  };\n}\n\n// Next.js App Router route-error helper.\n//\n// Next renders `app/error.tsx` / `app/global-error.tsx` (client components) when\n// a route segment throws on the client. These boundaries are frequently mounted\n// OUTSIDE the HumanBehaviorProvider tree (global-error.tsx replaces the root\n// layout), so this resolves the tracker from the global singleton (or an\n// explicit `client`) rather than React context. Use it from the boundary:\n//\n//   'use client';\n//   import { captureNextError } from 'humanbehavior-js/react';\n//   export default function Error({ error, reset }) {\n//     useEffect(() => { captureNextError(error); }, [error]);\n//     return <button onClick={reset}>Try again</button>;\n//   }\n//\n// Limitation: captures CLIENT-side route errors only. Server Component / RSC\n// errors that never reach the browser require a Next server module\n// (instrumentation.ts `onRequestError`) and are out of scope for this browser SDK.\n//\n// On an auto-updating install the global singleton is published by the recorder\n// once it arrives, so an error thrown in the first few hundred milliseconds of a\n// page load is not reported.\nexport function captureNextError(\n  error: unknown,\n  options?: { client?: HumanBehaviorTracker; componentStack?: string }\n): void {\n  try {\n    const tracker =\n      options?.client ??\n      (typeof window !== 'undefined'\n        ? ((window as unknown as { __humanBehaviorGlobalTracker?: HumanBehaviorTracker }).__humanBehaviorGlobalTracker)\n        : undefined);\n    if (tracker && typeof tracker.captureException === 'function') {\n      tracker.captureException(error, {\n        componentStack: options?.componentStack,\n        mechanism: 'react',\n      });\n    }\n  } catch {\n    // Reporting must never break the host app.\n  }\n}\n","/**\n * `humanbehavior-js/react/auto` - the auto-updating React integration.\n *\n * Identical surface to `humanbehavior-js/react`, except the recorder is fetched\n * from the CDN at runtime instead of bundled, so a recorder we publish reaches\n * the customer's users on their next page load with no reinstall.\n *\n * Nothing here may import `humanbehavior-js`: that would pull the recorder back\n * into the customer's build and defeat the point. `tests/no-recorder-in-auto-bundle`\n * in the package's unit tests fails the build if it ever creeps back in.\n */\n\nimport { HumanBehaviorTracker } from \"@humanbehavior/loader\";\nimport { createHumanBehaviorReact } from \"./factory\";\n\n// The SDK's own logger lives in the recorder, which by definition is not here\n// yet. These few messages are developer-facing integration errors, so the\n// console is the right destination for them anyway.\nconst react = createHumanBehaviorReact(HumanBehaviorTracker, {\n  /* eslint-disable no-console */\n  error: (...args: any[]) => console.error('[HumanBehavior]', ...args),\n  warn: (...args: any[]) => console.warn('[HumanBehavior]', ...args),\n  debug: () => {},\n  /* eslint-enable no-console */\n});\n\nexport const HumanBehaviorProvider = react.HumanBehaviorProvider;\nexport const useHumanBehavior = react.useHumanBehavior;\nexport const useRedaction = react.useRedaction;\nexport const useUserTracking = react.useUserTracking;\nexport const HumanBehaviorErrorBoundary = react.HumanBehaviorErrorBoundary;\n/** Matches the bundled entry, where this name works as a type as well. */\nexport type HumanBehaviorErrorBoundary = InstanceType<typeof react.HumanBehaviorErrorBoundary>;\n\nexport { captureNextError } from \"./factory\";\nexport type { IdentifyUserArgs } from \"./factory\";\n\nexport { HumanBehaviorTracker };\n"],"names":["e","n","test","t","Proxy","get","o","r","real","bind","i","value","ready","failed","Promise","resolve","q","push","m","a","res","rej","splice","length","console","warn","settle","window","document","init","c","l","v","cfg","cdnUrl","s","version","u","apiKey","options","createElement","async","src","replace","onerror","head","documentElement","appendChild","setTimeout","isBrowser","captureNextError","error","tracker","client","undefined","captureException","componentStack","mechanism","react","host","log","HumanBehaviorContext","createContext","createQueuingImplementation","queueEvent","addEvent","event","identifyUser","userProperties","identityToken","type","start","stop","logout","viewLogs","setUnredactedFields","hasUnredactedFields","getUnredactedFields","trackPageView","HumanBehaviorPageView","useContext","useEffect","handleRouteChange","addEventListener","originalPushState","history","pushState","originalReplaceState","replaceState","args","apply","this","removeEventListener","useHumanBehavior","Error","HumanBehaviorErrorBoundary","React","Component","constructor","props","super","state","hasError","getDerivedStateFromError","componentDidCatch","info","context","onError","render","fallback","children","contextType","HumanBehaviorProvider","humanBehavior","setHumanBehavior","useState","eventQueue","setEventQueue","isMounted","setIsMounted","isInitialized","setIsInitialized","apiKeyRef","useRef","clientRef","eventQueueRef","current","useCallback","prev","trim","ingestionUrl","logLevel","redactFields","redactionStrategy","enableAutomaticTracking","suppressConsoleErrors","recordCanvas","enableAutomaticProperties","propertyDenylist","automaticTrackingOptions","maxQueueSize","enableConsoleTracking","enableNetworkTracking","enableErrorTracking","enableWebVitals","enableTracing","release","environment","commitSha","dist","captureRequestBodies","initializationPromise","then","isTrackerStarted","currentQueue","debug","catch","contextValue","useMemo","_jsxs","Provider","_jsx","_Fragment","useRedaction","fields","useUserTracking","success","createHumanBehaviorReact","HumanBehaviorTracker"],"mappings":"gMAAA,MAAMA,EAAE,wBAAwB,SAASC,EAAED,GAAG,MAAM,qBAAqBE,KAAKF,EAAE,CAAC,SAASG,EAAEH,GAAG,OAAO,IAAII,MAAM,CAAA,EAAG,CAAC,GAAAC,CAAIF,EAAEG,GAAG,GAAG,iBAAiBA,EAAE,OAAO,MAAMC,EAAEP,EAAEQ,KAAK,GAAGD,EAAE,CAAC,MAAMP,EAAEO,EAAED,GAAG,MAAM,mBAAmBN,EAAEA,EAAES,KAAKF,GAAGP,CAAC,CAAC,MAAMU,EAAE,SAASV,EAAEC,GAAG,MAAM,SAASA,GAAG,UAAUA,GAAG,YAAYA,EAAE,CAACU,WAAM,GAAQ,0BAA0BV,EAAE,CAACU,MAAMX,EAAEY,OAAO,IAAI,CAA1H,CAA4HZ,EAAEM,GAAG,OAAOI,EAAEA,EAAEC,MAAM,IAAIR,KAAK,IAAIF,EAAEK,GAAG,OAAON,EAAEa,OAAOC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