@bitux/review-layer-react 0.1.8 → 0.1.9
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-layer-react.js","sources":["../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js","../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js","../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js","../src/utils/selector.ts","../src/utils/positioning.ts","../src/utils/pageUrl.ts","../src/utils/api.ts","../src/CommentModal.tsx","../src/ElementHighlight.tsx","../src/CommentPin.tsx","../src/Overlay.tsx","../src/variables.css?raw","../src/hooks/useReviewMode.ts","../src/utils/cache.ts","../src/ReviewProvider.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var f=require(\"react\"),k=Symbol.for(\"react.element\"),l=Symbol.for(\"react.fragment\"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=\"\"+g);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;\n","/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\nvar React = require('react');\n\n// ATTENTION\n// When adding new symbols to this file,\n// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'\n// The Symbol used to tag the ReactElement-like types.\nvar REACT_ELEMENT_TYPE = Symbol.for('react.element');\nvar REACT_PORTAL_TYPE = Symbol.for('react.portal');\nvar REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');\nvar REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');\nvar REACT_PROFILER_TYPE = Symbol.for('react.profiler');\nvar REACT_PROVIDER_TYPE = Symbol.for('react.provider');\nvar REACT_CONTEXT_TYPE = Symbol.for('react.context');\nvar REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');\nvar REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');\nvar REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');\nvar REACT_MEMO_TYPE = Symbol.for('react.memo');\nvar REACT_LAZY_TYPE = Symbol.for('react.lazy');\nvar REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');\nvar MAYBE_ITERATOR_SYMBOL = Symbol.iterator;\nvar FAUX_ITERATOR_SYMBOL = '@@iterator';\nfunction getIteratorFn(maybeIterable) {\n if (maybeIterable === null || typeof maybeIterable !== 'object') {\n return null;\n }\n\n var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];\n\n if (typeof maybeIterator === 'function') {\n return maybeIterator;\n }\n\n return null;\n}\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n// -----------------------------------------------------------------------------\n\nvar enableScopeAPI = false; // Experimental Create Event Handle API.\nvar enableCacheElement = false;\nvar enableTransitionTracing = false; // No known bugs, but needs performance testing\n\nvar enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber\n// stuff. Intended to enable React core members to more easily debug scheduling\n// issues in DEV builds.\n\nvar enableDebugTracing = false; // Track which Fiber(s) schedule render work.\n\nvar REACT_MODULE_REFERENCE;\n\n{\n REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');\n}\n\nfunction isValidElementType(type) {\n if (typeof type === 'string' || typeof type === 'function') {\n return true;\n } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).\n\n\n if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {\n return true;\n }\n\n if (typeof type === 'object' && type !== null) {\n if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object\n // types supported by any Flight configuration anywhere since\n // we don't know which Flight build this will end up being used\n // with.\n type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction getWrappedName(outerType, innerType, wrapperName) {\n var displayName = outerType.displayName;\n\n if (displayName) {\n return displayName;\n }\n\n var functionName = innerType.displayName || innerType.name || '';\n return functionName !== '' ? wrapperName + \"(\" + functionName + \")\" : wrapperName;\n} // Keep in sync with react-reconciler/getComponentNameFromFiber\n\n\nfunction getContextName(type) {\n return type.displayName || 'Context';\n} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.\n\n\nfunction getComponentNameFromType(type) {\n if (type == null) {\n // Host root, text node or just invalid type.\n return null;\n }\n\n {\n if (typeof type.tag === 'number') {\n error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');\n }\n }\n\n if (typeof type === 'function') {\n return type.displayName || type.name || null;\n }\n\n if (typeof type === 'string') {\n return type;\n }\n\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return 'Fragment';\n\n case REACT_PORTAL_TYPE:\n return 'Portal';\n\n case REACT_PROFILER_TYPE:\n return 'Profiler';\n\n case REACT_STRICT_MODE_TYPE:\n return 'StrictMode';\n\n case REACT_SUSPENSE_TYPE:\n return 'Suspense';\n\n case REACT_SUSPENSE_LIST_TYPE:\n return 'SuspenseList';\n\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_CONTEXT_TYPE:\n var context = type;\n return getContextName(context) + '.Consumer';\n\n case REACT_PROVIDER_TYPE:\n var provider = type;\n return getContextName(provider._context) + '.Provider';\n\n case REACT_FORWARD_REF_TYPE:\n return getWrappedName(type, type.render, 'ForwardRef');\n\n case REACT_MEMO_TYPE:\n var outerName = type.displayName || null;\n\n if (outerName !== null) {\n return outerName;\n }\n\n return getComponentNameFromType(type.type) || 'Memo';\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n return getComponentNameFromType(init(payload));\n } catch (x) {\n return null;\n }\n }\n\n // eslint-disable-next-line no-fallthrough\n }\n }\n\n return null;\n}\n\nvar assign = Object.assign;\n\n// Helpers to patch console.logs to avoid logging during side-effect free\n// replaying on render function. This currently only patches the object\n// lazily which won't cover if the log function was extracted eagerly.\n// We could also eagerly patch the method.\nvar disabledDepth = 0;\nvar prevLog;\nvar prevInfo;\nvar prevWarn;\nvar prevError;\nvar prevGroup;\nvar prevGroupCollapsed;\nvar prevGroupEnd;\n\nfunction disabledLog() {}\n\ndisabledLog.__reactDisabledLog = true;\nfunction disableLogs() {\n {\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n prevLog = console.log;\n prevInfo = console.info;\n prevWarn = console.warn;\n prevError = console.error;\n prevGroup = console.group;\n prevGroupCollapsed = console.groupCollapsed;\n prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099\n\n var props = {\n configurable: true,\n enumerable: true,\n value: disabledLog,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n info: props,\n log: props,\n warn: props,\n error: props,\n group: props,\n groupCollapsed: props,\n groupEnd: props\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n disabledDepth++;\n }\n}\nfunction reenableLogs() {\n {\n disabledDepth--;\n\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n var props = {\n configurable: true,\n enumerable: true,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n log: assign({}, props, {\n value: prevLog\n }),\n info: assign({}, props, {\n value: prevInfo\n }),\n warn: assign({}, props, {\n value: prevWarn\n }),\n error: assign({}, props, {\n value: prevError\n }),\n group: assign({}, props, {\n value: prevGroup\n }),\n groupCollapsed: assign({}, props, {\n value: prevGroupCollapsed\n }),\n groupEnd: assign({}, props, {\n value: prevGroupEnd\n })\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n if (disabledDepth < 0) {\n error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');\n }\n }\n}\n\nvar ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;\nvar prefix;\nfunction describeBuiltInComponentFrame(name, source, ownerFn) {\n {\n if (prefix === undefined) {\n // Extract the VM specific prefix used by each line.\n try {\n throw Error();\n } catch (x) {\n var match = x.stack.trim().match(/\\n( *(at )?)/);\n prefix = match && match[1] || '';\n }\n } // We use the prefix to ensure our stacks line up with native stack frames.\n\n\n return '\\n' + prefix + name;\n }\n}\nvar reentry = false;\nvar componentFrameCache;\n\n{\n var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;\n componentFrameCache = new PossiblyWeakMap();\n}\n\nfunction describeNativeComponentFrame(fn, construct) {\n // If something asked for a stack inside a fake render, it should get ignored.\n if ( !fn || reentry) {\n return '';\n }\n\n {\n var frame = componentFrameCache.get(fn);\n\n if (frame !== undefined) {\n return frame;\n }\n }\n\n var control;\n reentry = true;\n var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.\n\n Error.prepareStackTrace = undefined;\n var previousDispatcher;\n\n {\n previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function\n // for warnings.\n\n ReactCurrentDispatcher.current = null;\n disableLogs();\n }\n\n try {\n // This should throw.\n if (construct) {\n // Something should be setting the props in the constructor.\n var Fake = function () {\n throw Error();\n }; // $FlowFixMe\n\n\n Object.defineProperty(Fake.prototype, 'props', {\n set: function () {\n // We use a throwing setter instead of frozen or non-writable props\n // because that won't throw in a non-strict mode function.\n throw Error();\n }\n });\n\n if (typeof Reflect === 'object' && Reflect.construct) {\n // We construct a different control for this case to include any extra\n // frames added by the construct call.\n try {\n Reflect.construct(Fake, []);\n } catch (x) {\n control = x;\n }\n\n Reflect.construct(fn, [], Fake);\n } else {\n try {\n Fake.call();\n } catch (x) {\n control = x;\n }\n\n fn.call(Fake.prototype);\n }\n } else {\n try {\n throw Error();\n } catch (x) {\n control = x;\n }\n\n fn();\n }\n } catch (sample) {\n // This is inlined manually because closure doesn't do it for us.\n if (sample && control && typeof sample.stack === 'string') {\n // This extracts the first frame from the sample that isn't also in the control.\n // Skipping one frame that we assume is the frame that calls the two.\n var sampleLines = sample.stack.split('\\n');\n var controlLines = control.stack.split('\\n');\n var s = sampleLines.length - 1;\n var c = controlLines.length - 1;\n\n while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {\n // We expect at least one stack frame to be shared.\n // Typically this will be the root most one. However, stack frames may be\n // cut off due to maximum stack limits. In this case, one maybe cut off\n // earlier than the other. We assume that the sample is longer or the same\n // and there for cut off earlier. So we should find the root most frame in\n // the sample somewhere in the control.\n c--;\n }\n\n for (; s >= 1 && c >= 0; s--, c--) {\n // Next we find the first one that isn't the same which should be the\n // frame that called our sample function and the control.\n if (sampleLines[s] !== controlLines[c]) {\n // In V8, the first line is describing the message but other VMs don't.\n // If we're about to return the first line, and the control is also on the same\n // line, that's a pretty good indicator that our sample threw at same line as\n // the control. I.e. before we entered the sample frame. So we ignore this result.\n // This can happen if you passed a class to function component, or non-function.\n if (s !== 1 || c !== 1) {\n do {\n s--;\n c--; // We may still have similar intermediate frames from the construct call.\n // The next one that isn't the same should be our match though.\n\n if (c < 0 || sampleLines[s] !== controlLines[c]) {\n // V8 adds a \"new\" prefix for native classes. Let's remove it to make it prettier.\n var _frame = '\\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled \"<anonymous>\"\n // but we have a user-provided \"displayName\"\n // splice it in to make the stack more readable.\n\n\n if (fn.displayName && _frame.includes('<anonymous>')) {\n _frame = _frame.replace('<anonymous>', fn.displayName);\n }\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, _frame);\n }\n } // Return the line we found.\n\n\n return _frame;\n }\n } while (s >= 1 && c >= 0);\n }\n\n break;\n }\n }\n }\n } finally {\n reentry = false;\n\n {\n ReactCurrentDispatcher.current = previousDispatcher;\n reenableLogs();\n }\n\n Error.prepareStackTrace = previousPrepareStackTrace;\n } // Fallback to just using the name if we couldn't make it throw.\n\n\n var name = fn ? fn.displayName || fn.name : '';\n var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, syntheticFrame);\n }\n }\n\n return syntheticFrame;\n}\nfunction describeFunctionComponentFrame(fn, source, ownerFn) {\n {\n return describeNativeComponentFrame(fn, false);\n }\n}\n\nfunction shouldConstruct(Component) {\n var prototype = Component.prototype;\n return !!(prototype && prototype.isReactComponent);\n}\n\nfunction describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {\n\n if (type == null) {\n return '';\n }\n\n if (typeof type === 'function') {\n {\n return describeNativeComponentFrame(type, shouldConstruct(type));\n }\n }\n\n if (typeof type === 'string') {\n return describeBuiltInComponentFrame(type);\n }\n\n switch (type) {\n case REACT_SUSPENSE_TYPE:\n return describeBuiltInComponentFrame('Suspense');\n\n case REACT_SUSPENSE_LIST_TYPE:\n return describeBuiltInComponentFrame('SuspenseList');\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_FORWARD_REF_TYPE:\n return describeFunctionComponentFrame(type.render);\n\n case REACT_MEMO_TYPE:\n // Memo may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n // Lazy may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);\n } catch (x) {}\n }\n }\n }\n\n return '';\n}\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar loggedTypeFailures = {};\nvar ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n\nfunction setCurrentlyValidatingElement(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n ReactDebugCurrentFrame.setExtraStackFrame(stack);\n } else {\n ReactDebugCurrentFrame.setExtraStackFrame(null);\n }\n }\n}\n\nfunction checkPropTypes(typeSpecs, values, location, componentName, element) {\n {\n // $FlowFixMe This is okay but Flow doesn't know it.\n var has = Function.call.bind(hasOwnProperty);\n\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n // eslint-disable-next-line react-internal/prod-error-codes\n var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');\n err.name = 'Invariant Violation';\n throw err;\n }\n\n error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');\n } catch (ex) {\n error$1 = ex;\n }\n\n if (error$1 && !(error$1 instanceof Error)) {\n setCurrentlyValidatingElement(element);\n\n error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);\n\n setCurrentlyValidatingElement(null);\n }\n\n if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error$1.message] = true;\n setCurrentlyValidatingElement(element);\n\n error('Failed %s type: %s', location, error$1.message);\n\n setCurrentlyValidatingElement(null);\n }\n }\n }\n }\n}\n\nvar isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare\n\nfunction isArray(a) {\n return isArrayImpl(a);\n}\n\n/*\n * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol\n * and Temporal.* types. See https://github.com/facebook/react/pull/22064.\n *\n * The functions in this module will throw an easier-to-understand,\n * easier-to-debug exception with a clear errors message message explaining the\n * problem. (Instead of a confusing exception thrown inside the implementation\n * of the `value` object).\n */\n// $FlowFixMe only called in DEV, so void return is not possible.\nfunction typeName(value) {\n {\n // toStringTag is needed for namespaced types like Temporal.Instant\n var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;\n var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';\n return type;\n }\n} // $FlowFixMe only called in DEV, so void return is not possible.\n\n\nfunction willCoercionThrow(value) {\n {\n try {\n testStringCoercion(value);\n return false;\n } catch (e) {\n return true;\n }\n }\n}\n\nfunction testStringCoercion(value) {\n // If you ended up here by following an exception call stack, here's what's\n // happened: you supplied an object or symbol value to React (as a prop, key,\n // DOM attribute, CSS property, string ref, etc.) and when React tried to\n // coerce it to a string using `'' + value`, an exception was thrown.\n //\n // The most common types that will cause this exception are `Symbol` instances\n // and Temporal objects like `Temporal.Instant`. But any object that has a\n // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this\n // exception. (Library authors do this to prevent users from using built-in\n // numeric operators like `+` or comparison operators like `>=` because custom\n // methods are needed to perform accurate arithmetic or comparison.)\n //\n // To fix the problem, coerce this object or symbol value to a string before\n // passing it to React. The most reliable way is usually `String(value)`.\n //\n // To find which value is throwing, check the browser or debugger console.\n // Before this exception was thrown, there should be `console.error` output\n // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the\n // problem and how that type was used: key, atrribute, input value prop, etc.\n // In most cases, this console output also shows the component and its\n // ancestor components where the exception happened.\n //\n // eslint-disable-next-line react-internal/safe-string-coercion\n return '' + value;\n}\nfunction checkKeyStringCoercion(value) {\n {\n if (willCoercionThrow(value)) {\n error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));\n\n return testStringCoercion(value); // throw (to help callers find troubleshooting comments)\n }\n }\n}\n\nvar ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;\nvar RESERVED_PROPS = {\n key: true,\n ref: true,\n __self: true,\n __source: true\n};\nvar specialPropKeyWarningShown;\nvar specialPropRefWarningShown;\nvar didWarnAboutStringRefs;\n\n{\n didWarnAboutStringRefs = {};\n}\n\nfunction hasValidRef(config) {\n {\n if (hasOwnProperty.call(config, 'ref')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.ref !== undefined;\n}\n\nfunction hasValidKey(config) {\n {\n if (hasOwnProperty.call(config, 'key')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'key').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.key !== undefined;\n}\n\nfunction warnIfStringRefCannotBeAutoConverted(config, self) {\n {\n if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {\n var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);\n\n if (!didWarnAboutStringRefs[componentName]) {\n error('Component \"%s\" contains the string ref \"%s\". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);\n\n didWarnAboutStringRefs[componentName] = true;\n }\n }\n }\n}\n\nfunction defineKeyPropWarningGetter(props, displayName) {\n {\n var warnAboutAccessingKey = function () {\n if (!specialPropKeyWarningShown) {\n specialPropKeyWarningShown = true;\n\n error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n };\n\n warnAboutAccessingKey.isReactWarning = true;\n Object.defineProperty(props, 'key', {\n get: warnAboutAccessingKey,\n configurable: true\n });\n }\n}\n\nfunction defineRefPropWarningGetter(props, displayName) {\n {\n var warnAboutAccessingRef = function () {\n if (!specialPropRefWarningShown) {\n specialPropRefWarningShown = true;\n\n error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n };\n\n warnAboutAccessingRef.isReactWarning = true;\n Object.defineProperty(props, 'ref', {\n get: warnAboutAccessingRef,\n configurable: true\n });\n }\n}\n/**\n * Factory method to create a new React element. This no longer adheres to\n * the class pattern, so do not use new to call it. Also, instanceof check\n * will not work. Instead test $$typeof field against Symbol.for('react.element') to check\n * if something is a React Element.\n *\n * @param {*} type\n * @param {*} props\n * @param {*} key\n * @param {string|object} ref\n * @param {*} owner\n * @param {*} self A *temporary* helper to detect places where `this` is\n * different from the `owner` when React.createElement is called, so that we\n * can warn. We want to get rid of owner and replace string `ref`s with arrow\n * functions, and as long as `this` and owner are the same, there will be no\n * change in behavior.\n * @param {*} source An annotation object (added by a transpiler or otherwise)\n * indicating filename, line number, and/or other information.\n * @internal\n */\n\n\nvar ReactElement = function (type, key, ref, self, source, owner, props) {\n var element = {\n // This tag allows us to uniquely identify this as a React Element\n $$typeof: REACT_ELEMENT_TYPE,\n // Built-in properties that belong on the element\n type: type,\n key: key,\n ref: ref,\n props: props,\n // Record the component responsible for creating this element.\n _owner: owner\n };\n\n {\n // The validation flag is currently mutative. We put it on\n // an external backing store so that we can freeze the whole object.\n // This can be replaced with a WeakMap once they are implemented in\n // commonly used development environments.\n element._store = {}; // To make comparing ReactElements easier for testing purposes, we make\n // the validation flag non-enumerable (where possible, which should\n // include every environment we run tests in), so the test framework\n // ignores it.\n\n Object.defineProperty(element._store, 'validated', {\n configurable: false,\n enumerable: false,\n writable: true,\n value: false\n }); // self and source are DEV only properties.\n\n Object.defineProperty(element, '_self', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: self\n }); // Two elements created in two different places should be considered\n // equal for testing purposes and therefore we hide it from enumeration.\n\n Object.defineProperty(element, '_source', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: source\n });\n\n if (Object.freeze) {\n Object.freeze(element.props);\n Object.freeze(element);\n }\n }\n\n return element;\n};\n/**\n * https://github.com/reactjs/rfcs/pull/107\n * @param {*} type\n * @param {object} props\n * @param {string} key\n */\n\nfunction jsxDEV(type, config, maybeKey, source, self) {\n {\n var propName; // Reserved names are extracted\n\n var props = {};\n var key = null;\n var ref = null; // Currently, key can be spread in as a prop. This causes a potential\n // issue if key is also explicitly declared (ie. <div {...props} key=\"Hi\" />\n // or <div key=\"Hi\" {...props} /> ). We want to deprecate key spread,\n // but as an intermediary step, we will use jsxDEV for everything except\n // <div {...props} key=\"Hi\" />, because we aren't currently able to tell if\n // key is explicitly declared to be undefined or not.\n\n if (maybeKey !== undefined) {\n {\n checkKeyStringCoercion(maybeKey);\n }\n\n key = '' + maybeKey;\n }\n\n if (hasValidKey(config)) {\n {\n checkKeyStringCoercion(config.key);\n }\n\n key = '' + config.key;\n }\n\n if (hasValidRef(config)) {\n ref = config.ref;\n warnIfStringRefCannotBeAutoConverted(config, self);\n } // Remaining properties are added to a new props object\n\n\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n props[propName] = config[propName];\n }\n } // Resolve default props\n\n\n if (type && type.defaultProps) {\n var defaultProps = type.defaultProps;\n\n for (propName in defaultProps) {\n if (props[propName] === undefined) {\n props[propName] = defaultProps[propName];\n }\n }\n }\n\n if (key || ref) {\n var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;\n\n if (key) {\n defineKeyPropWarningGetter(props, displayName);\n }\n\n if (ref) {\n defineRefPropWarningGetter(props, displayName);\n }\n }\n\n return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);\n }\n}\n\nvar ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;\nvar ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;\n\nfunction setCurrentlyValidatingElement$1(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n ReactDebugCurrentFrame$1.setExtraStackFrame(stack);\n } else {\n ReactDebugCurrentFrame$1.setExtraStackFrame(null);\n }\n }\n}\n\nvar propTypesMisspellWarningShown;\n\n{\n propTypesMisspellWarningShown = false;\n}\n/**\n * Verifies the object is a ReactElement.\n * See https://reactjs.org/docs/react-api.html#isvalidelement\n * @param {?object} object\n * @return {boolean} True if `object` is a ReactElement.\n * @final\n */\n\n\nfunction isValidElement(object) {\n {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n }\n}\n\nfunction getDeclarationErrorAddendum() {\n {\n if (ReactCurrentOwner$1.current) {\n var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);\n\n if (name) {\n return '\\n\\nCheck the render method of `' + name + '`.';\n }\n }\n\n return '';\n }\n}\n\nfunction getSourceInfoErrorAddendum(source) {\n {\n if (source !== undefined) {\n var fileName = source.fileName.replace(/^.*[\\\\\\/]/, '');\n var lineNumber = source.lineNumber;\n return '\\n\\nCheck your code at ' + fileName + ':' + lineNumber + '.';\n }\n\n return '';\n }\n}\n/**\n * Warn if there's no key explicitly set on dynamic arrays of children or\n * object keys are not valid. This allows us to keep track of children between\n * updates.\n */\n\n\nvar ownerHasKeyUseWarning = {};\n\nfunction getCurrentComponentErrorInfo(parentType) {\n {\n var info = getDeclarationErrorAddendum();\n\n if (!info) {\n var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;\n\n if (parentName) {\n info = \"\\n\\nCheck the top-level render call using <\" + parentName + \">.\";\n }\n }\n\n return info;\n }\n}\n/**\n * Warn if the element doesn't have an explicit key assigned to it.\n * This element is in an array. The array could grow and shrink or be\n * reordered. All children that haven't already been validated are required to\n * have a \"key\" property assigned to it. Error statuses are cached so a warning\n * will only be shown once.\n *\n * @internal\n * @param {ReactElement} element Element that requires a key.\n * @param {*} parentType element's parent's type.\n */\n\n\nfunction validateExplicitKey(element, parentType) {\n {\n if (!element._store || element._store.validated || element.key != null) {\n return;\n }\n\n element._store.validated = true;\n var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);\n\n if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {\n return;\n }\n\n ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a\n // property, it may be the creator of the child that's responsible for\n // assigning it a key.\n\n var childOwner = '';\n\n if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {\n // Give the component that originally created this child.\n childOwner = \" It was passed a child from \" + getComponentNameFromType(element._owner.type) + \".\";\n }\n\n setCurrentlyValidatingElement$1(element);\n\n error('Each child in a list should have a unique \"key\" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);\n\n setCurrentlyValidatingElement$1(null);\n }\n}\n/**\n * Ensure that every element either is passed in a static location, in an\n * array with an explicit keys property defined, or in an object literal\n * with valid key property.\n *\n * @internal\n * @param {ReactNode} node Statically passed child of any type.\n * @param {*} parentType node's parent's type.\n */\n\n\nfunction validateChildKeys(node, parentType) {\n {\n if (typeof node !== 'object') {\n return;\n }\n\n if (isArray(node)) {\n for (var i = 0; i < node.length; i++) {\n var child = node[i];\n\n if (isValidElement(child)) {\n validateExplicitKey(child, parentType);\n }\n }\n } else if (isValidElement(node)) {\n // This element was passed in a valid location.\n if (node._store) {\n node._store.validated = true;\n }\n } else if (node) {\n var iteratorFn = getIteratorFn(node);\n\n if (typeof iteratorFn === 'function') {\n // Entry iterators used to provide implicit keys,\n // but now we print a separate warning for them later.\n if (iteratorFn !== node.entries) {\n var iterator = iteratorFn.call(node);\n var step;\n\n while (!(step = iterator.next()).done) {\n if (isValidElement(step.value)) {\n validateExplicitKey(step.value, parentType);\n }\n }\n }\n }\n }\n }\n}\n/**\n * Given an element, validate that its props follow the propTypes definition,\n * provided by the type.\n *\n * @param {ReactElement} element\n */\n\n\nfunction validatePropTypes(element) {\n {\n var type = element.type;\n\n if (type === null || type === undefined || typeof type === 'string') {\n return;\n }\n\n var propTypes;\n\n if (typeof type === 'function') {\n propTypes = type.propTypes;\n } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.\n // Inner props are checked in the reconciler.\n type.$$typeof === REACT_MEMO_TYPE)) {\n propTypes = type.propTypes;\n } else {\n return;\n }\n\n if (propTypes) {\n // Intentionally inside to avoid triggering lazy initializers:\n var name = getComponentNameFromType(type);\n checkPropTypes(propTypes, element.props, 'prop', name, element);\n } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {\n propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:\n\n var _name = getComponentNameFromType(type);\n\n error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');\n }\n\n if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {\n error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');\n }\n }\n}\n/**\n * Given a fragment, validate that it can only be provided with fragment props\n * @param {ReactElement} fragment\n */\n\n\nfunction validateFragmentProps(fragment) {\n {\n var keys = Object.keys(fragment.props);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n if (key !== 'children' && key !== 'key') {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);\n\n setCurrentlyValidatingElement$1(null);\n break;\n }\n }\n\n if (fragment.ref !== null) {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid attribute `ref` supplied to `React.Fragment`.');\n\n setCurrentlyValidatingElement$1(null);\n }\n }\n}\n\nvar didWarnAboutKeySpread = {};\nfunction jsxWithValidation(type, props, key, isStaticChildren, source, self) {\n {\n var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to\n // succeed and there will likely be errors in render.\n\n if (!validType) {\n var info = '';\n\n if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {\n info += ' You likely forgot to export your component from the file ' + \"it's defined in, or you might have mixed up default and named imports.\";\n }\n\n var sourceInfo = getSourceInfoErrorAddendum(source);\n\n if (sourceInfo) {\n info += sourceInfo;\n } else {\n info += getDeclarationErrorAddendum();\n }\n\n var typeString;\n\n if (type === null) {\n typeString = 'null';\n } else if (isArray(type)) {\n typeString = 'array';\n } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {\n typeString = \"<\" + (getComponentNameFromType(type.type) || 'Unknown') + \" />\";\n info = ' Did you accidentally export a JSX literal instead of a component?';\n } else {\n typeString = typeof type;\n }\n\n error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);\n }\n\n var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.\n // TODO: Drop this when these are no longer allowed as the type argument.\n\n if (element == null) {\n return element;\n } // Skip key warning if the type isn't valid since our key validation logic\n // doesn't expect a non-string/function type and can throw confusing errors.\n // We don't want exception behavior to differ between dev and prod.\n // (Rendering will throw with a helpful message and as soon as the type is\n // fixed, the key warnings will appear.)\n\n\n if (validType) {\n var children = props.children;\n\n if (children !== undefined) {\n if (isStaticChildren) {\n if (isArray(children)) {\n for (var i = 0; i < children.length; i++) {\n validateChildKeys(children[i], type);\n }\n\n if (Object.freeze) {\n Object.freeze(children);\n }\n } else {\n error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');\n }\n } else {\n validateChildKeys(children, type);\n }\n }\n }\n\n {\n if (hasOwnProperty.call(props, 'key')) {\n var componentName = getComponentNameFromType(type);\n var keys = Object.keys(props).filter(function (k) {\n return k !== 'key';\n });\n var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';\n\n if (!didWarnAboutKeySpread[componentName + beforeExample]) {\n var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';\n\n error('A props object containing a \"key\" prop is being spread into JSX:\\n' + ' let props = %s;\\n' + ' <%s {...props} />\\n' + 'React keys must be passed directly to JSX without using spread:\\n' + ' let props = %s;\\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);\n\n didWarnAboutKeySpread[componentName + beforeExample] = true;\n }\n }\n }\n\n if (type === REACT_FRAGMENT_TYPE) {\n validateFragmentProps(element);\n } else {\n validatePropTypes(element);\n }\n\n return element;\n }\n} // These two functions exist to still get child warnings in dev\n// even with the prod transform. This means that jsxDEV is purely\n// opt-in behavior for better messages but that we won't stop\n// giving you warnings if you use production apis.\n\nfunction jsxWithValidationStatic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, true);\n }\n}\nfunction jsxWithValidationDynamic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, false);\n }\n}\n\nvar jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.\n// for now we can ship identical prod functions\n\nvar jsxs = jsxWithValidationStatic ;\n\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsx;\nexports.jsxs = jsxs;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","/**\n * Generates a CSS selector for the given element.\n * Prefers id, then a unique path using tag and nth-child.\n */\nexport function getSelector(element: Element): string {\n if (element.id && /^[a-zA-Z][\\w-]*$/.test(element.id)) {\n return `#${element.id}`;\n }\n\n const path: string[] = [];\n let current: Element | null = element;\n\n while (current && current.nodeType === Node.ELEMENT_NODE) {\n let part = current.nodeName.toLowerCase();\n\n if (current.id && /^[a-zA-Z][\\w-]*$/.test(current.id)) {\n path.unshift(`#${current.id}`);\n break;\n }\n\n if (current.className && typeof current.className === \"string\") {\n const classes = current.className.trim().split(/\\s+/).filter(Boolean);\n if (classes.length > 0) {\n const safeClasses = classes\n .filter((c) => /^[a-zA-Z][\\w-]*$/.test(c))\n .slice(0, 2)\n .map((c) => `.${c}`)\n .join(\"\");\n if (safeClasses) {\n part += safeClasses;\n }\n }\n }\n\n if (path.length > 0) {\n const parent = current.parentElement;\n if (parent) {\n const siblings = Array.from(parent.children).filter(\n (el) => el.nodeName === current!.nodeName\n );\n if (siblings.length > 1) {\n const index = siblings.indexOf(current as Element) + 1;\n part += `:nth-child(${index})`;\n }\n }\n }\n\n path.unshift(part);\n current = current.parentElement;\n }\n\n return path.join(\" > \");\n}\n","import type { Comment } from \"./api\";\n\nconst REVIEW_LAYER_ROOT = \"[data-review-layer-root]\";\n\n/** Radio del pin en px (mitad del círculo) para inset en esquinas */\nconst PIN_RADIUS = 16;\n\n/**\n * Recorta la posición al viewport con un margen de radio (mitad del círculo)\n * para que el pin no se corte en esquinas. Si hay varios, los offsets se aplican sobre esto.\n */\nexport function clampPinToViewport(\n x: number,\n y: number,\n radius: number = PIN_RADIUS\n): { x: number; y: number } {\n if (typeof window === \"undefined\") return { x, y };\n const minX = radius;\n const minY = radius;\n const maxX = window.innerWidth - radius;\n const maxY = window.innerHeight - radius;\n return {\n x: Math.max(minX, Math.min(maxX, x)),\n y: Math.max(minY, Math.min(maxY, y)),\n };\n}\n\n/**\n * Ancestros del elemento que tienen scroll (overflow auto/scroll y contenido que desborda).\n * Útil en iframes/Storybook donde el scroll es en un div (ej. sbdocs-wrapper), no en window.\n */\nexport function getScrollableAncestors(el: Element | null): Element[] {\n if (typeof document === \"undefined\" || !el) return [];\n const result: Element[] = [];\n let current: Element | null = el.parentElement;\n while (current && current !== document.body) {\n const style = getComputedStyle(current);\n const ox = style.overflowX;\n const oy = style.overflowY;\n const scrollable =\n (ox === \"scroll\" || ox === \"auto\" || ox === \"overlay\" || oy === \"scroll\" || oy === \"auto\" || oy === \"overlay\") &&\n (current.scrollHeight > current.clientHeight || current.scrollWidth > current.clientWidth);\n if (scrollable) result.push(current);\n current = current.parentElement;\n }\n return result;\n}\n\n/**\n * Get the element's bounding rect if it exists in the DOM.\n * No devuelve posición si el elemento es parte del UI del review layer (pins, popover, iconos).\n */\nexport function getElementPosition(selector: string | null): DOMRect | null {\n if (typeof document === \"undefined\" || !selector?.trim()) return null;\n try {\n const el = document.querySelector(selector);\n if (!el || (el as Element).closest?.(REVIEW_LAYER_ROOT)) return null;\n return (el as Element).getBoundingClientRect();\n } catch {\n return null;\n }\n}\n\n/**\n * Get relative position (0–1) from a rect using current viewport.\n */\nexport function getRelativePosition(rect: DOMRect): {\n relativeX: number;\n relativeY: number;\n} {\n if (typeof window === \"undefined\") {\n return { relativeX: 0, relativeY: 0 };\n }\n const w = window.innerWidth;\n const h = window.innerHeight;\n return {\n relativeX: w > 0 ? rect.left / w : 0,\n relativeY: h > 0 ? rect.top / h : 0,\n };\n}\n\n/**\n * Fallback position when selector does not find an element.\n * Priority: relative coordinates (relativeX/relative_x, relativeY/relative_y) then absolute (x, y).\n * Acepta snake_case (API) y camelCase (frontend).\n */\nexport function getFallbackPosition(comment: Comment): { x: number; y: number } {\n if (typeof window === \"undefined\") {\n return {\n x: comment.x ?? 0,\n y: comment.y ?? 0,\n };\n }\n const relX = comment.relativeX ?? comment.relative_x ?? null;\n const relY = comment.relativeY ?? comment.relative_y ?? null;\n if (relX != null && relY != null) {\n return {\n x: relX * window.innerWidth,\n y: relY * window.innerHeight,\n };\n }\n return {\n x: comment.x ?? 0,\n y: comment.y ?? 0,\n };\n}\n\n/**\n * Rectángulo de respaldo para el highlight cuando el selector no encuentra el elemento\n * (p. ej. DOM cambiado, SPA). Usa coordenadas guardadas del comentario.\n */\nexport function getFallbackRect(comment: Comment): DOMRect | null {\n const { x, y } = getFallbackPosition(comment);\n const w = comment.width ?? 100;\n const h = comment.height ?? 40;\n return new DOMRect(x, y, w, h);\n}\n\n/**\n * Pin position: prioriza el elemento en vivo por selector para que el pin\n * siga al elemento al hacer scroll. Solo usa coordenadas guardadas cuando\n * el selector no encuentra el elemento (p. ej. DOM cambiado, SPA).\n */\nexport function getCommentPinPosition(comment: Comment): { x: number; y: number } {\n if (comment.selector) {\n const rect = getElementPosition(comment.selector);\n if (rect != null) {\n return { x: rect.left, y: rect.top };\n }\n }\n return getFallbackPosition(comment);\n}\n","/** Nombres conocidos por si el valor no empieza por \"/\" (ej. ?path=mi-pagina). */\nconst FALLBACK_QUERY_KEYS = [\"path\"] as const;\n\nfunction normalizePath(value: string): string {\n return value.trim().startsWith(\"/\") ? value.trim() : `/${value.trim()}`;\n}\n\n/**\n * URL de la página para scope de comentarios. Se resuelve de forma dinámica:\n *\n * 1. Cualquier query param cuyo valor empiece por \"/\" se usa como ruta (da igual el nombre: ?ruta=/x, ?page=/y, etc.).\n * 2. Si no hay ninguno, se buscan los nombres conocidos: path, route (con cualquier valor).\n * 3. Si es el iframe de Storybook (/iframe.html), se usa el param \"id\" → /story/:id.\n * 4. Si no, pathname.\n */\nexport function getPageUrl(): string {\n if (typeof window === \"undefined\") return \"/\";\n try {\n const params = new URLSearchParams(window.location.search);\n\n for (const [, value] of params) {\n const v = value?.trim();\n if (v !== \"\" && v.startsWith(\"/\")) {\n return v;\n }\n }\n\n for (const key of FALLBACK_QUERY_KEYS) {\n const value = params.get(key);\n if (value != null && value.trim() !== \"\") {\n return normalizePath(value);\n }\n }\n\n const pathname = window.location.pathname || \"/\";\n if (pathname === \"/iframe.html\" || pathname.endsWith(\"/iframe.html\")) {\n const storyId = params.get(\"id\");\n if (storyId != null && storyId.trim() !== \"\") {\n return `/story/${storyId.trim()}`;\n }\n }\n } catch {\n // ignore\n }\n return window.location.pathname || \"/\";\n}\n","export interface Reviewer {\n id: number;\n name: string;\n email?: string;\n /** URL de avatar (p. ej. Supabase Storage). Opcional; si no hay, se muestran iniciales. */\n image_url?: string | null;\n job_title?: string | null;\n}\n\nexport interface Comment {\n id: number;\n message: string;\n selector: string | null;\n x: number | null;\n y: number | null;\n /** Frontend camelCase */\n relativeX?: number | null;\n relativeY?: number | null;\n /** API snake_case (Laravel devuelve así) */\n relative_x?: number | null;\n relative_y?: number | null;\n width: number | null;\n height: number | null;\n url: string | null;\n status: string;\n reviewer_id?: number;\n reviewer?: Reviewer;\n created_at?: string;\n}\n\n/** Estados del comentario: Pendiente → Corregido Desarrollo → Validado (visible, se puede eliminar) */\nexport const COMMENT_STATUS = {\n PENDING: \"pending\",\n DEV_FIXED: \"dev_fixed\",\n VALIDATED: \"validated\",\n} as const;\n\nexport type CommentStatus = (typeof COMMENT_STATUS)[keyof typeof COMMENT_STATUS];\n\ninterface ApiResponse<T> {\n success: boolean;\n data: T;\n}\n\nconst API_LOG_PREFIX = \"[review-layer API]\";\n\n/** Clasifica y registra el fallo para depuración (CORS, apiKey, 404, servidor, etc.). */\nfunction logApiFailure(\n context: string,\n url: string,\n details:\n | { status: number; statusText: string; body?: string }\n | { networkError: unknown }\n): void {\n if (\"status\" in details) {\n const { status, statusText, body = \"\" } = details;\n let reason: string;\n if (status === 401) {\n reason = \"No autorizado (401). Revisa que apiKey sea correcta y esté aceptada por la API.\";\n } else if (status === 403) {\n reason = \"Acceso denegado (403). Revisa apiKey o permisos del proyecto.\";\n } else if (status === 404) {\n reason = \"Recurso no encontrado (404). Revisa apiUrl y que la ruta exista en el backend.\";\n } else if (status >= 500) {\n reason = \"Error del servidor (5xx). El backend puede estar caído o sobrecargado.\";\n } else {\n reason = `Respuesta HTTP ${status} ${statusText}. Revisa la API.`;\n }\n console.error(API_LOG_PREFIX, context, {\n motivo: reason,\n url,\n status,\n statusText,\n body: body.slice(0, 300),\n });\n return;\n }\n const e = details.networkError;\n const msg = e instanceof Error ? e.message : String(e);\n const isCorsOrNetwork =\n e instanceof TypeError ||\n /failed to fetch|networkerror|load failed|network request failed/i.test(msg);\n const reason = isCorsOrNetwork\n ? \"Posible CORS o error de red (servidor inalcanzable, bloqueo CORS o certificado). Revisa que apiUrl sea accesible desde este origen y que el backend permita CORS.\"\n : `Error inesperado: ${msg}`;\n console.error(API_LOG_PREFIX, context, { motivo: reason, url, error: e });\n}\n\nfunction getHeaders(apiKey: string): HeadersInit {\n return {\n \"Content-Type\": \"application/json\",\n \"x-review-key\": apiKey,\n };\n}\n\nexport async function fetchReviewers(\n apiUrl: string,\n apiKey: string,\n options?: { signal?: AbortSignal }\n): Promise<Reviewer[]> {\n const url = `${apiUrl}/reviewers`;\n let res: Response;\n try {\n res = await fetch(url, {\n headers: getHeaders(apiKey),\n signal: options?.signal,\n });\n } catch (e) {\n logApiFailure(\"fetchReviewers (red/CORS)\", url, { networkError: e });\n throw e;\n }\n if (!res.ok) {\n const body = await res.text();\n logApiFailure(\"fetchReviewers\", url, { status: res.status, statusText: res.statusText, body });\n throw new Error(\"Failed to fetch reviewers\");\n }\n const json: ApiResponse<Reviewer[]> = await res.json();\n return json.data ?? [];\n}\n\nexport interface CreateCommentPayload {\n message: string;\n selector: string;\n x: number;\n y: number;\n relativeX: number;\n relativeY: number;\n width: number;\n height: number;\n url: string;\n reviewerId: number;\n viewport: string;\n userAgent: string;\n pageTitle?: string;\n}\n\nexport async function createComment(\n apiUrl: string,\n apiKey: string,\n payload: CreateCommentPayload\n): Promise<Comment> {\n const url = `${apiUrl}/comments`;\n let res: Response;\n try {\n res = await fetch(url, {\n method: \"POST\",\n headers: getHeaders(apiKey),\n body: JSON.stringify(payload),\n });\n } catch (e) {\n logApiFailure(\"createComment (red/CORS)\", url, { networkError: e });\n throw e;\n }\n if (!res.ok) {\n const body = await res.text();\n let msg = \"Failed to create comment\";\n try {\n const err = JSON.parse(body);\n msg = err.message ?? msg;\n } catch {\n // body no es JSON\n }\n logApiFailure(\"createComment\", url, { status: res.status, statusText: res.statusText, body });\n throw new Error(msg);\n }\n const json: ApiResponse<Comment> = await res.json();\n return json.data;\n}\n\nexport async function fetchComments(\n apiUrl: string,\n apiKey: string,\n url: string,\n options?: { signal?: AbortSignal }\n): Promise<Comment[]> {\n const params = new URLSearchParams({ url });\n const fullUrl = `${apiUrl}/comments?${params}`;\n let res: Response;\n try {\n res = await fetch(fullUrl, {\n headers: getHeaders(apiKey),\n signal: options?.signal,\n });\n } catch (e) {\n logApiFailure(\"fetchComments (red/CORS)\", fullUrl, { networkError: e });\n throw e;\n }\n if (!res.ok) {\n const body = await res.text();\n logApiFailure(\"fetchComments\", fullUrl, { status: res.status, statusText: res.statusText, body });\n throw new Error(\"Failed to fetch comments\");\n }\n const json: ApiResponse<Comment[]> = await res.json();\n return json.data ?? [];\n}\n\nexport async function updateCommentStatus(\n apiUrl: string,\n apiKey: string,\n commentId: number,\n status: \"pending\" | \"dev_fixed\" | \"validated\"\n): Promise<Comment> {\n const url = `${apiUrl}/comments/${commentId}/status`;\n let res: Response;\n try {\n res = await fetch(url, {\n method: \"PATCH\",\n headers: getHeaders(apiKey),\n body: JSON.stringify({ status }),\n });\n } catch (e) {\n logApiFailure(\"updateCommentStatus (red/CORS)\", url, { networkError: e });\n throw e;\n }\n if (!res.ok) {\n const body = await res.text();\n logApiFailure(\"updateCommentStatus\", url, { status: res.status, statusText: res.statusText, body });\n let msg = \"Failed to update comment status\";\n try {\n const err = JSON.parse(body);\n msg = err.message ?? msg;\n } catch {\n // ignore\n }\n throw new Error(msg);\n }\n const json: ApiResponse<Comment> = await res.json();\n return json.data;\n}\n\nexport async function deleteComment(\n apiUrl: string,\n apiKey: string,\n commentId: number\n): Promise<void> {\n const url = `${apiUrl}/comments/${commentId}`;\n let res: Response;\n try {\n res = await fetch(url, {\n method: \"DELETE\",\n headers: getHeaders(apiKey),\n });\n } catch (e) {\n logApiFailure(\"deleteComment (red/CORS)\", url, { networkError: e });\n throw e;\n }\n if (!res.ok) {\n const body = await res.text();\n logApiFailure(\"deleteComment\", url, { status: res.status, statusText: res.statusText, body });\n let msg = \"Failed to delete comment\";\n try {\n const err = JSON.parse(body);\n msg = err.message ?? msg;\n } catch {\n // ignore\n }\n throw new Error(msg);\n }\n}\n","import { useState, useEffect, useCallback, useRef, memo } from \"react\";\nimport type { Reviewer, CreateCommentPayload } from \"./utils/api\";\nimport { createComment } from \"./utils/api\";\n\ninterface CommentModalProps {\n apiUrl: string;\n apiKey: string;\n reviewers: Reviewer[];\n position: { x: number; y: number };\n payload: Omit<CreateCommentPayload, \"message\" | \"reviewerId\">;\n onClose: () => void;\n onSuccess: () => void;\n}\n\nconst backdropStyle: React.CSSProperties = {\n position: \"fixed\",\n inset: 0,\n zIndex: 999997,\n backgroundColor: \"transparent\",\n};\n\nconst modalStyle: React.CSSProperties = {\n position: \"fixed\",\n minWidth: 320,\n maxWidth: 400,\n padding: \"var(--ui-positive-Value_400, 16px)\",\n backgroundColor: \"var(--ui-color-bg-surface-default, #fff)\",\n border: \"1px solid var(--ui-color-border-subtle, #e8e8e8)\",\n borderRadius: \"var(--ui-radius_8, 8px)\",\n boxShadow: \"0 8px 24px var(--ui-color-black-alpha-20, rgba(0,0,0,0.15))\",\n zIndex: 999998,\n};\n\nconst textareaStyle: React.CSSProperties = {\n width: \"100%\",\n minHeight: 80,\n padding: \"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_300, 12px)\",\n marginBottom: \"var(--ui-positive-Value_200, 12px)\",\n border: \"1px solid var(--ui-color-border-default, #d9d9d9)\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n fontSize: \"var(--ui-font-size-sm, 14px)\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n resize: \"vertical\",\n boxSizing: \"border-box\",\n};\n\nconst selectStyle: React.CSSProperties = {\n width: \"100%\",\n padding: \"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_300, 12px)\",\n marginBottom: \"var(--ui-positive-Value_300, 12px)\",\n border: \"1px solid var(--ui-color-border-default, #d9d9d9)\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n fontSize: \"var(--ui-font-size-sm, 14px)\",\n};\n\nconst buttonStyle: React.CSSProperties = {\n padding: \"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_400, 16px)\",\n backgroundColor: \"var(--ui-color-bg-fill-danger-default, #ff4d4f)\",\n color: \"var(--ui-color-text-on-color, #fff)\",\n border: \"none\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n fontSize: \"var(--ui-font-size-sm, 14px)\",\n cursor: \"pointer\",\n fontWeight: \"var(--ui-font-weight-medium, 500)\",\n};\n\nfunction CommentModalInner({\n apiUrl,\n apiKey,\n reviewers,\n position,\n payload,\n onClose,\n onSuccess,\n}: CommentModalProps) {\n const [message, setMessage] = useState(\"\");\n const [reviewerId, setReviewerId] = useState<number>(\n reviewers[0]?.id ?? 0\n );\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n if (reviewers.length > 0 && !reviewerId) {\n setReviewerId(reviewers[0].id);\n }\n }, [reviewers, reviewerId]);\n\n const handleSubmit = useCallback(\n async (e: React.FormEvent) => {\n e.preventDefault();\n if (!message.trim() || !reviewerId) return;\n setLoading(true);\n setError(null);\n try {\n await createComment(apiUrl, apiKey, {\n ...payload,\n message: message.trim(),\n reviewerId,\n });\n onSuccess();\n onClose();\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Failed to send comment\");\n } finally {\n setLoading(false);\n }\n },\n [apiUrl, apiKey, payload, message, reviewerId, onSuccess, onClose]\n );\n\n const modalContainerRef = useRef<HTMLDivElement>(null);\n\n // Cerrar con Escape a nivel document (funciona en Storybook/iframe)\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n onClose();\n }\n };\n document.addEventListener(\"keydown\", handleKeyDown, true);\n return () => document.removeEventListener(\"keydown\", handleKeyDown, true);\n }, [onClose]);\n\n // Cerrar al hacer clic fuera del modal (capture): en Storybook Docs el clic puede\n // ir al wrapper sbdocs en vez del backdrop; así cerramos igual.\n useEffect(() => {\n const handleMouseDown = (e: MouseEvent) => {\n const target = e.target as Node;\n if (modalContainerRef.current && !modalContainerRef.current.contains(target)) {\n e.preventDefault();\n e.stopPropagation();\n onClose();\n }\n };\n document.addEventListener(\"mousedown\", handleMouseDown, true);\n return () => document.removeEventListener(\"mousedown\", handleMouseDown, true);\n }, [onClose]);\n\n // Dar foco al contenedor del modal para que Escape funcione en iframe (Storybook Docs)\n useEffect(() => {\n modalContainerRef.current?.focus();\n }, []);\n\n return (\n <div\n ref={modalContainerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n tabIndex={-1}\n style={{ position: \"fixed\", inset: 0, zIndex: 999997, outline: \"none\" }}\n >\n <div\n role=\"presentation\"\n style={backdropStyle}\n onClick={onClose}\n />\n <div\n style={{\n ...modalStyle,\n left: Math.min(position.x, typeof window !== \"undefined\" ? window.innerWidth - 420 : position.x),\n top: position.y + 12,\n }}\n onClick={(e) => e.stopPropagation()}\n >\n <form onSubmit={handleSubmit}>\n <textarea\n placeholder=\"Escribe tu comentario...\"\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n style={textareaStyle}\n required\n autoFocus\n />\n <select\n value={reviewerId}\n onChange={(e) => setReviewerId(Number(e.target.value))}\n style={selectStyle}\n required\n disabled={reviewers.length === 0}\n >\n <option value=\"\">\n {reviewers.length === 0\n ? \"No hay revisores (ejecuta php artisan db:seed en la API)\"\n : \"Selecciona revisor\"}\n </option>\n {reviewers.map((r) => (\n <option key={r.id} value={r.id}>\n {r.name}\n </option>\n ))}\n </select>\n {error && (\n <div\n style={{\n color: \"var(--ui-color-text-danger-default, #ff4d4f)\",\n fontSize: \"var(--ui-font-size-xs, 12px)\",\n marginBottom: \"var(--ui-positive-Value_200, 8px)\",\n }}\n >\n {error}\n </div>\n )}\n <div style={{ display: \"flex\", justifyContent: \"flex-end\", gap: \"var(--ui-positive-Value_200, 8px)\" }}>\n <button\n type=\"button\"\n onClick={onClose}\n style={{\n ...buttonStyle,\n backgroundColor: \"var(--ui-color-bg-fill-secondary-default, #f0f0f0)\",\n color: \"var(--ui-color-text-primary, #333)\",\n }}\n >\n Cancelar\n </button>\n <button\n type=\"submit\"\n style={buttonStyle}\n disabled={loading || reviewers.length === 0}\n >\n {loading ? \"Enviando...\" : \"Enviar comentario\"}\n </button>\n </div>\n </form>\n </div>\n </div>\n );\n}\n\nexport const CommentModal = memo(CommentModalInner);\n","import { useState, useEffect, useCallback, memo } from \"react\";\nimport { getElementPosition, getFallbackRect } from \"./utils/positioning\";\nimport type { Comment } from \"./utils/api\";\n\nexport interface ElementHighlightProps {\n /** CSS selector for the element to highlight */\n selector: string | null;\n /** When false, render nothing */\n active: boolean;\n /** Si el selector no encuentra el elemento, se usa rect de respaldo (coords guardadas del comentario). */\n fallbackComment?: Comment | null;\n /** Color del borde del highlight (p. ej. según estado del comentario). Por defecto rojo. */\n outlineColor?: string;\n}\n\nconst DEFAULT_OUTLINE_COLOR = \"var(--ui-color-red-500, #ef4444)\";\n\nfunction getHighlightStyle(outlineColor: string): React.CSSProperties {\n return {\n position: \"fixed\",\n outline: `2px solid ${outlineColor}`,\n outlineOffset: \"var(--ui-positive-Value_200, 2px)\",\n pointerEvents: \"none\",\n zIndex: 999997,\n boxSizing: \"border-box\",\n };\n}\n\n/**\n * Finds the element by selector, tracks its bounding rect, and renders\n * a persistent highlight overlay. Updates on scroll and resize.\n */\nexport const ElementHighlight = memo(function ElementHighlight({\n selector,\n active,\n fallbackComment,\n outlineColor = DEFAULT_OUTLINE_COLOR,\n}: ElementHighlightProps) {\n const [rect, setRect] = useState<DOMRect | null>(null);\n\n const updateRect = useCallback(() => {\n if (!active) {\n setRect(null);\n return;\n }\n const fromSelector = selector?.trim() ? getElementPosition(selector) : null;\n if (fromSelector) {\n setRect(fromSelector);\n return;\n }\n if (fallbackComment) {\n setRect(getFallbackRect(fallbackComment));\n return;\n }\n setRect(null);\n }, [selector, active, fallbackComment]);\n\n useEffect(() => {\n updateRect();\n }, [updateRect]);\n\n useEffect(() => {\n if (!active) return;\n window.addEventListener(\"scroll\", updateRect, true);\n window.addEventListener(\"resize\", updateRect);\n return () => {\n window.removeEventListener(\"scroll\", updateRect, true);\n window.removeEventListener(\"resize\", updateRect);\n };\n }, [active, updateRect]);\n\n if (!active || rect == null) return null;\n\n return (\n <div\n aria-hidden\n style={{\n ...getHighlightStyle(outlineColor),\n left: rect.left,\n top: rect.top,\n width: rect.width,\n height: rect.height,\n }}\n />\n );\n});\n","import { useState, useEffect, useCallback, useRef, useMemo, memo } from \"react\";\nimport type { Comment } from \"./utils/api\";\nimport { COMMENT_STATUS, updateCommentStatus, deleteComment } from \"./utils/api\";\nimport { getCommentPinPosition, clampPinToViewport, getScrollableAncestors } from \"./utils/positioning\";\nimport { ElementHighlight } from \"./ElementHighlight\";\n\nconst PIN_SIZE = 32;\nconst HOVER_LEAVE_DELAY_MS = 150;\n/** Ancho fijo de la tarjeta de comentario para que todos se vean iguales */\nconst CARD_WIDTH = 250;\n\n// Tokens de diseño: usan variables CSS (definidas en variables.css / ReviewProvider)\nconst COLORS = {\n cardBg: \"var(--ui-color-bg-surface-default, #ffffff)\",\n cardFooterBg: \"var(--ui-color-bg-surface-secondary-default, #f8fafc)\",\n textDark: \"var(--ui-color-text-primary, #333333)\",\n textMuted: \"var(--ui-color-text-secondary, #888888)\",\n border: \"var(--ui-color-border-default, #cccccc)\",\n shadow: \"var(--ui-shadow-card, 0 4px 16px rgba(0, 0, 0, 0.12))\",\n} as const;\n\nconst STATUS_LABELS: Record<string, string> = {\n [COMMENT_STATUS.PENDING]: \"Pendiente\",\n [COMMENT_STATUS.DEV_FIXED]: \"Corregido\",\n [COMMENT_STATUS.VALIDATED]: \"Validado\",\n};\n\nconst STATUS_LABELS_UPPER: Record<string, string> = {\n [COMMENT_STATUS.PENDING]: \"PENDIENTE\",\n [COMMENT_STATUS.DEV_FIXED]: \"CORREGIDO\",\n [COMMENT_STATUS.VALIDATED]: \"VALIDADO\",\n};\n\nconst PIN_COLORS: Record<string, string> = {\n [COMMENT_STATUS.PENDING]: \"var(--ui-color-red-500, rgb(240, 69, 69))\",\n [COMMENT_STATUS.DEV_FIXED]: \"var(--ui-color-yellow-500, rgb(235, 179, 8))\",\n [COMMENT_STATUS.VALIDATED]: \"var(--ui-color-green-500, rgb(33, 196, 94))\",\n};\n\n/** Colores para badge: fondo 50, borde 500 */\nconst BADGE_BG_50: Record<string, string> = {\n [COMMENT_STATUS.PENDING]: \"var(--ui-color-bg-surface-danger-default, #fef2f2)\",\n [COMMENT_STATUS.DEV_FIXED]: \"var(--ui-color-bg-surface-warning-default, #fffbeb)\",\n [COMMENT_STATUS.VALIDATED]: \"var(--ui-color-bg-surface-success-default, #f0fdf4)\",\n};\nconst BADGE_BORDER_500: Record<string, string> = {\n [COMMENT_STATUS.PENDING]: \"var(--ui-color-red-500, #ef4444)\",\n [COMMENT_STATUS.DEV_FIXED]: \"var(--ui-color-orange-500, #f59e0b)\",\n [COMMENT_STATUS.VALIDATED]: \"var(--ui-color-green-500, #22c55e)\",\n};\n\nfunction getInitials(name: string): string {\n const parts = name.trim().split(/\\s+/);\n if (parts.length >= 2) return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();\n return name.slice(0, 2).toUpperCase() || \"?\";\n}\n\n/** Icono checkmark para badge validado */\nconst CheckIcon = () => (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" style={{ marginRight: 4, flexShrink: 0 }}>\n <path d=\"M10 3L4.5 8.5L2 6\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\n/** Icono chat bubble para el pin */\nconst ChatBubblePinIcon = ({ color }: { color: string }) => (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" style={{ flexShrink: 0 }}>\n <path\n d=\"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill=\"none\"\n />\n <path\n d=\"M8 10h.01M12 10h.01M16 10h.01\"\n stroke=\"var(--ui-color-white, #fff)\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n />\n </svg>\n);\n\nexport interface CommentPinProps {\n comment: Comment;\n /** Desplazamiento para no solaparse con otros pins en el mismo punto */\n offset?: { dx: number; dy: number };\n apiUrl: string;\n apiKey: string;\n onStatusChange: () => void;\n /** Cuando true (modo revisión), el popover no se abre al clic ni al hover */\n reviewMode?: boolean;\n}\n\nconst getPinStyle = (status: string): React.CSSProperties => ({\n position: \"fixed\",\n width: PIN_SIZE,\n height: PIN_SIZE,\n borderRadius: \"50%\",\n backgroundColor: PIN_COLORS[status] ?? PIN_COLORS[COMMENT_STATUS.PENDING],\n color: \"var(--ui-color-text-on-color, #fff)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n cursor: \"pointer\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n boxShadow: \"0 2px 8px var(--ui-color-black-alpha-20, rgba(0,0,0,0.2))\",\n zIndex: 999998,\n border: \"2px solid var(--ui-color-white, #fff)\",\n});\n\nconst cardStyle: React.CSSProperties = {\n position: \"fixed\",\n width: CARD_WIDTH,\n minWidth: CARD_WIDTH,\n maxWidth: CARD_WIDTH,\n boxSizing: \"border-box\",\n backgroundColor: COLORS.cardBg,\n borderRadius: \"var(--ui-radius_12, 12px)\",\n boxShadow: COLORS.shadow,\n fontSize: \"var(--ui-font-size-sm, 14px)\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n zIndex: 999999,\n pointerEvents: \"auto\",\n};\n\nconst headerRowStyle: React.CSSProperties = {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n gap: \"var(--ui-positive-Value_250, 10px)\",\n borderBottom: `1px solid ${COLORS.border}`,\n padding: \"var(--ui-positive-Value_300, 12px)\",\n};\n\nconst avatarStyle = (status: string): React.CSSProperties => ({\n width: 40,\n height: 40,\n borderRadius: \"50%\",\n backgroundColor: PIN_COLORS[status] ?? PIN_COLORS[COMMENT_STATUS.PENDING],\n color: \"var(--ui-color-text-on-color, #fff)\",\n border: \"2px solid var(--ui-color-white, #fff)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontSize: \"var(--ui-font-size-sm, 14px)\",\n fontWeight: \"var(--ui-font-weight-bold, 700)\",\n flexShrink: 0,\n overflow: \"hidden\",\n});\n\n/** Avatar: imagen si existe (cache del navegador), si no iniciales. Ctrl+Shift+R refresca caché. */\nconst ReviewerAvatar = memo(function ReviewerAvatar({\n reviewer,\n status,\n}: {\n reviewer: Comment[\"reviewer\"];\n status: string;\n}) {\n const imageUrl = reviewer?.image_url;\n const name = reviewer?.name ?? \"Revisor\";\n const style = avatarStyle(status);\n if (imageUrl && imageUrl.trim()) {\n const statusColor = PIN_COLORS[status] ?? PIN_COLORS[COMMENT_STATUS.PENDING];\n return (\n <div style={{ ...style, border: `2px solid ${statusColor}` }}>\n <img\n src={imageUrl}\n alt={name}\n style={{\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n }}\n loading=\"lazy\"\n />\n </div>\n );\n }\n return <div style={style}>{getInitials(name)}</div>;\n});\n\nconst closeButtonStyle: React.CSSProperties = {\n flexShrink: 0,\n width: \"var(--ui-positive-Value_600, 24px)\",\n height: \"var(--ui-positive-Value_600, 24px)\",\n padding: 0,\n border: \"none\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n backgroundColor: \"transparent\",\n color: COLORS.textDark,\n cursor: \"pointer\",\n fontSize: \"var(--ui-positive-Value_450, 18px)\",\n lineHeight: 1,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n};\n\n/** Badge pill: fondo 50, borde 1px solid 500, icono check en validado */\nconst getStatusBadgeStyle = (status: string): React.CSSProperties => {\n const borderColor = BADGE_BORDER_500[status] ?? BADGE_BORDER_500[COMMENT_STATUS.PENDING];\n return {\n display: \"inline-flex\",\n alignItems: \"center\",\n padding: \"var(--ui-positive-Value_50, 4px) var(--ui-positive-Value_100, 10px)\",\n borderRadius: \"var(--ui-radius_full, 9999px)\",\n fontSize: \"8px\",\n fontWeight: \"var(--ui-font-weight-bold, 700)\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n textTransform: \"uppercase\",\n letterSpacing: \"0.02em\",\n backgroundColor: BADGE_BG_50[status] ?? BADGE_BG_50[COMMENT_STATUS.PENDING],\n color: borderColor,\n border: `1px solid ${borderColor}`,\n };\n};\n\nconst changeStatusLabelStyle: React.CSSProperties = {\n display: \"block\",\n fontSize: \"var(--ui-font-size-2xs, 10px)\",\n fontWeight: \"var(--ui-font-weight-semibold, 600)\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n color: COLORS.textMuted,\n textTransform: \"uppercase\",\n letterSpacing: \"0.04em\",\n};\n\nconst selectStyle: React.CSSProperties = {\n width: \"100%\",\n padding: \"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_300, 12px)\",\n paddingRight: \"var(--ui-positive-Value_800, 32px)\",\n fontSize: \"var(--ui-font-size-xs, 13px)\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n borderRadius: \"var(--ui-radius_8, 8px)\",\n border: `1px solid ${COLORS.border}`,\n backgroundColor: COLORS.cardBg,\n color: COLORS.textDark,\n cursor: \"pointer\",\n appearance: \"none\",\n backgroundImage: `url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L2 4h8z'/%3E%3C/svg%3E\")`,\n backgroundRepeat: \"no-repeat\",\n backgroundPosition: \"right var(--ui-positive-Value_250, 10px) center\",\n};\n\nconst footerStyle: React.CSSProperties = {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n gap: \"var(--ui-positive-Value_200, 8px)\",\n padding: \"var(--ui-positive-Value_300, 12px)\",\n borderTop: `1px solid ${COLORS.border}`,\n backgroundColor: COLORS.cardFooterBg,\n};\n\nconst footerButtonBase: React.CSSProperties = {\n minWidth: 100,\n padding: \"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_350, 14px)\",\n fontSize: \"var(--ui-font-size-xs, 13px)\",\n fontWeight: \"var(--ui-font-weight-semibold, 600)\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n borderRadius: \"var(--ui-radius_8, 8px)\",\n cursor: \"pointer\",\n border: \"none\",\n};\n\nconst replyButtonStyle: React.CSSProperties = {\n ...footerButtonBase,\n backgroundColor: \"transparent\",\n color: COLORS.textDark,\n};\n\nconst RESOLVE_BTN_CLASS = \"review-layer-resolve-btn\";\n\nconst STATUS_OPTIONS: Array<\"pending\" | \"dev_fixed\" | \"validated\"> = [\n \"pending\",\n \"dev_fixed\",\n \"validated\",\n];\n\nconst resolveButtonStyle: React.CSSProperties = {\n ...footerButtonBase,\n backgroundColor: \"var(--ui-color-bg-fill-success-default, #22c55e)\",\n color: \"var(--ui-color-text-on-color, #fff)\",\n};\n\nfunction CommentPinInner({\n comment,\n offset = { dx: 0, dy: 0 },\n apiUrl,\n apiKey,\n onStatusChange,\n reviewMode = false,\n}: CommentPinProps) {\n const [showTooltip, setShowTooltip] = useState(false);\n const [isPinned, setIsPinned] = useState(false);\n const [position, setPosition] = useState(() => getCommentPinPosition(comment));\n const [updating, setUpdating] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const hoverLeaveTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const pinRef = useRef<HTMLDivElement>(null);\n const popupRef = useRef<HTMLDivElement>(null);\n\n const updatePosition = useCallback(() => {\n setPosition(getCommentPinPosition(comment));\n }, [comment]);\n\n useEffect(() => {\n updatePosition();\n }, [updatePosition]);\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n window.addEventListener(\"scroll\", updatePosition, true);\n window.addEventListener(\"resize\", updatePosition);\n return () => {\n window.removeEventListener(\"scroll\", updatePosition, true);\n window.removeEventListener(\"resize\", updatePosition);\n };\n }, [updatePosition]);\n\n // En iframe/Storybook el scroll suele ser en un div (ej. sbdocs-wrapper), no en window\n useEffect(() => {\n if (!comment.selector || typeof document === \"undefined\") return;\n const el = document.querySelector(comment.selector);\n if (!el) return;\n const ancestors = getScrollableAncestors(el);\n const cleanups = ancestors.map((node) => {\n node.addEventListener(\"scroll\", updatePosition, true);\n return () => node.removeEventListener(\"scroll\", updatePosition, true);\n });\n return () => cleanups.forEach((fn) => fn());\n }, [comment.selector, updatePosition]);\n\n const clearHoverLeaveTimeout = useCallback(() => {\n if (hoverLeaveTimeoutRef.current !== null) {\n clearTimeout(hoverLeaveTimeoutRef.current);\n hoverLeaveTimeoutRef.current = null;\n }\n }, []);\n\n const handlePinMouseEnter = useCallback(() => {\n if (reviewMode) return;\n clearHoverLeaveTimeout();\n setShowTooltip(true);\n }, [reviewMode, clearHoverLeaveTimeout]);\n\n const handlePinMouseLeave = useCallback(() => {\n if (isPinned) return;\n hoverLeaveTimeoutRef.current = setTimeout(() => {\n hoverLeaveTimeoutRef.current = null;\n setShowTooltip(false);\n }, HOVER_LEAVE_DELAY_MS);\n }, [isPinned]);\n\n const handlePopupMouseEnter = useCallback(() => {\n clearHoverLeaveTimeout();\n setShowTooltip(true);\n }, [clearHoverLeaveTimeout]);\n\n const handlePopupMouseLeave = useCallback(() => {\n if (isPinned) return;\n hoverLeaveTimeoutRef.current = setTimeout(() => {\n hoverLeaveTimeoutRef.current = null;\n setShowTooltip(false);\n }, HOVER_LEAVE_DELAY_MS);\n }, [isPinned]);\n\n const handlePinClick = useCallback(() => {\n if (reviewMode) {\n if (isPinned) {\n setIsPinned(false);\n setShowTooltip(false);\n }\n return;\n }\n if (isPinned) {\n setIsPinned(false);\n setShowTooltip(false);\n } else {\n setIsPinned(true);\n setShowTooltip(true);\n }\n }, [reviewMode, isPinned]);\n\n useEffect(() => {\n if (!isPinned) return;\n const handleClickOutside = (e: MouseEvent) => {\n const target = e.target as Node;\n if (\n pinRef.current?.contains(target) ||\n popupRef.current?.contains(target)\n ) {\n return;\n }\n setIsPinned(false);\n setShowTooltip(false);\n };\n document.addEventListener(\"mousedown\", handleClickOutside, true);\n return () => document.removeEventListener(\"mousedown\", handleClickOutside, true);\n }, [isPinned]);\n\n useEffect(() => {\n return () => clearHoverLeaveTimeout();\n }, [clearHoverLeaveTimeout]);\n\n // Al activar modo revisión, cerrar el popover para no interferir con la selección\n useEffect(() => {\n if (reviewMode) {\n setIsPinned(false);\n setShowTooltip(false);\n }\n }, [reviewMode]);\n\n const rawX = position.x + offset.dx;\n const rawY = position.y + offset.dy;\n const { x, y } = clampPinToViewport(rawX, rawY, PIN_SIZE / 2);\n // No mostrar highlight cuando el popover está abierto, para que no se vea en/sobre la card\n const showHighlight = showTooltip && !isPinned;\n\n const closePopup = useCallback(() => {\n setIsPinned(false);\n setShowTooltip(false);\n }, []);\n\n const handleStatusChange = useCallback(\n async (newStatus: \"pending\" | \"dev_fixed\" | \"validated\") => {\n if (newStatus === comment.status) return;\n setError(null);\n setUpdating(true);\n try {\n await updateCommentStatus(apiUrl, apiKey, comment.id, newStatus);\n onStatusChange();\n } catch (e) {\n setError(e instanceof Error ? e.message : \"Error al actualizar\");\n } finally {\n setUpdating(false);\n }\n },\n [apiUrl, apiKey, comment.id, comment.status, onStatusChange]\n );\n\n const handleDelete = useCallback(async () => {\n setError(null);\n setUpdating(true);\n try {\n await deleteComment(apiUrl, apiKey, comment.id);\n onStatusChange();\n closePopup();\n } catch (e) {\n setError(e instanceof Error ? e.message : \"Error al eliminar\");\n } finally {\n setUpdating(false);\n }\n }, [apiUrl, apiKey, comment.id, onStatusChange, closePopup]);\n\n const pinStyle = useMemo(\n () => ({ ...getPinStyle(comment.status), left: x, top: y, transform: \"translate(-50%, -50%)\" }),\n [comment.status, x, y]\n );\n\n return (\n <>\n <ElementHighlight\n selector={comment.selector}\n active={showHighlight}\n fallbackComment={comment}\n outlineColor={BADGE_BORDER_500[comment.status] ?? BADGE_BORDER_500[COMMENT_STATUS.PENDING]}\n />\n <div\n ref={pinRef}\n role=\"button\"\n tabIndex={0}\n aria-label={`Comentario: ${comment.message.slice(0, 30)}...`}\n aria-expanded={showTooltip}\n style={pinStyle}\n onMouseEnter={handlePinMouseEnter}\n onMouseLeave={handlePinMouseLeave}\n onClick={handlePinClick}\n >\n <ChatBubblePinIcon color=\"var(--ui-color-white, #fff)\" />\n </div>\n {showTooltip && (\n <div\n ref={popupRef}\n role=\"dialog\"\n aria-label=\"Detalle del comentario\"\n style={{\n ...cardStyle,\n left: x + PIN_SIZE / 2 + 6,\n top: y,\n }}\n onMouseEnter={handlePopupMouseEnter}\n onMouseLeave={handlePopupMouseLeave}\n >\n <div style={headerRowStyle}>\n <div style={{ display: \"flex\", alignItems: \"center\", gap: 10, flex: 1, minWidth: 0 }}>\n <ReviewerAvatar reviewer={comment.reviewer} status={comment.status} />\n <div>\n <div style={{ fontWeight: 700, fontSize: 14, color: COLORS.textDark }}>\n {comment.reviewer?.name ?? \"Revisor\"}\n </div>\n <div style={{ fontSize: 12, color: COLORS.textMuted }}>{comment.reviewer?.job_title ?? \"Revisor\"}</div>\n </div>\n </div>\n <button\n type=\"button\"\n aria-label={comment.status === COMMENT_STATUS.VALIDATED ? \"Eliminar comentario\" : \"Cerrar\"}\n style={closeButtonStyle}\n disabled={updating}\n onClick={(e) => {\n e.stopPropagation();\n if (comment.status === COMMENT_STATUS.VALIDATED) handleDelete();\n else closePopup();\n }}\n onMouseDown={(e) => e.stopPropagation()}\n >\n ✕\n </button>\n </div>\n <div style={{ padding: 12, display: \"flex\", alignItems: \"flex-start\", flexDirection: \"column\", gap: 4 }}>\n <div style={getStatusBadgeStyle(comment.status)}>\n {comment.status === COMMENT_STATUS.VALIDATED && <CheckIcon />}\n {STATUS_LABELS_UPPER[comment.status] ?? comment.status}\n </div>\n <div style={{ color: COLORS.textDark, lineHeight: 1.5, marginBottom: 12, marginTop: 12 }}>{comment.message}</div>\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: 4, width: \"100%\" }}>\n <label style={changeStatusLabelStyle} htmlFor={`comment-status-${comment.id}`}>\n Cambiar estado\n </label>\n <select\n id={`comment-status-${comment.id}`}\n style={selectStyle}\n value={comment.status}\n disabled={updating}\n onChange={(e) =>\n handleStatusChange(e.target.value as \"pending\" | \"dev_fixed\" | \"validated\")\n }\n onMouseDown={(e) => e.stopPropagation()}\n aria-label=\"Cambiar estado del comentario\"\n >\n {STATUS_OPTIONS.map((value) => (\n <option key={value} value={value}>\n {STATUS_LABELS[value]}\n </option>\n ))}\n </select>\n {error && (\n <div style={{ marginTop: 8, fontSize: 11, color: \"var(--ui-color-text-danger-default, rgb(240, 69, 69))\" }}>{error}</div>\n )}\n </div>\n </div>\n <div style={footerStyle}>\n <button\n type=\"button\"\n style={replyButtonStyle}\n onMouseDown={(e) => e.stopPropagation()}\n onClick={(e) => {\n e.stopPropagation();\n closePopup();\n }}\n >\n Cerrar\n </button>\n {comment.status !== COMMENT_STATUS.VALIDATED && (\n <>\n <style>{`\n .${RESOLVE_BTN_CLASS}:hover:not(:disabled) {\n background-color: var(--ui-color-bg-fill-success-hover, #16a34a) !important;\n }\n .${RESOLVE_BTN_CLASS}:active:not(:disabled) {\n background-color: var(--ui-color-bg-fill-success-pressed, #15803d) !important;\n }\n .${RESOLVE_BTN_CLASS}:disabled {\n background-color: var(--ui-color-bg-fill-success-default, #22c55e) !important;\n opacity: 0.7;\n cursor: not-allowed;\n }\n `}</style>\n <button\n type=\"button\"\n className={RESOLVE_BTN_CLASS}\n style={resolveButtonStyle}\n disabled={updating}\n onMouseDown={(e) => e.stopPropagation()}\n onClick={(e) => {\n e.stopPropagation();\n handleStatusChange(\"validated\");\n }}\n >\n Validar\n </button>\n </>\n )}\n </div>\n </div>\n )}\n </>\n );\n}\n\nexport const CommentPin = memo(CommentPinInner);\n","import { createPortal } from \"react-dom\";\nimport { useState, useCallback, useEffect, useRef, useMemo } from \"react\";\nimport { getSelector } from \"./utils/selector\";\nimport { getCommentPinPosition, getRelativePosition, clampPinToViewport, getScrollableAncestors } from \"./utils/positioning\";\nimport { getPageUrl } from \"./utils/pageUrl\";\nimport { CommentModal } from \"./CommentModal\";\nimport { CommentPin } from \"./CommentPin\";\nimport type { Reviewer, Comment, CreateCommentPayload } from \"./utils/api\";\n\ninterface OverlayProps {\n apiUrl: string;\n apiKey: string;\n /** Resolver de URL de la página (puede venir del ReviewProvider con override). */\n getPageUrl?: () => string;\n reviewMode: boolean;\n setReviewMode: (value: boolean) => void;\n reviewers: Reviewer[];\n comments: Comment[];\n loadComments: () => void;\n commentsLoadFailed?: boolean;\n}\n\nconst PIN_OVERLAP_RADIUS = 25;\nconst PIN_OFFSET_STEP = 36;\n\n/** Calcula desplazamientos para que pins no se solapen. Usa posiciones recortadas al viewport (mitad del círculo) para agrupar bien en esquinas. */\nfunction getPinOffsets(comments: Comment[]): Map<number, { dx: number; dy: number }> {\n const map = new Map<number, { dx: number; dy: number }>();\n for (let i = 0; i < comments.length; i++) {\n const c = comments[i];\n const { x, y } = getCommentPinPosition(c);\n const { x: cx, y: cy } = clampPinToViewport(x, y);\n let indexInGroup = 0;\n for (let j = 0; j < i; j++) {\n const { x: ox, y: oy } = getCommentPinPosition(comments[j]);\n const { x: cox, y: coy } = clampPinToViewport(ox, oy);\n if (Math.hypot(cx - cox, cy - coy) < PIN_OVERLAP_RADIUS) indexInGroup++;\n }\n map.set(c.id, { dx: indexInGroup * PIN_OFFSET_STEP, dy: 0 });\n }\n return map;\n}\n\nfunction getViewport(): string {\n if (typeof window === \"undefined\") return \"\";\n return `${window.innerWidth}x${window.innerHeight}`;\n}\n\nexport function Overlay({\n apiUrl,\n apiKey,\n getPageUrl: getPageUrlProp,\n reviewMode,\n setReviewMode,\n reviewers,\n comments,\n loadComments,\n commentsLoadFailed = false,\n}: OverlayProps) {\n const [hoveredEl, setHoveredEl] = useState<Element | null>(null);\n const selectedElementRef = useRef<HTMLElement | null>(null);\n const [modalState, setModalState] = useState<{\n position: { x: number; y: number };\n payload: Omit<CreateCommentPayload, \"message\" | \"reviewerId\">;\n } | null>(null);\n\n const clearHighlight = useCallback(() => {\n if (hoveredEl) {\n (hoveredEl as HTMLElement).style.outline = \"\";\n (hoveredEl as HTMLElement).style.outlineOffset = \"\";\n setHoveredEl(null);\n }\n }, [hoveredEl]);\n\n const clearSelectedElement = useCallback(() => {\n if (selectedElementRef.current) {\n selectedElementRef.current.style.outline = \"\";\n selectedElementRef.current.style.outlineOffset = \"\";\n selectedElementRef.current = null;\n }\n }, []);\n\n useEffect(() => {\n if (!reviewMode) {\n clearHighlight();\n clearSelectedElement();\n }\n }, [reviewMode, clearHighlight, clearSelectedElement]);\n\n useEffect(() => {\n if (typeof document === \"undefined\") return;\n const prev = document.body.style.cursor;\n if (modalState) {\n document.body.style.cursor = \"default\";\n } else if (reviewMode) {\n document.body.style.cursor = \"crosshair\";\n }\n return () => {\n document.body.style.cursor = prev;\n };\n }, [reviewMode, modalState]);\n\n const isBodyOrRoot = useCallback((el: Element | null) => {\n if (!el || typeof document === \"undefined\") return true;\n if (el === document.body || el === document.documentElement) return true;\n const tag = (el as HTMLElement).tagName?.toUpperCase();\n if (tag === \"BODY\" || tag === \"HTML\") return true;\n if (el.parentElement !== document.body) return false;\n if (el.id === \"root\" || el.getAttribute(\"data-review-layer-host\") != null) return true;\n if (document.body.children.length === 1) return true;\n return false;\n }, []);\n\n const handleMouseOver = useCallback(\n (e: MouseEvent) => {\n if (!reviewMode || modalState) return;\n const target = (e.target as Node).nodeType === Node.ELEMENT_NODE ? (e.target as Element) : (e.target as Element).parentElement;\n if (!target || isBodyOrRoot(target as Element)) return;\n clearHighlight();\n setHoveredEl(target);\n (target as HTMLElement).style.outline = \"2px solid var(--ui-color-bg-fill-danger-default, #ff4d4f)\";\n (target as HTMLElement).style.outlineOffset = \"2px\";\n },\n [reviewMode, modalState, clearHighlight, isBodyOrRoot]\n );\n\n const handleMouseOut = useCallback(\n (e: MouseEvent) => {\n if (modalState) return;\n const related = e.relatedTarget as Node | null;\n if (hoveredEl && (!related || !hoveredEl.contains(related)) && !(related && (hoveredEl as Node).contains?.(related))) {\n clearHighlight();\n }\n },\n [hoveredEl, modalState, clearHighlight]\n );\n\n const handleClick = useCallback(\n (e: MouseEvent) => {\n if (!reviewMode || modalState) return;\n const target = e.target as Element;\n if (!target || isBodyOrRoot(target) || target.closest(\"[data-review-layer-root]\")) return;\n e.preventDefault();\n e.stopPropagation();\n clearHighlight();\n const el = target as HTMLElement;\n selectedElementRef.current = el;\n el.style.outline = \"2px solid var(--ui-color-bg-fill-danger-default, #ff4d4f)\";\n el.style.outlineOffset = \"2px\";\n const rect = el.getBoundingClientRect();\n const selector = getSelector(target);\n const { relativeX, relativeY } = getRelativePosition(rect);\n setModalState({\n position: { x: rect.left + rect.width / 2, y: rect.bottom },\n payload: {\n selector,\n x: Math.round(rect.left),\n y: Math.round(rect.top),\n relativeX,\n relativeY,\n width: Math.round(rect.width),\n height: Math.round(rect.height),\n url: typeof window !== \"undefined\" ? (getPageUrlProp?.() ?? getPageUrl()) : \"/\",\n viewport: getViewport(),\n userAgent: typeof navigator !== \"undefined\" ? navigator.userAgent : \"\",\n pageTitle: typeof document !== \"undefined\" ? document.title : \"\",\n },\n });\n },\n [reviewMode, modalState, clearHighlight, isBodyOrRoot]\n );\n\n useEffect(() => {\n if (!reviewMode) return;\n document.addEventListener(\"mouseover\", handleMouseOver, true);\n document.addEventListener(\"mouseout\", handleMouseOut, true);\n document.addEventListener(\"click\", handleClick, true);\n return () => {\n document.removeEventListener(\"mouseover\", handleMouseOver, true);\n document.removeEventListener(\"mouseout\", handleMouseOut, true);\n document.removeEventListener(\"click\", handleClick, true);\n };\n }, [reviewMode, handleMouseOver, handleMouseOut, handleClick]);\n\n const [resizeScrollTick, setResizeScrollTick] = useState(0);\n const updateOnScrollResize = useCallback(() => {\n setResizeScrollTick((t) => t + 1);\n if (selectedElementRef.current) {\n const rect = selectedElementRef.current.getBoundingClientRect();\n setModalState((prev) =>\n prev\n ? { ...prev, position: { x: rect.left + rect.width / 2, y: rect.bottom } }\n : null\n );\n }\n }, []);\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n window.addEventListener(\"resize\", updateOnScrollResize);\n window.addEventListener(\"scroll\", updateOnScrollResize, true);\n return () => {\n window.removeEventListener(\"resize\", updateOnScrollResize);\n window.removeEventListener(\"scroll\", updateOnScrollResize, true);\n };\n }, [updateOnScrollResize]);\n\n // En iframe/Storybook el scroll suele ser en un div (ej. sbdocs-wrapper), no en window\n useEffect(() => {\n if (!modalState || !selectedElementRef.current) return;\n const el = selectedElementRef.current;\n const ancestors = getScrollableAncestors(el);\n const cleanup = ancestors.map((node) => {\n node.addEventListener(\"scroll\", updateOnScrollResize, true);\n return () => node.removeEventListener(\"scroll\", updateOnScrollResize, true);\n });\n return () => cleanup.forEach((fn) => fn());\n }, [modalState, updateOnScrollResize]);\n\n const pinOffsets = useMemo(\n () => getPinOffsets(comments),\n [comments, resizeScrollTick]\n );\n\n const handleModalClose = useCallback(() => {\n clearSelectedElement();\n setModalState(null);\n }, [clearSelectedElement]);\n\n const passThroughLayerStyle: React.CSSProperties = {\n position: \"fixed\",\n inset: 0,\n zIndex: 999999,\n pointerEvents: \"none\",\n cursor: reviewMode ? \"crosshair\" : undefined,\n };\n\n const content = (\n <>\n <div style={passThroughLayerStyle} aria-hidden data-review-layer-root />\n {reviewMode && (\n <div\n data-review-layer-root\n style={{\n position: \"fixed\",\n top: \"var(--ui-positive-Value_250, 10px)\",\n left: \"var(--ui-positive-Value_250, 10px)\",\n zIndex: 1000000,\n display: \"flex\",\n alignItems: \"center\",\n gap: \"var(--ui-positive-Value_250, 10px)\",\n padding: \"var(--ui-positive-Value_150, 6px) var(--ui-positive-Value_300, 12px)\",\n backgroundColor: \"var(--ui-color-bg-fill-danger-default, #ff4d4f)\",\n color: \"var(--ui-color-text-on-color, #fff)\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n fontSize: \"var(--ui-font-size-xs, 12px)\",\n fontWeight: \"var(--ui-font-weight-medium, 500)\",\n pointerEvents: \"auto\",\n }}\n >\n <span>Modo revisión (Shift+R para salir)</span>\n <button\n type=\"button\"\n onClick={() => setReviewMode(false)}\n aria-label=\"Salir del modo revisión\"\n style={{\n padding: 0,\n margin: 0,\n width: 20,\n height: 20,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n border: \"none\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n backgroundColor: \"rgba(255,255,255,0.2)\",\n color: \"inherit\",\n fontSize: 14,\n lineHeight: 1,\n cursor: \"pointer\",\n }}\n >\n ×\n </button>\n </div>\n )}\n {commentsLoadFailed && (\n <div\n style={{\n position: \"fixed\",\n bottom: \"var(--ui-positive-Value_400, 16px)\",\n left: \"50%\",\n transform: \"translateX(-50%)\",\n display: \"flex\",\n alignItems: \"center\",\n gap: \"var(--ui-positive-Value_250, 10px)\",\n padding: \"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_350, 14px)\",\n backgroundColor: \"var(--ui-color-bg-surface-default, #fff)\",\n border: \"1px solid var(--ui-color-border-subtle, #e8e8e8)\",\n borderRadius: \"var(--ui-radius_8, 8px)\",\n boxShadow: \"0 2px 12px var(--ui-color-black-alpha-10, rgba(0,0,0,0.1))\",\n fontSize: \"var(--ui-font-size-xs, 12px)\",\n color: \"var(--ui-color-text-primary, #333)\",\n zIndex: 999997,\n pointerEvents: \"auto\",\n }}\n >\n <span>No se pudo conectar. Mostrando últimos datos guardados. Reintentar no garantiza respuesta hasta que el servicio esté activo.</span>\n <button\n type=\"button\"\n onClick={() => loadComments()}\n style={{\n padding: \"var(--ui-positive-Value_100, 4px) var(--ui-positive-Value_250, 10px)\",\n fontSize: \"var(--ui-font-size-xs, 12px)\",\n fontWeight: \"var(--ui-font-weight-semibold, 600)\",\n backgroundColor: \"var(--ui-color-bg-fill-success-default, rgb(33, 196, 94))\",\n color: \"var(--ui-color-text-on-color, #fff)\",\n border: \"none\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n cursor: \"pointer\",\n }}\n >\n Reintentar\n </button>\n </div>\n )}\n {comments.map((comment) => (\n <div key={comment.id} data-review-layer-pin style={{ pointerEvents: \"auto\" }}>\n <CommentPin\n comment={comment}\n offset={pinOffsets.get(comment.id)}\n apiUrl={apiUrl}\n apiKey={apiKey}\n onStatusChange={loadComments}\n reviewMode={reviewMode}\n />\n </div>\n ))}\n {modalState && (\n <div data-review-layer-modal style={{ pointerEvents: \"auto\" }}>\n <CommentModal\n apiUrl={apiUrl}\n apiKey={apiKey}\n reviewers={reviewers}\n position={modalState.position}\n payload={modalState.payload}\n onClose={handleModalClose}\n onSuccess={loadComments}\n />\n </div>\n )}\n </>\n );\n\n const container = typeof document !== \"undefined\" ? document.body : null;\n return container ? createPortal(content, container) : null;\n}\n","export default \"/**\\n * Tokens de diseño UI para review-layer-react.\\n * Las variables se inyectan en :root al montar ReviewProvider.\\n * Puedes sobrescribirlas en tu app para adaptar el tema.\\n */\\n:root {\\n /* Colores base */\\n --ui-color-white: rgb(255, 255, 255);\\n --ui-color-black: rgb(0, 0, 0);\\n --ui-color-red-50: rgb(255, 242, 242);\\n --ui-color-red-100: rgb(252, 227, 227);\\n --ui-color-red-200: rgb(250, 189, 189);\\n --ui-color-red-300: rgb(245, 148, 148);\\n --ui-color-red-400: rgb(242, 107, 107);\\n --ui-color-red-500: rgb(240, 69, 69);\\n --ui-color-red-600: rgb(212, 61, 61);\\n --ui-color-red-700: rgb(184, 51, 51);\\n --ui-color-red-800: rgb(156, 43, 43);\\n --ui-color-red-900: rgb(128, 36, 36);\\n --ui-color-orange-50: rgb(255, 247, 242);\\n --ui-color-orange-100: rgb(252, 237, 227);\\n --ui-color-orange-200: rgb(252, 209, 176);\\n --ui-color-orange-300: rgb(250, 176, 125);\\n --ui-color-orange-400: rgb(250, 145, 74);\\n --ui-color-orange-500: rgb(250, 115, 23);\\n --ui-color-orange-600: rgb(219, 102, 20);\\n --ui-color-orange-700: rgb(189, 87, 18);\\n --ui-color-orange-800: rgb(158, 74, 13);\\n --ui-color-orange-900: rgb(128, 59, 10);\\n --ui-color-yellow-50: rgb(255, 250, 242);\\n --ui-color-yellow-100: rgb(252, 245, 227);\\n --ui-color-yellow-200: rgb(247, 230, 173);\\n --ui-color-yellow-300: rgb(242, 214, 117);\\n --ui-color-yellow-400: rgb(240, 196, 64);\\n --ui-color-yellow-500: rgb(235, 179, 8);\\n --ui-color-yellow-600: rgb(209, 158, 8);\\n --ui-color-yellow-700: rgb(181, 140, 5);\\n --ui-color-yellow-800: rgb(156, 120, 5);\\n --ui-color-yellow-900: rgb(128, 97, 5);\\n --ui-color-lime-50: rgb(250, 255, 242);\\n --ui-color-lime-100: rgb(242, 252, 227);\\n --ui-color-lime-200: rgb(214, 240, 176);\\n --ui-color-lime-300: rgb(186, 227, 125);\\n --ui-color-lime-400: rgb(161, 217, 74);\\n --ui-color-lime-500: rgb(133, 204, 23);\\n --ui-color-lime-600: rgb(120, 186, 20);\\n --ui-color-lime-700: rgb(107, 166, 18);\\n --ui-color-lime-800: rgb(97, 148, 15);\\n --ui-color-lime-900: rgb(84, 128, 13);\\n --ui-color-green-50: rgb(242, 255, 245);\\n --ui-color-green-100: rgb(227, 252, 237);\\n --ui-color-green-200: rgb(179, 240, 201);\\n --ui-color-green-300: rgb(130, 224, 166);\\n --ui-color-green-400: rgb(84, 212, 130);\\n --ui-color-green-500: rgb(33, 196, 94);\\n --ui-color-green-600: rgb(31, 181, 87);\\n --ui-color-green-700: rgb(28, 163, 79);\\n --ui-color-green-800: rgb(26, 145, 69);\\n --ui-color-green-900: rgb(23, 128, 61);\\n --ui-color-cyan-50: rgb(242, 252, 255);\\n --ui-color-cyan-100: rgb(227, 250, 252);\\n --ui-color-cyan-200: rgb(171, 232, 242);\\n --ui-color-cyan-300: rgb(117, 217, 232);\\n --ui-color-cyan-400: rgb(61, 199, 222);\\n --ui-color-cyan-500: rgb(5, 181, 212);\\n --ui-color-cyan-600: rgb(5, 163, 191);\\n --ui-color-cyan-700: rgb(5, 145, 171);\\n --ui-color-cyan-800: rgb(5, 128, 148);\\n --ui-color-cyan-900: rgb(5, 110, 128);\\n --ui-color-azure-50: rgb(242, 250, 255);\\n --ui-color-azure-100: rgb(227, 245, 252);\\n --ui-color-azure-200: rgb(173, 224, 247);\\n --ui-color-azure-300: rgb(120, 204, 242);\\n --ui-color-azure-400: rgb(69, 186, 237);\\n --ui-color-azure-500: rgb(13, 166, 232);\\n --ui-color-azure-600: rgb(13, 148, 207);\\n --ui-color-azure-700: rgb(10, 128, 181);\\n --ui-color-azure-800: rgb(10, 110, 156);\\n --ui-color-azure-900: rgb(8, 89, 128);\\n --ui-color-blue-50: rgb(242, 245, 255);\\n --ui-color-blue-100: rgb(227, 232, 252);\\n --ui-color-blue-200: rgb(184, 196, 237);\\n --ui-color-blue-300: rgb(140, 161, 222);\\n --ui-color-blue-400: rgb(97, 125, 209);\\n --ui-color-blue-500: rgb(54, 89, 194);\\n --ui-color-blue-600: rgb(51, 82, 176);\\n --ui-color-blue-700: rgb(46, 74, 161);\\n --ui-color-blue-800: rgb(41, 66, 145);\\n --ui-color-blue-900: rgb(36, 59, 128);\\n --ui-color-violet-50: rgb(245, 242, 255);\\n --ui-color-violet-100: rgb(237, 227, 252);\\n --ui-color-violet-200: rgb(209, 186, 250);\\n --ui-color-violet-300: rgb(181, 143, 245);\\n --ui-color-violet-400: rgb(153, 102, 242);\\n --ui-color-violet-500: rgb(125, 59, 237);\\n --ui-color-violet-600: rgb(110, 51, 209);\\n --ui-color-violet-700: rgb(97, 46, 184);\\n --ui-color-violet-800: rgb(82, 38, 156);\\n --ui-color-violet-900: rgb(66, 31, 128);\\n --ui-color-magenta-50: rgb(255, 242, 247);\\n --ui-color-magenta-100: rgb(252, 227, 240);\\n --ui-color-magenta-200: rgb(247, 184, 214);\\n --ui-color-magenta-300: rgb(245, 140, 186);\\n --ui-color-magenta-400: rgb(240, 94, 161);\\n --ui-color-magenta-500: rgb(235, 51, 135);\\n --ui-color-magenta-600: rgb(209, 46, 120);\\n --ui-color-magenta-700: rgb(181, 41, 105);\\n --ui-color-magenta-800: rgb(156, 33, 89);\\n --ui-color-magenta-900: rgb(128, 28, 74);\\n --ui-color-rose-50: rgb(255, 242, 245);\\n --ui-color-rose-100: rgb(252, 227, 232);\\n --ui-color-rose-200: rgb(245, 179, 194);\\n --ui-color-rose-300: rgb(240, 128, 153);\\n --ui-color-rose-400: rgb(232, 79, 112);\\n --ui-color-rose-500: rgb(224, 28, 71);\\n --ui-color-rose-600: rgb(201, 26, 64);\\n --ui-color-rose-700: rgb(176, 23, 56);\\n --ui-color-rose-800: rgb(153, 20, 48);\\n --ui-color-rose-900: rgb(128, 15, 41);\\n --ui-color-light-gray-50: rgb(247, 247, 250);\\n --ui-color-light-gray-100: rgb(240, 242, 242);\\n --ui-color-light-gray-200: rgb(224, 227, 230);\\n --ui-color-light-gray-300: rgb(212, 214, 217);\\n --ui-color-light-gray-400: rgb(199, 199, 204);\\n --ui-color-light-gray-500: rgb(186, 189, 191);\\n --ui-color-light-gray-600: rgb(171, 173, 179);\\n --ui-color-light-gray-700: rgb(158, 163, 166);\\n --ui-color-light-gray-800: rgb(145, 148, 153);\\n --ui-color-light-gray-900: rgb(133, 135, 140);\\n --ui-color-dark-gray-50: rgb(120, 122, 128);\\n --ui-color-dark-gray-100: rgb(107, 110, 115);\\n --ui-color-dark-gray-200: rgb(97, 99, 105);\\n --ui-color-dark-gray-300: rgb(89, 89, 94);\\n --ui-color-dark-gray-400: rgb(77, 79, 84);\\n --ui-color-dark-gray-500: rgb(69, 69, 74);\\n --ui-color-dark-gray-600: rgb(59, 61, 64);\\n --ui-color-dark-gray-700: rgb(48, 51, 54);\\n --ui-color-dark-gray-800: rgb(38, 41, 43);\\n --ui-color-dark-gray-900: rgb(31, 31, 33);\\n --ui-color-black-alpha-transparent: rgba(0, 0, 0, 0);\\n --ui-color-black-alpha-5: rgba(0, 0, 0, 0.05);\\n --ui-color-black-alpha-10: rgba(0, 0, 0, 0.1);\\n --ui-color-black-alpha-20: rgba(0, 0, 0, 0.2);\\n --ui-color-black-alpha-30: rgba(0, 0, 0, 0.3);\\n --ui-color-black-alpha-40: rgba(0, 0, 0, 0.4);\\n --ui-color-black-alpha-50: rgba(0, 0, 0, 0.5);\\n --ui-color-black-alpha-60: rgba(0, 0, 0, 0.6);\\n --ui-color-black-alpha-70: rgba(0, 0, 0, 0.7);\\n --ui-color-black-alpha-80: rgba(0, 0, 0, 0.8);\\n --ui-color-black-alpha-90: rgba(0, 0, 0, 0.9);\\n\\n /* Espaciado positivo */\\n --ui-positive-Value_0: 0;\\n --ui-positive-Value_12: 0.66px;\\n --ui-positive-Value_25: 1px;\\n --ui-positive-Value_50: 2px;\\n --ui-positive-Value_100: 4px;\\n --ui-positive-Value_150: 6px;\\n --ui-positive-Value_200: 8px;\\n --ui-positive-Value_250: 10px;\\n --ui-positive-Value_275: 11px;\\n --ui-positive-Value_300: 12px;\\n --ui-positive-Value_325: 13px;\\n --ui-positive-Value_350: 14px;\\n --ui-positive-Value_400: 16px;\\n --ui-positive-Value_450: 18px;\\n --ui-positive-Value_500: 20px;\\n --ui-positive-Value_600: 24px;\\n --ui-positive-Value_700: 28px;\\n --ui-positive-Value_750: 30px;\\n --ui-positive-Value_800: 32px;\\n --ui-positive-Value_900: 36px;\\n --ui-positive-Value_1000: 40px;\\n --ui-positive-Value_1200: 48px;\\n --ui-positive-Value_1400: 56px;\\n --ui-positive-Value_1600: 64px;\\n --ui-positive-Value_2000: 80px;\\n --ui-positive-Value_2400: 96px;\\n --ui-positive-Value_2800: 112px;\\n --ui-positive-Value_3200: 128px;\\n --ui-positive-Value_full: 9999px;\\n\\n /* Sombras */\\n --ui-shadow-01-x: 0;\\n --ui-shadow-01-y: 1px;\\n --ui-shadow-01-blur: 2px;\\n --ui-shadow-01-Spread: 0;\\n --ui-shadow-02-x: 0;\\n --ui-shadow-02-y: 2px;\\n --ui-shadow-02-blur: 4px;\\n --ui-shadow-02-Spread: -1px;\\n --ui-shadow-03-x: 0;\\n --ui-shadow-03-y: 4px;\\n --ui-shadow-03-blur: 8px;\\n --ui-shadow-03-Spread: -2px;\\n --ui-shadow-04-x: 0;\\n --ui-shadow-04-y: 8px;\\n --ui-shadow-04-blur: 16px;\\n --ui-shadow-04-Spread: -4px;\\n --ui-shadow-05-x: 0;\\n --ui-shadow-05-y: 16px;\\n --ui-shadow-05-blur: 24px;\\n --ui-shadow-05-Spread: -8px;\\n --ui-shadow-01-Color: var(--ui-color-black-alpha-10);\\n --ui-shadow-02-Color: var(--ui-color-black-alpha-20);\\n --ui-shadow-03-Color: var(--ui-color-black-alpha-20);\\n --ui-shadow-04-Color: var(--ui-color-black-alpha-30);\\n --ui-shadow-05-Color: var(--ui-color-black-alpha-30);\\n\\n /* Z-index */\\n --ui-z-hide: -1;\\n --ui-z-base: 0;\\n --ui-z-raised: 100;\\n --ui-z-sticky: 200;\\n --ui-z-shell: 300;\\n --ui-z-dropdown: 400;\\n --ui-z-popover: 500;\\n --ui-z-tooltip: 600;\\n --ui-z-modalBackdrop: 690;\\n --ui-z-modal: 700;\\n --ui-z-toast: 800;\\n --ui-z-overlay: 900;\\n --ui-z-max: 99999;\\n\\n /* Tipografía */\\n --ui-font-family-ui: \\\"Inter\\\", -apple-system, BlinkMacSystemFont, \\\"Segoe UI\\\", sans-serif;\\n --ui-font-family-mono: \\\"IBM Plex Mono\\\";\\n --ui-font-weight-regular: 400;\\n --ui-font-weight-medium: 500;\\n --ui-font-weight-semibold: 600;\\n --ui-font-weight-bold: 700;\\n\\n /* Radios */\\n --ui-radius_0: 0;\\n --ui-radius_2: 2px;\\n --ui-radius_4: 4px;\\n --ui-radius_6: 6px;\\n --ui-radius_8: 8px;\\n --ui-radius_10: 10px;\\n --ui-radius_12: 12px;\\n --ui-radius_16: 16px;\\n --ui-radius_24: 24px;\\n --ui-radius_full: 9999px;\\n\\n /* Semánticos: texto */\\n --ui-color-text-primary: var(--ui-color-dark-gray-700);\\n --ui-color-text-secondary: var(--ui-color-dark-gray-300);\\n --ui-color-text-tertiary: var(--ui-color-dark-gray-100);\\n --ui-color-text-disabled: var(--ui-color-light-gray-500);\\n --ui-color-text-on-color: var(--ui-color-white);\\n --ui-color-text-danger-default: var(--ui-color-red-700);\\n --ui-color-text-danger-hover: var(--ui-color-red-800);\\n --ui-color-text-danger-pressed: var(--ui-color-red-900);\\n\\n /* Semánticos: bordes */\\n --ui-color-border-default: var(--ui-color-light-gray-400);\\n --ui-color-border-subtle: var(--ui-color-light-gray-300);\\n --ui-color-border-strong: var(--ui-color-dark-gray-400);\\n --ui-color-border-danger: var(--ui-color-red-500);\\n\\n /* Semánticos: superficies y fondos */\\n --ui-color-bg-surface-default: var(--ui-color-white);\\n --ui-color-bg-surface-secondary-default: var(--ui-color-light-gray-50);\\n --ui-color-bg-surface-secondary-hover: var(--ui-color-light-gray-100);\\n --ui-color-bg-fill-danger-default: var(--ui-color-red-500);\\n --ui-color-bg-fill-danger-hover: var(--ui-color-red-600);\\n --ui-color-bg-fill-danger-pressed: var(--ui-color-red-700);\\n --ui-color-bg-fill-success-default: var(--ui-color-green-500);\\n --ui-color-bg-fill-success-hover: var(--ui-color-green-600);\\n --ui-color-bg-fill-success-pressed: var(--ui-color-green-700);\\n --ui-color-bg-surface-success-default: var(--ui-color-green-50);\\n --ui-color-bg-surface-success-hover: var(--ui-color-green-100);\\n --ui-color-bg-surface-success-selected: var(--ui-color-green-200);\\n --ui-color-bg-surface-danger-default: var(--ui-color-red-50);\\n --ui-color-bg-surface-danger-hover: var(--ui-color-red-100);\\n --ui-color-bg-surface-danger-selected: var(--ui-color-red-200);\\n --ui-color-bg-surface-warning-default: var(--ui-color-yellow-50);\\n --ui-color-bg-surface-warning-hover: var(--ui-color-yellow-100);\\n --ui-color-bg-surface-warning-selected: var(--ui-color-yellow-200);\\n\\n /* Espaciado (space) */\\n --ui-Positive-space_0: var(--ui-positive-Value_0);\\n --ui-Positive-space_2: var(--ui-positive-Value_100);\\n --ui-Positive-space_4: var(--ui-positive-Value_100);\\n --ui-Positive-space_6: var(--ui-positive-Value_150);\\n --ui-Positive-space_8: var(--ui-positive-Value_200);\\n --ui-Positive-space_10: var(--ui-positive-Value_250);\\n --ui-Positive-space_12: var(--ui-positive-Value_300);\\n --ui-Positive-space_16: var(--ui-positive-Value_400);\\n --ui-Positive-space_20: var(--ui-positive-Value_500);\\n --ui-Positive-space_24: var(--ui-positive-Value_600);\\n --ui-Positive-space_28: var(--ui-positive-Value_700);\\n --ui-Positive-space_32: var(--ui-positive-Value_800);\\n --ui-Positive-space_40: var(--ui-positive-Value_1000);\\n --ui-Positive-space_48: var(--ui-positive-Value_1200);\\n --ui-Positive-space_56: var(--ui-positive-Value_1400);\\n --ui-Positive-space_64: var(--ui-positive-Value_1600);\\n --ui-Positive-space_80: var(--ui-positive-Value_2000);\\n --ui-Positive-space_96: var(--ui-positive-Value_2400);\\n\\n /* Tamaños de fuente */\\n --ui-font-size-2xs: var(--ui-positive-Value_250);\\n --ui-font-size-xs: var(--ui-positive-Value_300);\\n --ui-font-size-sm: var(--ui-positive-Value_350);\\n --ui-font-size-md: var(--ui-positive-Value_400);\\n --ui-font-size-lg: var(--ui-positive-Value_450);\\n --ui-font-size-xl: var(--ui-positive-Value_500);\\n --ui-font-size-2xl: var(--ui-positive-Value_600);\\n --ui-font-size-3xl: var(--ui-positive-Value_750);\\n --ui-font-size-4xl: var(--ui-positive-Value_900);\\n --ui-font-size-5xl: var(--ui-positive-Value_1200);\\n\\n /* Line height (muestra) */\\n --ui-font-lh-10-normal: 14.5px;\\n --ui-font-lh-12-normal: 17.5px;\\n --ui-font-lh-14-normal: 20.5px;\\n --ui-font-lh-16-normal: 23px;\\n --ui-font-lh-18-normal: 26px;\\n --ui-font-lh-20-snug: 25px;\\n\\n /* Sombras compuestas (para uso en box-shadow) */\\n --ui-shadow-card: 0 4px 16px var(--ui-shadow-01-Color);\\n --ui-shadow-popover: 0 var(--ui-shadow-02-y) var(--ui-shadow-02-blur) var(--ui-shadow-02-Color);\\n --ui-shadow-modal: 0 var(--ui-shadow-04-y) var(--ui-shadow-04-blur) var(--ui-shadow-04-Color);\\n}\\n\"","import { useEffect, useCallback, type Dispatch, type SetStateAction } from \"react\";\n\nexport function useReviewMode(\n enabled: boolean,\n _reviewMode: boolean,\n setReviewMode: Dispatch<SetStateAction<boolean>>\n): void {\n const toggle = useCallback(() => {\n if (!enabled) return;\n setReviewMode((prev: boolean) => !prev);\n }, [enabled, setReviewMode]);\n\n useEffect(() => {\n if (!enabled) return;\n\n const handler = (e: KeyboardEvent) => {\n // Solo Shift+R; Ctrl+Shift+R (recarga forzada) no debe salir del modo\n if (\n (e.key === \"r\" || e.key === \"R\" || e.code === \"KeyR\") &&\n e.shiftKey &&\n !e.ctrlKey &&\n !e.metaKey\n ) {\n e.preventDefault();\n toggle();\n }\n };\n\n window.addEventListener(\"keydown\", handler);\n return () => window.removeEventListener(\"keydown\", handler);\n }, [enabled, toggle]);\n}\n","/**\n * Caché local para modo offline-first.\n * Cuando el backend (p. ej. Render) está suspendido por inactividad,\n * la app muestra los últimos datos guardados y los actualiza al despertar el servicio.\n */\n\nimport type { Comment, Reviewer } from \"./api\";\n\nconst PREFIX = \"review_layer:v1:\";\n\nfunction safeJsonParse<T>(raw: string | null, fallback: T): T {\n if (raw == null) return fallback;\n try {\n const data = JSON.parse(raw) as T;\n return data ?? fallback;\n } catch {\n return fallback;\n }\n}\n\nfunction storageKey(apiUrl: string, apiKey: string, kind: string, pageUrl?: string): string {\n const base = `${PREFIX}${normalizeUrl(apiUrl)}:${kind}`;\n return pageUrl != null ? `${base}:${pageUrl}` : base;\n}\n\nfunction normalizeUrl(url: string): string {\n return url.replace(/\\/+$/, \"\") || \"/\";\n}\n\nexport interface CachedWithTime<T> {\n data: T;\n at: number;\n}\n\nfunction getCached<T>(key: string): CachedWithTime<T> | null {\n if (typeof localStorage === \"undefined\") return null;\n const raw = localStorage.getItem(key);\n return safeJsonParse(raw, null) as CachedWithTime<T> | null;\n}\n\nfunction setCached<T>(key: string, data: T): void {\n if (typeof localStorage === \"undefined\") return;\n try {\n localStorage.setItem(key, JSON.stringify({ data, at: Date.now() }));\n } catch {\n // QuotaExceeded o privado\n }\n}\n\nexport function getCachedComments(\n apiUrl: string,\n apiKey: string,\n pageUrl: string\n): Comment[] | null {\n const entry = getCached<Comment[]>(storageKey(apiUrl, apiKey, \"comments\", pageUrl));\n return entry?.data ?? null;\n}\n\nexport function setCachedComments(\n apiUrl: string,\n apiKey: string,\n pageUrl: string,\n comments: Comment[]\n): void {\n setCached(storageKey(apiUrl, apiKey, \"comments\", pageUrl), comments);\n}\n\nexport function getCachedReviewers(apiUrl: string, apiKey: string): Reviewer[] | null {\n const entry = getCached<Reviewer[]>(storageKey(apiUrl, apiKey, \"reviewers\"));\n return entry?.data ?? null;\n}\n\nexport function setCachedReviewers(\n apiUrl: string,\n apiKey: string,\n reviewers: Reviewer[]\n): void {\n setCached(storageKey(apiUrl, apiKey, \"reviewers\"), reviewers);\n}\n\nexport function getCacheTimeComments(\n apiUrl: string,\n apiKey: string,\n pageUrl: string\n): number | null {\n const entry = getCached<Comment[]>(storageKey(apiUrl, apiKey, \"comments\", pageUrl));\n return entry?.at ?? null;\n}\n\nexport function getCacheTimeReviewers(apiUrl: string, apiKey: string): number | null {\n const entry = getCached<Reviewer[]>(storageKey(apiUrl, apiKey, \"reviewers\"));\n return entry?.at ?? null;\n}\n","import {\n createContext,\n useContext,\n useState,\n useEffect,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Overlay } from \"./Overlay\";\nimport variablesCss from \"./variables.css?raw\";\nimport { useReviewMode } from \"./hooks/useReviewMode\";\nimport { fetchReviewers, fetchComments } from \"./utils/api\";\nimport {\n getCachedComments,\n setCachedComments,\n getCachedReviewers,\n setCachedReviewers,\n getCacheTimeComments,\n getCacheTimeReviewers,\n} from \"./utils/cache\";\nimport { getPageUrl } from \"./utils/pageUrl\";\nimport type { Reviewer, Comment } from \"./utils/api\";\n\n/** URL por defecto de la API en producción (Render). Si no pasas apiUrl, se usa esta. */\nexport const DEFAULT_API_URL = \"https://review-layer-api.onrender.com/api\";\n\ninterface ReviewContextValue {\n apiUrl: string;\n apiKey: string;\n reviewMode: boolean;\n setReviewMode: (value: boolean) => void;\n reviewers: Reviewer[];\n comments: Comment[];\n loadComments: () => void;\n /** true si la última carga de comentarios falló (ej. backend dormido en Render) */\n commentsLoadFailed: boolean;\n}\n\nconst ReviewContext = createContext<ReviewContextValue | null>(null);\n\n/** Solo una carga inicial por config; evita peticiones duplicadas que llegarían al backend (p. ej. Strict Mode). */\nlet initialLoadKey: string | null = null;\n\nexport function useReview() {\n const ctx = useContext(ReviewContext);\n if (!ctx) {\n throw new Error(\"useReview must be used within ReviewProvider\");\n }\n return ctx;\n}\n\nexport interface ReviewProviderProps {\n children: React.ReactNode;\n enabled?: boolean;\n /** URL base de la API. Si no se pasa, se usa la de producción (Render). */\n apiUrl?: string;\n apiKey: string;\n /**\n * Función opcional para resolver la URL de la página (scope de comentarios).\n * Si no se pasa, se usa la lógica por defecto (query path/route, o en iframe Storybook el id del story).\n * Útil cuando el host (ej. Storybook) no expone la URL correcta en el iframe; el consumidor puede inyectarla.\n */\n getPageUrl?: () => string;\n}\n\nconst LOG_PREFIX = \"[review-layer]\";\n/** Si la caché es más reciente que esto (ms), no se hace petición para no saturar el servidor (ej. Storybook re-montando). */\nconst CACHE_FRESH_MS = 2500;\n\nexport function ReviewProvider({\n children,\n enabled = true,\n apiUrl: apiUrlProp,\n apiKey,\n getPageUrl: getPageUrlProp,\n}: ReviewProviderProps) {\n const apiUrl = apiUrlProp?.trim() || DEFAULT_API_URL;\n const [reviewMode, setReviewMode] = useState(false);\n const [reviewers, setReviewers] = useState<Reviewer[]>([]);\n const [comments, setComments] = useState<Comment[]>([]);\n const [commentsLoadFailed, setCommentsLoadFailed] = useState(false);\n const loadingReviewersRef = useRef(false);\n const loadingCommentsUrlRef = useRef<string | null>(null);\n\n const resolvePageUrl = useCallback(\n () => (getPageUrlProp?.() ?? getPageUrl()),\n [getPageUrlProp]\n );\n\n useReviewMode(enabled, reviewMode, setReviewMode);\n\n const loadReviewers = useCallback(\n async (signal?: AbortSignal) => {\n if (!enabled || !apiUrl || !apiKey) {\n console.warn(LOG_PREFIX, \"loadReviewers omitido: faltan enabled, apiUrl o apiKey\", {\n enabled,\n apiUrl: apiUrl || \"(vacío)\",\n hasApiKey: !!apiKey,\n });\n return;\n }\n const cachedAt = getCacheTimeReviewers(apiUrl, apiKey);\n if (cachedAt != null && Date.now() - cachedAt < CACHE_FRESH_MS) {\n const cached = getCachedReviewers(apiUrl, apiKey);\n if (cached != null) {\n setReviewers(cached);\n return;\n }\n }\n if (loadingReviewersRef.current) return;\n loadingReviewersRef.current = true;\n console.log(LOG_PREFIX, \"Cargando revisores...\", { apiUrl });\n try {\n const list = await fetchReviewers(apiUrl, apiKey, { signal });\n if (!signal?.aborted) {\n setReviewers(list);\n setCachedReviewers(apiUrl, apiKey, list);\n console.log(LOG_PREFIX, \"Revisores cargados:\", list.length);\n }\n } catch (e) {\n if (e instanceof Error && e.name === \"AbortError\") return;\n if (!signal?.aborted) {\n console.error(LOG_PREFIX, \"Error al cargar revisores:\", e);\n const cached = getCachedReviewers(apiUrl, apiKey);\n if (cached != null) {\n setReviewers(cached);\n console.log(LOG_PREFIX, \"Usando revisores en caché:\", cached.length);\n }\n }\n } finally {\n loadingReviewersRef.current = false;\n }\n },\n [enabled, apiUrl, apiKey]\n );\n\n const loadComments = useCallback(\n async (signal?: AbortSignal) => {\n if (!enabled || !apiUrl || !apiKey) {\n console.warn(LOG_PREFIX, \"loadComments omitido: faltan enabled, apiUrl o apiKey\", {\n enabled,\n apiUrl: apiUrl || \"(vacío)\",\n hasApiKey: !!apiKey,\n });\n return;\n }\n const url = resolvePageUrl();\n const cached = getCachedComments(apiUrl, apiKey, url);\n if (cached != null) setComments(cached);\n const cachedAt = getCacheTimeComments(apiUrl, apiKey, url);\n if (cachedAt != null && Date.now() - cachedAt < CACHE_FRESH_MS) {\n if (cached != null) return;\n }\n if (loadingCommentsUrlRef.current === url) return;\n loadingCommentsUrlRef.current = url;\n console.log(LOG_PREFIX, \"Cargando comentarios...\", { apiUrl, url });\n try {\n setCommentsLoadFailed(false);\n const list = await fetchComments(apiUrl, apiKey, url, { signal });\n if (!signal?.aborted) {\n setComments(list);\n setCachedComments(apiUrl, apiKey, url, list);\n console.log(LOG_PREFIX, \"Comentarios cargados:\", list.length);\n }\n } catch (e) {\n if (e instanceof Error && e.name === \"AbortError\") return;\n if (!signal?.aborted) {\n setCommentsLoadFailed(true);\n console.error(LOG_PREFIX, \"Error al cargar comentarios:\", e);\n const cachedAfter = getCachedComments(apiUrl, apiKey, url);\n if (cachedAfter != null) {\n setComments(cachedAfter);\n console.log(LOG_PREFIX, \"Usando comentarios en caché:\", cachedAfter.length);\n } else {\n console.warn(LOG_PREFIX, \"Sin caché de comentarios; la lista quedará vacía hasta que la API responda.\");\n }\n }\n } finally {\n loadingCommentsUrlRef.current = null;\n }\n },\n [enabled, apiUrl, apiKey, resolvePageUrl]\n );\n\n useEffect(() => {\n if (!enabled || !apiUrl || !apiKey) {\n console.warn(LOG_PREFIX, \"Provider activo pero sin carga: enabled, apiUrl y apiKey son requeridos.\", {\n enabled,\n apiUrl: apiUrl || \"(vacío)\",\n hasApiKey: !!apiKey,\n });\n return;\n }\n const url = resolvePageUrl();\n const cachedReviewersList = getCachedReviewers(apiUrl, apiKey);\n const cachedCommentsList = getCachedComments(apiUrl, apiKey, url);\n if (cachedReviewersList != null) {\n setReviewers(cachedReviewersList);\n console.log(LOG_PREFIX, \"Revisores desde caché (inicial):\", cachedReviewersList.length);\n }\n if (cachedCommentsList != null) {\n setComments(cachedCommentsList);\n console.log(LOG_PREFIX, \"Comentarios desde caché (inicial):\", cachedCommentsList.length, { url });\n }\n }, [enabled, apiUrl, apiKey, resolvePageUrl]);\n\n /* Inyecta tokens UI en :root para que los componentes usen var(--ui-...) */\n useEffect(() => {\n if (typeof document === \"undefined\") return;\n const id = \"review-layer-ui-variables\";\n if (!document.getElementById(id)) {\n const style = document.createElement(\"style\");\n style.id = id;\n style.textContent = variablesCss;\n document.head.appendChild(style);\n }\n }, []);\n\n useEffect(() => {\n if (!enabled || !apiUrl || !apiKey) return;\n const key = `${apiUrl}:${apiKey}`;\n if (initialLoadKey === key) return;\n initialLoadKey = key;\n console.log(LOG_PREFIX, \"Inicio de carga (revisores + comentarios)\", { apiUrl, apiKey: apiKey ? \"***\" : \"(vacío)\" });\n loadReviewers();\n loadComments();\n return () => {\n setTimeout(() => {\n initialLoadKey = null;\n }, 0);\n };\n }, [enabled, apiUrl, apiKey, loadReviewers, loadComments]);\n\n useEffect(() => {\n if (!enabled) return;\n const onPopState = () => loadComments();\n window.addEventListener(\"popstate\", onPopState);\n return () => window.removeEventListener(\"popstate\", onPopState);\n }, [enabled, loadComments]);\n\n const value = useMemo<ReviewContextValue>(\n () => ({\n apiUrl,\n apiKey,\n reviewMode,\n setReviewMode,\n reviewers,\n comments,\n loadComments,\n commentsLoadFailed,\n }),\n [apiUrl, apiKey, reviewMode, setReviewMode, reviewers, comments, loadComments, commentsLoadFailed]\n );\n\n const overlay =\n enabled && typeof document !== \"undefined\"\n ? createPortal(\n <Overlay\n apiUrl={apiUrl}\n apiKey={apiKey}\n getPageUrl={resolvePageUrl}\n reviewMode={reviewMode}\n setReviewMode={setReviewMode}\n reviewers={reviewers}\n comments={comments}\n loadComments={loadComments}\n commentsLoadFailed={commentsLoadFailed}\n />,\n document.body\n )\n : null;\n\n return (\n <ReviewContext.Provider value={value}>\n {children}\n {overlay}\n </ReviewContext.Provider>\n );\n}\n"],"names":["f","require$$0","k","l","m","n","p","q","c","a","b","d","e","h","reactJsxRuntime_production_min","React","REACT_ELEMENT_TYPE","REACT_PORTAL_TYPE","REACT_FRAGMENT_TYPE","REACT_STRICT_MODE_TYPE","REACT_PROFILER_TYPE","REACT_PROVIDER_TYPE","REACT_CONTEXT_TYPE","REACT_FORWARD_REF_TYPE","REACT_SUSPENSE_TYPE","REACT_SUSPENSE_LIST_TYPE","REACT_MEMO_TYPE","REACT_LAZY_TYPE","REACT_OFFSCREEN_TYPE","MAYBE_ITERATOR_SYMBOL","FAUX_ITERATOR_SYMBOL","getIteratorFn","maybeIterable","maybeIterator","ReactSharedInternals","error","format","_len2","args","_key2","printWarning","level","ReactDebugCurrentFrame","stack","argsWithFormat","item","enableScopeAPI","enableCacheElement","enableTransitionTracing","enableLegacyHidden","enableDebugTracing","REACT_MODULE_REFERENCE","isValidElementType","type","getWrappedName","outerType","innerType","wrapperName","displayName","functionName","getContextName","getComponentNameFromType","context","provider","outerName","lazyComponent","payload","init","assign","disabledDepth","prevLog","prevInfo","prevWarn","prevError","prevGroup","prevGroupCollapsed","prevGroupEnd","disabledLog","disableLogs","props","reenableLogs","ReactCurrentDispatcher","prefix","describeBuiltInComponentFrame","name","source","ownerFn","x","match","reentry","componentFrameCache","PossiblyWeakMap","describeNativeComponentFrame","fn","construct","frame","control","previousPrepareStackTrace","previousDispatcher","Fake","sample","sampleLines","controlLines","s","_frame","syntheticFrame","describeFunctionComponentFrame","shouldConstruct","Component","prototype","describeUnknownElementTypeFrameInDEV","hasOwnProperty","loggedTypeFailures","setCurrentlyValidatingElement","element","owner","checkPropTypes","typeSpecs","values","location","componentName","has","typeSpecName","error$1","err","ex","isArrayImpl","isArray","typeName","value","hasToStringTag","willCoercionThrow","testStringCoercion","checkKeyStringCoercion","ReactCurrentOwner","RESERVED_PROPS","specialPropKeyWarningShown","specialPropRefWarningShown","hasValidRef","config","getter","hasValidKey","warnIfStringRefCannotBeAutoConverted","self","defineKeyPropWarningGetter","warnAboutAccessingKey","defineRefPropWarningGetter","warnAboutAccessingRef","ReactElement","key","ref","jsxDEV","maybeKey","propName","defaultProps","ReactCurrentOwner$1","ReactDebugCurrentFrame$1","setCurrentlyValidatingElement$1","propTypesMisspellWarningShown","isValidElement","object","getDeclarationErrorAddendum","getSourceInfoErrorAddendum","ownerHasKeyUseWarning","getCurrentComponentErrorInfo","parentType","info","parentName","validateExplicitKey","currentComponentErrorInfo","childOwner","validateChildKeys","node","i","child","iteratorFn","iterator","step","validatePropTypes","propTypes","_name","validateFragmentProps","fragment","keys","didWarnAboutKeySpread","jsxWithValidation","isStaticChildren","validType","sourceInfo","typeString","children","beforeExample","afterExample","jsxWithValidationStatic","jsxWithValidationDynamic","jsx","jsxs","reactJsxRuntime_development","jsxRuntimeModule","require$$1","getSelector","path","current","part","classes","safeClasses","parent","siblings","el","index","REVIEW_LAYER_ROOT","PIN_RADIUS","clampPinToViewport","y","radius","minX","minY","maxX","maxY","getScrollableAncestors","result","style","ox","oy","getElementPosition","selector","_a","getRelativePosition","rect","w","getFallbackPosition","comment","relX","relY","getFallbackRect","getCommentPinPosition","FALLBACK_QUERY_KEYS","normalizePath","getPageUrl","params","v","pathname","storyId","COMMENT_STATUS","API_LOG_PREFIX","logApiFailure","url","details","status","statusText","body","reason","msg","getHeaders","apiKey","fetchReviewers","apiUrl","options","res","createComment","fetchComments","fullUrl","updateCommentStatus","commentId","deleteComment","backdropStyle","modalStyle","textareaStyle","selectStyle","buttonStyle","CommentModalInner","reviewers","position","onClose","onSuccess","message","setMessage","useState","reviewerId","setReviewerId","loading","setLoading","setError","useEffect","handleSubmit","useCallback","modalContainerRef","useRef","handleKeyDown","handleMouseDown","target","r","CommentModal","memo","DEFAULT_OUTLINE_COLOR","getHighlightStyle","outlineColor","ElementHighlight","active","fallbackComment","setRect","updateRect","fromSelector","PIN_SIZE","HOVER_LEAVE_DELAY_MS","CARD_WIDTH","COLORS","STATUS_LABELS","STATUS_LABELS_UPPER","PIN_COLORS","BADGE_BG_50","BADGE_BORDER_500","getInitials","parts","CheckIcon","ChatBubblePinIcon","color","getPinStyle","cardStyle","headerRowStyle","avatarStyle","ReviewerAvatar","reviewer","imageUrl","statusColor","closeButtonStyle","getStatusBadgeStyle","borderColor","changeStatusLabelStyle","footerStyle","footerButtonBase","replyButtonStyle","RESOLVE_BTN_CLASS","STATUS_OPTIONS","resolveButtonStyle","CommentPinInner","offset","onStatusChange","reviewMode","showTooltip","setShowTooltip","isPinned","setIsPinned","setPosition","updating","setUpdating","hoverLeaveTimeoutRef","pinRef","popupRef","updatePosition","cleanups","clearHoverLeaveTimeout","handlePinMouseEnter","handlePinMouseLeave","handlePopupMouseEnter","handlePopupMouseLeave","handlePinClick","handleClickOutside","_b","rawX","rawY","showHighlight","closePopup","handleStatusChange","newStatus","handleDelete","pinStyle","useMemo","Fragment","CommentPin","PIN_OVERLAP_RADIUS","PIN_OFFSET_STEP","getPinOffsets","comments","map","cx","cy","indexInGroup","j","cox","coy","getViewport","Overlay","getPageUrlProp","setReviewMode","loadComments","commentsLoadFailed","hoveredEl","setHoveredEl","selectedElementRef","modalState","setModalState","clearHighlight","clearSelectedElement","prev","isBodyOrRoot","tag","handleMouseOver","handleMouseOut","related","handleClick","relativeX","relativeY","resizeScrollTick","setResizeScrollTick","updateOnScrollResize","t","cleanup","pinOffsets","handleModalClose","passThroughLayerStyle","content","container","createPortal","variablesCss","useReviewMode","enabled","_reviewMode","toggle","handler","PREFIX","safeJsonParse","raw","fallback","storageKey","kind","pageUrl","base","normalizeUrl","getCached","setCached","data","getCachedComments","entry","setCachedComments","getCachedReviewers","setCachedReviewers","getCacheTimeComments","getCacheTimeReviewers","DEFAULT_API_URL","ReviewContext","createContext","initialLoadKey","useReview","ctx","useContext","LOG_PREFIX","CACHE_FRESH_MS","ReviewProvider","apiUrlProp","setReviewers","setComments","setCommentsLoadFailed","loadingReviewersRef","loadingCommentsUrlRef","resolvePageUrl","loadReviewers","signal","cachedAt","cached","list","cachedAfter","cachedReviewersList","cachedCommentsList","id","onPopState","overlay"],"mappings":";;;;;;;;;;;;;;;;AASa,MAAIA,IAAEC,IAAiBC,IAAE,OAAO,IAAI,eAAe,GAAEC,IAAE,OAAO,IAAI,gBAAgB,GAAEC,IAAE,OAAO,UAAU,gBAAeC,IAAEL,EAAE,mDAAmD,mBAAkBM,IAAE,EAAC,KAAI,IAAG,KAAI,IAAG,QAAO,IAAG,UAAS,GAAE;AAClP,WAASC,EAAEC,GAAEC,GAAE,GAAE;AAAC,QAAIC,GAAEC,IAAE,CAAA,GAAGC,IAAE,MAAKC,IAAE;AAAK,IAAS,MAAT,WAAaD,IAAE,KAAG,IAAYH,EAAE,QAAX,WAAiBG,IAAE,KAAGH,EAAE,MAAcA,EAAE,QAAX,WAAiBI,IAAEJ,EAAE;AAAK,SAAIC,KAAKD,EAAE,CAAAL,EAAE,KAAKK,GAAEC,CAAC,KAAG,CAACJ,EAAE,eAAeI,CAAC,MAAIC,EAAED,CAAC,IAAED,EAAEC,CAAC;AAAG,QAAGF,KAAGA,EAAE,aAAa,MAAIE,KAAKD,IAAED,EAAE,cAAaC,EAAE,CAASE,EAAED,CAAC,MAAZ,WAAgBC,EAAED,CAAC,IAAED,EAAEC,CAAC;AAAG,WAAM,EAAC,UAASR,GAAE,MAAKM,GAAE,KAAII,GAAE,KAAIC,GAAE,OAAMF,GAAE,QAAON,EAAE,QAAO;AAAA,EAAC;AAAC,SAAAS,cAAiBX,GAAEW,GAAA,MAAYP,GAAEO,GAAA,OAAaP;;;;;;;;;;;;;;wBCEtW,QAAQ,IAAI,aAAa,gBAC1B,WAAW;AAGd,QAAIQ,IAAQd,IAMRe,IAAqB,OAAO,IAAI,eAAe,GAC/CC,IAA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oBAAoB,YAAYA,CAAU;AAAA,EAChE,GAAG,CAACjD,GAAS/B,CAAY,CAAC;AAE1B,QAAMhQ,IAAQ8O;AAAA,IACZ,OAAO;AAAA,MACL,QAAA/G;AAAA,MACA,QAAAF;AAAA,MACA,YAAAoF;AAAA,MACA,eAAA8C;AAAA,MACA,WAAAjH;AAAA,MACA,UAAAsG;AAAA,MACA,cAAAY;AAAA,MACA,oBAAAC;AAAA,IAAA;AAAA,IAEF,CAAClI,GAAQF,GAAQoF,GAAY8C,GAAejH,GAAWsG,GAAUY,GAAcC,CAAkB;AAAA,EAAA,GAG7FgF,IACJlD,KAAW,OAAO,WAAa,MAC3BH;AAAA,IACE1N,gBAAAA,EAAAA;AAAAA,MAAC2L;AAAA,MAAA;AAAA,QACC,QAAA9H;AAAA,QACA,QAAAF;AAAA,QACA,YAAYyM;AAAA,QACZ,YAAArH;AAAA,QACA,eAAA8C;AAAA,QACA,WAAAjH;AAAA,QACA,UAAAsG;AAAA,QACA,cAAAY;AAAA,QACA,oBAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,SAAS;AAAA,EAAA,IAEX;AAEN,SACE9L,gBAAAA,EAAAA,KAACoP,GAAc,UAAd,EAAuB,OAAAvT,GACrB,UAAA;AAAA,IAAA6D;AAAA,IACAoR;AAAA,EAAA,GACH;AAEJ;","x_google_ignoreList":[0,1,2]}
|
|
1
|
+
{"version":3,"file":"review-layer-react.js","sources":["../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js","../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js","../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js","../src/utils/selector.ts","../src/utils/positioning.ts","../src/utils/pageUrl.ts","../src/utils/api.ts","../src/CommentModal.tsx","../src/ElementHighlight.tsx","../src/CommentPin.tsx","../src/Overlay.tsx","../src/variables.css?raw","../src/hooks/useReviewMode.ts","../src/utils/cache.ts","../src/ReviewProvider.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var f=require(\"react\"),k=Symbol.for(\"react.element\"),l=Symbol.for(\"react.fragment\"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=\"\"+g);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;\n","/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\nvar React = require('react');\n\n// ATTENTION\n// When adding new symbols to this file,\n// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'\n// The Symbol used to tag the ReactElement-like types.\nvar REACT_ELEMENT_TYPE = Symbol.for('react.element');\nvar REACT_PORTAL_TYPE = Symbol.for('react.portal');\nvar REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');\nvar REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');\nvar REACT_PROFILER_TYPE = Symbol.for('react.profiler');\nvar REACT_PROVIDER_TYPE = Symbol.for('react.provider');\nvar REACT_CONTEXT_TYPE = Symbol.for('react.context');\nvar REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');\nvar REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');\nvar REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');\nvar REACT_MEMO_TYPE = Symbol.for('react.memo');\nvar REACT_LAZY_TYPE = Symbol.for('react.lazy');\nvar REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');\nvar MAYBE_ITERATOR_SYMBOL = Symbol.iterator;\nvar FAUX_ITERATOR_SYMBOL = '@@iterator';\nfunction getIteratorFn(maybeIterable) {\n if (maybeIterable === null || typeof maybeIterable !== 'object') {\n return null;\n }\n\n var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];\n\n if (typeof maybeIterator === 'function') {\n return maybeIterator;\n }\n\n return null;\n}\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n// -----------------------------------------------------------------------------\n\nvar enableScopeAPI = false; // Experimental Create Event Handle API.\nvar enableCacheElement = false;\nvar enableTransitionTracing = false; // No known bugs, but needs performance testing\n\nvar enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber\n// stuff. Intended to enable React core members to more easily debug scheduling\n// issues in DEV builds.\n\nvar enableDebugTracing = false; // Track which Fiber(s) schedule render work.\n\nvar REACT_MODULE_REFERENCE;\n\n{\n REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');\n}\n\nfunction isValidElementType(type) {\n if (typeof type === 'string' || typeof type === 'function') {\n return true;\n } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).\n\n\n if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {\n return true;\n }\n\n if (typeof type === 'object' && type !== null) {\n if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object\n // types supported by any Flight configuration anywhere since\n // we don't know which Flight build this will end up being used\n // with.\n type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction getWrappedName(outerType, innerType, wrapperName) {\n var displayName = outerType.displayName;\n\n if (displayName) {\n return displayName;\n }\n\n var functionName = innerType.displayName || innerType.name || '';\n return functionName !== '' ? wrapperName + \"(\" + functionName + \")\" : wrapperName;\n} // Keep in sync with react-reconciler/getComponentNameFromFiber\n\n\nfunction getContextName(type) {\n return type.displayName || 'Context';\n} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.\n\n\nfunction getComponentNameFromType(type) {\n if (type == null) {\n // Host root, text node or just invalid type.\n return null;\n }\n\n {\n if (typeof type.tag === 'number') {\n error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');\n }\n }\n\n if (typeof type === 'function') {\n return type.displayName || type.name || null;\n }\n\n if (typeof type === 'string') {\n return type;\n }\n\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return 'Fragment';\n\n case REACT_PORTAL_TYPE:\n return 'Portal';\n\n case REACT_PROFILER_TYPE:\n return 'Profiler';\n\n case REACT_STRICT_MODE_TYPE:\n return 'StrictMode';\n\n case REACT_SUSPENSE_TYPE:\n return 'Suspense';\n\n case REACT_SUSPENSE_LIST_TYPE:\n return 'SuspenseList';\n\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_CONTEXT_TYPE:\n var context = type;\n return getContextName(context) + '.Consumer';\n\n case REACT_PROVIDER_TYPE:\n var provider = type;\n return getContextName(provider._context) + '.Provider';\n\n case REACT_FORWARD_REF_TYPE:\n return getWrappedName(type, type.render, 'ForwardRef');\n\n case REACT_MEMO_TYPE:\n var outerName = type.displayName || null;\n\n if (outerName !== null) {\n return outerName;\n }\n\n return getComponentNameFromType(type.type) || 'Memo';\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n return getComponentNameFromType(init(payload));\n } catch (x) {\n return null;\n }\n }\n\n // eslint-disable-next-line no-fallthrough\n }\n }\n\n return null;\n}\n\nvar assign = Object.assign;\n\n// Helpers to patch console.logs to avoid logging during side-effect free\n// replaying on render function. This currently only patches the object\n// lazily which won't cover if the log function was extracted eagerly.\n// We could also eagerly patch the method.\nvar disabledDepth = 0;\nvar prevLog;\nvar prevInfo;\nvar prevWarn;\nvar prevError;\nvar prevGroup;\nvar prevGroupCollapsed;\nvar prevGroupEnd;\n\nfunction disabledLog() {}\n\ndisabledLog.__reactDisabledLog = true;\nfunction disableLogs() {\n {\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n prevLog = console.log;\n prevInfo = console.info;\n prevWarn = console.warn;\n prevError = console.error;\n prevGroup = console.group;\n prevGroupCollapsed = console.groupCollapsed;\n prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099\n\n var props = {\n configurable: true,\n enumerable: true,\n value: disabledLog,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n info: props,\n log: props,\n warn: props,\n error: props,\n group: props,\n groupCollapsed: props,\n groupEnd: props\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n disabledDepth++;\n }\n}\nfunction reenableLogs() {\n {\n disabledDepth--;\n\n if (disabledDepth === 0) {\n /* eslint-disable react-internal/no-production-logging */\n var props = {\n configurable: true,\n enumerable: true,\n writable: true\n }; // $FlowFixMe Flow thinks console is immutable.\n\n Object.defineProperties(console, {\n log: assign({}, props, {\n value: prevLog\n }),\n info: assign({}, props, {\n value: prevInfo\n }),\n warn: assign({}, props, {\n value: prevWarn\n }),\n error: assign({}, props, {\n value: prevError\n }),\n group: assign({}, props, {\n value: prevGroup\n }),\n groupCollapsed: assign({}, props, {\n value: prevGroupCollapsed\n }),\n groupEnd: assign({}, props, {\n value: prevGroupEnd\n })\n });\n /* eslint-enable react-internal/no-production-logging */\n }\n\n if (disabledDepth < 0) {\n error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');\n }\n }\n}\n\nvar ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;\nvar prefix;\nfunction describeBuiltInComponentFrame(name, source, ownerFn) {\n {\n if (prefix === undefined) {\n // Extract the VM specific prefix used by each line.\n try {\n throw Error();\n } catch (x) {\n var match = x.stack.trim().match(/\\n( *(at )?)/);\n prefix = match && match[1] || '';\n }\n } // We use the prefix to ensure our stacks line up with native stack frames.\n\n\n return '\\n' + prefix + name;\n }\n}\nvar reentry = false;\nvar componentFrameCache;\n\n{\n var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;\n componentFrameCache = new PossiblyWeakMap();\n}\n\nfunction describeNativeComponentFrame(fn, construct) {\n // If something asked for a stack inside a fake render, it should get ignored.\n if ( !fn || reentry) {\n return '';\n }\n\n {\n var frame = componentFrameCache.get(fn);\n\n if (frame !== undefined) {\n return frame;\n }\n }\n\n var control;\n reentry = true;\n var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.\n\n Error.prepareStackTrace = undefined;\n var previousDispatcher;\n\n {\n previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function\n // for warnings.\n\n ReactCurrentDispatcher.current = null;\n disableLogs();\n }\n\n try {\n // This should throw.\n if (construct) {\n // Something should be setting the props in the constructor.\n var Fake = function () {\n throw Error();\n }; // $FlowFixMe\n\n\n Object.defineProperty(Fake.prototype, 'props', {\n set: function () {\n // We use a throwing setter instead of frozen or non-writable props\n // because that won't throw in a non-strict mode function.\n throw Error();\n }\n });\n\n if (typeof Reflect === 'object' && Reflect.construct) {\n // We construct a different control for this case to include any extra\n // frames added by the construct call.\n try {\n Reflect.construct(Fake, []);\n } catch (x) {\n control = x;\n }\n\n Reflect.construct(fn, [], Fake);\n } else {\n try {\n Fake.call();\n } catch (x) {\n control = x;\n }\n\n fn.call(Fake.prototype);\n }\n } else {\n try {\n throw Error();\n } catch (x) {\n control = x;\n }\n\n fn();\n }\n } catch (sample) {\n // This is inlined manually because closure doesn't do it for us.\n if (sample && control && typeof sample.stack === 'string') {\n // This extracts the first frame from the sample that isn't also in the control.\n // Skipping one frame that we assume is the frame that calls the two.\n var sampleLines = sample.stack.split('\\n');\n var controlLines = control.stack.split('\\n');\n var s = sampleLines.length - 1;\n var c = controlLines.length - 1;\n\n while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {\n // We expect at least one stack frame to be shared.\n // Typically this will be the root most one. However, stack frames may be\n // cut off due to maximum stack limits. In this case, one maybe cut off\n // earlier than the other. We assume that the sample is longer or the same\n // and there for cut off earlier. So we should find the root most frame in\n // the sample somewhere in the control.\n c--;\n }\n\n for (; s >= 1 && c >= 0; s--, c--) {\n // Next we find the first one that isn't the same which should be the\n // frame that called our sample function and the control.\n if (sampleLines[s] !== controlLines[c]) {\n // In V8, the first line is describing the message but other VMs don't.\n // If we're about to return the first line, and the control is also on the same\n // line, that's a pretty good indicator that our sample threw at same line as\n // the control. I.e. before we entered the sample frame. So we ignore this result.\n // This can happen if you passed a class to function component, or non-function.\n if (s !== 1 || c !== 1) {\n do {\n s--;\n c--; // We may still have similar intermediate frames from the construct call.\n // The next one that isn't the same should be our match though.\n\n if (c < 0 || sampleLines[s] !== controlLines[c]) {\n // V8 adds a \"new\" prefix for native classes. Let's remove it to make it prettier.\n var _frame = '\\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled \"<anonymous>\"\n // but we have a user-provided \"displayName\"\n // splice it in to make the stack more readable.\n\n\n if (fn.displayName && _frame.includes('<anonymous>')) {\n _frame = _frame.replace('<anonymous>', fn.displayName);\n }\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, _frame);\n }\n } // Return the line we found.\n\n\n return _frame;\n }\n } while (s >= 1 && c >= 0);\n }\n\n break;\n }\n }\n }\n } finally {\n reentry = false;\n\n {\n ReactCurrentDispatcher.current = previousDispatcher;\n reenableLogs();\n }\n\n Error.prepareStackTrace = previousPrepareStackTrace;\n } // Fallback to just using the name if we couldn't make it throw.\n\n\n var name = fn ? fn.displayName || fn.name : '';\n var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';\n\n {\n if (typeof fn === 'function') {\n componentFrameCache.set(fn, syntheticFrame);\n }\n }\n\n return syntheticFrame;\n}\nfunction describeFunctionComponentFrame(fn, source, ownerFn) {\n {\n return describeNativeComponentFrame(fn, false);\n }\n}\n\nfunction shouldConstruct(Component) {\n var prototype = Component.prototype;\n return !!(prototype && prototype.isReactComponent);\n}\n\nfunction describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {\n\n if (type == null) {\n return '';\n }\n\n if (typeof type === 'function') {\n {\n return describeNativeComponentFrame(type, shouldConstruct(type));\n }\n }\n\n if (typeof type === 'string') {\n return describeBuiltInComponentFrame(type);\n }\n\n switch (type) {\n case REACT_SUSPENSE_TYPE:\n return describeBuiltInComponentFrame('Suspense');\n\n case REACT_SUSPENSE_LIST_TYPE:\n return describeBuiltInComponentFrame('SuspenseList');\n }\n\n if (typeof type === 'object') {\n switch (type.$$typeof) {\n case REACT_FORWARD_REF_TYPE:\n return describeFunctionComponentFrame(type.render);\n\n case REACT_MEMO_TYPE:\n // Memo may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);\n\n case REACT_LAZY_TYPE:\n {\n var lazyComponent = type;\n var payload = lazyComponent._payload;\n var init = lazyComponent._init;\n\n try {\n // Lazy may contain any component type so we recursively resolve it.\n return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);\n } catch (x) {}\n }\n }\n }\n\n return '';\n}\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar loggedTypeFailures = {};\nvar ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n\nfunction setCurrentlyValidatingElement(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n ReactDebugCurrentFrame.setExtraStackFrame(stack);\n } else {\n ReactDebugCurrentFrame.setExtraStackFrame(null);\n }\n }\n}\n\nfunction checkPropTypes(typeSpecs, values, location, componentName, element) {\n {\n // $FlowFixMe This is okay but Flow doesn't know it.\n var has = Function.call.bind(hasOwnProperty);\n\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n // eslint-disable-next-line react-internal/prod-error-codes\n var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');\n err.name = 'Invariant Violation';\n throw err;\n }\n\n error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');\n } catch (ex) {\n error$1 = ex;\n }\n\n if (error$1 && !(error$1 instanceof Error)) {\n setCurrentlyValidatingElement(element);\n\n error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);\n\n setCurrentlyValidatingElement(null);\n }\n\n if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error$1.message] = true;\n setCurrentlyValidatingElement(element);\n\n error('Failed %s type: %s', location, error$1.message);\n\n setCurrentlyValidatingElement(null);\n }\n }\n }\n }\n}\n\nvar isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare\n\nfunction isArray(a) {\n return isArrayImpl(a);\n}\n\n/*\n * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol\n * and Temporal.* types. See https://github.com/facebook/react/pull/22064.\n *\n * The functions in this module will throw an easier-to-understand,\n * easier-to-debug exception with a clear errors message message explaining the\n * problem. (Instead of a confusing exception thrown inside the implementation\n * of the `value` object).\n */\n// $FlowFixMe only called in DEV, so void return is not possible.\nfunction typeName(value) {\n {\n // toStringTag is needed for namespaced types like Temporal.Instant\n var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;\n var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';\n return type;\n }\n} // $FlowFixMe only called in DEV, so void return is not possible.\n\n\nfunction willCoercionThrow(value) {\n {\n try {\n testStringCoercion(value);\n return false;\n } catch (e) {\n return true;\n }\n }\n}\n\nfunction testStringCoercion(value) {\n // If you ended up here by following an exception call stack, here's what's\n // happened: you supplied an object or symbol value to React (as a prop, key,\n // DOM attribute, CSS property, string ref, etc.) and when React tried to\n // coerce it to a string using `'' + value`, an exception was thrown.\n //\n // The most common types that will cause this exception are `Symbol` instances\n // and Temporal objects like `Temporal.Instant`. But any object that has a\n // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this\n // exception. (Library authors do this to prevent users from using built-in\n // numeric operators like `+` or comparison operators like `>=` because custom\n // methods are needed to perform accurate arithmetic or comparison.)\n //\n // To fix the problem, coerce this object or symbol value to a string before\n // passing it to React. The most reliable way is usually `String(value)`.\n //\n // To find which value is throwing, check the browser or debugger console.\n // Before this exception was thrown, there should be `console.error` output\n // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the\n // problem and how that type was used: key, atrribute, input value prop, etc.\n // In most cases, this console output also shows the component and its\n // ancestor components where the exception happened.\n //\n // eslint-disable-next-line react-internal/safe-string-coercion\n return '' + value;\n}\nfunction checkKeyStringCoercion(value) {\n {\n if (willCoercionThrow(value)) {\n error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));\n\n return testStringCoercion(value); // throw (to help callers find troubleshooting comments)\n }\n }\n}\n\nvar ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;\nvar RESERVED_PROPS = {\n key: true,\n ref: true,\n __self: true,\n __source: true\n};\nvar specialPropKeyWarningShown;\nvar specialPropRefWarningShown;\nvar didWarnAboutStringRefs;\n\n{\n didWarnAboutStringRefs = {};\n}\n\nfunction hasValidRef(config) {\n {\n if (hasOwnProperty.call(config, 'ref')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.ref !== undefined;\n}\n\nfunction hasValidKey(config) {\n {\n if (hasOwnProperty.call(config, 'key')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'key').get;\n\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n\n return config.key !== undefined;\n}\n\nfunction warnIfStringRefCannotBeAutoConverted(config, self) {\n {\n if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {\n var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);\n\n if (!didWarnAboutStringRefs[componentName]) {\n error('Component \"%s\" contains the string ref \"%s\". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);\n\n didWarnAboutStringRefs[componentName] = true;\n }\n }\n }\n}\n\nfunction defineKeyPropWarningGetter(props, displayName) {\n {\n var warnAboutAccessingKey = function () {\n if (!specialPropKeyWarningShown) {\n specialPropKeyWarningShown = true;\n\n error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n };\n\n warnAboutAccessingKey.isReactWarning = true;\n Object.defineProperty(props, 'key', {\n get: warnAboutAccessingKey,\n configurable: true\n });\n }\n}\n\nfunction defineRefPropWarningGetter(props, displayName) {\n {\n var warnAboutAccessingRef = function () {\n if (!specialPropRefWarningShown) {\n specialPropRefWarningShown = true;\n\n error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);\n }\n };\n\n warnAboutAccessingRef.isReactWarning = true;\n Object.defineProperty(props, 'ref', {\n get: warnAboutAccessingRef,\n configurable: true\n });\n }\n}\n/**\n * Factory method to create a new React element. This no longer adheres to\n * the class pattern, so do not use new to call it. Also, instanceof check\n * will not work. Instead test $$typeof field against Symbol.for('react.element') to check\n * if something is a React Element.\n *\n * @param {*} type\n * @param {*} props\n * @param {*} key\n * @param {string|object} ref\n * @param {*} owner\n * @param {*} self A *temporary* helper to detect places where `this` is\n * different from the `owner` when React.createElement is called, so that we\n * can warn. We want to get rid of owner and replace string `ref`s with arrow\n * functions, and as long as `this` and owner are the same, there will be no\n * change in behavior.\n * @param {*} source An annotation object (added by a transpiler or otherwise)\n * indicating filename, line number, and/or other information.\n * @internal\n */\n\n\nvar ReactElement = function (type, key, ref, self, source, owner, props) {\n var element = {\n // This tag allows us to uniquely identify this as a React Element\n $$typeof: REACT_ELEMENT_TYPE,\n // Built-in properties that belong on the element\n type: type,\n key: key,\n ref: ref,\n props: props,\n // Record the component responsible for creating this element.\n _owner: owner\n };\n\n {\n // The validation flag is currently mutative. We put it on\n // an external backing store so that we can freeze the whole object.\n // This can be replaced with a WeakMap once they are implemented in\n // commonly used development environments.\n element._store = {}; // To make comparing ReactElements easier for testing purposes, we make\n // the validation flag non-enumerable (where possible, which should\n // include every environment we run tests in), so the test framework\n // ignores it.\n\n Object.defineProperty(element._store, 'validated', {\n configurable: false,\n enumerable: false,\n writable: true,\n value: false\n }); // self and source are DEV only properties.\n\n Object.defineProperty(element, '_self', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: self\n }); // Two elements created in two different places should be considered\n // equal for testing purposes and therefore we hide it from enumeration.\n\n Object.defineProperty(element, '_source', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: source\n });\n\n if (Object.freeze) {\n Object.freeze(element.props);\n Object.freeze(element);\n }\n }\n\n return element;\n};\n/**\n * https://github.com/reactjs/rfcs/pull/107\n * @param {*} type\n * @param {object} props\n * @param {string} key\n */\n\nfunction jsxDEV(type, config, maybeKey, source, self) {\n {\n var propName; // Reserved names are extracted\n\n var props = {};\n var key = null;\n var ref = null; // Currently, key can be spread in as a prop. This causes a potential\n // issue if key is also explicitly declared (ie. <div {...props} key=\"Hi\" />\n // or <div key=\"Hi\" {...props} /> ). We want to deprecate key spread,\n // but as an intermediary step, we will use jsxDEV for everything except\n // <div {...props} key=\"Hi\" />, because we aren't currently able to tell if\n // key is explicitly declared to be undefined or not.\n\n if (maybeKey !== undefined) {\n {\n checkKeyStringCoercion(maybeKey);\n }\n\n key = '' + maybeKey;\n }\n\n if (hasValidKey(config)) {\n {\n checkKeyStringCoercion(config.key);\n }\n\n key = '' + config.key;\n }\n\n if (hasValidRef(config)) {\n ref = config.ref;\n warnIfStringRefCannotBeAutoConverted(config, self);\n } // Remaining properties are added to a new props object\n\n\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n props[propName] = config[propName];\n }\n } // Resolve default props\n\n\n if (type && type.defaultProps) {\n var defaultProps = type.defaultProps;\n\n for (propName in defaultProps) {\n if (props[propName] === undefined) {\n props[propName] = defaultProps[propName];\n }\n }\n }\n\n if (key || ref) {\n var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;\n\n if (key) {\n defineKeyPropWarningGetter(props, displayName);\n }\n\n if (ref) {\n defineRefPropWarningGetter(props, displayName);\n }\n }\n\n return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);\n }\n}\n\nvar ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;\nvar ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;\n\nfunction setCurrentlyValidatingElement$1(element) {\n {\n if (element) {\n var owner = element._owner;\n var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);\n ReactDebugCurrentFrame$1.setExtraStackFrame(stack);\n } else {\n ReactDebugCurrentFrame$1.setExtraStackFrame(null);\n }\n }\n}\n\nvar propTypesMisspellWarningShown;\n\n{\n propTypesMisspellWarningShown = false;\n}\n/**\n * Verifies the object is a ReactElement.\n * See https://reactjs.org/docs/react-api.html#isvalidelement\n * @param {?object} object\n * @return {boolean} True if `object` is a ReactElement.\n * @final\n */\n\n\nfunction isValidElement(object) {\n {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n }\n}\n\nfunction getDeclarationErrorAddendum() {\n {\n if (ReactCurrentOwner$1.current) {\n var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);\n\n if (name) {\n return '\\n\\nCheck the render method of `' + name + '`.';\n }\n }\n\n return '';\n }\n}\n\nfunction getSourceInfoErrorAddendum(source) {\n {\n if (source !== undefined) {\n var fileName = source.fileName.replace(/^.*[\\\\\\/]/, '');\n var lineNumber = source.lineNumber;\n return '\\n\\nCheck your code at ' + fileName + ':' + lineNumber + '.';\n }\n\n return '';\n }\n}\n/**\n * Warn if there's no key explicitly set on dynamic arrays of children or\n * object keys are not valid. This allows us to keep track of children between\n * updates.\n */\n\n\nvar ownerHasKeyUseWarning = {};\n\nfunction getCurrentComponentErrorInfo(parentType) {\n {\n var info = getDeclarationErrorAddendum();\n\n if (!info) {\n var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;\n\n if (parentName) {\n info = \"\\n\\nCheck the top-level render call using <\" + parentName + \">.\";\n }\n }\n\n return info;\n }\n}\n/**\n * Warn if the element doesn't have an explicit key assigned to it.\n * This element is in an array. The array could grow and shrink or be\n * reordered. All children that haven't already been validated are required to\n * have a \"key\" property assigned to it. Error statuses are cached so a warning\n * will only be shown once.\n *\n * @internal\n * @param {ReactElement} element Element that requires a key.\n * @param {*} parentType element's parent's type.\n */\n\n\nfunction validateExplicitKey(element, parentType) {\n {\n if (!element._store || element._store.validated || element.key != null) {\n return;\n }\n\n element._store.validated = true;\n var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);\n\n if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {\n return;\n }\n\n ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a\n // property, it may be the creator of the child that's responsible for\n // assigning it a key.\n\n var childOwner = '';\n\n if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {\n // Give the component that originally created this child.\n childOwner = \" It was passed a child from \" + getComponentNameFromType(element._owner.type) + \".\";\n }\n\n setCurrentlyValidatingElement$1(element);\n\n error('Each child in a list should have a unique \"key\" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);\n\n setCurrentlyValidatingElement$1(null);\n }\n}\n/**\n * Ensure that every element either is passed in a static location, in an\n * array with an explicit keys property defined, or in an object literal\n * with valid key property.\n *\n * @internal\n * @param {ReactNode} node Statically passed child of any type.\n * @param {*} parentType node's parent's type.\n */\n\n\nfunction validateChildKeys(node, parentType) {\n {\n if (typeof node !== 'object') {\n return;\n }\n\n if (isArray(node)) {\n for (var i = 0; i < node.length; i++) {\n var child = node[i];\n\n if (isValidElement(child)) {\n validateExplicitKey(child, parentType);\n }\n }\n } else if (isValidElement(node)) {\n // This element was passed in a valid location.\n if (node._store) {\n node._store.validated = true;\n }\n } else if (node) {\n var iteratorFn = getIteratorFn(node);\n\n if (typeof iteratorFn === 'function') {\n // Entry iterators used to provide implicit keys,\n // but now we print a separate warning for them later.\n if (iteratorFn !== node.entries) {\n var iterator = iteratorFn.call(node);\n var step;\n\n while (!(step = iterator.next()).done) {\n if (isValidElement(step.value)) {\n validateExplicitKey(step.value, parentType);\n }\n }\n }\n }\n }\n }\n}\n/**\n * Given an element, validate that its props follow the propTypes definition,\n * provided by the type.\n *\n * @param {ReactElement} element\n */\n\n\nfunction validatePropTypes(element) {\n {\n var type = element.type;\n\n if (type === null || type === undefined || typeof type === 'string') {\n return;\n }\n\n var propTypes;\n\n if (typeof type === 'function') {\n propTypes = type.propTypes;\n } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.\n // Inner props are checked in the reconciler.\n type.$$typeof === REACT_MEMO_TYPE)) {\n propTypes = type.propTypes;\n } else {\n return;\n }\n\n if (propTypes) {\n // Intentionally inside to avoid triggering lazy initializers:\n var name = getComponentNameFromType(type);\n checkPropTypes(propTypes, element.props, 'prop', name, element);\n } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {\n propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:\n\n var _name = getComponentNameFromType(type);\n\n error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');\n }\n\n if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {\n error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');\n }\n }\n}\n/**\n * Given a fragment, validate that it can only be provided with fragment props\n * @param {ReactElement} fragment\n */\n\n\nfunction validateFragmentProps(fragment) {\n {\n var keys = Object.keys(fragment.props);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n if (key !== 'children' && key !== 'key') {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);\n\n setCurrentlyValidatingElement$1(null);\n break;\n }\n }\n\n if (fragment.ref !== null) {\n setCurrentlyValidatingElement$1(fragment);\n\n error('Invalid attribute `ref` supplied to `React.Fragment`.');\n\n setCurrentlyValidatingElement$1(null);\n }\n }\n}\n\nvar didWarnAboutKeySpread = {};\nfunction jsxWithValidation(type, props, key, isStaticChildren, source, self) {\n {\n var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to\n // succeed and there will likely be errors in render.\n\n if (!validType) {\n var info = '';\n\n if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {\n info += ' You likely forgot to export your component from the file ' + \"it's defined in, or you might have mixed up default and named imports.\";\n }\n\n var sourceInfo = getSourceInfoErrorAddendum(source);\n\n if (sourceInfo) {\n info += sourceInfo;\n } else {\n info += getDeclarationErrorAddendum();\n }\n\n var typeString;\n\n if (type === null) {\n typeString = 'null';\n } else if (isArray(type)) {\n typeString = 'array';\n } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {\n typeString = \"<\" + (getComponentNameFromType(type.type) || 'Unknown') + \" />\";\n info = ' Did you accidentally export a JSX literal instead of a component?';\n } else {\n typeString = typeof type;\n }\n\n error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);\n }\n\n var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.\n // TODO: Drop this when these are no longer allowed as the type argument.\n\n if (element == null) {\n return element;\n } // Skip key warning if the type isn't valid since our key validation logic\n // doesn't expect a non-string/function type and can throw confusing errors.\n // We don't want exception behavior to differ between dev and prod.\n // (Rendering will throw with a helpful message and as soon as the type is\n // fixed, the key warnings will appear.)\n\n\n if (validType) {\n var children = props.children;\n\n if (children !== undefined) {\n if (isStaticChildren) {\n if (isArray(children)) {\n for (var i = 0; i < children.length; i++) {\n validateChildKeys(children[i], type);\n }\n\n if (Object.freeze) {\n Object.freeze(children);\n }\n } else {\n error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');\n }\n } else {\n validateChildKeys(children, type);\n }\n }\n }\n\n {\n if (hasOwnProperty.call(props, 'key')) {\n var componentName = getComponentNameFromType(type);\n var keys = Object.keys(props).filter(function (k) {\n return k !== 'key';\n });\n var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';\n\n if (!didWarnAboutKeySpread[componentName + beforeExample]) {\n var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';\n\n error('A props object containing a \"key\" prop is being spread into JSX:\\n' + ' let props = %s;\\n' + ' <%s {...props} />\\n' + 'React keys must be passed directly to JSX without using spread:\\n' + ' let props = %s;\\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);\n\n didWarnAboutKeySpread[componentName + beforeExample] = true;\n }\n }\n }\n\n if (type === REACT_FRAGMENT_TYPE) {\n validateFragmentProps(element);\n } else {\n validatePropTypes(element);\n }\n\n return element;\n }\n} // These two functions exist to still get child warnings in dev\n// even with the prod transform. This means that jsxDEV is purely\n// opt-in behavior for better messages but that we won't stop\n// giving you warnings if you use production apis.\n\nfunction jsxWithValidationStatic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, true);\n }\n}\nfunction jsxWithValidationDynamic(type, props, key) {\n {\n return jsxWithValidation(type, props, key, false);\n }\n}\n\nvar jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.\n// for now we can ship identical prod functions\n\nvar jsxs = jsxWithValidationStatic ;\n\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsx;\nexports.jsxs = jsxs;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","/**\n * Generates a CSS selector for the given element.\n * Prefers id, then a unique path using tag and nth-child.\n */\nexport function getSelector(element: Element): string {\n if (element.id && /^[a-zA-Z][\\w-]*$/.test(element.id)) {\n return `#${element.id}`;\n }\n\n const path: string[] = [];\n let current: Element | null = element;\n\n while (current && current.nodeType === Node.ELEMENT_NODE) {\n let part = current.nodeName.toLowerCase();\n\n if (current.id && /^[a-zA-Z][\\w-]*$/.test(current.id)) {\n path.unshift(`#${current.id}`);\n break;\n }\n\n if (current.className && typeof current.className === \"string\") {\n const classes = current.className.trim().split(/\\s+/).filter(Boolean);\n if (classes.length > 0) {\n const safeClasses = classes\n .filter((c) => /^[a-zA-Z][\\w-]*$/.test(c))\n .slice(0, 2)\n .map((c) => `.${c}`)\n .join(\"\");\n if (safeClasses) {\n part += safeClasses;\n }\n }\n }\n\n // :nth-child(n) en CSS es la posición entre TODOS los hijos del padre, no solo mismo tag\n const parent = current.parentElement;\n if (parent) {\n const allChildren = Array.from(parent.children);\n if (allChildren.length > 1) {\n const index = allChildren.indexOf(current as Element) + 1;\n part += `:nth-child(${index})`;\n }\n }\n\n path.unshift(part);\n current = current.parentElement;\n }\n\n return path.join(\" > \");\n}\n","import type { Comment } from \"./api\";\n\nconst REVIEW_LAYER_ROOT = \"[data-review-layer-root]\";\n\n/** Radio del pin en px (mitad del círculo) para inset en esquinas */\nconst PIN_RADIUS = 16;\n\n/**\n * Recorta la posición al viewport con un margen de radio (mitad del círculo)\n * para que el pin no se corte en esquinas. Si hay varios, los offsets se aplican sobre esto.\n */\nexport function clampPinToViewport(\n x: number,\n y: number,\n radius: number = PIN_RADIUS\n): { x: number; y: number } {\n if (typeof window === \"undefined\") return { x, y };\n const minX = radius;\n const minY = radius;\n const maxX = window.innerWidth - radius;\n const maxY = window.innerHeight - radius;\n return {\n x: Math.max(minX, Math.min(maxX, x)),\n y: Math.max(minY, Math.min(maxY, y)),\n };\n}\n\n/**\n * Ancestros del elemento que tienen scroll (overflow auto/scroll y contenido que desborda).\n * Útil en iframes/Storybook donde el scroll es en un div (ej. sbdocs-wrapper), no en window.\n */\nexport function getScrollableAncestors(el: Element | null): Element[] {\n if (typeof document === \"undefined\" || !el) return [];\n const result: Element[] = [];\n let current: Element | null = el.parentElement;\n while (current && current !== document.body) {\n const style = getComputedStyle(current);\n const ox = style.overflowX;\n const oy = style.overflowY;\n const scrollable =\n (ox === \"scroll\" || ox === \"auto\" || ox === \"overlay\" || oy === \"scroll\" || oy === \"auto\" || oy === \"overlay\") &&\n (current.scrollHeight > current.clientHeight || current.scrollWidth > current.clientWidth);\n if (scrollable) result.push(current);\n current = current.parentElement;\n }\n return result;\n}\n\n/**\n * Get the element's bounding rect if it exists in the DOM.\n * No devuelve posición si el elemento es parte del UI del review layer (pins, popover, iconos).\n */\nexport function getElementPosition(selector: string | null): DOMRect | null {\n if (typeof document === \"undefined\" || !selector?.trim()) return null;\n try {\n const el = document.querySelector(selector);\n if (!el || (el as Element).closest?.(REVIEW_LAYER_ROOT)) return null;\n return (el as Element).getBoundingClientRect();\n } catch {\n return null;\n }\n}\n\n/**\n * Get relative position (0–1) from a rect using current viewport.\n */\nexport function getRelativePosition(rect: DOMRect): {\n relativeX: number;\n relativeY: number;\n} {\n if (typeof window === \"undefined\") {\n return { relativeX: 0, relativeY: 0 };\n }\n const w = window.innerWidth;\n const h = window.innerHeight;\n return {\n relativeX: w > 0 ? rect.left / w : 0,\n relativeY: h > 0 ? rect.top / h : 0,\n };\n}\n\n/**\n * Fallback position when selector does not find an element.\n * Priority: relative coordinates (relativeX/relative_x, relativeY/relative_y) then absolute (x, y).\n * Acepta snake_case (API) y camelCase (frontend).\n */\nexport function getFallbackPosition(comment: Comment): { x: number; y: number } {\n if (typeof window === \"undefined\") {\n return {\n x: comment.x ?? 0,\n y: comment.y ?? 0,\n };\n }\n const relX = comment.relativeX ?? comment.relative_x ?? null;\n const relY = comment.relativeY ?? comment.relative_y ?? null;\n if (relX != null && relY != null) {\n return {\n x: relX * window.innerWidth,\n y: relY * window.innerHeight,\n };\n }\n return {\n x: comment.x ?? 0,\n y: comment.y ?? 0,\n };\n}\n\n/**\n * Rectángulo de respaldo para el highlight cuando el selector no encuentra el elemento\n * (p. ej. DOM cambiado, SPA). Usa coordenadas guardadas del comentario.\n */\nexport function getFallbackRect(comment: Comment): DOMRect | null {\n const { x, y } = getFallbackPosition(comment);\n const w = comment.width ?? 100;\n const h = comment.height ?? 40;\n return new DOMRect(x, y, w, h);\n}\n\n/**\n * Pin position: prioriza el elemento en vivo por selector para que el pin\n * siga al elemento al hacer scroll. Solo usa coordenadas guardadas cuando\n * el selector no encuentra el elemento (p. ej. DOM cambiado, SPA).\n */\nexport function getCommentPinPosition(comment: Comment): { x: number; y: number } {\n if (comment.selector) {\n const rect = getElementPosition(comment.selector);\n if (rect != null) {\n return { x: rect.left, y: rect.top };\n }\n }\n return getFallbackPosition(comment);\n}\n","/** Nombres conocidos por si el valor no empieza por \"/\" (ej. ?path=mi-pagina). */\nconst FALLBACK_QUERY_KEYS = [\"path\"] as const;\n\nfunction normalizePath(value: string): string {\n return value.trim().startsWith(\"/\") ? value.trim() : `/${value.trim()}`;\n}\n\n/**\n * URL de la página para scope de comentarios. Se resuelve de forma dinámica:\n *\n * 1. Cualquier query param cuyo valor empiece por \"/\" se usa como ruta (da igual el nombre: ?ruta=/x, ?page=/y, etc.).\n * 2. Si no hay ninguno, se buscan los nombres conocidos: path, route (con cualquier valor).\n * 3. Si es el iframe de Storybook (/iframe.html), se usa el param \"id\" → /story/:id.\n * 4. Si no, pathname.\n */\nexport function getPageUrl(): string {\n if (typeof window === \"undefined\") return \"/\";\n try {\n const params = new URLSearchParams(window.location.search);\n\n for (const [, value] of params) {\n const v = value?.trim();\n if (v !== \"\" && v.startsWith(\"/\")) {\n return v;\n }\n }\n\n for (const key of FALLBACK_QUERY_KEYS) {\n const value = params.get(key);\n if (value != null && value.trim() !== \"\") {\n return normalizePath(value);\n }\n }\n\n const pathname = window.location.pathname || \"/\";\n if (pathname === \"/iframe.html\" || pathname.endsWith(\"/iframe.html\")) {\n const storyId = params.get(\"id\");\n if (storyId != null && storyId.trim() !== \"\") {\n return `/story/${storyId.trim()}`;\n }\n }\n } catch {\n // ignore\n }\n return window.location.pathname || \"/\";\n}\n","export interface Reviewer {\n id: number;\n name: string;\n email?: string;\n /** URL de avatar (p. ej. Supabase Storage). Opcional; si no hay, se muestran iniciales. */\n image_url?: string | null;\n job_title?: string | null;\n}\n\nexport interface Comment {\n id: number;\n message: string;\n selector: string | null;\n x: number | null;\n y: number | null;\n /** Frontend camelCase */\n relativeX?: number | null;\n relativeY?: number | null;\n /** API snake_case (Laravel devuelve así) */\n relative_x?: number | null;\n relative_y?: number | null;\n width: number | null;\n height: number | null;\n url: string | null;\n status: string;\n reviewer_id?: number;\n reviewer?: Reviewer;\n created_at?: string;\n}\n\n/** Estados del comentario: Pendiente → Corregido Desarrollo → Validado (visible, se puede eliminar) */\nexport const COMMENT_STATUS = {\n PENDING: \"pending\",\n DEV_FIXED: \"dev_fixed\",\n VALIDATED: \"validated\",\n} as const;\n\nexport type CommentStatus = (typeof COMMENT_STATUS)[keyof typeof COMMENT_STATUS];\n\ninterface ApiResponse<T> {\n success: boolean;\n data: T;\n}\n\nconst API_LOG_PREFIX = \"[review-layer API]\";\n\n/** Clasifica y registra el fallo para depuración (CORS, apiKey, 404, servidor, etc.). */\nfunction logApiFailure(\n context: string,\n url: string,\n details:\n | { status: number; statusText: string; body?: string }\n | { networkError: unknown }\n): void {\n if (\"status\" in details) {\n const { status, statusText, body = \"\" } = details;\n let reason: string;\n if (status === 401) {\n reason = \"No autorizado (401). Revisa que apiKey sea correcta y esté aceptada por la API.\";\n } else if (status === 403) {\n reason = \"Acceso denegado (403). Revisa apiKey o permisos del proyecto.\";\n } else if (status === 404) {\n reason = \"Recurso no encontrado (404). Revisa apiUrl y que la ruta exista en el backend.\";\n } else if (status >= 500) {\n reason = \"Error del servidor (5xx). El backend puede estar caído o sobrecargado.\";\n } else {\n reason = `Respuesta HTTP ${status} ${statusText}. Revisa la API.`;\n }\n console.error(API_LOG_PREFIX, context, {\n motivo: reason,\n url,\n status,\n statusText,\n body: body.slice(0, 300),\n });\n return;\n }\n const e = details.networkError;\n const msg = e instanceof Error ? e.message : String(e);\n const isCorsOrNetwork =\n e instanceof TypeError ||\n /failed to fetch|networkerror|load failed|network request failed/i.test(msg);\n const reason = isCorsOrNetwork\n ? \"Posible CORS o error de red (servidor inalcanzable, bloqueo CORS o certificado). Revisa que apiUrl sea accesible desde este origen y que el backend permita CORS.\"\n : `Error inesperado: ${msg}`;\n console.error(API_LOG_PREFIX, context, { motivo: reason, url, error: e });\n}\n\nfunction getHeaders(apiKey: string): HeadersInit {\n return {\n \"Content-Type\": \"application/json\",\n \"x-review-key\": apiKey,\n };\n}\n\nexport async function fetchReviewers(\n apiUrl: string,\n apiKey: string,\n options?: { signal?: AbortSignal }\n): Promise<Reviewer[]> {\n const url = `${apiUrl}/reviewers`;\n let res: Response;\n try {\n res = await fetch(url, {\n headers: getHeaders(apiKey),\n signal: options?.signal,\n });\n } catch (e) {\n logApiFailure(\"fetchReviewers (red/CORS)\", url, { networkError: e });\n throw e;\n }\n if (!res.ok) {\n const body = await res.text();\n logApiFailure(\"fetchReviewers\", url, { status: res.status, statusText: res.statusText, body });\n throw new Error(\"Failed to fetch reviewers\");\n }\n const json: ApiResponse<Reviewer[]> = await res.json();\n return json.data ?? [];\n}\n\nexport interface CreateCommentPayload {\n message: string;\n selector: string;\n x: number;\n y: number;\n relativeX: number;\n relativeY: number;\n width: number;\n height: number;\n url: string;\n reviewerId: number;\n viewport: string;\n userAgent: string;\n pageTitle?: string;\n}\n\nexport async function createComment(\n apiUrl: string,\n apiKey: string,\n payload: CreateCommentPayload\n): Promise<Comment> {\n const url = `${apiUrl}/comments`;\n let res: Response;\n try {\n res = await fetch(url, {\n method: \"POST\",\n headers: getHeaders(apiKey),\n body: JSON.stringify(payload),\n });\n } catch (e) {\n logApiFailure(\"createComment (red/CORS)\", url, { networkError: e });\n throw e;\n }\n if (!res.ok) {\n const body = await res.text();\n let msg = \"Failed to create comment\";\n try {\n const err = JSON.parse(body);\n msg = err.message ?? msg;\n } catch {\n // body no es JSON\n }\n logApiFailure(\"createComment\", url, { status: res.status, statusText: res.statusText, body });\n throw new Error(msg);\n }\n const json: ApiResponse<Comment> = await res.json();\n return json.data;\n}\n\nexport async function fetchComments(\n apiUrl: string,\n apiKey: string,\n url: string,\n options?: { signal?: AbortSignal }\n): Promise<Comment[]> {\n const params = new URLSearchParams({ url });\n const fullUrl = `${apiUrl}/comments?${params}`;\n let res: Response;\n try {\n res = await fetch(fullUrl, {\n headers: getHeaders(apiKey),\n signal: options?.signal,\n });\n } catch (e) {\n logApiFailure(\"fetchComments (red/CORS)\", fullUrl, { networkError: e });\n throw e;\n }\n if (!res.ok) {\n const body = await res.text();\n logApiFailure(\"fetchComments\", fullUrl, { status: res.status, statusText: res.statusText, body });\n throw new Error(\"Failed to fetch comments\");\n }\n const json: ApiResponse<Comment[]> = await res.json();\n return json.data ?? [];\n}\n\nexport async function updateCommentStatus(\n apiUrl: string,\n apiKey: string,\n commentId: number,\n status: \"pending\" | \"dev_fixed\" | \"validated\"\n): Promise<Comment> {\n const url = `${apiUrl}/comments/${commentId}/status`;\n let res: Response;\n try {\n res = await fetch(url, {\n method: \"PATCH\",\n headers: getHeaders(apiKey),\n body: JSON.stringify({ status }),\n });\n } catch (e) {\n logApiFailure(\"updateCommentStatus (red/CORS)\", url, { networkError: e });\n throw e;\n }\n if (!res.ok) {\n const body = await res.text();\n logApiFailure(\"updateCommentStatus\", url, { status: res.status, statusText: res.statusText, body });\n let msg = \"Failed to update comment status\";\n try {\n const err = JSON.parse(body);\n msg = err.message ?? msg;\n } catch {\n // ignore\n }\n throw new Error(msg);\n }\n const json: ApiResponse<Comment> = await res.json();\n return json.data;\n}\n\nexport async function deleteComment(\n apiUrl: string,\n apiKey: string,\n commentId: number\n): Promise<void> {\n const url = `${apiUrl}/comments/${commentId}`;\n let res: Response;\n try {\n res = await fetch(url, {\n method: \"DELETE\",\n headers: getHeaders(apiKey),\n });\n } catch (e) {\n logApiFailure(\"deleteComment (red/CORS)\", url, { networkError: e });\n throw e;\n }\n if (!res.ok) {\n const body = await res.text();\n logApiFailure(\"deleteComment\", url, { status: res.status, statusText: res.statusText, body });\n let msg = \"Failed to delete comment\";\n try {\n const err = JSON.parse(body);\n msg = err.message ?? msg;\n } catch {\n // ignore\n }\n throw new Error(msg);\n }\n}\n","import { useState, useEffect, useCallback, useRef, memo } from \"react\";\nimport type { Reviewer, CreateCommentPayload } from \"./utils/api\";\nimport { createComment } from \"./utils/api\";\n\ninterface CommentModalProps {\n apiUrl: string;\n apiKey: string;\n reviewers: Reviewer[];\n position: { x: number; y: number };\n payload: Omit<CreateCommentPayload, \"message\" | \"reviewerId\">;\n onClose: () => void;\n onSuccess: () => void;\n}\n\nconst backdropStyle: React.CSSProperties = {\n position: \"fixed\",\n inset: 0,\n zIndex: 999997,\n backgroundColor: \"transparent\",\n};\n\nconst modalStyle: React.CSSProperties = {\n position: \"fixed\",\n minWidth: 320,\n maxWidth: 400,\n padding: \"var(--ui-positive-Value_400, 16px)\",\n backgroundColor: \"var(--ui-color-bg-surface-default, #fff)\",\n border: \"1px solid var(--ui-color-border-subtle, #e8e8e8)\",\n borderRadius: \"var(--ui-radius_8, 8px)\",\n boxShadow: \"0 8px 24px var(--ui-color-black-alpha-20, rgba(0,0,0,0.15))\",\n zIndex: 999998,\n};\n\nconst textareaStyle: React.CSSProperties = {\n width: \"100%\",\n minHeight: 80,\n padding: \"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_300, 12px)\",\n marginBottom: \"var(--ui-positive-Value_200, 12px)\",\n border: \"1px solid var(--ui-color-border-default, #d9d9d9)\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n fontSize: \"var(--ui-font-size-sm, 14px)\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n resize: \"vertical\",\n boxSizing: \"border-box\",\n};\n\nconst selectStyle: React.CSSProperties = {\n width: \"100%\",\n padding: \"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_300, 12px)\",\n marginBottom: \"var(--ui-positive-Value_300, 12px)\",\n border: \"1px solid var(--ui-color-border-default, #d9d9d9)\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n fontSize: \"var(--ui-font-size-sm, 14px)\",\n};\n\nconst buttonStyle: React.CSSProperties = {\n padding: \"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_400, 16px)\",\n backgroundColor: \"var(--ui-color-bg-fill-danger-default, #ff4d4f)\",\n color: \"var(--ui-color-text-on-color, #fff)\",\n border: \"none\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n fontSize: \"var(--ui-font-size-sm, 14px)\",\n cursor: \"pointer\",\n fontWeight: \"var(--ui-font-weight-medium, 500)\",\n};\n\nfunction CommentModalInner({\n apiUrl,\n apiKey,\n reviewers,\n position,\n payload,\n onClose,\n onSuccess,\n}: CommentModalProps) {\n const [message, setMessage] = useState(\"\");\n const [reviewerId, setReviewerId] = useState<number>(\n reviewers[0]?.id ?? 0\n );\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n if (reviewers.length > 0 && !reviewerId) {\n setReviewerId(reviewers[0].id);\n }\n }, [reviewers, reviewerId]);\n\n const handleSubmit = useCallback(\n async (e: React.FormEvent) => {\n e.preventDefault();\n if (!message.trim() || !reviewerId) return;\n setLoading(true);\n setError(null);\n try {\n await createComment(apiUrl, apiKey, {\n ...payload,\n message: message.trim(),\n reviewerId,\n });\n onSuccess();\n onClose();\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Failed to send comment\");\n } finally {\n setLoading(false);\n }\n },\n [apiUrl, apiKey, payload, message, reviewerId, onSuccess, onClose]\n );\n\n const modalContainerRef = useRef<HTMLDivElement>(null);\n\n // Cerrar con Escape a nivel document (funciona en Storybook/iframe)\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n onClose();\n }\n };\n document.addEventListener(\"keydown\", handleKeyDown, true);\n return () => document.removeEventListener(\"keydown\", handleKeyDown, true);\n }, [onClose]);\n\n // Cerrar al hacer clic fuera del modal (capture): en Storybook Docs el clic puede\n // ir al wrapper sbdocs en vez del backdrop; así cerramos igual.\n useEffect(() => {\n const handleMouseDown = (e: MouseEvent) => {\n const target = e.target as Node;\n if (modalContainerRef.current && !modalContainerRef.current.contains(target)) {\n e.preventDefault();\n e.stopPropagation();\n onClose();\n }\n };\n document.addEventListener(\"mousedown\", handleMouseDown, true);\n return () => document.removeEventListener(\"mousedown\", handleMouseDown, true);\n }, [onClose]);\n\n // Dar foco al contenedor del modal para que Escape funcione en iframe (Storybook Docs)\n useEffect(() => {\n modalContainerRef.current?.focus();\n }, []);\n\n return (\n <div\n ref={modalContainerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n tabIndex={-1}\n style={{ position: \"fixed\", inset: 0, zIndex: 999997, outline: \"none\" }}\n >\n <div\n role=\"presentation\"\n style={backdropStyle}\n onClick={onClose}\n />\n <div\n style={{\n ...modalStyle,\n left: Math.min(position.x, typeof window !== \"undefined\" ? window.innerWidth - 420 : position.x),\n top: position.y + 12,\n }}\n onClick={(e) => e.stopPropagation()}\n >\n <form onSubmit={handleSubmit}>\n <textarea\n placeholder=\"Escribe tu comentario...\"\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n style={textareaStyle}\n required\n autoFocus\n />\n <select\n value={reviewerId}\n onChange={(e) => setReviewerId(Number(e.target.value))}\n style={selectStyle}\n required\n disabled={reviewers.length === 0}\n >\n <option value=\"\">\n {reviewers.length === 0\n ? \"No hay revisores (ejecuta php artisan db:seed en la API)\"\n : \"Selecciona revisor\"}\n </option>\n {reviewers.map((r) => (\n <option key={r.id} value={r.id}>\n {r.name}\n </option>\n ))}\n </select>\n {error && (\n <div\n style={{\n color: \"var(--ui-color-text-danger-default, #ff4d4f)\",\n fontSize: \"var(--ui-font-size-xs, 12px)\",\n marginBottom: \"var(--ui-positive-Value_200, 8px)\",\n }}\n >\n {error}\n </div>\n )}\n <div style={{ display: \"flex\", justifyContent: \"flex-end\", gap: \"var(--ui-positive-Value_200, 8px)\" }}>\n <button\n type=\"button\"\n onClick={onClose}\n style={{\n ...buttonStyle,\n backgroundColor: \"var(--ui-color-bg-fill-secondary-default, #f0f0f0)\",\n color: \"var(--ui-color-text-primary, #333)\",\n }}\n >\n Cancelar\n </button>\n <button\n type=\"submit\"\n style={buttonStyle}\n disabled={loading || reviewers.length === 0}\n >\n {loading ? \"Enviando...\" : \"Enviar comentario\"}\n </button>\n </div>\n </form>\n </div>\n </div>\n );\n}\n\nexport const CommentModal = memo(CommentModalInner);\n","import { useState, useEffect, useCallback, memo } from \"react\";\nimport { getElementPosition, getFallbackRect } from \"./utils/positioning\";\nimport type { Comment } from \"./utils/api\";\n\nexport interface ElementHighlightProps {\n /** CSS selector for the element to highlight */\n selector: string | null;\n /** When false, render nothing */\n active: boolean;\n /** Si el selector no encuentra el elemento, se usa rect de respaldo (coords guardadas del comentario). */\n fallbackComment?: Comment | null;\n /** Color del borde del highlight (p. ej. según estado del comentario). Por defecto rojo. */\n outlineColor?: string;\n}\n\nconst DEFAULT_OUTLINE_COLOR = \"var(--ui-color-red-500, #ef4444)\";\n\nfunction getHighlightStyle(outlineColor: string): React.CSSProperties {\n return {\n position: \"fixed\",\n outline: `2px solid ${outlineColor}`,\n outlineOffset: \"var(--ui-positive-Value_200, 2px)\",\n pointerEvents: \"none\",\n zIndex: 999997,\n boxSizing: \"border-box\",\n };\n}\n\n/**\n * Finds the element by selector, tracks its bounding rect, and renders\n * a persistent highlight overlay. Updates on scroll and resize.\n */\nexport const ElementHighlight = memo(function ElementHighlight({\n selector,\n active,\n fallbackComment,\n outlineColor = DEFAULT_OUTLINE_COLOR,\n}: ElementHighlightProps) {\n const [rect, setRect] = useState<DOMRect | null>(null);\n\n const updateRect = useCallback(() => {\n if (!active) {\n setRect(null);\n return;\n }\n const fromSelector = selector?.trim() ? getElementPosition(selector) : null;\n if (fromSelector) {\n setRect(fromSelector);\n return;\n }\n if (fallbackComment) {\n setRect(getFallbackRect(fallbackComment));\n return;\n }\n setRect(null);\n }, [selector, active, fallbackComment]);\n\n useEffect(() => {\n updateRect();\n }, [updateRect]);\n\n useEffect(() => {\n if (!active) return;\n window.addEventListener(\"scroll\", updateRect, true);\n window.addEventListener(\"resize\", updateRect);\n return () => {\n window.removeEventListener(\"scroll\", updateRect, true);\n window.removeEventListener(\"resize\", updateRect);\n };\n }, [active, updateRect]);\n\n if (!active || rect == null) return null;\n\n return (\n <div\n aria-hidden\n style={{\n ...getHighlightStyle(outlineColor),\n left: rect.left,\n top: rect.top,\n width: rect.width,\n height: rect.height,\n }}\n />\n );\n});\n","import { useState, useEffect, useCallback, useRef, useMemo, memo } from \"react\";\nimport type { Comment } from \"./utils/api\";\nimport { COMMENT_STATUS, updateCommentStatus, deleteComment } from \"./utils/api\";\nimport { getCommentPinPosition, clampPinToViewport, getScrollableAncestors } from \"./utils/positioning\";\nimport { ElementHighlight } from \"./ElementHighlight\";\n\nconst PIN_SIZE = 32;\nconst HOVER_LEAVE_DELAY_MS = 150;\n/** Ancho fijo de la tarjeta de comentario para que todos se vean iguales */\nconst CARD_WIDTH = 250;\n\n// Tokens de diseño: usan variables CSS (definidas en variables.css / ReviewProvider)\nconst COLORS = {\n cardBg: \"var(--ui-color-bg-surface-default, #ffffff)\",\n cardFooterBg: \"var(--ui-color-bg-surface-secondary-default, #f8fafc)\",\n textDark: \"var(--ui-color-text-primary, #333333)\",\n textMuted: \"var(--ui-color-text-secondary, #888888)\",\n border: \"var(--ui-color-border-default, #cccccc)\",\n shadow: \"var(--ui-shadow-card, 0 4px 16px rgba(0, 0, 0, 0.12))\",\n} as const;\n\nconst STATUS_LABELS: Record<string, string> = {\n [COMMENT_STATUS.PENDING]: \"Pendiente\",\n [COMMENT_STATUS.DEV_FIXED]: \"Corregido\",\n [COMMENT_STATUS.VALIDATED]: \"Validado\",\n};\n\nconst STATUS_LABELS_UPPER: Record<string, string> = {\n [COMMENT_STATUS.PENDING]: \"PENDIENTE\",\n [COMMENT_STATUS.DEV_FIXED]: \"CORREGIDO\",\n [COMMENT_STATUS.VALIDATED]: \"VALIDADO\",\n};\n\nconst PIN_COLORS: Record<string, string> = {\n [COMMENT_STATUS.PENDING]: \"var(--ui-color-red-500, rgb(240, 69, 69))\",\n [COMMENT_STATUS.DEV_FIXED]: \"var(--ui-color-yellow-500, rgb(235, 179, 8))\",\n [COMMENT_STATUS.VALIDATED]: \"var(--ui-color-green-500, rgb(33, 196, 94))\",\n};\n\n/** Colores para badge: fondo 50, borde 500 */\nconst BADGE_BG_50: Record<string, string> = {\n [COMMENT_STATUS.PENDING]: \"var(--ui-color-bg-surface-danger-default, #fef2f2)\",\n [COMMENT_STATUS.DEV_FIXED]: \"var(--ui-color-bg-surface-warning-default, #fffbeb)\",\n [COMMENT_STATUS.VALIDATED]: \"var(--ui-color-bg-surface-success-default, #f0fdf4)\",\n};\nconst BADGE_BORDER_500: Record<string, string> = {\n [COMMENT_STATUS.PENDING]: \"var(--ui-color-red-500, #ef4444)\",\n [COMMENT_STATUS.DEV_FIXED]: \"var(--ui-color-orange-500, #f59e0b)\",\n [COMMENT_STATUS.VALIDATED]: \"var(--ui-color-green-500, #22c55e)\",\n};\n\nfunction getInitials(name: string): string {\n const parts = name.trim().split(/\\s+/);\n if (parts.length >= 2) return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();\n return name.slice(0, 2).toUpperCase() || \"?\";\n}\n\n/** Icono checkmark para badge validado */\nconst CheckIcon = () => (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" style={{ marginRight: 4, flexShrink: 0 }}>\n <path d=\"M10 3L4.5 8.5L2 6\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\n/** Icono chat bubble para el pin */\nconst ChatBubblePinIcon = ({ color }: { color: string }) => (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" style={{ flexShrink: 0 }}>\n <path\n d=\"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill=\"none\"\n />\n <path\n d=\"M8 10h.01M12 10h.01M16 10h.01\"\n stroke=\"var(--ui-color-white, #fff)\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n />\n </svg>\n);\n\nexport interface CommentPinProps {\n comment: Comment;\n /** Desplazamiento para no solaparse con otros pins en el mismo punto */\n offset?: { dx: number; dy: number };\n apiUrl: string;\n apiKey: string;\n onStatusChange: () => void;\n /** Cuando true (modo revisión), el popover no se abre al clic ni al hover */\n reviewMode?: boolean;\n}\n\nconst getPinStyle = (status: string): React.CSSProperties => ({\n position: \"fixed\",\n width: PIN_SIZE,\n height: PIN_SIZE,\n borderRadius: \"50%\",\n backgroundColor: PIN_COLORS[status] ?? PIN_COLORS[COMMENT_STATUS.PENDING],\n color: \"var(--ui-color-text-on-color, #fff)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n cursor: \"pointer\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n boxShadow: \"0 2px 8px var(--ui-color-black-alpha-20, rgba(0,0,0,0.2))\",\n zIndex: 999998,\n border: \"2px solid var(--ui-color-white, #fff)\",\n});\n\nconst cardStyle: React.CSSProperties = {\n position: \"fixed\",\n width: CARD_WIDTH,\n minWidth: CARD_WIDTH,\n maxWidth: CARD_WIDTH,\n boxSizing: \"border-box\",\n backgroundColor: COLORS.cardBg,\n borderRadius: \"var(--ui-radius_12, 12px)\",\n boxShadow: COLORS.shadow,\n fontSize: \"var(--ui-font-size-sm, 14px)\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n zIndex: 999999,\n pointerEvents: \"auto\",\n};\n\nconst headerRowStyle: React.CSSProperties = {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n gap: \"var(--ui-positive-Value_250, 10px)\",\n borderBottom: `1px solid ${COLORS.border}`,\n padding: \"var(--ui-positive-Value_300, 12px)\",\n};\n\nconst avatarStyle = (status: string): React.CSSProperties => ({\n width: 40,\n height: 40,\n borderRadius: \"50%\",\n backgroundColor: PIN_COLORS[status] ?? PIN_COLORS[COMMENT_STATUS.PENDING],\n color: \"var(--ui-color-text-on-color, #fff)\",\n border: \"2px solid var(--ui-color-white, #fff)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontSize: \"var(--ui-font-size-sm, 14px)\",\n fontWeight: \"var(--ui-font-weight-bold, 700)\",\n flexShrink: 0,\n overflow: \"hidden\",\n});\n\n/** Avatar: imagen si existe (cache del navegador), si no iniciales. Ctrl+Shift+R refresca caché. */\nconst ReviewerAvatar = memo(function ReviewerAvatar({\n reviewer,\n status,\n}: {\n reviewer: Comment[\"reviewer\"];\n status: string;\n}) {\n const imageUrl = reviewer?.image_url;\n const name = reviewer?.name ?? \"Revisor\";\n const style = avatarStyle(status);\n if (imageUrl && imageUrl.trim()) {\n const statusColor = PIN_COLORS[status] ?? PIN_COLORS[COMMENT_STATUS.PENDING];\n return (\n <div style={{ ...style, border: `2px solid ${statusColor}` }}>\n <img\n src={imageUrl}\n alt={name}\n style={{\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n }}\n loading=\"lazy\"\n />\n </div>\n );\n }\n return <div style={style}>{getInitials(name)}</div>;\n});\n\nconst closeButtonStyle: React.CSSProperties = {\n flexShrink: 0,\n width: \"var(--ui-positive-Value_600, 24px)\",\n height: \"var(--ui-positive-Value_600, 24px)\",\n padding: 0,\n border: \"none\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n backgroundColor: \"transparent\",\n color: COLORS.textDark,\n cursor: \"pointer\",\n fontSize: \"var(--ui-positive-Value_450, 18px)\",\n lineHeight: 1,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n};\n\n/** Badge pill: fondo 50, borde 1px solid 500, icono check en validado */\nconst getStatusBadgeStyle = (status: string): React.CSSProperties => {\n const borderColor = BADGE_BORDER_500[status] ?? BADGE_BORDER_500[COMMENT_STATUS.PENDING];\n return {\n display: \"inline-flex\",\n alignItems: \"center\",\n padding: \"var(--ui-positive-Value_50, 4px) var(--ui-positive-Value_100, 10px)\",\n borderRadius: \"var(--ui-radius_full, 9999px)\",\n fontSize: \"8px\",\n fontWeight: \"var(--ui-font-weight-bold, 700)\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n textTransform: \"uppercase\",\n letterSpacing: \"0.02em\",\n backgroundColor: BADGE_BG_50[status] ?? BADGE_BG_50[COMMENT_STATUS.PENDING],\n color: borderColor,\n border: `1px solid ${borderColor}`,\n };\n};\n\nconst changeStatusLabelStyle: React.CSSProperties = {\n display: \"block\",\n fontSize: \"var(--ui-font-size-2xs, 10px)\",\n fontWeight: \"var(--ui-font-weight-semibold, 600)\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n color: COLORS.textMuted,\n textTransform: \"uppercase\",\n letterSpacing: \"0.04em\",\n};\n\nconst selectStyle: React.CSSProperties = {\n width: \"100%\",\n padding: \"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_300, 12px)\",\n paddingRight: \"var(--ui-positive-Value_800, 32px)\",\n fontSize: \"var(--ui-font-size-xs, 13px)\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n borderRadius: \"var(--ui-radius_8, 8px)\",\n border: `1px solid ${COLORS.border}`,\n backgroundColor: COLORS.cardBg,\n color: COLORS.textDark,\n cursor: \"pointer\",\n appearance: \"none\",\n backgroundImage: `url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L2 4h8z'/%3E%3C/svg%3E\")`,\n backgroundRepeat: \"no-repeat\",\n backgroundPosition: \"right var(--ui-positive-Value_250, 10px) center\",\n};\n\nconst footerStyle: React.CSSProperties = {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n gap: \"var(--ui-positive-Value_200, 8px)\",\n padding: \"var(--ui-positive-Value_300, 12px)\",\n borderTop: `1px solid ${COLORS.border}`,\n backgroundColor: COLORS.cardFooterBg,\n};\n\nconst footerButtonBase: React.CSSProperties = {\n minWidth: 100,\n padding: \"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_350, 14px)\",\n fontSize: \"var(--ui-font-size-xs, 13px)\",\n fontWeight: \"var(--ui-font-weight-semibold, 600)\",\n fontFamily: \"var(--ui-font-family-ui, 'Inter', sans-serif)\",\n borderRadius: \"var(--ui-radius_8, 8px)\",\n cursor: \"pointer\",\n border: \"none\",\n};\n\nconst replyButtonStyle: React.CSSProperties = {\n ...footerButtonBase,\n backgroundColor: \"transparent\",\n color: COLORS.textDark,\n};\n\nconst RESOLVE_BTN_CLASS = \"review-layer-resolve-btn\";\n\nconst STATUS_OPTIONS: Array<\"pending\" | \"dev_fixed\" | \"validated\"> = [\n \"pending\",\n \"dev_fixed\",\n \"validated\",\n];\n\nconst resolveButtonStyle: React.CSSProperties = {\n ...footerButtonBase,\n backgroundColor: \"var(--ui-color-bg-fill-success-default, #22c55e)\",\n color: \"var(--ui-color-text-on-color, #fff)\",\n};\n\nfunction CommentPinInner({\n comment,\n offset = { dx: 0, dy: 0 },\n apiUrl,\n apiKey,\n onStatusChange,\n reviewMode = false,\n}: CommentPinProps) {\n const [showTooltip, setShowTooltip] = useState(false);\n const [isPinned, setIsPinned] = useState(false);\n const [position, setPosition] = useState(() => getCommentPinPosition(comment));\n const [updating, setUpdating] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const hoverLeaveTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const pinRef = useRef<HTMLDivElement>(null);\n const popupRef = useRef<HTMLDivElement>(null);\n\n const updatePosition = useCallback(() => {\n setPosition(getCommentPinPosition(comment));\n }, [comment]);\n\n useEffect(() => {\n updatePosition();\n }, [updatePosition]);\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n window.addEventListener(\"scroll\", updatePosition, true);\n window.addEventListener(\"resize\", updatePosition);\n return () => {\n window.removeEventListener(\"scroll\", updatePosition, true);\n window.removeEventListener(\"resize\", updatePosition);\n };\n }, [updatePosition]);\n\n // En iframe/Storybook el scroll suele ser en un div (ej. sbdocs-wrapper), no en window\n useEffect(() => {\n if (!comment.selector || typeof document === \"undefined\") return;\n const el = document.querySelector(comment.selector);\n if (!el) return;\n const ancestors = getScrollableAncestors(el);\n const cleanups = ancestors.map((node) => {\n node.addEventListener(\"scroll\", updatePosition, true);\n return () => node.removeEventListener(\"scroll\", updatePosition, true);\n });\n return () => cleanups.forEach((fn) => fn());\n }, [comment.selector, updatePosition]);\n\n const clearHoverLeaveTimeout = useCallback(() => {\n if (hoverLeaveTimeoutRef.current !== null) {\n clearTimeout(hoverLeaveTimeoutRef.current);\n hoverLeaveTimeoutRef.current = null;\n }\n }, []);\n\n const handlePinMouseEnter = useCallback(() => {\n if (reviewMode) return;\n clearHoverLeaveTimeout();\n setShowTooltip(true);\n }, [reviewMode, clearHoverLeaveTimeout]);\n\n const handlePinMouseLeave = useCallback(() => {\n if (isPinned) return;\n hoverLeaveTimeoutRef.current = setTimeout(() => {\n hoverLeaveTimeoutRef.current = null;\n setShowTooltip(false);\n }, HOVER_LEAVE_DELAY_MS);\n }, [isPinned]);\n\n const handlePopupMouseEnter = useCallback(() => {\n clearHoverLeaveTimeout();\n setShowTooltip(true);\n }, [clearHoverLeaveTimeout]);\n\n const handlePopupMouseLeave = useCallback(() => {\n if (isPinned) return;\n hoverLeaveTimeoutRef.current = setTimeout(() => {\n hoverLeaveTimeoutRef.current = null;\n setShowTooltip(false);\n }, HOVER_LEAVE_DELAY_MS);\n }, [isPinned]);\n\n const handlePinClick = useCallback(() => {\n if (reviewMode) {\n if (isPinned) {\n setIsPinned(false);\n setShowTooltip(false);\n }\n return;\n }\n if (isPinned) {\n setIsPinned(false);\n setShowTooltip(false);\n } else {\n setIsPinned(true);\n setShowTooltip(true);\n }\n }, [reviewMode, isPinned]);\n\n useEffect(() => {\n if (!isPinned) return;\n const handleClickOutside = (e: MouseEvent) => {\n const target = e.target as Node;\n if (\n pinRef.current?.contains(target) ||\n popupRef.current?.contains(target)\n ) {\n return;\n }\n setIsPinned(false);\n setShowTooltip(false);\n };\n document.addEventListener(\"mousedown\", handleClickOutside, true);\n return () => document.removeEventListener(\"mousedown\", handleClickOutside, true);\n }, [isPinned]);\n\n useEffect(() => {\n return () => clearHoverLeaveTimeout();\n }, [clearHoverLeaveTimeout]);\n\n // Al activar modo revisión, cerrar el popover para no interferir con la selección\n useEffect(() => {\n if (reviewMode) {\n setIsPinned(false);\n setShowTooltip(false);\n }\n }, [reviewMode]);\n\n const rawX = position.x + offset.dx;\n const rawY = position.y + offset.dy;\n const { x, y } = clampPinToViewport(rawX, rawY, PIN_SIZE / 2);\n // No mostrar highlight cuando el popover está abierto, para que no se vea en/sobre la card\n const showHighlight = showTooltip && !isPinned;\n\n const closePopup = useCallback(() => {\n setIsPinned(false);\n setShowTooltip(false);\n }, []);\n\n const handleStatusChange = useCallback(\n async (newStatus: \"pending\" | \"dev_fixed\" | \"validated\") => {\n if (newStatus === comment.status) return;\n setError(null);\n setUpdating(true);\n try {\n await updateCommentStatus(apiUrl, apiKey, comment.id, newStatus);\n onStatusChange();\n } catch (e) {\n setError(e instanceof Error ? e.message : \"Error al actualizar\");\n } finally {\n setUpdating(false);\n }\n },\n [apiUrl, apiKey, comment.id, comment.status, onStatusChange]\n );\n\n const handleDelete = useCallback(async () => {\n setError(null);\n setUpdating(true);\n try {\n await deleteComment(apiUrl, apiKey, comment.id);\n onStatusChange();\n closePopup();\n } catch (e) {\n setError(e instanceof Error ? e.message : \"Error al eliminar\");\n } finally {\n setUpdating(false);\n }\n }, [apiUrl, apiKey, comment.id, onStatusChange, closePopup]);\n\n const pinStyle = useMemo(\n () => ({ ...getPinStyle(comment.status), left: x, top: y, transform: \"translate(-50%, -50%)\" }),\n [comment.status, x, y]\n );\n\n return (\n <>\n <ElementHighlight\n selector={comment.selector}\n active={showHighlight}\n fallbackComment={comment}\n outlineColor={BADGE_BORDER_500[comment.status] ?? BADGE_BORDER_500[COMMENT_STATUS.PENDING]}\n />\n <div\n ref={pinRef}\n role=\"button\"\n tabIndex={0}\n aria-label={`Comentario: ${comment.message.slice(0, 30)}...`}\n aria-expanded={showTooltip}\n style={pinStyle}\n onMouseEnter={handlePinMouseEnter}\n onMouseLeave={handlePinMouseLeave}\n onClick={handlePinClick}\n >\n <ChatBubblePinIcon color=\"var(--ui-color-white, #fff)\" />\n </div>\n {showTooltip && (\n <div\n ref={popupRef}\n role=\"dialog\"\n aria-label=\"Detalle del comentario\"\n style={{\n ...cardStyle,\n left: x + PIN_SIZE / 2 + 6,\n top: y,\n }}\n onMouseEnter={handlePopupMouseEnter}\n onMouseLeave={handlePopupMouseLeave}\n >\n <div style={headerRowStyle}>\n <div style={{ display: \"flex\", alignItems: \"center\", gap: 10, flex: 1, minWidth: 0 }}>\n <ReviewerAvatar reviewer={comment.reviewer} status={comment.status} />\n <div>\n <div style={{ fontWeight: 700, fontSize: 14, color: COLORS.textDark }}>\n {comment.reviewer?.name ?? \"Revisor\"}\n </div>\n <div style={{ fontSize: 12, color: COLORS.textMuted }}>{comment.reviewer?.job_title ?? \"Revisor\"}</div>\n </div>\n </div>\n <button\n type=\"button\"\n aria-label={comment.status === COMMENT_STATUS.VALIDATED ? \"Eliminar comentario\" : \"Cerrar\"}\n style={closeButtonStyle}\n disabled={updating}\n onClick={(e) => {\n e.stopPropagation();\n if (comment.status === COMMENT_STATUS.VALIDATED) handleDelete();\n else closePopup();\n }}\n onMouseDown={(e) => e.stopPropagation()}\n >\n ✕\n </button>\n </div>\n <div style={{ padding: 12, display: \"flex\", alignItems: \"flex-start\", flexDirection: \"column\", gap: 4 }}>\n <div style={getStatusBadgeStyle(comment.status)}>\n {comment.status === COMMENT_STATUS.VALIDATED && <CheckIcon />}\n {STATUS_LABELS_UPPER[comment.status] ?? comment.status}\n </div>\n <div style={{ color: COLORS.textDark, lineHeight: 1.5, marginBottom: 12, marginTop: 12 }}>{comment.message}</div>\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: 4, width: \"100%\" }}>\n <label style={changeStatusLabelStyle} htmlFor={`comment-status-${comment.id}`}>\n Cambiar estado\n </label>\n <select\n id={`comment-status-${comment.id}`}\n style={selectStyle}\n value={comment.status}\n disabled={updating}\n onChange={(e) =>\n handleStatusChange(e.target.value as \"pending\" | \"dev_fixed\" | \"validated\")\n }\n onMouseDown={(e) => e.stopPropagation()}\n aria-label=\"Cambiar estado del comentario\"\n >\n {STATUS_OPTIONS.map((value) => (\n <option key={value} value={value}>\n {STATUS_LABELS[value]}\n </option>\n ))}\n </select>\n {error && (\n <div style={{ marginTop: 8, fontSize: 11, color: \"var(--ui-color-text-danger-default, rgb(240, 69, 69))\" }}>{error}</div>\n )}\n </div>\n </div>\n <div style={footerStyle}>\n <button\n type=\"button\"\n style={replyButtonStyle}\n onMouseDown={(e) => e.stopPropagation()}\n onClick={(e) => {\n e.stopPropagation();\n closePopup();\n }}\n >\n Cerrar\n </button>\n {comment.status !== COMMENT_STATUS.VALIDATED && (\n <>\n <style>{`\n .${RESOLVE_BTN_CLASS}:hover:not(:disabled) {\n background-color: var(--ui-color-bg-fill-success-hover, #16a34a) !important;\n }\n .${RESOLVE_BTN_CLASS}:active:not(:disabled) {\n background-color: var(--ui-color-bg-fill-success-pressed, #15803d) !important;\n }\n .${RESOLVE_BTN_CLASS}:disabled {\n background-color: var(--ui-color-bg-fill-success-default, #22c55e) !important;\n opacity: 0.7;\n cursor: not-allowed;\n }\n `}</style>\n <button\n type=\"button\"\n className={RESOLVE_BTN_CLASS}\n style={resolveButtonStyle}\n disabled={updating}\n onMouseDown={(e) => e.stopPropagation()}\n onClick={(e) => {\n e.stopPropagation();\n handleStatusChange(\"validated\");\n }}\n >\n Validar\n </button>\n </>\n )}\n </div>\n </div>\n )}\n </>\n );\n}\n\nexport const CommentPin = memo(CommentPinInner);\n","import { createPortal } from \"react-dom\";\nimport { useState, useCallback, useEffect, useRef, useMemo } from \"react\";\nimport { getSelector } from \"./utils/selector\";\nimport { getCommentPinPosition, getRelativePosition, clampPinToViewport, getScrollableAncestors } from \"./utils/positioning\";\nimport { getPageUrl } from \"./utils/pageUrl\";\nimport { CommentModal } from \"./CommentModal\";\nimport { CommentPin } from \"./CommentPin\";\nimport type { Reviewer, Comment, CreateCommentPayload } from \"./utils/api\";\n\ninterface OverlayProps {\n apiUrl: string;\n apiKey: string;\n /** Resolver de URL de la página (puede venir del ReviewProvider con override). */\n getPageUrl?: () => string;\n reviewMode: boolean;\n setReviewMode: (value: boolean) => void;\n reviewers: Reviewer[];\n comments: Comment[];\n loadComments: () => void;\n commentsLoadFailed?: boolean;\n}\n\nconst PIN_OVERLAP_RADIUS = 25;\nconst PIN_OFFSET_STEP = 36;\n\n/** Calcula desplazamientos para que pins no se solapen. Usa posiciones recortadas al viewport (mitad del círculo) para agrupar bien en esquinas. */\nfunction getPinOffsets(comments: Comment[]): Map<number, { dx: number; dy: number }> {\n const map = new Map<number, { dx: number; dy: number }>();\n for (let i = 0; i < comments.length; i++) {\n const c = comments[i];\n const { x, y } = getCommentPinPosition(c);\n const { x: cx, y: cy } = clampPinToViewport(x, y);\n let indexInGroup = 0;\n for (let j = 0; j < i; j++) {\n const { x: ox, y: oy } = getCommentPinPosition(comments[j]);\n const { x: cox, y: coy } = clampPinToViewport(ox, oy);\n if (Math.hypot(cx - cox, cy - coy) < PIN_OVERLAP_RADIUS) indexInGroup++;\n }\n map.set(c.id, { dx: indexInGroup * PIN_OFFSET_STEP, dy: 0 });\n }\n return map;\n}\n\nfunction getViewport(): string {\n if (typeof window === \"undefined\") return \"\";\n return `${window.innerWidth}x${window.innerHeight}`;\n}\n\nexport function Overlay({\n apiUrl,\n apiKey,\n getPageUrl: getPageUrlProp,\n reviewMode,\n setReviewMode,\n reviewers,\n comments,\n loadComments,\n commentsLoadFailed = false,\n}: OverlayProps) {\n const [hoveredEl, setHoveredEl] = useState<Element | null>(null);\n const selectedElementRef = useRef<HTMLElement | null>(null);\n const [modalState, setModalState] = useState<{\n position: { x: number; y: number };\n payload: Omit<CreateCommentPayload, \"message\" | \"reviewerId\">;\n } | null>(null);\n\n const clearHighlight = useCallback(() => {\n if (hoveredEl) {\n (hoveredEl as HTMLElement).style.outline = \"\";\n (hoveredEl as HTMLElement).style.outlineOffset = \"\";\n setHoveredEl(null);\n }\n }, [hoveredEl]);\n\n const clearSelectedElement = useCallback(() => {\n if (selectedElementRef.current) {\n selectedElementRef.current.style.outline = \"\";\n selectedElementRef.current.style.outlineOffset = \"\";\n selectedElementRef.current = null;\n }\n }, []);\n\n useEffect(() => {\n if (!reviewMode) {\n clearHighlight();\n clearSelectedElement();\n }\n }, [reviewMode, clearHighlight, clearSelectedElement]);\n\n useEffect(() => {\n if (typeof document === \"undefined\") return;\n const prev = document.body.style.cursor;\n if (modalState) {\n document.body.style.cursor = \"default\";\n } else if (reviewMode) {\n document.body.style.cursor = \"crosshair\";\n }\n return () => {\n document.body.style.cursor = prev;\n };\n }, [reviewMode, modalState]);\n\n const isBodyOrRoot = useCallback((el: Element | null) => {\n if (!el || typeof document === \"undefined\") return true;\n if (el === document.body || el === document.documentElement) return true;\n const tag = (el as HTMLElement).tagName?.toUpperCase();\n if (tag === \"BODY\" || tag === \"HTML\") return true;\n if (el.parentElement !== document.body) return false;\n if (el.id === \"root\" || el.getAttribute(\"data-review-layer-host\") != null) return true;\n if (document.body.children.length === 1) return true;\n return false;\n }, []);\n\n const handleMouseOver = useCallback(\n (e: MouseEvent) => {\n if (!reviewMode || modalState) return;\n const target = (e.target as Node).nodeType === Node.ELEMENT_NODE ? (e.target as Element) : (e.target as Element).parentElement;\n if (!target || isBodyOrRoot(target as Element)) return;\n clearHighlight();\n setHoveredEl(target);\n (target as HTMLElement).style.outline = \"2px solid var(--ui-color-bg-fill-danger-default, #ff4d4f)\";\n (target as HTMLElement).style.outlineOffset = \"2px\";\n },\n [reviewMode, modalState, clearHighlight, isBodyOrRoot]\n );\n\n const handleMouseOut = useCallback(\n (e: MouseEvent) => {\n if (modalState) return;\n const related = e.relatedTarget as Node | null;\n if (hoveredEl && (!related || !hoveredEl.contains(related)) && !(related && (hoveredEl as Node).contains?.(related))) {\n clearHighlight();\n }\n },\n [hoveredEl, modalState, clearHighlight]\n );\n\n const handleClick = useCallback(\n (e: MouseEvent) => {\n if (!reviewMode || modalState) return;\n const target = e.target as Element;\n if (!target || isBodyOrRoot(target) || target.closest(\"[data-review-layer-root]\")) return;\n e.preventDefault();\n e.stopPropagation();\n clearHighlight();\n const el = target as HTMLElement;\n selectedElementRef.current = el;\n el.style.outline = \"2px solid var(--ui-color-bg-fill-danger-default, #ff4d4f)\";\n el.style.outlineOffset = \"2px\";\n const rect = el.getBoundingClientRect();\n const selector = getSelector(target);\n const { relativeX, relativeY } = getRelativePosition(rect);\n setModalState({\n position: { x: rect.left + rect.width / 2, y: rect.bottom },\n payload: {\n selector,\n x: Math.round(rect.left),\n y: Math.round(rect.top),\n relativeX,\n relativeY,\n width: Math.round(rect.width),\n height: Math.round(rect.height),\n url: typeof window !== \"undefined\" ? (getPageUrlProp?.() ?? getPageUrl()) : \"/\",\n viewport: getViewport(),\n userAgent: typeof navigator !== \"undefined\" ? navigator.userAgent : \"\",\n pageTitle: typeof document !== \"undefined\" ? document.title : \"\",\n },\n });\n },\n [reviewMode, modalState, clearHighlight, isBodyOrRoot]\n );\n\n useEffect(() => {\n if (!reviewMode) return;\n document.addEventListener(\"mouseover\", handleMouseOver, true);\n document.addEventListener(\"mouseout\", handleMouseOut, true);\n document.addEventListener(\"click\", handleClick, true);\n return () => {\n document.removeEventListener(\"mouseover\", handleMouseOver, true);\n document.removeEventListener(\"mouseout\", handleMouseOut, true);\n document.removeEventListener(\"click\", handleClick, true);\n };\n }, [reviewMode, handleMouseOver, handleMouseOut, handleClick]);\n\n const [resizeScrollTick, setResizeScrollTick] = useState(0);\n const updateOnScrollResize = useCallback(() => {\n setResizeScrollTick((t) => t + 1);\n if (selectedElementRef.current) {\n const rect = selectedElementRef.current.getBoundingClientRect();\n setModalState((prev) =>\n prev\n ? { ...prev, position: { x: rect.left + rect.width / 2, y: rect.bottom } }\n : null\n );\n }\n }, []);\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n window.addEventListener(\"resize\", updateOnScrollResize);\n window.addEventListener(\"scroll\", updateOnScrollResize, true);\n return () => {\n window.removeEventListener(\"resize\", updateOnScrollResize);\n window.removeEventListener(\"scroll\", updateOnScrollResize, true);\n };\n }, [updateOnScrollResize]);\n\n // En iframe/Storybook el scroll suele ser en un div (ej. sbdocs-wrapper), no en window\n useEffect(() => {\n if (!modalState || !selectedElementRef.current) return;\n const el = selectedElementRef.current;\n const ancestors = getScrollableAncestors(el);\n const cleanup = ancestors.map((node) => {\n node.addEventListener(\"scroll\", updateOnScrollResize, true);\n return () => node.removeEventListener(\"scroll\", updateOnScrollResize, true);\n });\n return () => cleanup.forEach((fn) => fn());\n }, [modalState, updateOnScrollResize]);\n\n const pinOffsets = useMemo(\n () => getPinOffsets(comments),\n [comments, resizeScrollTick]\n );\n\n const handleModalClose = useCallback(() => {\n clearSelectedElement();\n setModalState(null);\n }, [clearSelectedElement]);\n\n const passThroughLayerStyle: React.CSSProperties = {\n position: \"fixed\",\n inset: 0,\n zIndex: 999999,\n pointerEvents: \"none\",\n cursor: reviewMode ? \"crosshair\" : undefined,\n };\n\n const content = (\n <>\n <div style={passThroughLayerStyle} aria-hidden data-review-layer-root />\n {reviewMode && (\n <div\n data-review-layer-root\n style={{\n position: \"fixed\",\n top: \"var(--ui-positive-Value_250, 10px)\",\n left: \"var(--ui-positive-Value_250, 10px)\",\n zIndex: 1000000,\n display: \"flex\",\n alignItems: \"center\",\n gap: \"var(--ui-positive-Value_250, 10px)\",\n padding: \"var(--ui-positive-Value_150, 6px) var(--ui-positive-Value_300, 12px)\",\n backgroundColor: \"var(--ui-color-bg-fill-danger-default, #ff4d4f)\",\n color: \"var(--ui-color-text-on-color, #fff)\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n fontSize: \"var(--ui-font-size-xs, 12px)\",\n fontWeight: \"var(--ui-font-weight-medium, 500)\",\n pointerEvents: \"auto\",\n }}\n >\n <span>Modo revisión (Shift+R para salir)</span>\n <button\n type=\"button\"\n onClick={() => setReviewMode(false)}\n aria-label=\"Salir del modo revisión\"\n style={{\n padding: 0,\n margin: 0,\n width: 20,\n height: 20,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n border: \"none\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n backgroundColor: \"rgba(255,255,255,0.2)\",\n color: \"inherit\",\n fontSize: 14,\n lineHeight: 1,\n cursor: \"pointer\",\n }}\n >\n ×\n </button>\n </div>\n )}\n {commentsLoadFailed && (\n <div\n style={{\n position: \"fixed\",\n bottom: \"var(--ui-positive-Value_400, 16px)\",\n left: \"50%\",\n transform: \"translateX(-50%)\",\n display: \"flex\",\n alignItems: \"center\",\n gap: \"var(--ui-positive-Value_250, 10px)\",\n padding: \"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_350, 14px)\",\n backgroundColor: \"var(--ui-color-bg-surface-default, #fff)\",\n border: \"1px solid var(--ui-color-border-subtle, #e8e8e8)\",\n borderRadius: \"var(--ui-radius_8, 8px)\",\n boxShadow: \"0 2px 12px var(--ui-color-black-alpha-10, rgba(0,0,0,0.1))\",\n fontSize: \"var(--ui-font-size-xs, 12px)\",\n color: \"var(--ui-color-text-primary, #333)\",\n zIndex: 999997,\n pointerEvents: \"auto\",\n }}\n >\n <span>No se pudo conectar. Mostrando últimos datos guardados. Reintentar no garantiza respuesta hasta que el servicio esté activo.</span>\n <button\n type=\"button\"\n onClick={() => loadComments()}\n style={{\n padding: \"var(--ui-positive-Value_100, 4px) var(--ui-positive-Value_250, 10px)\",\n fontSize: \"var(--ui-font-size-xs, 12px)\",\n fontWeight: \"var(--ui-font-weight-semibold, 600)\",\n backgroundColor: \"var(--ui-color-bg-fill-success-default, rgb(33, 196, 94))\",\n color: \"var(--ui-color-text-on-color, #fff)\",\n border: \"none\",\n borderRadius: \"var(--ui-radius_6, 6px)\",\n cursor: \"pointer\",\n }}\n >\n Reintentar\n </button>\n </div>\n )}\n {comments.map((comment) => (\n <div key={comment.id} data-review-layer-pin style={{ pointerEvents: \"auto\" }}>\n <CommentPin\n comment={comment}\n offset={pinOffsets.get(comment.id)}\n apiUrl={apiUrl}\n apiKey={apiKey}\n onStatusChange={loadComments}\n reviewMode={reviewMode}\n />\n </div>\n ))}\n {modalState && (\n <div data-review-layer-modal style={{ pointerEvents: \"auto\" }}>\n <CommentModal\n apiUrl={apiUrl}\n apiKey={apiKey}\n reviewers={reviewers}\n position={modalState.position}\n payload={modalState.payload}\n onClose={handleModalClose}\n onSuccess={loadComments}\n />\n </div>\n )}\n </>\n );\n\n const container = typeof document !== \"undefined\" ? document.body : null;\n return container ? createPortal(content, container) : null;\n}\n","export default \"/**\\n * Tokens de diseño UI para review-layer-react.\\n * Las variables se inyectan en :root al montar ReviewProvider.\\n * Puedes sobrescribirlas en tu app para adaptar el tema.\\n */\\n:root {\\n /* Colores base */\\n --ui-color-white: rgb(255, 255, 255);\\n --ui-color-black: rgb(0, 0, 0);\\n --ui-color-red-50: rgb(255, 242, 242);\\n --ui-color-red-100: rgb(252, 227, 227);\\n --ui-color-red-200: rgb(250, 189, 189);\\n --ui-color-red-300: rgb(245, 148, 148);\\n --ui-color-red-400: rgb(242, 107, 107);\\n --ui-color-red-500: rgb(240, 69, 69);\\n --ui-color-red-600: rgb(212, 61, 61);\\n --ui-color-red-700: rgb(184, 51, 51);\\n --ui-color-red-800: rgb(156, 43, 43);\\n --ui-color-red-900: rgb(128, 36, 36);\\n --ui-color-orange-50: rgb(255, 247, 242);\\n --ui-color-orange-100: rgb(252, 237, 227);\\n --ui-color-orange-200: rgb(252, 209, 176);\\n --ui-color-orange-300: rgb(250, 176, 125);\\n --ui-color-orange-400: rgb(250, 145, 74);\\n --ui-color-orange-500: rgb(250, 115, 23);\\n --ui-color-orange-600: rgb(219, 102, 20);\\n --ui-color-orange-700: rgb(189, 87, 18);\\n --ui-color-orange-800: rgb(158, 74, 13);\\n --ui-color-orange-900: rgb(128, 59, 10);\\n --ui-color-yellow-50: rgb(255, 250, 242);\\n --ui-color-yellow-100: rgb(252, 245, 227);\\n --ui-color-yellow-200: rgb(247, 230, 173);\\n --ui-color-yellow-300: rgb(242, 214, 117);\\n --ui-color-yellow-400: rgb(240, 196, 64);\\n --ui-color-yellow-500: rgb(235, 179, 8);\\n --ui-color-yellow-600: rgb(209, 158, 8);\\n --ui-color-yellow-700: rgb(181, 140, 5);\\n --ui-color-yellow-800: rgb(156, 120, 5);\\n --ui-color-yellow-900: rgb(128, 97, 5);\\n --ui-color-lime-50: rgb(250, 255, 242);\\n --ui-color-lime-100: rgb(242, 252, 227);\\n --ui-color-lime-200: rgb(214, 240, 176);\\n --ui-color-lime-300: rgb(186, 227, 125);\\n --ui-color-lime-400: rgb(161, 217, 74);\\n --ui-color-lime-500: rgb(133, 204, 23);\\n --ui-color-lime-600: rgb(120, 186, 20);\\n --ui-color-lime-700: rgb(107, 166, 18);\\n --ui-color-lime-800: rgb(97, 148, 15);\\n --ui-color-lime-900: rgb(84, 128, 13);\\n --ui-color-green-50: rgb(242, 255, 245);\\n --ui-color-green-100: rgb(227, 252, 237);\\n --ui-color-green-200: rgb(179, 240, 201);\\n --ui-color-green-300: rgb(130, 224, 166);\\n --ui-color-green-400: rgb(84, 212, 130);\\n --ui-color-green-500: rgb(33, 196, 94);\\n --ui-color-green-600: rgb(31, 181, 87);\\n --ui-color-green-700: rgb(28, 163, 79);\\n --ui-color-green-800: rgb(26, 145, 69);\\n --ui-color-green-900: rgb(23, 128, 61);\\n --ui-color-cyan-50: rgb(242, 252, 255);\\n --ui-color-cyan-100: rgb(227, 250, 252);\\n --ui-color-cyan-200: rgb(171, 232, 242);\\n --ui-color-cyan-300: rgb(117, 217, 232);\\n --ui-color-cyan-400: rgb(61, 199, 222);\\n --ui-color-cyan-500: rgb(5, 181, 212);\\n --ui-color-cyan-600: rgb(5, 163, 191);\\n --ui-color-cyan-700: rgb(5, 145, 171);\\n --ui-color-cyan-800: rgb(5, 128, 148);\\n --ui-color-cyan-900: rgb(5, 110, 128);\\n --ui-color-azure-50: rgb(242, 250, 255);\\n --ui-color-azure-100: rgb(227, 245, 252);\\n --ui-color-azure-200: rgb(173, 224, 247);\\n --ui-color-azure-300: rgb(120, 204, 242);\\n --ui-color-azure-400: rgb(69, 186, 237);\\n --ui-color-azure-500: rgb(13, 166, 232);\\n --ui-color-azure-600: rgb(13, 148, 207);\\n --ui-color-azure-700: rgb(10, 128, 181);\\n --ui-color-azure-800: rgb(10, 110, 156);\\n --ui-color-azure-900: rgb(8, 89, 128);\\n --ui-color-blue-50: rgb(242, 245, 255);\\n --ui-color-blue-100: rgb(227, 232, 252);\\n --ui-color-blue-200: rgb(184, 196, 237);\\n --ui-color-blue-300: rgb(140, 161, 222);\\n --ui-color-blue-400: rgb(97, 125, 209);\\n --ui-color-blue-500: rgb(54, 89, 194);\\n --ui-color-blue-600: rgb(51, 82, 176);\\n --ui-color-blue-700: rgb(46, 74, 161);\\n --ui-color-blue-800: rgb(41, 66, 145);\\n --ui-color-blue-900: rgb(36, 59, 128);\\n --ui-color-violet-50: rgb(245, 242, 255);\\n --ui-color-violet-100: rgb(237, 227, 252);\\n --ui-color-violet-200: rgb(209, 186, 250);\\n --ui-color-violet-300: rgb(181, 143, 245);\\n --ui-color-violet-400: rgb(153, 102, 242);\\n --ui-color-violet-500: rgb(125, 59, 237);\\n --ui-color-violet-600: rgb(110, 51, 209);\\n --ui-color-violet-700: rgb(97, 46, 184);\\n --ui-color-violet-800: rgb(82, 38, 156);\\n --ui-color-violet-900: rgb(66, 31, 128);\\n --ui-color-magenta-50: rgb(255, 242, 247);\\n --ui-color-magenta-100: rgb(252, 227, 240);\\n --ui-color-magenta-200: rgb(247, 184, 214);\\n --ui-color-magenta-300: rgb(245, 140, 186);\\n --ui-color-magenta-400: rgb(240, 94, 161);\\n --ui-color-magenta-500: rgb(235, 51, 135);\\n --ui-color-magenta-600: rgb(209, 46, 120);\\n --ui-color-magenta-700: rgb(181, 41, 105);\\n --ui-color-magenta-800: rgb(156, 33, 89);\\n --ui-color-magenta-900: rgb(128, 28, 74);\\n --ui-color-rose-50: rgb(255, 242, 245);\\n --ui-color-rose-100: rgb(252, 227, 232);\\n --ui-color-rose-200: rgb(245, 179, 194);\\n --ui-color-rose-300: rgb(240, 128, 153);\\n --ui-color-rose-400: rgb(232, 79, 112);\\n --ui-color-rose-500: rgb(224, 28, 71);\\n --ui-color-rose-600: rgb(201, 26, 64);\\n --ui-color-rose-700: rgb(176, 23, 56);\\n --ui-color-rose-800: rgb(153, 20, 48);\\n --ui-color-rose-900: rgb(128, 15, 41);\\n --ui-color-light-gray-50: rgb(247, 247, 250);\\n --ui-color-light-gray-100: rgb(240, 242, 242);\\n --ui-color-light-gray-200: rgb(224, 227, 230);\\n --ui-color-light-gray-300: rgb(212, 214, 217);\\n --ui-color-light-gray-400: rgb(199, 199, 204);\\n --ui-color-light-gray-500: rgb(186, 189, 191);\\n --ui-color-light-gray-600: rgb(171, 173, 179);\\n --ui-color-light-gray-700: rgb(158, 163, 166);\\n --ui-color-light-gray-800: rgb(145, 148, 153);\\n --ui-color-light-gray-900: rgb(133, 135, 140);\\n --ui-color-dark-gray-50: rgb(120, 122, 128);\\n --ui-color-dark-gray-100: rgb(107, 110, 115);\\n --ui-color-dark-gray-200: rgb(97, 99, 105);\\n --ui-color-dark-gray-300: rgb(89, 89, 94);\\n --ui-color-dark-gray-400: rgb(77, 79, 84);\\n --ui-color-dark-gray-500: rgb(69, 69, 74);\\n --ui-color-dark-gray-600: rgb(59, 61, 64);\\n --ui-color-dark-gray-700: rgb(48, 51, 54);\\n --ui-color-dark-gray-800: rgb(38, 41, 43);\\n --ui-color-dark-gray-900: rgb(31, 31, 33);\\n --ui-color-black-alpha-transparent: rgba(0, 0, 0, 0);\\n --ui-color-black-alpha-5: rgba(0, 0, 0, 0.05);\\n --ui-color-black-alpha-10: rgba(0, 0, 0, 0.1);\\n --ui-color-black-alpha-20: rgba(0, 0, 0, 0.2);\\n --ui-color-black-alpha-30: rgba(0, 0, 0, 0.3);\\n --ui-color-black-alpha-40: rgba(0, 0, 0, 0.4);\\n --ui-color-black-alpha-50: rgba(0, 0, 0, 0.5);\\n --ui-color-black-alpha-60: rgba(0, 0, 0, 0.6);\\n --ui-color-black-alpha-70: rgba(0, 0, 0, 0.7);\\n --ui-color-black-alpha-80: rgba(0, 0, 0, 0.8);\\n --ui-color-black-alpha-90: rgba(0, 0, 0, 0.9);\\n\\n /* Espaciado positivo */\\n --ui-positive-Value_0: 0;\\n --ui-positive-Value_12: 0.66px;\\n --ui-positive-Value_25: 1px;\\n --ui-positive-Value_50: 2px;\\n --ui-positive-Value_100: 4px;\\n --ui-positive-Value_150: 6px;\\n --ui-positive-Value_200: 8px;\\n --ui-positive-Value_250: 10px;\\n --ui-positive-Value_275: 11px;\\n --ui-positive-Value_300: 12px;\\n --ui-positive-Value_325: 13px;\\n --ui-positive-Value_350: 14px;\\n --ui-positive-Value_400: 16px;\\n --ui-positive-Value_450: 18px;\\n --ui-positive-Value_500: 20px;\\n --ui-positive-Value_600: 24px;\\n --ui-positive-Value_700: 28px;\\n --ui-positive-Value_750: 30px;\\n --ui-positive-Value_800: 32px;\\n --ui-positive-Value_900: 36px;\\n --ui-positive-Value_1000: 40px;\\n --ui-positive-Value_1200: 48px;\\n --ui-positive-Value_1400: 56px;\\n --ui-positive-Value_1600: 64px;\\n --ui-positive-Value_2000: 80px;\\n --ui-positive-Value_2400: 96px;\\n --ui-positive-Value_2800: 112px;\\n --ui-positive-Value_3200: 128px;\\n --ui-positive-Value_full: 9999px;\\n\\n /* Sombras */\\n --ui-shadow-01-x: 0;\\n --ui-shadow-01-y: 1px;\\n --ui-shadow-01-blur: 2px;\\n --ui-shadow-01-Spread: 0;\\n --ui-shadow-02-x: 0;\\n --ui-shadow-02-y: 2px;\\n --ui-shadow-02-blur: 4px;\\n --ui-shadow-02-Spread: -1px;\\n --ui-shadow-03-x: 0;\\n --ui-shadow-03-y: 4px;\\n --ui-shadow-03-blur: 8px;\\n --ui-shadow-03-Spread: -2px;\\n --ui-shadow-04-x: 0;\\n --ui-shadow-04-y: 8px;\\n --ui-shadow-04-blur: 16px;\\n --ui-shadow-04-Spread: -4px;\\n --ui-shadow-05-x: 0;\\n --ui-shadow-05-y: 16px;\\n --ui-shadow-05-blur: 24px;\\n --ui-shadow-05-Spread: -8px;\\n --ui-shadow-01-Color: var(--ui-color-black-alpha-10);\\n --ui-shadow-02-Color: var(--ui-color-black-alpha-20);\\n --ui-shadow-03-Color: var(--ui-color-black-alpha-20);\\n --ui-shadow-04-Color: var(--ui-color-black-alpha-30);\\n --ui-shadow-05-Color: var(--ui-color-black-alpha-30);\\n\\n /* Z-index */\\n --ui-z-hide: -1;\\n --ui-z-base: 0;\\n --ui-z-raised: 100;\\n --ui-z-sticky: 200;\\n --ui-z-shell: 300;\\n --ui-z-dropdown: 400;\\n --ui-z-popover: 500;\\n --ui-z-tooltip: 600;\\n --ui-z-modalBackdrop: 690;\\n --ui-z-modal: 700;\\n --ui-z-toast: 800;\\n --ui-z-overlay: 900;\\n --ui-z-max: 99999;\\n\\n /* Tipografía */\\n --ui-font-family-ui: \\\"Inter\\\", -apple-system, BlinkMacSystemFont, \\\"Segoe UI\\\", sans-serif;\\n --ui-font-family-mono: \\\"IBM Plex Mono\\\";\\n --ui-font-weight-regular: 400;\\n --ui-font-weight-medium: 500;\\n --ui-font-weight-semibold: 600;\\n --ui-font-weight-bold: 700;\\n\\n /* Radios */\\n --ui-radius_0: 0;\\n --ui-radius_2: 2px;\\n --ui-radius_4: 4px;\\n --ui-radius_6: 6px;\\n --ui-radius_8: 8px;\\n --ui-radius_10: 10px;\\n --ui-radius_12: 12px;\\n --ui-radius_16: 16px;\\n --ui-radius_24: 24px;\\n --ui-radius_full: 9999px;\\n\\n /* Semánticos: texto */\\n --ui-color-text-primary: var(--ui-color-dark-gray-700);\\n --ui-color-text-secondary: var(--ui-color-dark-gray-300);\\n --ui-color-text-tertiary: var(--ui-color-dark-gray-100);\\n --ui-color-text-disabled: var(--ui-color-light-gray-500);\\n --ui-color-text-on-color: var(--ui-color-white);\\n --ui-color-text-danger-default: var(--ui-color-red-700);\\n --ui-color-text-danger-hover: var(--ui-color-red-800);\\n --ui-color-text-danger-pressed: var(--ui-color-red-900);\\n\\n /* Semánticos: bordes */\\n --ui-color-border-default: var(--ui-color-light-gray-400);\\n --ui-color-border-subtle: var(--ui-color-light-gray-300);\\n --ui-color-border-strong: var(--ui-color-dark-gray-400);\\n --ui-color-border-danger: var(--ui-color-red-500);\\n\\n /* Semánticos: superficies y fondos */\\n --ui-color-bg-surface-default: var(--ui-color-white);\\n --ui-color-bg-surface-secondary-default: var(--ui-color-light-gray-50);\\n --ui-color-bg-surface-secondary-hover: var(--ui-color-light-gray-100);\\n --ui-color-bg-fill-danger-default: var(--ui-color-red-500);\\n --ui-color-bg-fill-danger-hover: var(--ui-color-red-600);\\n --ui-color-bg-fill-danger-pressed: var(--ui-color-red-700);\\n --ui-color-bg-fill-success-default: var(--ui-color-green-500);\\n --ui-color-bg-fill-success-hover: var(--ui-color-green-600);\\n --ui-color-bg-fill-success-pressed: var(--ui-color-green-700);\\n --ui-color-bg-surface-success-default: var(--ui-color-green-50);\\n --ui-color-bg-surface-success-hover: var(--ui-color-green-100);\\n --ui-color-bg-surface-success-selected: var(--ui-color-green-200);\\n --ui-color-bg-surface-danger-default: var(--ui-color-red-50);\\n --ui-color-bg-surface-danger-hover: var(--ui-color-red-100);\\n --ui-color-bg-surface-danger-selected: var(--ui-color-red-200);\\n --ui-color-bg-surface-warning-default: var(--ui-color-yellow-50);\\n --ui-color-bg-surface-warning-hover: var(--ui-color-yellow-100);\\n --ui-color-bg-surface-warning-selected: var(--ui-color-yellow-200);\\n\\n /* Espaciado (space) */\\n --ui-Positive-space_0: var(--ui-positive-Value_0);\\n --ui-Positive-space_2: var(--ui-positive-Value_100);\\n --ui-Positive-space_4: var(--ui-positive-Value_100);\\n --ui-Positive-space_6: var(--ui-positive-Value_150);\\n --ui-Positive-space_8: var(--ui-positive-Value_200);\\n --ui-Positive-space_10: var(--ui-positive-Value_250);\\n --ui-Positive-space_12: var(--ui-positive-Value_300);\\n --ui-Positive-space_16: var(--ui-positive-Value_400);\\n --ui-Positive-space_20: var(--ui-positive-Value_500);\\n --ui-Positive-space_24: var(--ui-positive-Value_600);\\n --ui-Positive-space_28: var(--ui-positive-Value_700);\\n --ui-Positive-space_32: var(--ui-positive-Value_800);\\n --ui-Positive-space_40: var(--ui-positive-Value_1000);\\n --ui-Positive-space_48: var(--ui-positive-Value_1200);\\n --ui-Positive-space_56: var(--ui-positive-Value_1400);\\n --ui-Positive-space_64: var(--ui-positive-Value_1600);\\n --ui-Positive-space_80: var(--ui-positive-Value_2000);\\n --ui-Positive-space_96: var(--ui-positive-Value_2400);\\n\\n /* Tamaños de fuente */\\n --ui-font-size-2xs: var(--ui-positive-Value_250);\\n --ui-font-size-xs: var(--ui-positive-Value_300);\\n --ui-font-size-sm: var(--ui-positive-Value_350);\\n --ui-font-size-md: var(--ui-positive-Value_400);\\n --ui-font-size-lg: var(--ui-positive-Value_450);\\n --ui-font-size-xl: var(--ui-positive-Value_500);\\n --ui-font-size-2xl: var(--ui-positive-Value_600);\\n --ui-font-size-3xl: var(--ui-positive-Value_750);\\n --ui-font-size-4xl: var(--ui-positive-Value_900);\\n --ui-font-size-5xl: var(--ui-positive-Value_1200);\\n\\n /* Line height (muestra) */\\n --ui-font-lh-10-normal: 14.5px;\\n --ui-font-lh-12-normal: 17.5px;\\n --ui-font-lh-14-normal: 20.5px;\\n --ui-font-lh-16-normal: 23px;\\n --ui-font-lh-18-normal: 26px;\\n --ui-font-lh-20-snug: 25px;\\n\\n /* Sombras compuestas (para uso en box-shadow) */\\n --ui-shadow-card: 0 4px 16px var(--ui-shadow-01-Color);\\n --ui-shadow-popover: 0 var(--ui-shadow-02-y) var(--ui-shadow-02-blur) var(--ui-shadow-02-Color);\\n --ui-shadow-modal: 0 var(--ui-shadow-04-y) var(--ui-shadow-04-blur) var(--ui-shadow-04-Color);\\n}\\n\"","import { useEffect, useCallback, type Dispatch, type SetStateAction } from \"react\";\n\nexport function useReviewMode(\n enabled: boolean,\n _reviewMode: boolean,\n setReviewMode: Dispatch<SetStateAction<boolean>>\n): void {\n const toggle = useCallback(() => {\n if (!enabled) return;\n setReviewMode((prev: boolean) => !prev);\n }, [enabled, setReviewMode]);\n\n useEffect(() => {\n if (!enabled) return;\n\n const handler = (e: KeyboardEvent) => {\n // Solo Shift+R; Ctrl+Shift+R (recarga forzada) no debe salir del modo\n if (\n (e.key === \"r\" || e.key === \"R\" || e.code === \"KeyR\") &&\n e.shiftKey &&\n !e.ctrlKey &&\n !e.metaKey\n ) {\n e.preventDefault();\n toggle();\n }\n };\n\n window.addEventListener(\"keydown\", handler);\n return () => window.removeEventListener(\"keydown\", handler);\n }, [enabled, toggle]);\n}\n","/**\n * Caché local para modo offline-first.\n * Cuando el backend (p. ej. Render) está suspendido por inactividad,\n * la app muestra los últimos datos guardados y los actualiza al despertar el servicio.\n */\n\nimport type { Comment, Reviewer } from \"./api\";\n\nconst PREFIX = \"review_layer:v1:\";\n\nfunction safeJsonParse<T>(raw: string | null, fallback: T): T {\n if (raw == null) return fallback;\n try {\n const data = JSON.parse(raw) as T;\n return data ?? fallback;\n } catch {\n return fallback;\n }\n}\n\nfunction storageKey(apiUrl: string, apiKey: string, kind: string, pageUrl?: string): string {\n const base = `${PREFIX}${normalizeUrl(apiUrl)}:${kind}`;\n return pageUrl != null ? `${base}:${pageUrl}` : base;\n}\n\nfunction normalizeUrl(url: string): string {\n return url.replace(/\\/+$/, \"\") || \"/\";\n}\n\nexport interface CachedWithTime<T> {\n data: T;\n at: number;\n}\n\nfunction getCached<T>(key: string): CachedWithTime<T> | null {\n if (typeof localStorage === \"undefined\") return null;\n const raw = localStorage.getItem(key);\n return safeJsonParse(raw, null) as CachedWithTime<T> | null;\n}\n\nfunction setCached<T>(key: string, data: T): void {\n if (typeof localStorage === \"undefined\") return;\n try {\n localStorage.setItem(key, JSON.stringify({ data, at: Date.now() }));\n } catch {\n // QuotaExceeded o privado\n }\n}\n\nexport function getCachedComments(\n apiUrl: string,\n apiKey: string,\n pageUrl: string\n): Comment[] | null {\n const entry = getCached<Comment[]>(storageKey(apiUrl, apiKey, \"comments\", pageUrl));\n return entry?.data ?? null;\n}\n\nexport function setCachedComments(\n apiUrl: string,\n apiKey: string,\n pageUrl: string,\n comments: Comment[]\n): void {\n setCached(storageKey(apiUrl, apiKey, \"comments\", pageUrl), comments);\n}\n\nexport function getCachedReviewers(apiUrl: string, apiKey: string): Reviewer[] | null {\n const entry = getCached<Reviewer[]>(storageKey(apiUrl, apiKey, \"reviewers\"));\n return entry?.data ?? null;\n}\n\nexport function setCachedReviewers(\n apiUrl: string,\n apiKey: string,\n reviewers: Reviewer[]\n): void {\n setCached(storageKey(apiUrl, apiKey, \"reviewers\"), reviewers);\n}\n\nexport function getCacheTimeComments(\n apiUrl: string,\n apiKey: string,\n pageUrl: string\n): number | null {\n const entry = getCached<Comment[]>(storageKey(apiUrl, apiKey, \"comments\", pageUrl));\n return entry?.at ?? null;\n}\n\nexport function getCacheTimeReviewers(apiUrl: string, apiKey: string): number | null {\n const entry = getCached<Reviewer[]>(storageKey(apiUrl, apiKey, \"reviewers\"));\n return entry?.at ?? null;\n}\n","import {\n createContext,\n useContext,\n useState,\n useEffect,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Overlay } from \"./Overlay\";\nimport variablesCss from \"./variables.css?raw\";\nimport { useReviewMode } from \"./hooks/useReviewMode\";\nimport { fetchReviewers, fetchComments } from \"./utils/api\";\nimport {\n getCachedComments,\n setCachedComments,\n getCachedReviewers,\n setCachedReviewers,\n getCacheTimeComments,\n getCacheTimeReviewers,\n} from \"./utils/cache\";\nimport { getPageUrl } from \"./utils/pageUrl\";\nimport type { Reviewer, Comment } from \"./utils/api\";\n\n/** URL por defecto de la API en producción (Render). Si no pasas apiUrl, se usa esta. */\nexport const DEFAULT_API_URL = \"https://review-layer-api.onrender.com/api\";\n\ninterface ReviewContextValue {\n apiUrl: string;\n apiKey: string;\n reviewMode: boolean;\n setReviewMode: (value: boolean) => void;\n reviewers: Reviewer[];\n comments: Comment[];\n loadComments: () => void;\n /** true si la última carga de comentarios falló (ej. backend dormido en Render) */\n commentsLoadFailed: boolean;\n}\n\nconst ReviewContext = createContext<ReviewContextValue | null>(null);\n\n/** Solo una carga inicial por config; evita peticiones duplicadas que llegarían al backend (p. ej. Strict Mode). */\nlet initialLoadKey: string | null = null;\n\nexport function useReview() {\n const ctx = useContext(ReviewContext);\n if (!ctx) {\n throw new Error(\"useReview must be used within ReviewProvider\");\n }\n return ctx;\n}\n\nexport interface ReviewProviderProps {\n children: React.ReactNode;\n enabled?: boolean;\n /** URL base de la API. Si no se pasa, se usa la de producción (Render). */\n apiUrl?: string;\n apiKey: string;\n /**\n * Función opcional para resolver la URL de la página (scope de comentarios).\n * Si no se pasa, se usa la lógica por defecto (query path/route, o en iframe Storybook el id del story).\n * Útil cuando el host (ej. Storybook) no expone la URL correcta en el iframe; el consumidor puede inyectarla.\n */\n getPageUrl?: () => string;\n}\n\nconst LOG_PREFIX = \"[review-layer]\";\n/** Si la caché es más reciente que esto (ms), no se hace petición para no saturar el servidor (ej. Storybook re-montando). */\nconst CACHE_FRESH_MS = 2500;\n\nexport function ReviewProvider({\n children,\n enabled = true,\n apiUrl: apiUrlProp,\n apiKey,\n getPageUrl: getPageUrlProp,\n}: ReviewProviderProps) {\n const apiUrl = apiUrlProp?.trim() || DEFAULT_API_URL;\n const [reviewMode, setReviewMode] = useState(false);\n const [reviewers, setReviewers] = useState<Reviewer[]>([]);\n const [comments, setComments] = useState<Comment[]>([]);\n const [commentsLoadFailed, setCommentsLoadFailed] = useState(false);\n const loadingReviewersRef = useRef(false);\n const loadingCommentsUrlRef = useRef<string | null>(null);\n\n const resolvePageUrl = useCallback(\n () => (getPageUrlProp?.() ?? getPageUrl()),\n [getPageUrlProp]\n );\n\n useReviewMode(enabled, reviewMode, setReviewMode);\n\n const loadReviewers = useCallback(\n async (signal?: AbortSignal) => {\n if (!enabled || !apiUrl || !apiKey) {\n console.warn(LOG_PREFIX, \"loadReviewers omitido: faltan enabled, apiUrl o apiKey\", {\n enabled,\n apiUrl: apiUrl || \"(vacío)\",\n hasApiKey: !!apiKey,\n });\n return;\n }\n const cachedAt = getCacheTimeReviewers(apiUrl, apiKey);\n if (cachedAt != null && Date.now() - cachedAt < CACHE_FRESH_MS) {\n const cached = getCachedReviewers(apiUrl, apiKey);\n if (cached != null) {\n setReviewers(cached);\n return;\n }\n }\n if (loadingReviewersRef.current) return;\n loadingReviewersRef.current = true;\n console.log(LOG_PREFIX, \"Cargando revisores...\", { apiUrl });\n try {\n const list = await fetchReviewers(apiUrl, apiKey, { signal });\n if (!signal?.aborted) {\n setReviewers(list);\n setCachedReviewers(apiUrl, apiKey, list);\n console.log(LOG_PREFIX, \"Revisores cargados:\", list.length);\n }\n } catch (e) {\n if (e instanceof Error && e.name === \"AbortError\") return;\n if (!signal?.aborted) {\n console.error(LOG_PREFIX, \"Error al cargar revisores:\", e);\n const cached = getCachedReviewers(apiUrl, apiKey);\n if (cached != null) {\n setReviewers(cached);\n console.log(LOG_PREFIX, \"Usando revisores en caché:\", cached.length);\n }\n }\n } finally {\n loadingReviewersRef.current = false;\n }\n },\n [enabled, apiUrl, apiKey]\n );\n\n const loadComments = useCallback(\n async (signal?: AbortSignal) => {\n if (!enabled || !apiUrl || !apiKey) {\n console.warn(LOG_PREFIX, \"loadComments omitido: faltan enabled, apiUrl o apiKey\", {\n enabled,\n apiUrl: apiUrl || \"(vacío)\",\n hasApiKey: !!apiKey,\n });\n return;\n }\n const url = resolvePageUrl();\n const cached = getCachedComments(apiUrl, apiKey, url);\n if (cached != null) setComments(cached);\n const cachedAt = getCacheTimeComments(apiUrl, apiKey, url);\n if (cachedAt != null && Date.now() - cachedAt < CACHE_FRESH_MS) {\n if (cached != null) return;\n }\n if (loadingCommentsUrlRef.current === url) return;\n loadingCommentsUrlRef.current = url;\n console.log(LOG_PREFIX, \"Cargando comentarios...\", { apiUrl, url });\n try {\n setCommentsLoadFailed(false);\n const list = await fetchComments(apiUrl, apiKey, url, { signal });\n if (!signal?.aborted) {\n setComments(list);\n setCachedComments(apiUrl, apiKey, url, list);\n console.log(LOG_PREFIX, \"Comentarios cargados:\", list.length);\n }\n } catch (e) {\n if (e instanceof Error && e.name === \"AbortError\") return;\n if (!signal?.aborted) {\n setCommentsLoadFailed(true);\n console.error(LOG_PREFIX, \"Error al cargar comentarios:\", e);\n const cachedAfter = getCachedComments(apiUrl, apiKey, url);\n if (cachedAfter != null) {\n setComments(cachedAfter);\n console.log(LOG_PREFIX, \"Usando comentarios en caché:\", cachedAfter.length);\n } else {\n console.warn(LOG_PREFIX, \"Sin caché de comentarios; la lista quedará vacía hasta que la API responda.\");\n }\n }\n } finally {\n loadingCommentsUrlRef.current = null;\n }\n },\n [enabled, apiUrl, apiKey, resolvePageUrl]\n );\n\n useEffect(() => {\n if (!enabled || !apiUrl || !apiKey) {\n console.warn(LOG_PREFIX, \"Provider activo pero sin carga: enabled, apiUrl y apiKey son requeridos.\", {\n enabled,\n apiUrl: apiUrl || \"(vacío)\",\n hasApiKey: !!apiKey,\n });\n return;\n }\n const url = resolvePageUrl();\n const cachedReviewersList = getCachedReviewers(apiUrl, apiKey);\n const cachedCommentsList = getCachedComments(apiUrl, apiKey, url);\n if (cachedReviewersList != null) {\n setReviewers(cachedReviewersList);\n console.log(LOG_PREFIX, \"Revisores desde caché (inicial):\", cachedReviewersList.length);\n }\n if (cachedCommentsList != null) {\n setComments(cachedCommentsList);\n console.log(LOG_PREFIX, \"Comentarios desde caché (inicial):\", cachedCommentsList.length, { url });\n }\n }, [enabled, apiUrl, apiKey, resolvePageUrl]);\n\n /* Inyecta tokens UI en :root para que los componentes usen var(--ui-...) */\n useEffect(() => {\n if (typeof document === \"undefined\") return;\n const id = \"review-layer-ui-variables\";\n if (!document.getElementById(id)) {\n const style = document.createElement(\"style\");\n style.id = id;\n style.textContent = variablesCss;\n document.head.appendChild(style);\n }\n }, []);\n\n useEffect(() => {\n if (!enabled || !apiUrl || !apiKey) return;\n const key = `${apiUrl}:${apiKey}`;\n if (initialLoadKey === key) return;\n initialLoadKey = key;\n console.log(LOG_PREFIX, \"Inicio de carga (revisores + comentarios)\", { apiUrl, apiKey: apiKey ? \"***\" : \"(vacío)\" });\n loadReviewers();\n loadComments();\n return () => {\n setTimeout(() => {\n initialLoadKey = null;\n }, 0);\n };\n }, [enabled, apiUrl, apiKey, loadReviewers, loadComments]);\n\n useEffect(() => {\n if (!enabled) return;\n const onPopState = () => loadComments();\n window.addEventListener(\"popstate\", onPopState);\n return () => window.removeEventListener(\"popstate\", onPopState);\n }, [enabled, loadComments]);\n\n const value = useMemo<ReviewContextValue>(\n () => ({\n apiUrl,\n apiKey,\n reviewMode,\n setReviewMode,\n reviewers,\n comments,\n loadComments,\n commentsLoadFailed,\n }),\n [apiUrl, apiKey, reviewMode, setReviewMode, reviewers, comments, loadComments, commentsLoadFailed]\n );\n\n const overlay =\n enabled && typeof document !== \"undefined\"\n ? createPortal(\n <Overlay\n apiUrl={apiUrl}\n apiKey={apiKey}\n getPageUrl={resolvePageUrl}\n reviewMode={reviewMode}\n setReviewMode={setReviewMode}\n reviewers={reviewers}\n comments={comments}\n loadComments={loadComments}\n commentsLoadFailed={commentsLoadFailed}\n />,\n document.body\n )\n : null;\n\n return (\n <ReviewContext.Provider value={value}>\n {children}\n {overlay}\n </ReviewContext.Provider>\n );\n}\n"],"names":["f","require$$0","k","l","m","n","p","q","c","a","b","d","e","h","reactJsxRuntime_production_min","React","REACT_ELEMENT_TYPE","REACT_PORTAL_TYPE","REACT_FRAGMENT_TYPE","REACT_STRICT_MODE_TYPE","REACT_PROFILER_TYPE","REACT_PROVIDER_TYPE","REACT_CONTEXT_TYPE","REACT_FORWARD_REF_TYPE","REACT_SUSPENSE_TYPE","REACT_SUSPENSE_LIST_TYPE","REACT_MEMO_TYPE","REACT_LAZY_TYPE","REACT_OFFSCREEN_TYPE","MAYBE_ITERATOR_SYMBOL","FAUX_ITERATOR_SYMBOL","getIteratorFn","maybeIterable","maybeIterator","ReactSharedInternals","error","format","_len2","args","_key2","printWarning","level","ReactDebugCurrentFrame","stack","argsWithFormat","item","enableScopeAPI","enableCacheElement","enableTransitionTracing","enableLegacyHidden","enableDebugTracing","REACT_MODULE_REFERENCE","isValidElementType","type","getWrappedName","outerType","innerType","wrapperName","displayName","functionName","getContextName","getComponentNameFromType","context","provider","outerName","lazyComponent","payload","init","assign","disabledDepth","prevLog","prevInfo","prevWarn","prevError","prevGroup","prevGroupCollapsed","prevGroupEnd","disabledLog","disableLogs","props","reenableLogs","ReactCurrentDispatcher","prefix","describeBuiltInComponentFrame","name","source","ownerFn","x","match","reentry","componentFrameCache","PossiblyWeakMap","describeNativeComponentFrame","fn","construct","frame","control","previousPrepareStackTrace","previousDispatcher","Fake","sample","sampleLines","controlLines","s","_frame","syntheticFrame","describeFunctionComponentFrame","shouldConstruct","Component","prototype","describeUnknownElementTypeFrameInDEV","hasOwnProperty","loggedTypeFailures","setCurrentlyValidatingElement","element","owner","checkPropTypes","typeSpecs","values","location","componentName","has","typeSpecName","error$1","err","ex","isArrayImpl","isArray","typeName","value","hasToStringTag","willCoercionThrow","testStringCoercion","checkKeyStringCoercion","ReactCurrentOwner","RESERVED_PROPS","specialPropKeyWarningShown","specialPropRefWarningShown","hasValidRef","config","getter","hasValidKey","warnIfStringRefCannotBeAutoConverted","self","defineKeyPropWarningGetter","warnAboutAccessingKey","defineRefPropWarningGetter","warnAboutAccessingRef","ReactElement","key","ref","jsxDEV","maybeKey","propName","defaultProps","ReactCurrentOwner$1","ReactDebugCurrentFrame$1","setCurrentlyValidatingElement$1","propTypesMisspellWarningShown","isValidElement","object","getDeclarationErrorAddendum","getSourceInfoErrorAddendum","ownerHasKeyUseWarning","getCurrentComponentErrorInfo","parentType","info","parentName","validateExplicitKey","currentComponentErrorInfo","childOwner","validateChildKeys","node","i","child","iteratorFn","iterator","step","validatePropTypes","propTypes","_name","validateFragmentProps","fragment","keys","didWarnAboutKeySpread","jsxWithValidation","isStaticChildren","validType","sourceInfo","typeString","children","beforeExample","afterExample","jsxWithValidationStatic","jsxWithValidationDynamic","jsx","jsxs","reactJsxRuntime_development","jsxRuntimeModule","require$$1","getSelector","path","current","part","classes","safeClasses","parent","allChildren","index","REVIEW_LAYER_ROOT","PIN_RADIUS","clampPinToViewport","y","radius","minX","minY","maxX","maxY","getScrollableAncestors","el","result","style","ox","oy","getElementPosition","selector","_a","getRelativePosition","rect","w","getFallbackPosition","comment","relX","relY","getFallbackRect","getCommentPinPosition","FALLBACK_QUERY_KEYS","normalizePath","getPageUrl","params","v","pathname","storyId","COMMENT_STATUS","API_LOG_PREFIX","logApiFailure","url","details","status","statusText","body","reason","msg","getHeaders","apiKey","fetchReviewers","apiUrl","options","res","createComment","fetchComments","fullUrl","updateCommentStatus","commentId","deleteComment","backdropStyle","modalStyle","textareaStyle","selectStyle","buttonStyle","CommentModalInner","reviewers","position","onClose","onSuccess","message","setMessage","useState","reviewerId","setReviewerId","loading","setLoading","setError","useEffect","handleSubmit","useCallback","modalContainerRef","useRef","handleKeyDown","handleMouseDown","target","r","CommentModal","memo","DEFAULT_OUTLINE_COLOR","getHighlightStyle","outlineColor","ElementHighlight","active","fallbackComment","setRect","updateRect","fromSelector","PIN_SIZE","HOVER_LEAVE_DELAY_MS","CARD_WIDTH","COLORS","STATUS_LABELS","STATUS_LABELS_UPPER","PIN_COLORS","BADGE_BG_50","BADGE_BORDER_500","getInitials","parts","CheckIcon","ChatBubblePinIcon","color","getPinStyle","cardStyle","headerRowStyle","avatarStyle","ReviewerAvatar","reviewer","imageUrl","statusColor","closeButtonStyle","getStatusBadgeStyle","borderColor","changeStatusLabelStyle","footerStyle","footerButtonBase","replyButtonStyle","RESOLVE_BTN_CLASS","STATUS_OPTIONS","resolveButtonStyle","CommentPinInner","offset","onStatusChange","reviewMode","showTooltip","setShowTooltip","isPinned","setIsPinned","setPosition","updating","setUpdating","hoverLeaveTimeoutRef","pinRef","popupRef","updatePosition","cleanups","clearHoverLeaveTimeout","handlePinMouseEnter","handlePinMouseLeave","handlePopupMouseEnter","handlePopupMouseLeave","handlePinClick","handleClickOutside","_b","rawX","rawY","showHighlight","closePopup","handleStatusChange","newStatus","handleDelete","pinStyle","useMemo","Fragment","CommentPin","PIN_OVERLAP_RADIUS","PIN_OFFSET_STEP","getPinOffsets","comments","map","cx","cy","indexInGroup","j","cox","coy","getViewport","Overlay","getPageUrlProp","setReviewMode","loadComments","commentsLoadFailed","hoveredEl","setHoveredEl","selectedElementRef","modalState","setModalState","clearHighlight","clearSelectedElement","prev","isBodyOrRoot","tag","handleMouseOver","handleMouseOut","related","handleClick","relativeX","relativeY","resizeScrollTick","setResizeScrollTick","updateOnScrollResize","t","cleanup","pinOffsets","handleModalClose","passThroughLayerStyle","content","container","createPortal","variablesCss","useReviewMode","enabled","_reviewMode","toggle","handler","PREFIX","safeJsonParse","raw","fallback","storageKey","kind","pageUrl","base","normalizeUrl","getCached","setCached","data","getCachedComments","entry","setCachedComments","getCachedReviewers","setCachedReviewers","getCacheTimeComments","getCacheTimeReviewers","DEFAULT_API_URL","ReviewContext","createContext","initialLoadKey","useReview","ctx","useContext","LOG_PREFIX","CACHE_FRESH_MS","ReviewProvider","apiUrlProp","setReviewers","setComments","setCommentsLoadFailed","loadingReviewersRef","loadingCommentsUrlRef","resolvePageUrl","loadReviewers","signal","cachedAt","cached","list","cachedAfter","cachedReviewersList","cachedCommentsList","id","onPopState","overlay"],"mappings":";;;;;;;;;;;;;;;;AASa,MAAIA,IAAEC,IAAiBC,IAAE,OAAO,IAAI,eAAe,GAAEC,IAAE,OAAO,IAAI,gBAAgB,GAAEC,IAAE,OAAO,UAAU,gBAAeC,IAAEL,EAAE,mDAAmD,mBAAkBM,IAAE,EAAC,KAAI,IAAG,KAAI,IAAG,QAAO,IAAG,UAAS,GAAE;AAClP,WAASC,EAAEC,GAAEC,GAAE,GAAE;AAAC,QAAIC,GAAEC,IAAE,CAA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