@preprio/prepr-nextjs 1.3.2 → 2.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +55 -144
  3. package/dist/chunk-E7ATRJ2F.js +2 -0
  4. package/dist/chunk-E7ATRJ2F.js.map +1 -0
  5. package/dist/index.css +1 -0
  6. package/dist/metafile-cjs.json +1 -0
  7. package/dist/metafile-esm.json +1 -0
  8. package/dist/middleware/index.cjs +2 -0
  9. package/dist/middleware/index.cjs.map +1 -0
  10. package/dist/middleware/index.d.cts +10 -0
  11. package/dist/middleware/index.d.ts +10 -0
  12. package/dist/middleware/index.js +2 -0
  13. package/dist/middleware/index.js.map +1 -0
  14. package/dist/react/index.cjs +3 -0
  15. package/dist/react/index.cjs.map +1 -0
  16. package/dist/react/index.d.cts +226 -0
  17. package/dist/react/index.d.ts +226 -0
  18. package/dist/react/index.js +3 -0
  19. package/dist/react/index.js.map +1 -0
  20. package/dist/server/index.cjs +7 -0
  21. package/dist/server/index.cjs.map +1 -0
  22. package/dist/{index.d.mts → server/index.d.cts} +6 -17
  23. package/dist/{index.d.ts → server/index.d.ts} +6 -17
  24. package/dist/server/index.js +7 -0
  25. package/dist/server/index.js.map +1 -0
  26. package/dist/types/index.cjs +2 -0
  27. package/dist/types/index.cjs.map +1 -0
  28. package/dist/types/index.d.cts +14 -0
  29. package/dist/types/index.d.ts +14 -0
  30. package/dist/types/index.js +2 -0
  31. package/dist/types/index.js.map +1 -0
  32. package/dist/utils/index.cjs +2 -0
  33. package/dist/utils/index.cjs.map +1 -0
  34. package/dist/utils/index.d.cts +138 -0
  35. package/dist/utils/index.d.ts +138 -0
  36. package/dist/utils/index.js +2 -0
  37. package/dist/utils/index.js.map +1 -0
  38. package/package.json +104 -59
  39. package/dist/chunk-IQXHJV5O.mjs +0 -25
  40. package/dist/chunk-IQXHJV5O.mjs.map +0 -1
  41. package/dist/components.css +0 -430
  42. package/dist/components.css.map +0 -1
  43. package/dist/components.d.mts +0 -10
  44. package/dist/components.d.ts +0 -10
  45. package/dist/components.js +0 -415
  46. package/dist/components.js.map +0 -1
  47. package/dist/components.mjs +0 -388
  48. package/dist/components.mjs.map +0 -1
  49. package/dist/index.js +0 -325
  50. package/dist/index.js.map +0 -1
  51. package/dist/index.mjs +0 -279
  52. package/dist/index.mjs.map +0 -1
  53. package/dist/types-DmITW6Tn.d.mts +0 -6
  54. package/dist/types-DmITW6Tn.d.ts +0 -6
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/react/index.tsx","../../src/react/prepr-previewbar-provider.tsx","../../src/react/contexts/segment-context.tsx","../../src/utils/errors.ts","../../src/react/contexts/variant-context.tsx","../../src/react/contexts/edit-mode-context.tsx","../../src/react/components/error-boundary.tsx","../../src/utils/debug.ts","../../src/react/components/prepr-preview-bar.tsx","../../src/react/hooks/useStegaScan.tsx","../../src/utils/dom.ts","../../src/utils/performance.ts","../../src/react/hooks/useStegaOverlay.tsx","../../src/react/hooks/useStegaProximity.tsx","../../src/react/hooks/useStegaElements.tsx","../../src/react/components/preview-bar-wrapper.tsx","../../src/react/components/preview-bar/preview-bar.tsx","../../src/utils/index.ts","../../src/react/hooks/useModal.ts","../../src/react/components/preview-bar/preview-bar-content.tsx","../../src/react/components/logo.tsx","../../src/react/components/segment-dropdown.tsx","../../src/react/components/icons/sort-down.tsx","../../src/react/components/variant-selector.tsx","../../src/react/components/radio-selector.tsx","../../src/react/components/edit-mode-selector.tsx","../../src/react/components/reset-button.tsx","../../src/react/components/icons/rotate.tsx","../../src/react/components/preview-bar/preview-bar-button.tsx","../../src/react/components/icon.tsx","../../src/react/components/preview-bar-indicator-wrapper.tsx","../../src/react/components/status-indicator-pill.tsx","../../src/react/components/close-edit-mode-pill.tsx","../../src/react/components/icons/xmark.tsx","../../src/react/hooks/useScrollPosition.tsx"],"sourcesContent":["'use client';\n\n// Main exports\nexport {\n PreprPreviewBarProvider,\n usePreprPreviewBar,\n} from './prepr-previewbar-provider';\n\nexport { default as PreprPreviewBar } from './components/prepr-preview-bar';\n\n// Context exports\nexport * from './contexts';\n\n// Hook exports\nexport { default as useStegaScan } from './hooks/useStegaScan';\nexport { useStegaOverlay } from './hooks/useStegaOverlay';\nexport { useStegaProximity } from './hooks/useStegaProximity';\nexport { useStegaElements } from './hooks/useStegaElements';\nexport { useModal } from './hooks/useModal';\nexport { default as useScrollPosition } from './hooks/useScrollPosition';\n\n// Debug utilities\nexport {\n debugLog,\n debugWarn,\n debugError,\n createScopedLogger,\n} from '../utils/debug';\n\n// Component exports\nexport { StegaErrorBoundary } from './components/error-boundary';\nexport { default as PreviewBar } from './components/preview-bar/preview-bar';\nexport { default as PreviewBarWrapper } from './components/preview-bar-wrapper';\nexport { default as PreviewBarIndicatorWrapper } from './components/preview-bar-indicator-wrapper';\nexport { default as SegmentDropdown } from './components/segment-dropdown';\nexport { default as VariantSelector } from './components/variant-selector';\nexport { default as EditModeSelector } from './components/edit-mode-selector';\nexport { default as ResetButton } from './components/reset-button';\nexport { default as Logo } from './components/logo';\n","'use client';\n\nimport React, { ReactNode, useEffect } from 'react';\nimport { PreprPreviewBarOptions, PreprPreviewBarProps } from '../types';\nimport {\n SegmentProvider,\n VariantProvider,\n EditModeProvider,\n useSegmentContext,\n useVariantContext,\n useEditModeContext,\n} from './contexts';\nimport { StegaErrorBoundary } from './components/error-boundary';\nimport { initDebugLogger } from '../utils/debug';\n\ninterface PreprPreviewBarProviderProps {\n children: ReactNode;\n props: PreprPreviewBarProps;\n options?: PreprPreviewBarOptions;\n}\n\nexport const PreprPreviewBarProvider: React.FC<\n PreprPreviewBarProviderProps\n> = ({ children, props, options }) => {\n const { activeSegment, activeVariant, data } = props;\n\n // Initialize debug logger with options\n useEffect(() => {\n const debugEnabled = options?.debug ?? false;\n initDebugLogger(debugEnabled);\n }, [options?.debug]);\n\n return (\n <StegaErrorBoundary>\n <SegmentProvider initialSegments={data} activeSegment={activeSegment}>\n <VariantProvider activeVariant={activeVariant}>\n <EditModeProvider>{children}</EditModeProvider>\n </VariantProvider>\n </SegmentProvider>\n </StegaErrorBoundary>\n );\n};\n\n// Legacy hook for backward compatibility\nexport const usePreprPreviewBar = () => {\n // This will be deprecated in favor of specific context hooks\n // but kept for backward compatibility\n const segmentContext = useSegmentContext();\n const variantContext = useVariantContext();\n const editModeContext = useEditModeContext();\n\n return {\n isPreviewMode: false,\n activeSegment: segmentContext.selectedSegment._id,\n activeVariant: variantContext.selectedVariant,\n data: segmentContext.segments,\n emptySegment: segmentContext.emptySegment,\n segmentList: segmentContext.segments,\n selectedSegment: segmentContext.selectedSegment,\n setSelectedSegment: segmentContext.setSelectedSegment,\n emptyVariant: variantContext.emptyVariant,\n selectedVariant: variantContext.selectedVariant,\n setSelectedVariant: variantContext.setSelectedVariant,\n editMode: editModeContext.editMode,\n setEditMode: editModeContext.setEditMode,\n isIframe: editModeContext.isIframe,\n resetSelected: () => {\n segmentContext.setSelectedSegment(segmentContext.emptySegment);\n variantContext.setSelectedVariant(variantContext.emptyVariant);\n editModeContext.setEditMode(false);\n },\n };\n};\n","'use client';\n\nimport React, { createContext, useContext, useState, ReactNode } from 'react';\nimport { PreprSegment } from '../../types';\nimport { handleContextError } from '../../utils/errors';\n\ninterface SegmentContextValue {\n segments: PreprSegment[];\n selectedSegment: PreprSegment;\n setSelectedSegment: (segment: PreprSegment) => void;\n emptySegment: PreprSegment;\n}\n\nconst SegmentContext = createContext<SegmentContextValue | undefined>(\n undefined\n);\n\ninterface SegmentProviderProps {\n children: ReactNode;\n initialSegments: PreprSegment[];\n activeSegment?: string | null;\n}\n\nexport function SegmentProvider({\n children,\n initialSegments,\n activeSegment,\n}: SegmentProviderProps) {\n const segmentList = [\n {\n _id: 'all_other_users',\n name: 'All other users',\n },\n ...initialSegments,\n ];\n\n const emptySegment: PreprSegment = {\n name: 'Choose segment',\n _id: 'null',\n };\n\n const [selectedSegment, setSelectedSegment] = useState<PreprSegment>(\n (segmentList &&\n segmentList.filter(\n (segmentData: PreprSegment) => segmentData._id === activeSegment\n )[0]) ||\n emptySegment\n );\n\n const value: SegmentContextValue = {\n segments: segmentList,\n selectedSegment,\n setSelectedSegment,\n emptySegment,\n };\n\n return (\n <SegmentContext.Provider value={value}>{children}</SegmentContext.Provider>\n );\n}\n\nexport function useSegmentContext(): SegmentContextValue {\n const context = useContext(SegmentContext);\n if (!context) {\n handleContextError('useSegmentContext');\n }\n return context!;\n}\n","export const StegaError = {\n DECODE_FAILED: 'STEGA_DECODE_FAILED',\n INVALID_FORMAT: 'STEGA_INVALID_FORMAT',\n DOM_MANIPULATION_FAILED: 'DOM_MANIPULATION_FAILED',\n CONTEXT_NOT_FOUND: 'CONTEXT_NOT_FOUND',\n} as const;\n\nexport type StegaErrorType = (typeof StegaError)[keyof typeof StegaError];\n\n// Define specific types for error additional data\nexport interface ErrorAdditionalData {\n input?: string;\n element?: HTMLElement;\n context?: string;\n [key: string]: string | HTMLElement | undefined;\n}\n\nexport interface ErrorInfo {\n type: StegaErrorType;\n context: string;\n message: string;\n timestamp: string;\n stack?: string;\n additionalData?: ErrorAdditionalData;\n}\n\nexport function createErrorInfo(\n type: StegaErrorType,\n context: string,\n error: Error,\n additionalData?: ErrorAdditionalData\n): ErrorInfo {\n return {\n type,\n context,\n message: error.message,\n timestamp: new Date().toISOString(),\n stack: error.stack,\n additionalData,\n };\n}\n\nexport function handleStegaError(\n error: Error,\n context: string,\n additionalData?: ErrorAdditionalData\n) {\n const errorInfo = createErrorInfo(\n StegaError.DECODE_FAILED,\n context,\n error,\n additionalData\n );\n\n console.error('Stega Error:', errorInfo);\n\n // In production, you might want to send this to an error tracking service\n if (process.env.NODE_ENV === 'production') {\n // sendToErrorTrackingService(errorInfo);\n }\n\n return errorInfo;\n}\n\nexport function handleDOMError(error: Error, context: string) {\n const errorInfo = createErrorInfo(\n StegaError.DOM_MANIPULATION_FAILED,\n context,\n error\n );\n\n console.error('DOM Error:', errorInfo);\n return errorInfo;\n}\n\nexport function handleContextError(contextName: string) {\n const error = new Error(`${contextName} must be used within its provider`);\n const errorInfo = createErrorInfo(\n StegaError.CONTEXT_NOT_FOUND,\n contextName,\n error\n );\n\n console.error('Context Error:', errorInfo);\n throw error;\n}\n","'use client';\n\nimport React, { createContext, useContext, useState, ReactNode } from 'react';\nimport { handleContextError } from '../../utils/errors';\n\ninterface VariantContextValue {\n selectedVariant: string | null;\n setSelectedVariant: (variant: string | null) => void;\n emptyVariant: string;\n}\n\nconst VariantContext = createContext<VariantContextValue | undefined>(\n undefined\n);\n\ninterface VariantProviderProps {\n children: ReactNode;\n activeVariant?: string | null;\n}\n\nexport function VariantProvider({\n children,\n activeVariant,\n}: VariantProviderProps) {\n const emptyVariant = 'null';\n\n const [selectedVariant, setSelectedVariant] = useState<string | null>(\n activeVariant || 'null'\n );\n\n const value: VariantContextValue = {\n selectedVariant,\n setSelectedVariant,\n emptyVariant,\n };\n\n return (\n <VariantContext.Provider value={value}>{children}</VariantContext.Provider>\n );\n}\n\nexport function useVariantContext(): VariantContextValue {\n const context = useContext(VariantContext);\n if (!context) {\n handleContextError('useVariantContext');\n }\n return context!;\n}\n","'use client';\n\nimport React, {\n createContext,\n useContext,\n useState,\n useEffect,\n ReactNode,\n} from 'react';\nimport { handleContextError } from '../../utils/errors';\n\ninterface EditModeContextValue {\n editMode: boolean;\n setEditMode: (mode: boolean) => void;\n isIframe: boolean;\n}\n\nconst EditModeContext = createContext<EditModeContextValue | undefined>(\n undefined\n);\n\ninterface EditModeProviderProps {\n children: ReactNode;\n}\n\nexport function EditModeProvider({ children }: EditModeProviderProps) {\n const [editMode, setEditMode] = useState(false);\n const [isIframe, setIsIframe] = useState(false);\n\n useEffect(() => {\n if (window.parent !== self) {\n setIsIframe(true);\n }\n }, []);\n\n const value: EditModeContextValue = {\n editMode,\n setEditMode,\n isIframe,\n };\n\n return (\n <EditModeContext.Provider value={value}>\n {children}\n </EditModeContext.Provider>\n );\n}\n\nexport function useEditModeContext(): EditModeContextValue {\n const context = useContext(EditModeContext);\n if (!context) {\n handleContextError('useEditModeContext');\n }\n return context!;\n}\n","'use client';\n\nimport React, { Component, ReactNode } from 'react';\n\ninterface Props {\n children: ReactNode;\n fallback?: ReactNode;\n}\n\ninterface State {\n hasError: boolean;\n error: Error | null;\n}\n\nexport class StegaErrorBoundary extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = { hasError: false, error: null };\n }\n\n static getDerivedStateFromError(error: Error): State {\n return { hasError: true, error };\n }\n\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {\n console.error('Stega Error Boundary caught an error:', error, errorInfo);\n\n // In production, you might want to send this to an error tracking service\n if (process.env.NODE_ENV === 'production') {\n // sendToErrorTrackingService({ error, errorInfo });\n }\n }\n\n render() {\n if (this.state.hasError) {\n if (this.props.fallback) {\n return this.props.fallback;\n }\n\n return (\n <div className=\"p-rounded-lg p-border p-border-red-200 p-bg-red-50 p-p-4 p-text-sm p-text-red-800\">\n <div className=\"p-mb-2 p-font-semibold\">Preview mode unavailable</div>\n <div className=\"p-text-red-600\">\n {this.state.error?.message || 'An unexpected error occurred'}\n </div>\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n","/**\n * Debug utility for Prepr Next.js package\n * Provides centralized debug logging with performance optimizations\n */\n\n// Define specific types for debug arguments\nexport type DebugArg = string | number | boolean | null | undefined | object;\n\ninterface DebugOptions {\n enabled: boolean;\n prefix?: string;\n}\n\nclass DebugLogger {\n private options: DebugOptions;\n\n constructor(options: DebugOptions) {\n this.options = {\n prefix: '[Prepr]',\n ...options,\n };\n }\n\n /**\n * Log a debug message if debug is enabled\n */\n log(message: string, ...args: DebugArg[]): void {\n if (!this.options.enabled) return;\n\n const prefix = this.options.prefix;\n console.log(`${prefix} ${message}`, ...args);\n }\n\n /**\n * Log a debug warning if debug is enabled\n */\n warn(message: string, ...args: DebugArg[]): void {\n if (!this.options.enabled) return;\n\n const prefix = this.options.prefix;\n console.warn(`${prefix} ${message}`, ...args);\n }\n\n /**\n * Log a debug error if debug is enabled\n */\n error(message: string, ...args: DebugArg[]): void {\n if (!this.options.enabled) return;\n\n const prefix = this.options.prefix;\n console.error(`${prefix} ${message}`, ...args);\n }\n\n /**\n * Create a scoped logger with additional context\n */\n scope(scopeName: string): DebugLogger {\n return new DebugLogger({\n ...this.options,\n prefix: `${this.options.prefix}[${scopeName}]`,\n });\n }\n}\n\n// Global debug instance\nlet globalDebugLogger: DebugLogger | null = null;\n\n/**\n * Initialize the debug logger\n */\nexport function initDebugLogger(enabled: boolean = false): void {\n globalDebugLogger = new DebugLogger({ enabled });\n}\n\n/**\n * Get the debug logger instance\n */\nexport function getDebugLogger(): DebugLogger {\n if (!globalDebugLogger) {\n // Fallback to disabled logger if not initialized\n globalDebugLogger = new DebugLogger({ enabled: false });\n }\n return globalDebugLogger;\n}\n\n/**\n * Convenience function for logging\n */\nexport function debugLog(message: string, ...args: DebugArg[]): void {\n getDebugLogger().log(message, ...args);\n}\n\n/**\n * Convenience function for warning\n */\nexport function debugWarn(message: string, ...args: DebugArg[]): void {\n getDebugLogger().warn(message, ...args);\n}\n\n/**\n * Convenience function for errors\n */\nexport function debugError(message: string, ...args: DebugArg[]): void {\n getDebugLogger().error(message, ...args);\n}\n\n/**\n * Create a scoped debug logger\n */\nexport function createScopedLogger(scopeName: string): DebugLogger {\n return getDebugLogger().scope(scopeName);\n}\n","'use client';\n\nimport React from 'react';\nimport { useEditModeContext } from '../contexts';\nimport useStegaScan from '../hooks/useStegaScan';\nimport PreviewBarWrapper from './preview-bar-wrapper';\nimport PreviewBarIndicatorWrapper from './preview-bar-indicator-wrapper';\n\nexport default function PreprPreviewBar() {\n const { editMode } = useEditModeContext();\n\n useStegaScan(editMode);\n\n return (\n <>\n <PreviewBarWrapper />\n <PreviewBarIndicatorWrapper />\n </>\n );\n}\n","import { useEffect, useRef, useCallback, useMemo } from 'react';\nimport { DOMService } from '../../utils/dom';\nimport { createScopedLogger } from '../../utils/debug';\nimport { throttle } from '../../utils/performance';\nimport { useStegaOverlay } from './useStegaOverlay';\nimport { useStegaProximity } from './useStegaProximity';\nimport { useStegaElements } from './useStegaElements';\n\nexport default function useStegaScan(editMode: boolean): void {\n const debug = createScopedLogger('useStegaScan');\n const isInitializedRef = useRef(false);\n\n const {\n currentElementRef,\n hideTimeoutRef,\n createOverlay,\n showOverlay,\n hideOverlay,\n cleanup: cleanupOverlay,\n decode,\n } = useStegaOverlay();\n\n const { updateElementGradients, clearAllHighlights } = useStegaProximity();\n\n const {\n getElements,\n scanDocument,\n setupMutationObserver,\n cleanup: cleanupElements,\n } = useStegaElements();\n\n // Memoize the throttled mouse move handler\n const throttledMouseMove = useMemo(\n () =>\n throttle((e: Event) => {\n const mouseEvent = e as MouseEvent;\n const target = mouseEvent.target as HTMLElement;\n // Early return if hovering over tooltip\n if (target.closest('.prepr-tooltip')) {\n return;\n }\n updateElementGradients(mouseEvent.clientX, mouseEvent.clientY);\n const encodedElement = target.closest('[data-prepr-encoded]');\n if (encodedElement) {\n showOverlay(encodedElement as HTMLElement);\n } else {\n hideOverlay();\n }\n }, 16),\n [updateElementGradients, showOverlay, hideOverlay]\n );\n\n // Memoize tooltip handlers\n const handleTooltipMouseEnter = useCallback(() => {\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n }, [hideTimeoutRef]);\n\n const handleTooltipMouseLeave = useCallback(() => {\n if (!currentElementRef.current) {\n hideOverlay();\n }\n }, [currentElementRef, hideOverlay]);\n\n useEffect(() => {\n debug.log('editMode changed to', editMode);\n if (!editMode) {\n debug.log('editMode is false, cleaning up');\n if (isInitializedRef.current) {\n DOMService.removeEventListener(\n document,\n 'mousemove',\n throttledMouseMove\n );\n cleanupOverlay();\n clearAllHighlights();\n cleanupElements();\n isInitializedRef.current = false;\n }\n return;\n }\n if (isInitializedRef.current) {\n debug.log('already initialized, skipping setup');\n return;\n }\n debug.log('editMode is true, setting up scanning');\n // Create overlay and tooltip elements\n const { tooltip } = createOverlay();\n debug.log('created overlay and tooltip');\n DOMService.addEventListener(tooltip, 'mouseenter', handleTooltipMouseEnter);\n DOMService.addEventListener(tooltip, 'mouseleave', handleTooltipMouseLeave);\n debug.log('starting document scan');\n scanDocument(decode);\n const elements = getElements();\n debug.log('found', elements.length, 'encoded elements after scan');\n setupMutationObserver(decode);\n debug.log('set up mutation observer');\n DOMService.addEventListener(document, 'mousemove', throttledMouseMove);\n debug.log('added throttled mousemove handler');\n isInitializedRef.current = true;\n return () => {\n debug.log('cleaning up');\n DOMService.removeEventListener(document, 'mousemove', throttledMouseMove);\n DOMService.removeEventListener(\n tooltip,\n 'mouseenter',\n handleTooltipMouseEnter\n );\n DOMService.removeEventListener(\n tooltip,\n 'mouseleave',\n handleTooltipMouseLeave\n );\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n }\n cleanupOverlay();\n clearAllHighlights();\n cleanupElements();\n isInitializedRef.current = false;\n };\n }, [editMode]);\n}\n","import { handleDOMError } from './errors';\n\nexport class DOMService {\n /**\n * Creates an HTML element with specified tag and class name\n */\n static createElement(tag: string, className: string): HTMLElement {\n try {\n const element = document.createElement(tag);\n element.className = className;\n return element;\n } catch (error) {\n handleDOMError(error as Error, 'createElement');\n throw error;\n }\n }\n\n /**\n * Appends an element to the document body\n */\n static appendToBody(element: HTMLElement): void {\n try {\n document.body.appendChild(element);\n } catch (error) {\n handleDOMError(error as Error, 'appendToBody');\n throw error;\n }\n }\n\n /**\n * Removes an element from the document body\n */\n static removeFromBody(element: HTMLElement): void {\n try {\n if (element.parentNode) {\n element.parentNode.removeChild(element);\n }\n } catch (error) {\n handleDOMError(error as Error, 'removeFromBody');\n throw error;\n }\n }\n\n /**\n * Sets multiple CSS properties on an element\n */\n static setElementStyles(\n element: HTMLElement,\n styles: Record<string, string>\n ): void {\n try {\n Object.entries(styles).forEach(([property, value]) => {\n element.style.setProperty(property, value);\n });\n } catch (error) {\n handleDOMError(error as Error, 'setElementStyles');\n throw error;\n }\n }\n\n /**\n * Gets the bounding rectangle of an element\n */\n static getElementRect(element: HTMLElement): DOMRect {\n try {\n return element.getBoundingClientRect();\n } catch (error) {\n handleDOMError(error as Error, 'getElementRect');\n throw error;\n }\n }\n\n /**\n * Checks if an element is in the viewport\n */\n static isElementInViewport(element: HTMLElement): boolean {\n try {\n const rect = this.getElementRect(element);\n return (\n rect.top >= 0 &&\n rect.left >= 0 &&\n rect.bottom <=\n (window.innerHeight || document.documentElement.clientHeight) &&\n rect.right <=\n (window.innerWidth || document.documentElement.clientWidth)\n );\n } catch (error) {\n handleDOMError(error as Error, 'isElementInViewport');\n return false;\n }\n }\n\n /**\n * Calculates distance between two points\n */\n static calculateDistance(\n x1: number,\n y1: number,\n x2: number,\n y2: number\n ): number {\n return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n }\n\n /**\n * Finds the closest element to a point from a list of elements\n */\n static findClosestElement(\n pointX: number,\n pointY: number,\n elements: NodeListOf<Element>\n ): HTMLElement | null {\n try {\n let closestElement: HTMLElement | null = null;\n let minDistance = Infinity;\n\n elements.forEach(element => {\n const rect = this.getElementRect(element as HTMLElement);\n const distance = this.calculateDistance(\n pointX,\n pointY,\n rect.left + rect.width / 2,\n rect.top + rect.height / 2\n );\n\n if (distance < minDistance) {\n minDistance = distance;\n closestElement = element as HTMLElement;\n }\n });\n\n return closestElement;\n } catch (error) {\n handleDOMError(error as Error, 'findClosestElement');\n return null;\n }\n }\n\n /**\n * Safely adds event listeners\n */\n static addEventListener(\n element: EventTarget,\n event: string,\n handler: EventListener,\n options?: AddEventListenerOptions\n ): void {\n try {\n element.addEventListener(event, handler, options);\n } catch (error) {\n handleDOMError(error as Error, 'addEventListener');\n throw error;\n }\n }\n\n /**\n * Safely removes event listeners\n */\n static removeEventListener(\n element: EventTarget,\n event: string,\n handler: EventListener,\n options?: EventListenerOptions\n ): void {\n try {\n element.removeEventListener(event, handler, options);\n } catch (error) {\n handleDOMError(error as Error, 'removeEventListener');\n throw error;\n }\n }\n}\n","// Performance utilities\n\n// TODO: Refine the type for args and return value if possible\nexport function throttle<T extends (...args: any[]) => any>(\n func: T,\n delay: number\n): T {\n let timeoutId: NodeJS.Timeout | null = null;\n let lastExecTime = 0;\n\n return ((...args: unknown[]) => {\n const currentTime = Date.now();\n if (currentTime - lastExecTime > delay) {\n func(...(args as Parameters<T>));\n lastExecTime = currentTime;\n } else {\n if (timeoutId) clearTimeout(timeoutId);\n timeoutId = setTimeout(\n () => {\n func(...(args as Parameters<T>));\n lastExecTime = Date.now();\n },\n delay - (currentTime - lastExecTime)\n );\n }\n }) as T;\n}\n\n// Simple DOM element cache for querySelectorAll\nexport function createElementCache<T extends Element = Element>(\n query: string,\n ttl: number = 1000\n) {\n let cache: NodeListOf<T> | null = null;\n let lastCacheTime = 0;\n return () => {\n const now = Date.now();\n if (!cache || now - lastCacheTime > ttl) {\n cache = document.querySelectorAll<T>(query);\n lastCacheTime = now;\n }\n return cache;\n };\n}\n","import { useRef, useCallback } from 'react';\nimport { DOMService } from '../../utils/dom';\nimport { handleStegaError } from '../../utils/errors';\nimport { createScopedLogger } from '../../utils/debug';\nimport { vercelStegaDecode } from '@vercel/stega';\n\ninterface DecodedData {\n origin: string;\n href: string;\n}\n\nfunction decode(str: string | null): DecodedData | null {\n if (!str) return null;\n\n const debug = createScopedLogger('decode');\n\n try {\n // First, try to decode the string directly\n debug.log('attempting to decode stega data');\n\n const decoded = vercelStegaDecode(str) as DecodedData;\n debug.log('vercelStegaDecode result:', decoded);\n\n if (decoded?.href) {\n debug.log('successfully decoded', decoded);\n return decoded;\n }\n } catch (e) {\n debug.log('error decoding stega data:', e as Error);\n // If it fails, it might be because of trailing characters.\n // Regex to find the JSON string\n const regex = /{\"origin.*?}/;\n const match = str.match(regex);\n\n if (match) {\n try {\n // Now, try to decode the matched JSON string\n const decodedMatch = vercelStegaDecode(match[0]) as DecodedData;\n if (decodedMatch?.href) {\n debug.log('successfully decoded with regex match', decodedMatch);\n return decodedMatch;\n }\n } catch (e) {\n handleStegaError(e as Error, 'decode', { input: str });\n }\n }\n }\n\n return null;\n}\n\nexport function useStegaOverlay() {\n const debug = createScopedLogger('useStegaOverlay');\n const overlayRef = useRef<HTMLDivElement | null>(null);\n const tooltipRef = useRef<HTMLDivElement | null>(null);\n const hideTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n const currentElementRef = useRef<HTMLElement | null>(null);\n\n const createOverlay = useCallback(() => {\n const overlay = DOMService.createElement(\n 'div',\n 'prepr-overlay'\n ) as HTMLDivElement;\n overlay.style.display = 'none';\n\n const tooltip = DOMService.createElement(\n 'div',\n 'prepr-tooltip'\n ) as HTMLDivElement;\n tooltip.style.display = 'none';\n\n DOMService.appendToBody(overlay);\n DOMService.appendToBody(tooltip);\n\n overlayRef.current = overlay;\n tooltipRef.current = tooltip;\n\n debug.log('created overlay and tooltip elements');\n\n return { overlay, tooltip };\n }, [debug]);\n\n const showOverlay = useCallback(\n (element: HTMLElement) => {\n if (!overlayRef.current || !tooltipRef.current) return;\n\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n\n const rect = DOMService.getElementRect(element);\n const href = element.getAttribute('data-prepr-href');\n const origin = element.getAttribute('data-prepr-origin');\n\n debug.log('showing overlay for element:', { href, origin, rect });\n\n // Position overlay\n const overlay = overlayRef.current;\n overlay.style.display = 'block';\n overlay.style.top = `${rect.top + window.scrollY - 2}px`;\n overlay.style.left = `${rect.left + window.scrollX - 4}px`;\n overlay.style.width = `${rect.width + 8}px`;\n overlay.style.height = `${rect.height + 4}px`;\n\n // Position and show tooltip\n const tooltip = tooltipRef.current;\n if (tooltip && href && origin) {\n const MIN_WIDTH_FOR_TEXT = 80;\n const isCompact = rect.width < MIN_WIDTH_FOR_TEXT;\n tooltip.textContent = isCompact ? '↗' : `${origin} ↗`;\n tooltip.style.display = 'block';\n\n // Remove min-width constraint for compact tooltips\n if (isCompact) {\n tooltip.style.minWidth = 'auto';\n } else {\n tooltip.style.minWidth = '80px';\n }\n\n // Use requestAnimationFrame to ensure the DOM has updated before calculating position\n requestAnimationFrame(() => {\n if (tooltip) {\n tooltip.style.top = `${rect.top + window.scrollY - tooltip.clientHeight - 2}px`;\n tooltip.style.left = `${rect.right + 4 - tooltip.clientWidth}px`;\n }\n });\n\n tooltip.onclick = () =>\n window.open(href, '_blank', 'noopener,noreferrer');\n }\n\n currentElementRef.current = element;\n },\n [debug]\n );\n\n const hideOverlay = useCallback(() => {\n if (!overlayRef.current || !tooltipRef.current) return;\n\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n }\n\n hideTimeoutRef.current = setTimeout(() => {\n if (overlayRef.current) overlayRef.current.style.display = 'none';\n if (tooltipRef.current) tooltipRef.current.style.display = 'none';\n currentElementRef.current = null;\n debug.log('hidden overlay and tooltip');\n }, 100);\n }, [debug]);\n\n const cleanup = useCallback(() => {\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n }\n\n if (overlayRef.current) {\n DOMService.removeFromBody(overlayRef.current);\n }\n if (tooltipRef.current) {\n DOMService.removeFromBody(tooltipRef.current);\n }\n\n debug.log('cleaned up overlay and tooltip');\n }, [debug]);\n\n return {\n overlayRef,\n tooltipRef,\n currentElementRef,\n hideTimeoutRef,\n createOverlay,\n showOverlay,\n hideOverlay,\n cleanup,\n decode,\n };\n}\n","import { useRef, useCallback } from 'react';\nimport { createScopedLogger } from '../../utils/debug';\nimport { createElementCache } from '../../utils/performance';\n\nexport function useStegaProximity() {\n const debug = createScopedLogger('useStegaProximity');\n const highlightedElementsRef = useRef<Set<HTMLElement>>(new Set());\n const getEncodedElements = createElementCache<HTMLElement>(\n '[data-prepr-encoded]',\n 500\n );\n\n const updateElementGradients = useCallback(\n (cursorX: number, cursorY: number) => {\n const encodedElements = getEncodedElements();\n const newHighlightedElements = new Set<HTMLElement>();\n let highlightedCount = 0;\n\n encodedElements.forEach(element => {\n const rect = element.getBoundingClientRect();\n\n // Calculate shortest distance from cursor to element edges\n const distanceLeft = Math.abs(cursorX - rect.left);\n const distanceRight = Math.abs(cursorX - rect.right);\n const distanceTop = Math.abs(cursorY - rect.top);\n const distanceBottom = Math.abs(cursorY - rect.bottom);\n\n // Use minimum distance to any edge\n const distance = Math.min(\n distanceLeft,\n distanceRight,\n distanceTop,\n distanceBottom\n );\n\n const el = element as HTMLElement;\n if (distance < 150) {\n // Calculate relative cursor position within the element\n const relativeX = cursorX - rect.left;\n const relativeY = cursorY - rect.top;\n\n el.style.setProperty('--cursor-x', `${relativeX}px`);\n el.style.setProperty('--cursor-y', `${relativeY}px`);\n\n // Set gradient size based on element dimensions\n // Calculate base gradient size based on element dimensions\n const baseGradientSize = Math.max(\n 150,\n Math.max(rect.width, rect.height) * 1.1\n );\n // Scale gradient size based on distance (400 is max distance, closer = larger gradient)\n const distanceScale = Math.max(0, (400 - distance) / 400);\n const gradientSize = baseGradientSize * distanceScale;\n\n el.style.setProperty('--gradient-size', `${gradientSize}px`);\n el.classList.add('prepr-proximity-highlight');\n newHighlightedElements.add(el);\n highlightedCount++;\n } else {\n el.classList.remove('prepr-proximity-highlight');\n }\n });\n\n // Update the highlighted elements reference\n highlightedElementsRef.current = newHighlightedElements;\n\n if (highlightedCount > 0) {\n debug.log('highlighted', highlightedCount, 'elements near cursor');\n }\n },\n [debug, getEncodedElements]\n );\n\n const clearAllHighlights = useCallback(() => {\n const highlightedElements = highlightedElementsRef.current;\n let clearedCount = 0;\n\n highlightedElements.forEach(element => {\n element.classList.remove('prepr-proximity-highlight');\n clearedCount++;\n });\n\n highlightedElementsRef.current.clear();\n\n if (clearedCount > 0) {\n debug.log('cleared highlights from', clearedCount, 'elements');\n }\n }, [debug]);\n\n return {\n updateElementGradients,\n clearAllHighlights,\n highlightedElementsRef,\n };\n}\n","import { useRef, useCallback } from 'react';\nimport { createScopedLogger } from '../../utils/debug';\n\n// Define the expected structure for decoded data\ninterface DecodedData {\n href: string;\n origin: string;\n}\n\nexport function useStegaElements() {\n const debug = createScopedLogger('useStegaElements');\n const elementsRef = useRef<NodeListOf<Element> | undefined>(undefined);\n const observerRef = useRef<MutationObserver | null>(null);\n\n const getElements = useCallback(() => {\n if (!elementsRef.current) {\n elementsRef.current = document.querySelectorAll('[data-prepr-encoded]');\n }\n return elementsRef.current;\n }, []);\n\n const scanNode = useCallback(\n (node: Node, decode: (str: string | null) => DecodedData | null) => {\n if (node.nodeType === Node.TEXT_NODE) {\n if (!node.textContent?.trim()) return;\n if (node.parentElement?.closest('script, style, noscript')) return;\n const decoded = decode(node.textContent);\n if (decoded?.href) {\n const target = node.parentElement;\n if (target && !target.hasAttribute('data-prepr-encoded')) {\n target.setAttribute('data-prepr-encoded', '');\n target.setAttribute('data-prepr-href', decoded.href);\n target.setAttribute('data-prepr-origin', decoded.origin);\n debug.log('encoded element found:', {\n href: decoded.href,\n origin: decoded.origin,\n });\n }\n }\n } else if (node.nodeType === Node.ELEMENT_NODE) {\n for (let i = 0; i < node.childNodes.length; i++) {\n scanNode(node.childNodes[i], decode);\n }\n }\n },\n [debug]\n );\n\n const scanDocument = useCallback(\n (decode: (str: string | null) => DecodedData | null) => {\n debug.log('starting document scan');\n const walker = document.createTreeWalker(\n document.body,\n NodeFilter.SHOW_TEXT,\n {\n acceptNode: node => {\n if (node.parentElement?.closest('script, style, noscript')) {\n return NodeFilter.FILTER_REJECT;\n }\n if (!node.textContent?.trim()) {\n return NodeFilter.FILTER_REJECT;\n }\n return NodeFilter.FILTER_ACCEPT;\n },\n }\n );\n let textNode;\n let encodedCount = 0;\n while ((textNode = walker.nextNode())) {\n const decoded = decode(textNode.textContent);\n if (decoded?.href) {\n const target = textNode.parentElement;\n if (target && !target.hasAttribute('data-prepr-encoded')) {\n target.setAttribute('data-prepr-encoded', '');\n target.setAttribute('data-prepr-href', decoded.href);\n target.setAttribute('data-prepr-origin', decoded.origin);\n encodedCount++;\n }\n }\n }\n debug.log('document scan complete, encoded', encodedCount, 'elements');\n elementsRef.current = document.querySelectorAll('[data-prepr-encoded]');\n },\n [debug]\n );\n\n const setupMutationObserver = useCallback(\n (decode: (str: string | null) => DecodedData | null) => {\n if (observerRef.current) {\n observerRef.current.disconnect();\n }\n let pendingMutations: MutationRecord[] = [];\n let debounceTimeout: NodeJS.Timeout | null = null;\n const processMutations = () => {\n const allAddedNodes = new Set<Node>();\n pendingMutations.forEach(mutation => {\n mutation.addedNodes.forEach(node => allAddedNodes.add(node));\n });\n allAddedNodes.forEach(node => scanNode(node, decode));\n pendingMutations = [];\n elementsRef.current = document.querySelectorAll('[data-prepr-encoded]');\n };\n observerRef.current = new MutationObserver(mutations => {\n pendingMutations.push(...mutations);\n if (debounceTimeout) clearTimeout(debounceTimeout);\n debounceTimeout = setTimeout(processMutations, 100);\n });\n observerRef.current.observe(document.body, {\n childList: true,\n subtree: true,\n });\n debug.log('mutation observer set up');\n },\n [scanNode, debug]\n );\n\n const cleanup = useCallback(() => {\n if (observerRef.current) {\n observerRef.current.disconnect();\n observerRef.current = null;\n }\n const encodedElements = document.querySelectorAll('[data-prepr-encoded]');\n encodedElements.forEach(element => {\n element.removeAttribute('data-prepr-encoded');\n element.removeAttribute('data-prepr-href');\n element.removeAttribute('data-prepr-origin');\n });\n debug.log('cleaned up', encodedElements.length, 'encoded elements');\n elementsRef.current = undefined;\n }, [debug]);\n\n return {\n getElements,\n scanDocument,\n setupMutationObserver,\n cleanup,\n };\n}\n","import React, { useEffect, useState } from 'react';\nimport { PreviewBar } from './preview-bar';\nimport { useSearchParams } from 'next/navigation';\n\nexport default function PreviewBarWrapper() {\n const searchParams = useSearchParams();\n const [isIframe, setIsIframe] = useState<boolean>(false);\n\n const handleKeyDown = (event: KeyboardEvent) => {\n const key = event.key.toLowerCase();\n // Check for the blocked shortcuts\n const isSaveShortcut = (event.ctrlKey || event.metaKey) && key === 's';\n const isPrintShortcut = (event.ctrlKey || event.metaKey) && key === 'p';\n const isAddressBarShortcut =\n (event.ctrlKey || event.metaKey) && key === 'l';\n if (isSaveShortcut || isPrintShortcut || isAddressBarShortcut) {\n event.preventDefault(); // Prevent the browser's default action\n }\n };\n\n useEffect(() => {\n const isIframe =\n typeof window !== 'undefined' && window?.parent !== window.self;\n if (isIframe) {\n setIsIframe(true);\n const previewBarMessage = {\n name: 'prepr_preview_bar',\n event: 'loaded',\n };\n window.parent.postMessage(previewBarMessage, '*');\n window.addEventListener('keydown', handleKeyDown);\n }\n return () => {\n if (isIframe) {\n window.removeEventListener('keydown', handleKeyDown);\n }\n };\n }, []);\n\n if (searchParams.get('prepr_hide_bar') === 'true' || isIframe) {\n return null;\n }\n\n return <PreviewBar />;\n}\n","import React, { useEffect, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { cn } from '../../../utils';\nimport { useEditModeContext } from '../../contexts';\nimport { useModal } from '../../hooks/useModal';\nimport { PreviewBarContent } from './preview-bar-content';\nimport { PreviewBarButton } from './preview-bar-button';\n\ninterface PreviewBarProps {\n children?: React.ReactNode;\n}\n\nexport default function PreviewBar({ children }: PreviewBarProps) {\n const [isMounted, setIsMounted] = useState(false);\n const [isBarVisible, setIsBarVisible] = React.useState(false);\n const { editMode } = useEditModeContext();\n const { contentRef, triggerRef } = useModal({\n isVisible: isBarVisible,\n onClose: () => setIsBarVisible(false),\n });\n\n useEffect(() => {\n setIsMounted(true);\n }, []);\n\n // Ref for the popup box\n const popupBoxRef = React.useRef<HTMLDivElement>(null);\n const [popupTop, setPopupTop] = React.useState<string | number>('');\n\n const updatePopupPosition = React.useCallback(() => {\n if (popupBoxRef.current && triggerRef.current) {\n const popupHeight = popupBoxRef.current.offsetHeight;\n const windowHeight = window.innerHeight;\n const triggerRect = triggerRef.current.getBoundingClientRect();\n // Center popup relative to the icon (trigger)\n const triggerCenter = triggerRect.top + triggerRect.height / 2;\n let top = triggerCenter - popupHeight / 2;\n // Clamp to leave at least 32px top and bottom\n top = Math.max(32, Math.min(top, windowHeight - popupHeight - 32));\n setPopupTop(top);\n }\n }, [triggerRef]);\n\n useEffect(() => {\n if (isBarVisible) {\n updatePopupPosition();\n window.addEventListener('resize', updatePopupPosition);\n return () => window.removeEventListener('resize', updatePopupPosition);\n }\n return undefined;\n }, [isBarVisible, updatePopupPosition]);\n\n const handleClick = () => {\n setIsBarVisible(!isBarVisible);\n };\n\n useEffect(() => {\n if (editMode) {\n setTimeout(() => {\n setIsBarVisible(false);\n }, 150);\n }\n }, [editMode]);\n\n const previewBarContent = (\n <>\n {isBarVisible && <div className=\"preview-bar-backdrop\" />}\n <div className={cn('preview-bar-container')}>\n {/* Button holder*/}\n <div className=\"p-pr-4\" ref={triggerRef}>\n <PreviewBarButton onClick={handleClick} />\n </div>\n\n {/* Box holder */}\n <div\n ref={popupBoxRef}\n style={\n popupTop !== ''\n ? { top: popupTop, position: 'fixed', right: 0 }\n : {}\n }\n className={cn(\n 'preview-bar-popup',\n isBarVisible\n ? 'p-pointer-events-auto p-opacity-100'\n : 'p-pointer-events-none p-opacity-0'\n )}\n >\n {children || (\n <PreviewBarContent onClose={handleClick} contentRef={contentRef} />\n )}\n </div>\n </div>\n </>\n );\n\n if (!isMounted) return null;\n\n return createPortal(previewBarContent, document.body);\n}\n\n// Compound component pattern\nPreviewBar.Content = PreviewBarContent;\nPreviewBar.Button = PreviewBarButton;\n","import { ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n// Define specific types for Prepr events\nexport interface PreprEventData {\n segment?: string;\n variant?: string;\n editMode?: boolean;\n [key: string]: string | boolean | number | undefined;\n}\n\nexport function sendPreprEvent(event: string, data?: PreprEventData) {\n window.parent.postMessage({\n name: 'prepr_preview_bar',\n event,\n ...data,\n });\n}\n\n// Export error handling utilities\nexport * from './errors';\n\n// Export DOM service\nexport * from './dom';\n\n// Export debug utilities\nexport * from './debug';\n\n// Export performance utilities\nexport * from './performance';\n","import { useEffect, useRef } from 'react';\n\ninterface UseModalProps {\n isVisible: boolean;\n onClose: () => void;\n}\n\nexport function useModal({ isVisible, onClose }: UseModalProps) {\n const contentRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (isVisible) {\n document.body.style.overflow = 'hidden';\n } else {\n document.body.style.overflow = '';\n }\n return () => {\n document.body.style.overflow = '';\n };\n }, [isVisible]);\n\n useEffect(() => {\n const handleEscapeKey = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onClose();\n }\n };\n\n const handleClickOutside = (event: MouseEvent) => {\n // Check if the click target is part of a dropdown\n const isDropdownItem = (event.target as HTMLElement).closest(\n '[role=\"listbox\"], [role=\"option\"]'\n );\n if (isDropdownItem) {\n return;\n }\n\n if (\n contentRef.current &&\n !contentRef.current.contains(event.target as Node) &&\n triggerRef.current &&\n !triggerRef.current.contains(event.target as Node)\n ) {\n onClose();\n }\n };\n\n if (isVisible) {\n document.addEventListener('keydown', handleEscapeKey);\n document.addEventListener('mousedown', handleClickOutside);\n }\n\n return () => {\n document.removeEventListener('keydown', handleEscapeKey);\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, [isVisible, onClose]);\n\n return {\n contentRef,\n triggerRef,\n };\n}\n","import React from 'react';\nimport Logo from '../logo';\nimport SegmentDropdown from '../segment-dropdown';\nimport VariantSelector from '../variant-selector';\nimport EditModeSelector from '../edit-mode-selector';\nimport ResetButton from '../reset-button';\n\ninterface PreviewBarContentProps {\n onClose: () => void;\n contentRef: React.RefObject<HTMLDivElement | null>;\n}\n\nexport function PreviewBarContent({\n onClose,\n contentRef,\n}: PreviewBarContentProps) {\n return (\n <div\n ref={contentRef}\n className=\"p-box-shadow p-right-0 p-z-[101] p-flex p-w-full p-flex-col p-gap-y-10 p-rounded-lg p-bg-primary-50 p-p-6 sm:p-w-[502px] sm:p-p-10\"\n >\n {/* Header */}\n <div className=\"p-flex p-items-center p-justify-between p-gap-2\">\n <div className=\"p-flex p-items-start p-gap-3\">\n <Logo />\n <div className=\"p-flex p-h-6 p-items-center p-rounded p-bg-primary-100 p-px-3 p-py-1 p-text-sm p-text-primary-700\">\n toolbar\n </div>\n </div>\n <button\n onClick={onClose}\n className=\"p-flex p-h-8 p-w-8 p-cursor-pointer p-items-center p-justify-center p-rounded-md p-bg-primary-100 p-text-gray-700\"\n >\n <svg\n width=\"10\"\n height=\"10\"\n viewBox=\"0 0 10 10\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M8.17578 1.07031C8.41016 0.816406 8.82031 0.816406 9.05469 1.07031C9.30859 1.30469 9.30859 1.71484 9.05469 1.94922L5.75391 5.25L9.05469 8.57031C9.30859 8.80469 9.30859 9.21484 9.05469 9.44922C8.82031 9.70312 8.41016 9.70312 8.17578 9.44922L4.875 6.14844L1.55469 9.44922C1.32031 9.70312 0.910156 9.70312 0.675781 9.44922C0.421875 9.21484 0.421875 8.80469 0.675781 8.57031L3.97656 5.25L0.675781 1.94922C0.421875 1.71484 0.421875 1.30469 0.675781 1.07031C0.910156 0.816406 1.32031 0.816406 1.55469 1.07031L4.875 4.37109L8.17578 1.07031Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </div>\n\n {/* Personalized Content */}\n <div className=\"p-space-y-2\">\n <span className=\"p-text-sm p-text-grey-400\">Personalized content</span>\n <div className=\"p-gap p-flex p-flex-wrap p-items-center p-justify-between p-gap-x-6 p-gap-y-2\">\n <h2 className=\"p-text-grey-800 p-font-semibold\">Apply segment</h2>\n <SegmentDropdown />\n </div>\n <div className=\"p-gap p-flex p-flex-wrap p-items-center p-justify-between p-gap-x-6 p-gap-y-2\">\n <h2 className=\"p-text-grey-800 p-font-semibold\">Show A/B variant</h2>\n <VariantSelector />\n </div>\n </div>\n\n {/* Collaboration */}\n <div className=\"p-space-y-2\">\n <span className=\"p-text-sm p-text-grey-400\">Collaboration</span>\n <div className=\"p-gap p-flex p-flex-wrap p-items-center p-justify-between p-gap-x-6 p-gap-y-2\">\n <h2 className=\"p-text-grey-800 p-font-semibold\">Edit mode</h2>\n <EditModeSelector />\n </div>\n </div>\n\n <ResetButton />\n </div>\n );\n}\n","import React from 'react';\n\nconst Logo: React.FC<React.SVGProps<SVGSVGElement>> = props => {\n return (\n <svg\n width=\"102\"\n height=\"28\"\n viewBox=\"0 0 102 28\"\n fill=\"none\"\n {...props}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M39.2674 2.19699C39.2757 2.18321 39.2839 2.16943 39.291 2.15528L39.2939 2.15057L39.2935 2.1502C39.3379 2.06208 39.3633 1.96308 39.3633 1.85754C39.3633 1.62109 39.2374 1.41474 39.0507 1.30231C39.0485 1.30014 39.0467 1.29651 39.0446 1.29578C35.1089 -0.88088 29.8537 -0.36627 26.3741 3.2632C24.4207 5.3006 23.4231 7.92116 23.3716 10.5544H23.3684V20.893C23.3684 21.2495 23.6538 21.5389 24.0058 21.5389H26.98C27.332 21.5389 27.6174 21.2495 27.6174 20.893V10.7698H27.6192C27.6192 9.14658 28.2169 7.52187 29.4209 6.26599C31.5699 4.02478 34.7423 3.8565 36.9299 5.03659C36.9367 5.04058 36.9439 5.04384 36.9507 5.04747C36.9557 5.05001 36.9607 5.05254 36.9657 5.05508H36.9664C37.0494 5.09497 37.1417 5.11782 37.2393 5.11782C37.4879 5.11782 37.7032 4.97276 37.808 4.76206L39.2674 2.19699Z\"\n fill=\"#4338CA\"\n />\n <path\n d=\"M10.6216 0.000244141C4.75551 0.000244141 0 4.82177 0 10.7693V27.3543C0 27.7108 0.285079 28.0002 0.637405 28.0002H3.61161C3.96358 28.0002 4.24902 27.7108 4.24902 27.3543V19.3853C6.02424 20.7373 8.23084 21.5388 10.622 21.5388C16.4878 21.5388 21.244 16.7173 21.244 10.7697C21.2437 4.82177 16.4878 0.000244141 10.6216 0.000244141ZM10.6216 17.2311C7.10196 17.2311 4.24866 14.3382 4.24866 10.7693C4.24866 7.20079 7.10196 4.30788 10.6216 4.30788C14.1413 4.30788 16.995 7.20079 16.995 10.7693C16.995 14.3379 14.1413 17.2311 10.6216 17.2311Z\"\n fill=\"#4338CA\"\n />\n <path\n d=\"M73.259 0C67.3932 0 62.6373 4.82152 62.6373 10.7691V27.3541C62.6373 27.7106 62.9228 28 63.2747 28H66.2489C66.6009 28 66.8863 27.7106 66.8863 27.3541V19.3854C68.6616 20.7374 70.8682 21.5389 73.2593 21.5389C79.1251 21.5389 83.8813 16.7174 83.8813 10.7698C83.881 4.82152 79.1248 0 73.259 0ZM73.259 17.2309C69.7393 17.2309 66.886 14.338 66.886 10.7691C66.886 7.20055 69.7393 4.30764 73.259 4.30764C76.7783 4.30764 79.632 7.20055 79.632 10.7691C79.632 14.3376 76.7783 17.2309 73.259 17.2309Z\"\n fill=\"#4338CA\"\n />\n <path\n d=\"M60.439 10.9845C60.439 5.03657 55.6827 0 49.817 0C43.9508 0 39.1953 4.82152 39.1953 10.7691C39.1953 16.7167 43.9508 21.5382 49.817 21.5382C53.1374 21.5382 55.8763 19.9954 57.5939 18.1031C57.5939 18.1031 57.5942 18.1027 57.5946 18.1024C57.596 18.1009 57.5975 18.0995 57.5985 18.098C57.7112 17.9812 57.7806 17.822 57.7806 17.6461C57.7806 17.4601 57.7026 17.2929 57.5785 17.1751V17.1743L57.5696 17.1671C57.5535 17.1522 57.5367 17.1384 57.5188 17.1254L55.2464 15.2501C55.1344 15.1503 54.9877 15.0891 54.8264 15.0891C54.6261 15.0891 54.4476 15.183 54.331 15.3291C53.3216 16.3707 51.7256 17.2309 49.8166 17.2309C46.2969 17.2309 43.4436 14.338 43.4436 10.7691C43.4436 7.20055 46.2969 4.30764 49.8166 4.30764C52.5909 4.30764 54.9505 6.10605 55.8255 8.61527H50.3474C49.9954 8.61527 49.71 8.90467 49.71 9.26152V12.277C49.71 12.6339 49.9954 12.9233 50.3474 12.9233H59.5884C59.6059 12.9233 59.6227 12.9218 59.6399 12.9207C59.6571 12.9222 59.6742 12.9233 59.6914 12.9233C59.9743 12.9233 60.214 12.7361 60.2973 12.4772L60.3045 12.4783C60.308 12.4551 60.3116 12.4326 60.3152 12.4097C60.3199 12.3876 60.3234 12.3655 60.3256 12.3427C60.4003 11.861 60.439 11.5172 60.439 10.9845Z\"\n fill=\"#4338CA\"\n />\n <path\n d=\"M101.928 2.15406L101.931 2.14934L101.93 2.14898C101.974 2.06085 102 1.96185 102 1.85632C102 1.61987 101.874 1.41351 101.687 1.30109C101.685 1.29891 101.683 1.29529 101.681 1.29456C97.7455 -0.882101 92.4903 -0.367491 89.0107 3.26198C87.0573 5.29938 86.0597 7.91993 86.0082 10.5532H86.005V20.8918C86.005 21.2483 86.2904 21.5377 86.6424 21.5377H89.6166C89.9686 21.5377 90.254 21.2483 90.254 20.8918V10.7686H90.2555C90.2555 9.14535 90.8532 7.52065 92.0571 6.26477C94.2062 4.02355 97.3785 3.85528 99.5662 5.03537C99.573 5.03936 99.5801 5.04262 99.5869 5.04624C99.5919 5.04878 99.5969 5.05132 99.6019 5.05386H99.6027C99.6856 5.09375 99.7779 5.11696 99.8756 5.11696C100.124 5.11696 100.339 4.9719 100.444 4.7612L101.905 2.19685C101.913 2.18235 101.92 2.16856 101.928 2.15406Z\"\n fill=\"#4338CA\"\n />\n </svg>\n );\n};\n\nexport default Logo;\n","import React from 'react';\nimport { PreprSegment } from '../../types';\nimport { useSegmentContext } from '../contexts';\nimport { usePathname, useRouter } from 'next/navigation';\nimport {\n Listbox,\n ListboxButton,\n ListboxOption,\n ListboxOptions,\n} from '@headlessui/react';\nimport SortDown from './icons/sort-down';\nimport { cn } from '../../utils';\n\nexport default function SegmentDropdown() {\n const { segments, setSelectedSegment, selectedSegment } = useSegmentContext();\n\n const pathname = usePathname();\n const router = useRouter();\n\n const updateSelectedSegment = (value: string) => {\n const params = new URLSearchParams(window.location.search);\n const segment = segments.find(segment => segment._id === value);\n\n if (segment) {\n setSelectedSegment(segment);\n params.set('prepr_preview_segment', value);\n\n router.push(`${pathname}?${params.toString()}`, {\n scroll: false,\n });\n router.refresh();\n }\n };\n\n return (\n <Listbox\n value={selectedSegment._id}\n onChange={(value: string) => updateSelectedSegment(value)}\n >\n <ListboxButton\n as=\"button\"\n disabled={!(segments && segments.length > 0)}\n className=\"p-regular-text p-flex p-h-10 p-w-[240px] p-shrink-0 p-flex-nowrap p-items-center p-gap-2 p-overflow-hidden p-text-ellipsis p-text-nowrap p-rounded-lg p-border p-border-gray-300 p-bg-white p-px-2 p-text-gray-500 disabled:p-cursor-not-allowed disabled:p-bg-gray-200 disabled:p-text-gray-400 data-[open]:p-rounded-b-none data-[open]:p-border-b-white md:p-px-4\"\n >\n <div\n style={{\n textWrap: 'nowrap',\n textOverflow: 'ellipsis',\n textAlign: 'left',\n }}\n className=\"p-mr-auto p-w-full p-overflow-hidden\"\n >\n {segments.length > 0 ? selectedSegment.name : 'No segments'}\n </div>\n <div className=\"p-text-gray-800\">\n <SortDown />\n </div>\n </ListboxButton>\n <ListboxOptions\n anchor=\"bottom start\"\n className=\"p-no-scrollbar p-z-[9999] !p-max-h-[300px] p-w-[240px] p-rounded-b-md p-border-x p-border-b p-border-gray-300 p-bg-white p-shadow-xl\"\n >\n {segments?.map((segment: PreprSegment) => (\n <ListboxOption\n key={segment._id}\n value={segment._id}\n className={cn(\n 'p-regular-text p-z-[100] p-flex p-w-full p-items-center p-p-2 p-px-4 hover:p-cursor-pointer',\n segment._id === selectedSegment._id\n ? 'p-bg-indigo-50 p-text-indigo-700'\n : 'p-bg-white p-text-gray-900 hover:p-bg-gray-100'\n )}\n >\n <div\n style={{\n textWrap: 'nowrap',\n textOverflow: 'ellipsis',\n textAlign: 'left',\n }}\n className=\"p-mr-auto p-w-full p-overflow-hidden\"\n >\n {segment.name}\n </div>\n </ListboxOption>\n ))}\n </ListboxOptions>\n </Listbox>\n );\n}\n","import React from 'react';\n\nexport default function SortDown(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n width=\"9\"\n height=\"6\"\n viewBox=\"0 0 9 6\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n d=\"M5.24274 5.36865C4.91462 5.72412 4.3404 5.72412 4.01227 5.36865L0.512273 1.86865C0.266179 1.62256 0.184148 1.23975 0.320867 0.911621C0.457586 0.583496 0.785711 0.364746 1.14118 0.364746H8.14118C8.46931 0.364746 8.79743 0.583496 8.93415 0.911621C9.07087 1.23975 8.98884 1.62256 8.74274 1.86865L5.24274 5.36865Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport { useVariantContext } from '../contexts';\nimport { usePathname, useRouter } from 'next/navigation';\nimport RadioSelector from './radio-selector';\n\nexport default function VariantSelector() {\n const { selectedVariant, setSelectedVariant, emptyVariant } =\n useVariantContext();\n\n const pathname = usePathname();\n const router = useRouter();\n\n const updateSelectedVariant = (value: string | boolean) => {\n const params = new URLSearchParams(window.location.search);\n setSelectedVariant(String(value));\n params.set('prepr_preview_ab', String(value));\n\n router.push(`${pathname}?${params.toString()}`, {\n scroll: false,\n });\n router.refresh();\n };\n\n const options = [\n { value: 'null', label: 'Off', width: 'p-w-[58px]' },\n { value: 'A', label: 'A', width: 'p-w-[82px]' },\n { value: 'B', label: 'B', width: 'p-w-[82px]' },\n ];\n\n return (\n <RadioSelector\n value={selectedVariant || emptyVariant}\n onChange={updateSelectedVariant}\n options={options}\n />\n );\n}\n","import React from 'react';\nimport { Radio, RadioGroup } from '@headlessui/react';\nimport { cn } from '../../utils';\n\ninterface RadioOption {\n value: string | boolean;\n label: string;\n width?: string;\n}\n\ninterface RadioSelectorProps {\n value: string | boolean;\n onChange: (value: string | boolean) => void;\n options: RadioOption[];\n}\n\nexport default function RadioSelector({\n value,\n onChange,\n options,\n}: RadioSelectorProps) {\n return (\n <RadioGroup\n className=\"p-flex p-h-10 p-items-center p-gap-1 p-rounded-lg p-border p-border-gray-300 p-bg-white p-p-1\"\n value={value}\n onChange={onChange}\n >\n {options.map(option => (\n <Radio\n key={String(option.value)}\n value={option.value}\n className={cn(\n option.width || 'p-w-[58px]',\n 'p-regular-text p-flex p-h-8 p-cursor-pointer p-items-center p-justify-center p-rounded-md p-px-4.5 p-py-2 p-text-center p-text-gray-900 p-transition-all p-duration-200 p-ease-in-out',\n option.value === false ||\n option.value === 'null' ||\n option.value === 'off'\n ? 'data-[checked]:p-bg-gray-800 data-[checked]:p-text-white'\n : 'data-[checked]:p-bg-indigo-600 data-[checked]:p-text-white',\n option.value === value && 'p-drop-shadow-3'\n )}\n >\n {option.label}\n </Radio>\n ))}\n </RadioGroup>\n );\n}\n","import React from 'react';\nimport { useEditModeContext } from '../contexts';\nimport RadioSelector from './radio-selector';\n\nexport default function EditModeSelector() {\n const { editMode, setEditMode } = useEditModeContext();\n\n const updateEditMode = (value: string | boolean) => {\n setEditMode(value === 'true' || value === true);\n };\n\n const options = [\n { value: 'false', label: 'Off' },\n { value: 'true', label: 'On' },\n ];\n\n return (\n <RadioSelector\n options={options}\n value={editMode.toString()}\n onChange={updateEditMode}\n />\n );\n}\n","import React from 'react';\n// import classNames from 'classnames';\n// import { FaRotate } from 'react-icons/fa6';\nimport { usePathname, useRouter } from 'next/navigation';\nimport { cn } from '../../utils';\nimport { usePreprPreviewBar } from '../prepr-previewbar-provider';\nimport Rotate from './icons/rotate';\n\nexport default function ResetButton() {\n const router = useRouter();\n const {\n resetSelected,\n selectedVariant,\n selectedSegment,\n setEditMode,\n editMode,\n } = usePreprPreviewBar();\n const pathname = usePathname();\n const enabled =\n selectedSegment._id !== 'null' || selectedVariant !== 'null' || editMode;\n\n const handleClick = () => {\n resetSelected();\n\n // Push null values to the URL to reset the preview\n const params = new URLSearchParams({});\n params.append('prepr_preview_segment', 'null');\n params.append('prepr_preview_ab', 'null');\n\n setEditMode(false);\n\n router.push(`${pathname}?${params.toString()}`, {\n scroll: false,\n });\n router.refresh();\n\n // Remove the params from the URL\n params.delete('prepr_preview_segment');\n params.delete('prepr_preview_ab');\n router.push(`${pathname}?${params.toString()}`, {\n scroll: false,\n });\n router.refresh();\n };\n\n const classes = cn(\n 'p-py-2 p-px-3 p-flex p-justify-center p-gap-2 p-items-center p-rounded-md p-regular-text p-h-10 p-w-full md:p-w-[108px]',\n enabled &&\n 'p-bg-secondary-400 hover:p-secondary-500 p-cursor-pointer p-text-white',\n !enabled && 'p-bg-grey-400 p-text-gray-500'\n );\n\n return (\n <button onClick={handleClick} className={classes} disabled={!enabled}>\n <Rotate />\n <span className=\"p-block sm:p-hidden lg:p-block\">Reset</span>\n </button>\n );\n}\n","import React from 'react';\n\nexport default function Rotate() {\n return (\n <svg\n width=\"15\"\n height=\"14\"\n viewBox=\"0 0 15 14\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M3.37109 5.80078C3.20703 6.26562 2.6875 6.51172 2.25 6.34766C1.78516 6.18359 1.53906 5.69141 1.70312 5.22656C2.00391 4.37891 2.49609 3.58594 3.15234 2.92969C5.55859 0.550781 9.41406 0.550781 11.8203 2.92969L12.2852 3.42188V2C12.2852 1.53516 12.6953 1.125 13.1602 1.125C13.6523 1.125 14.0352 1.53516 14.0352 2V5.5C14.0352 5.99219 13.6523 6.375 13.1602 6.375H9.6875C9.19531 6.375 8.8125 5.99219 8.8125 5.5C8.8125 5.03516 9.19531 4.625 9.6875 4.625H11.0547L10.5898 4.16016C8.86719 2.46484 6.10547 2.46484 4.38281 4.16016C3.91797 4.65234 3.5625 5.19922 3.37109 5.80078ZM1.56641 8.17969C1.59375 8.15234 1.64844 8.15234 1.67578 8.15234C1.73047 8.15234 1.75781 8.125 1.8125 8.125H5.3125C5.77734 8.125 6.1875 8.53516 6.1875 9C6.1875 9.49219 5.77734 9.875 5.3125 9.875H3.91797L4.38281 10.3672C6.10547 12.0625 8.86719 12.0625 10.5898 10.3672C11.0547 9.875 11.4102 9.32812 11.6016 8.72656C11.7656 8.26172 12.2852 8.01562 12.7227 8.17969C13.1875 8.34375 13.4336 8.83594 13.2695 9.30078C12.9688 10.1484 12.4766 10.9141 11.8203 11.5977C9.41406 13.9766 5.55859 13.9766 3.15234 11.5977L2.6875 11.1055V12.5C2.6875 12.9922 2.27734 13.375 1.8125 13.375C1.32031 13.375 0.9375 12.9922 0.9375 12.5V9.02734C0.9375 8.97266 0.9375 8.91797 0.9375 8.89062C0.9375 8.83594 0.9375 8.80859 0.964844 8.78125C0.992188 8.64453 1.07422 8.50781 1.18359 8.39844C1.29297 8.28906 1.42969 8.20703 1.56641 8.17969Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport { cn } from '../../../utils';\nimport Icon from '../icon';\n\ninterface PreviewBarButtonProps {\n onClick: () => void;\n className?: string;\n}\n\nexport function PreviewBarButton({\n onClick,\n className,\n}: PreviewBarButtonProps) {\n return (\n <button\n onClick={onClick}\n className={cn(\n 'cursor-pointer p-z-50 p-flex p-size-9 p-items-center p-justify-center p-rounded-full p-bg-primary-700',\n className\n )}\n >\n <Icon className=\"p-text-white\" />\n </button>\n );\n}\n","import React from 'react';\n\nconst Icon: React.FC<React.SVGProps<SVGSVGElement>> = props => {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n d=\"M9.05365 0C5.71033 0 3 2.75516 3 6.15377V15.6309C3 15.8346 3.16248 16 3.36328 16H5.05838C5.25898 16 5.42166 15.8346 5.42166 15.6309V11.0772C6.43342 11.8498 7.69104 12.3077 9.05385 12.3077C12.397 12.3077 15.1077 9.55259 15.1077 6.15397C15.1075 2.75516 12.397 0 9.05365 0ZM9.05365 9.84623C7.04766 9.84623 5.42146 8.19314 5.42146 6.15377C5.42146 4.1146 7.04766 2.46151 9.05365 2.46151C11.0596 2.46151 12.686 4.1146 12.686 6.15377C12.686 8.19293 11.0596 9.84623 9.05365 9.84623Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n};\n\nexport default Icon;\n","import React from 'react';\nimport StatusIndicatorPill from './status-indicator-pill';\nimport CloseEditModePill from './close-edit-mode-pill';\n\nexport default function PreviewBarIndicatorWrapper() {\n return (\n <div className=\"p-fixed p-bottom-6 p-right-6 p-z-[999] p-flex p-gap-3\">\n <StatusIndicatorPill />\n <CloseEditModePill />\n </div>\n );\n}\n","import React from 'react';\nimport { usePreprPreviewBar } from '../prepr-previewbar-provider';\n\nexport default function StatusIndicatorPill() {\n const {\n selectedSegment,\n selectedVariant,\n emptySegment,\n emptyVariant,\n isIframe,\n } = usePreprPreviewBar();\n\n // Only show if a segment or variant is applied (not empty/null)\n const show =\n (selectedSegment &&\n selectedSegment._id !== (emptySegment?._id ?? 'null')) ||\n (selectedVariant && selectedVariant !== (emptyVariant ?? 'null'));\n\n if (isIframe) {\n return null;\n }\n\n return (\n <div className=\"p-z-[998] p-flex p-gap-2\">\n {show && (\n <div className=\"p-flex p-items-center p-gap-2 p-rounded-full p-bg-primary-700 p-px-4 p-py-2 p-text-xs p-font-medium p-text-white p-shadow-lg\">\n <span className=\"p-text-[10px] p-text-white/60\">viewing as</span>\n {selectedSegment &&\n selectedSegment._id !== (emptySegment?._id ?? 'null') && (\n <span className=\"max-w-[120px] p-inline-block p-truncate\">\n {selectedSegment.name}\n </span>\n )}\n {selectedVariant && selectedVariant !== (emptyVariant ?? 'null') && (\n <span className=\"max-w-[80px] p-inline-block p-truncate p-rounded p-bg-white/20 p-px-2\">\n {selectedVariant}\n </span>\n )}\n </div>\n )}\n </div>\n );\n}\n","import React from 'react';\nimport { usePreprPreviewBar } from '../prepr-previewbar-provider';\nimport XMark from './icons/xmark';\n\nexport default function CloseEditModePill() {\n const { editMode, setEditMode, isIframe } = usePreprPreviewBar();\n\n if (!editMode || isIframe) {\n return null;\n }\n\n return (\n <div className=\"p-z-[999] p-flex\">\n <button\n type=\"button\"\n onClick={() => setEditMode && setEditMode(false)}\n className=\"p-flex p-items-center p-gap-2 p-rounded-full p-bg-primary-50 p-px-4 p-py-2 p-text-xs p-font-medium p-text-gray-800 p-shadow-lg p-transition-colors p-duration-150 hover:p-bg-primary-100\"\n aria-label=\"Close edit mode\"\n >\n <span>Edit mode</span>\n <XMark className=\"transition-colors duration-150 p-h-4 p-w-4 p-text-gray-500 hover:p-text-gray-700\" />\n </button>\n </div>\n );\n}\n","import React from 'react';\n\nexport default function XMark(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n d=\"M4.22 4.22a.75.75 0 0 1 1.06 0L8 6.94l2.72-2.72a.75.75 0 1 1 1.06 1.06L9.06 8l2.72 2.72a.75.75 0 1 1-1.06 1.06L8 9.06l-2.72 2.72a.75.75 0 1 1-1.06-1.06L6.94 8 4.22 5.28a.75.75 0 0 1 0-1.06z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n}\n","import { useEffect } from 'react';\nimport { sendPreprEvent } from '../../utils';\nimport { createScopedLogger } from '../../utils/debug';\n\nexport default function useScrollPosition() {\n const debug = createScopedLogger('useScrollPosition');\n\n useEffect(() => {\n sendPreprEvent('getScrollPosition', {\n value: 0,\n });\n\n if (window.parent !== self) {\n let parentOrigin: string | null = null; //Get origin of parent outside iframe\n sendPreprEvent('loaded');\n\n const handleMessage = (evt: MessageEvent) => {\n debug.log('received message:', evt.data);\n\n if (evt?.data?.event === 'prepr:initVE' && !parentOrigin) {\n parentOrigin = evt.origin;\n\n if (evt.data?.scrollPosition) {\n debug.log('scrolling to position:', evt.data.scrollPosition);\n //Timeout needed in order to scroll to position\n setTimeout(() => {\n window.scrollTo(0, evt.data?.scrollPosition);\n }, 1);\n }\n }\n if (evt.origin !== parentOrigin) return;\n\n if (evt?.data?.event === 'prepr:getScrollPosition') {\n const currentScrollY =\n window.scrollY || document.documentElement.scrollTop;\n debug.log('sending scroll position:', currentScrollY);\n sendPreprEvent('getScrollPosition', {\n value: currentScrollY,\n });\n }\n };\n\n window.addEventListener('message', handleMessage);\n\n debug.log('set up iframe message listener');\n\n return () => {\n window.removeEventListener('message', handleMessage);\n debug.log('cleaned up iframe message listener');\n };\n } else {\n debug.log('not in iframe, skipping iframe setup');\n return undefined;\n }\n }, [debug]);\n}\n"],"mappings":";27BAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,sBAAAE,GAAA,qBAAAC,GAAA,SAAAC,GAAA,oBAAAC,GAAA,4BAAAC,GAAA,eAAAC,EAAA,+BAAAC,GAAA,sBAAAC,GAAA,gBAAAC,GAAA,oBAAAC,EAAA,oBAAAC,GAAA,uBAAAC,EAAA,oBAAAC,GAAA,oBAAAC,GAAA,uBAAAC,EAAA,eAAAC,GAAA,aAAAC,GAAA,cAAAC,GAAA,uBAAAC,EAAA,aAAAC,GAAA,uBAAAC,EAAA,sBAAAC,GAAA,sBAAAC,EAAA,qBAAAC,GAAA,oBAAAC,GAAA,sBAAAC,GAAA,iBAAAC,EAAA,sBAAAC,IAAA,eAAAC,GAAA9B,ICEA,IAAA+B,EAA4C,sBCA5C,IAAAC,EAAsE,sBCF/D,IAAMC,GAAa,CACxB,cAAe,sBACf,eAAgB,uBAChB,wBAAyB,0BACzB,kBAAmB,mBACrB,EAqBO,SAASC,GACdC,EACAC,EACAC,EACAC,EACW,CACX,MAAO,CACL,KAAAH,EACA,QAAAC,EACA,QAASC,EAAM,QACf,UAAW,IAAI,KAAK,EAAE,YAAY,EAClC,MAAOA,EAAM,MACb,eAAAC,CACF,CACF,CAEO,SAASC,GACdF,EACAD,EACAE,EACA,CACA,IAAME,EAAYN,GAChBD,GAAW,cACXG,EACAC,EACAC,CACF,EAEA,eAAQ,MAAM,eAAgBE,CAAS,EAGnC,QAAQ,IAAI,SAITA,CACT,CAEO,SAASC,EAAeJ,EAAcD,EAAiB,CAC5D,IAAMI,EAAYN,GAChBD,GAAW,wBACXG,EACAC,CACF,EAEA,eAAQ,MAAM,aAAcG,CAAS,EAC9BA,CACT,CAEO,SAASE,EAAmBC,EAAqB,CACtD,IAAMN,EAAQ,IAAI,MAAM,GAAG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vB,IAAME,EAAiBC,GAAsB,CAhBnD,IAAAC,EAAAC,EAAAC,EA8BQ,GAbAR,EAAM,IAAI,oBAAqBK,EAAI,IAAI,IAEnCC,EAAAD,GAAA,YAAAA,EAAK,OAAL,YAAAC,EAAW,SAAU,gBAAkB,CAACH,IAC1CA,EAAeE,EAAI,QAEfE,EAAAF,EAAI,OAAJ,MAAAE,EAAU,iBACZP,EAAM,IAAI,yBAA0BK,EAAI,KAAK,cAAc,EAE3D,WAAW,IAAM,CAzB7B,IAAAC,EA0Bc,OAAO,SAAS,GAAGA,EAAAD,EAAI,OAAJ,YAAAC,EAAU,cAAc,CAC7C,EAAG,CAAC,IAGJD,EAAI,SAAWF,KAEfK,EAAAH,GAAA,YAAAA,EAAK,OAAL,YAAAG,EAAW,SAAU,0BAA2B,CAClD,IAAMC,EACJ,OAAO,SAAW,SAAS,gBAAgB,UAC7CT,EAAM,IAAI,2BAA4BS,CAAc,EACpDP,GAAe,oBAAqB,CAClC,MAAOO,CACT,CAAC,CACH,CACF,EAEA,cAAO,iBAAiB,UAAWL,CAAa,EAEhDJ,EAAM,IAAI,gCAAgC,EAEnC,IAAM,CACX,OAAO,oBAAoB,UAAWI,CAAa,EACnDJ,EAAM,IAAI,oCAAoC,CAChD,CACF,KAAO,CACLA,EAAM,IAAI,sCAAsC,EAChD,MACF,CACF,EAAG,CAACA,CAAK,CAAC,CACZ","names":["react_exports","__export","EditModeProvider","EditModeSelector","logo_default","PreprPreviewBar","PreprPreviewBarProvider","PreviewBar","PreviewBarIndicatorWrapper","PreviewBarWrapper","ResetButton","SegmentDropdown","SegmentProvider","StegaErrorBoundary","VariantProvider","VariantSelector","createScopedLogger","debugError","debugLog","debugWarn","useEditModeContext","useModal","usePreprPreviewBar","useScrollPosition","useSegmentContext","useStegaElements","useStegaOverlay","useStegaProximity","useStegaScan","useVariantContext","__toCommonJS","import_react","import_react","StegaError","createErrorInfo","type","context","error","additionalData","handleStegaError","errorInfo","handleDOMError","handleContextError","contextName","SegmentContext","SegmentProvider","children","initialSegments","activeSegment","segmentList","emptySegment","selectedSegment","setSelectedSegment","segmentData","value","React","useSegmentContext","context","handleContextError","import_react","VariantContext","VariantProvider","children","activeVariant","emptyVariant","selectedVariant","setSelectedVariant","value","React","useVariantContext","context","handleContextError","import_react","EditModeContext","EditModeProvider","children","editMode","setEditMode","isIframe","setIsIframe","value","React","useEditModeContext","context","handleContextError","import_react","StegaErrorBoundary","props","error","errorInfo","_a","React","DebugLogger","_DebugLogger","options","__spreadValues","message","args","prefix","scopeName","__spreadProps","globalDebugLogger","initDebugLogger","enabled","getDebugLogger","debugLog","debugWarn","debugError","createScopedLogger","PreprPreviewBarProvider","children","props","options","activeSegment","activeVariant","data","_a","debugEnabled","initDebugLogger","React","StegaErrorBoundary","SegmentProvider","VariantProvider","EditModeProvider","usePreprPreviewBar","segmentContext","useSegmentContext","variantContext","useVariantContext","editModeContext","useEditModeContext","import_react","import_react","DOMService","tag","className","element","error","handleDOMError","styles","property","value","rect","x1","y1","x2","y2","pointX","pointY","elements","closestElement","minDistance","distance","event","handler","options","throttle","func","delay","timeoutId","lastExecTime","args","currentTime","createElementCache","query","ttl","cache","lastCacheTime","now","import_react","import_stega","decode","str","debug","createScopedLogger","decoded","e","regex","match","decodedMatch","handleStegaError","useStegaOverlay","overlayRef","tooltipRef","hideTimeoutRef","currentElementRef","createOverlay","overlay","DOMService","tooltip","showOverlay","element","rect","href","origin","isCompact","hideOverlay","cleanup","import_react","useStegaProximity","debug","createScopedLogger","highlightedElementsRef","getEncodedElements","createElementCache","updateElementGradients","cursorX","cursorY","encodedElements","newHighlightedElements","highlightedCount","element","rect","distanceLeft","distanceRight","distanceTop","distanceBottom","distance","el","relativeX","relativeY","baseGradientSize","distanceScale","gradientSize","clearAllHighlights","highlightedElements","clearedCount","import_react","useStegaElements","debug","createScopedLogger","elementsRef","observerRef","getElements","scanNode","node","decode","_a","_b","decoded","target","i","scanDocument","walker","textNode","encodedCount","setupMutationObserver","pendingMutations","debounceTimeout","processMutations","allAddedNodes","mutation","mutations","cleanup","encodedElements","element","useStegaScan","editMode","debug","createScopedLogger","isInitializedRef","currentElementRef","hideTimeoutRef","createOverlay","showOverlay","hideOverlay","cleanupOverlay","decode","useStegaOverlay","updateElementGradients","clearAllHighlights","useStegaProximity","getElements","scanDocument","setupMutationObserver","cleanupElements","useStegaElements","throttledMouseMove","throttle","e","mouseEvent","target","encodedElement","handleTooltipMouseEnter","handleTooltipMouseLeave","DOMService","tooltip","elements","import_react","import_react","import_react_dom","import_clsx","import_tailwind_merge","cn","inputs","sendPreprEvent","event","data","__spreadValues","import_react","useModal","isVisible","onClose","contentRef","triggerRef","handleEscapeKey","event","handleClickOutside","import_react","import_react","Logo","props","React","__spreadProps","__spreadValues","logo_default","import_react","import_navigation","import_react","import_react","SortDown","props","React","__spreadValues","SegmentDropdown","segments","setSelectedSegment","selectedSegment","useSegmentContext","pathname","router","updateSelectedSegment","value","params","segment","React","SortDown","cn","import_react","import_navigation","import_react","RadioSelector","value","onChange","options","React","option","cn","VariantSelector","selectedVariant","setSelectedVariant","emptyVariant","useVariantContext","pathname","router","React","RadioSelector","value","params","import_react","EditModeSelector","editMode","setEditMode","useEditModeContext","updateEditMode","value","React","RadioSelector","import_react","import_navigation","import_react","Rotate","React","ResetButton","router","resetSelected","selectedVariant","selectedSegment","setEditMode","editMode","usePreprPreviewBar","pathname","enabled","handleClick","params","classes","cn","React","Rotate","PreviewBarContent","onClose","contentRef","React","logo_default","SegmentDropdown","VariantSelector","EditModeSelector","ResetButton","import_react","import_react","Icon","props","React","__spreadValues","icon_default","PreviewBarButton","onClick","className","React","cn","icon_default","PreviewBar","children","isMounted","setIsMounted","isBarVisible","setIsBarVisible","React","editMode","useEditModeContext","contentRef","triggerRef","useModal","popupBoxRef","popupTop","setPopupTop","updatePopupPosition","popupHeight","windowHeight","triggerRect","top","handleClick","previewBarContent","cn","PreviewBarButton","PreviewBarContent","import_navigation","PreviewBarWrapper","searchParams","isIframe","setIsIframe","handleKeyDown","event","key","isSaveShortcut","isPrintShortcut","isAddressBarShortcut","previewBarMessage","React","PreviewBar","import_react","import_react","StatusIndicatorPill","_a","_b","selectedSegment","selectedVariant","emptySegment","emptyVariant","isIframe","usePreprPreviewBar","show","React","import_react","import_react","XMark","props","React","__spreadValues","CloseEditModePill","editMode","setEditMode","isIframe","usePreprPreviewBar","React","XMark","PreviewBarIndicatorWrapper","React","StatusIndicatorPill","CloseEditModePill","PreprPreviewBar","editMode","useEditModeContext","useStegaScan","React","PreviewBarWrapper","PreviewBarIndicatorWrapper","import_react","useScrollPosition","debug","createScopedLogger","sendPreprEvent","parentOrigin","handleMessage","evt","_a","_b","_c","currentScrollY"]}
@@ -0,0 +1,226 @@
1
+ import * as React from 'react';
2
+ import React__default, { ReactNode, Component } from 'react';
3
+
4
+ type PreprSegment = {
5
+ _id: string;
6
+ name: string;
7
+ };
8
+ type PreprPreviewBarOptions = {
9
+ debug?: boolean;
10
+ };
11
+ type PreprPreviewBarProps = {
12
+ activeSegment: string | null;
13
+ activeVariant: string | null;
14
+ data: PreprSegment[];
15
+ };
16
+
17
+ interface PreprPreviewBarProviderProps {
18
+ children: ReactNode;
19
+ props: PreprPreviewBarProps;
20
+ options?: PreprPreviewBarOptions;
21
+ }
22
+ declare const PreprPreviewBarProvider: React__default.FC<PreprPreviewBarProviderProps>;
23
+ declare const usePreprPreviewBar: () => {
24
+ isPreviewMode: boolean;
25
+ activeSegment: string;
26
+ activeVariant: string | null;
27
+ data: PreprSegment[];
28
+ emptySegment: PreprSegment;
29
+ segmentList: PreprSegment[];
30
+ selectedSegment: PreprSegment;
31
+ setSelectedSegment: (segment: PreprSegment) => void;
32
+ emptyVariant: string;
33
+ selectedVariant: string | null;
34
+ setSelectedVariant: (variant: string | null) => void;
35
+ editMode: boolean;
36
+ setEditMode: (mode: boolean) => void;
37
+ isIframe: boolean;
38
+ resetSelected: () => void;
39
+ };
40
+
41
+ declare function PreprPreviewBar(): React__default.JSX.Element;
42
+
43
+ interface SegmentContextValue {
44
+ segments: PreprSegment[];
45
+ selectedSegment: PreprSegment;
46
+ setSelectedSegment: (segment: PreprSegment) => void;
47
+ emptySegment: PreprSegment;
48
+ }
49
+ interface SegmentProviderProps {
50
+ children: ReactNode;
51
+ initialSegments: PreprSegment[];
52
+ activeSegment?: string | null;
53
+ }
54
+ declare function SegmentProvider({ children, initialSegments, activeSegment, }: SegmentProviderProps): React__default.JSX.Element;
55
+ declare function useSegmentContext(): SegmentContextValue;
56
+
57
+ interface VariantContextValue {
58
+ selectedVariant: string | null;
59
+ setSelectedVariant: (variant: string | null) => void;
60
+ emptyVariant: string;
61
+ }
62
+ interface VariantProviderProps {
63
+ children: ReactNode;
64
+ activeVariant?: string | null;
65
+ }
66
+ declare function VariantProvider({ children, activeVariant, }: VariantProviderProps): React__default.JSX.Element;
67
+ declare function useVariantContext(): VariantContextValue;
68
+
69
+ interface EditModeContextValue {
70
+ editMode: boolean;
71
+ setEditMode: (mode: boolean) => void;
72
+ isIframe: boolean;
73
+ }
74
+ interface EditModeProviderProps {
75
+ children: ReactNode;
76
+ }
77
+ declare function EditModeProvider({ children }: EditModeProviderProps): React__default.JSX.Element;
78
+ declare function useEditModeContext(): EditModeContextValue;
79
+
80
+ declare function useStegaScan(editMode: boolean): void;
81
+
82
+ interface DecodedData$1 {
83
+ origin: string;
84
+ href: string;
85
+ }
86
+ declare function decode(str: string | null): DecodedData$1 | null;
87
+ declare function useStegaOverlay(): {
88
+ overlayRef: React.RefObject<HTMLDivElement | null>;
89
+ tooltipRef: React.RefObject<HTMLDivElement | null>;
90
+ currentElementRef: React.RefObject<HTMLElement | null>;
91
+ hideTimeoutRef: React.RefObject<NodeJS.Timeout | null>;
92
+ createOverlay: () => {
93
+ overlay: HTMLDivElement;
94
+ tooltip: HTMLDivElement;
95
+ };
96
+ showOverlay: (element: HTMLElement) => void;
97
+ hideOverlay: () => void;
98
+ cleanup: () => void;
99
+ decode: typeof decode;
100
+ };
101
+
102
+ declare function useStegaProximity(): {
103
+ updateElementGradients: (cursorX: number, cursorY: number) => void;
104
+ clearAllHighlights: () => void;
105
+ highlightedElementsRef: React.RefObject<Set<HTMLElement>>;
106
+ };
107
+
108
+ interface DecodedData {
109
+ href: string;
110
+ origin: string;
111
+ }
112
+ declare function useStegaElements(): {
113
+ getElements: () => NodeListOf<Element>;
114
+ scanDocument: (decode: (str: string | null) => DecodedData | null) => void;
115
+ setupMutationObserver: (decode: (str: string | null) => DecodedData | null) => void;
116
+ cleanup: () => void;
117
+ };
118
+
119
+ interface UseModalProps {
120
+ isVisible: boolean;
121
+ onClose: () => void;
122
+ }
123
+ declare function useModal({ isVisible, onClose }: UseModalProps): {
124
+ contentRef: React.RefObject<HTMLDivElement | null>;
125
+ triggerRef: React.RefObject<HTMLDivElement | null>;
126
+ };
127
+
128
+ declare function useScrollPosition(): void;
129
+
130
+ /**
131
+ * Debug utility for Prepr Next.js package
132
+ * Provides centralized debug logging with performance optimizations
133
+ */
134
+ type DebugArg = string | number | boolean | null | undefined | object;
135
+ interface DebugOptions {
136
+ enabled: boolean;
137
+ prefix?: string;
138
+ }
139
+ declare class DebugLogger {
140
+ private options;
141
+ constructor(options: DebugOptions);
142
+ /**
143
+ * Log a debug message if debug is enabled
144
+ */
145
+ log(message: string, ...args: DebugArg[]): void;
146
+ /**
147
+ * Log a debug warning if debug is enabled
148
+ */
149
+ warn(message: string, ...args: DebugArg[]): void;
150
+ /**
151
+ * Log a debug error if debug is enabled
152
+ */
153
+ error(message: string, ...args: DebugArg[]): void;
154
+ /**
155
+ * Create a scoped logger with additional context
156
+ */
157
+ scope(scopeName: string): DebugLogger;
158
+ }
159
+ /**
160
+ * Convenience function for logging
161
+ */
162
+ declare function debugLog(message: string, ...args: DebugArg[]): void;
163
+ /**
164
+ * Convenience function for warning
165
+ */
166
+ declare function debugWarn(message: string, ...args: DebugArg[]): void;
167
+ /**
168
+ * Convenience function for errors
169
+ */
170
+ declare function debugError(message: string, ...args: DebugArg[]): void;
171
+ /**
172
+ * Create a scoped debug logger
173
+ */
174
+ declare function createScopedLogger(scopeName: string): DebugLogger;
175
+
176
+ interface Props {
177
+ children: ReactNode;
178
+ fallback?: ReactNode;
179
+ }
180
+ interface State {
181
+ hasError: boolean;
182
+ error: Error | null;
183
+ }
184
+ declare class StegaErrorBoundary extends Component<Props, State> {
185
+ constructor(props: Props);
186
+ static getDerivedStateFromError(error: Error): State;
187
+ componentDidCatch(error: Error, errorInfo: React__default.ErrorInfo): void;
188
+ render(): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | React__default.JSX.Element | null | undefined;
189
+ }
190
+
191
+ interface PreviewBarContentProps {
192
+ onClose: () => void;
193
+ contentRef: React__default.RefObject<HTMLDivElement | null>;
194
+ }
195
+ declare function PreviewBarContent({ onClose, contentRef, }: PreviewBarContentProps): React__default.JSX.Element;
196
+
197
+ interface PreviewBarButtonProps {
198
+ onClick: () => void;
199
+ className?: string;
200
+ }
201
+ declare function PreviewBarButton({ onClick, className, }: PreviewBarButtonProps): React__default.JSX.Element;
202
+
203
+ interface PreviewBarProps {
204
+ children?: React__default.ReactNode;
205
+ }
206
+ declare function PreviewBar({ children }: PreviewBarProps): React__default.ReactPortal | null;
207
+ declare namespace PreviewBar {
208
+ var Content: typeof PreviewBarContent;
209
+ var Button: typeof PreviewBarButton;
210
+ }
211
+
212
+ declare function PreviewBarWrapper(): React__default.JSX.Element | null;
213
+
214
+ declare function PreviewBarIndicatorWrapper(): React__default.JSX.Element;
215
+
216
+ declare function SegmentDropdown(): React__default.JSX.Element;
217
+
218
+ declare function VariantSelector(): React__default.JSX.Element;
219
+
220
+ declare function EditModeSelector(): React__default.JSX.Element;
221
+
222
+ declare function ResetButton(): React__default.JSX.Element;
223
+
224
+ declare const Logo: React__default.FC<React__default.SVGProps<SVGSVGElement>>;
225
+
226
+ export { EditModeProvider, EditModeSelector, Logo, PreprPreviewBar, PreprPreviewBarProvider, PreviewBar, PreviewBarIndicatorWrapper, PreviewBarWrapper, ResetButton, SegmentDropdown, SegmentProvider, StegaErrorBoundary, VariantProvider, VariantSelector, createScopedLogger, debugError, debugLog, debugWarn, useEditModeContext, useModal, usePreprPreviewBar, useScrollPosition, useSegmentContext, useStegaElements, useStegaOverlay, useStegaProximity, useStegaScan, useVariantContext };