@bitux/review-layer-react 0.1.2 → 0.1.3
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.
- package/dist/CommentModal.d.ts +2 -1
- package/dist/CommentPin.d.ts +5 -1
- package/dist/ElementHighlight.d.ts +7 -1
- package/dist/Overlay.d.ts +2 -1
- package/dist/review-layer-react.js +1490 -1010
- package/dist/review-layer-react.js.map +1 -1
- package/dist/review-layer-react.umd.cjs +347 -10
- package/dist/review-layer-react.umd.cjs.map +1 -1
- package/dist/utils/api.d.ts +7 -0
- package/dist/utils/positioning.d.ts +19 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(G,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],a):(G=typeof globalThis<"u"?globalThis:G||self,a(G.ReviewLayerReact={},G.React,G.ReactDOM))})(this,function(G,a,Ar){"use strict";var Er={exports:{}},rr={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Fr;function de(){if(Fr)return rr;Fr=1;var e=a,o=Symbol.for("react.element"),t=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function p(b,f,_){var y,m={},j=null,C=null;_!==void 0&&(j=""+_),f.key!==void 0&&(j=""+f.key),f.ref!==void 0&&(C=f.ref);for(y in f)i.call(f,y)&&!c.hasOwnProperty(y)&&(m[y]=f[y]);if(b&&b.defaultProps)for(y in f=b.defaultProps,f)m[y]===void 0&&(m[y]=f[y]);return{$$typeof:o,type:b,key:j,ref:C,props:m,_owner:l.current}}return rr.Fragment=t,rr.jsx=p,rr.jsxs=p,rr}var er={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,18 +14,355 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var Nr;function fe(){return Nr||(Nr=1,process.env.NODE_ENV!=="production"&&function(){var e=a,o=Symbol.for("react.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),b=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),C=Symbol.for("react.offscreen"),V=Symbol.iterator,F="@@iterator";function L(r){if(r===null||typeof r!="object")return null;var n=V&&r[V]||r[F];return typeof n=="function"?n:null}var d=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(r){{for(var n=arguments.length,u=new Array(n>1?n-1:0),v=1;v<n;v++)u[v-1]=arguments[v];I("error",r,u)}}function I(r,n,u){{var v=d.ReactDebugCurrentFrame,R=v.getStackAddendum();R!==""&&(n+="%s",u=u.concat([R]));var S=u.map(function(x){return String(x)});S.unshift("Warning: "+n),Function.prototype.apply.call(console[r],console,S)}}var A=!1,H=!1,or=!1,nr=!1,ir=!1,X;X=Symbol.for("react.module.reference");function w(r){return!!(typeof r=="string"||typeof r=="function"||r===i||r===c||ir||r===l||r===_||r===y||nr||r===C||A||H||or||typeof r=="object"&&r!==null&&(r.$$typeof===j||r.$$typeof===m||r.$$typeof===p||r.$$typeof===b||r.$$typeof===f||r.$$typeof===X||r.getModuleId!==void 0))}function P(r,n,u){var v=r.displayName;if(v)return v;var R=n.displayName||n.name||"";return R!==""?u+"("+R+")":u}function z(r){return r.displayName||"Context"}function T(r){if(r==null)return null;if(typeof r.tag=="number"&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case i:return"Fragment";case t:return"Portal";case c:return"Profiler";case l:return"StrictMode";case _:return"Suspense";case y:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case b:var n=r;return z(n)+".Consumer";case p:var u=r;return z(u._context)+".Provider";case f:return P(r,r.render,"ForwardRef");case m:var v=r.displayName||null;return v!==null?v:T(r.type)||"Memo";case j:{var R=r,S=R._payload,x=R._init;try{return T(x(S))}catch{return null}}}return null}var U=Object.assign,B=0,J,gr,br,ar,lr,E,Z;function ur(){}ur.__reactDisabledLog=!0;function hr(){{if(B===0){J=console.log,gr=console.info,br=console.warn,ar=console.error,lr=console.group,E=console.groupCollapsed,Z=console.groupEnd;var r={configurable:!0,enumerable:!0,value:ur,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}B++}}function xr(){{if(B--,B===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:U({},r,{value:J}),info:U({},r,{value:gr}),warn:U({},r,{value:br}),error:U({},r,{value:ar}),group:U({},r,{value:lr}),groupCollapsed:U({},r,{value:E}),groupEnd:U({},r,{value:Z})})}B<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var jr=d.ReactCurrentDispatcher,Vr;function yr(r,n,u){{if(Vr===void 0)try{throw Error()}catch(R){var v=R.stack.trim().match(/\n( *(at )?)/);Vr=v&&v[1]||""}return`
|
|
18
|
+
`+Vr+r}}var Tr=!1,mr;{var vt=typeof WeakMap=="function"?WeakMap:Map;mr=new vt}function Qr(r,n){if(!r||Tr)return"";{var u=mr.get(r);if(u!==void 0)return u}var v;Tr=!0;var R=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var S;S=jr.current,jr.current=null,hr();try{if(n){var x=function(){throw Error()};if(Object.defineProperty(x.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(x,[])}catch(W){v=W}Reflect.construct(r,[],x)}else{try{x.call()}catch(W){v=W}r.call(x.prototype)}}else{try{throw Error()}catch(W){v=W}r()}}catch(W){if(W&&v&&typeof W.stack=="string"){for(var h=W.stack.split(`
|
|
19
|
+
`),N=v.stack.split(`
|
|
20
|
+
`),D=h.length-1,O=N.length-1;D>=1&&O>=0&&h[D]!==N[O];)O--;for(;D>=1&&O>=0;D--,O--)if(h[D]!==N[O]){if(D!==1||O!==1)do if(D--,O--,O<0||h[D]!==N[O]){var Y=`
|
|
21
|
+
`+h[D].replace(" at new "," at ");return r.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",r.displayName)),typeof r=="function"&&mr.set(r,Y),Y}while(D>=1&&O>=0);break}}}finally{Tr=!1,jr.current=S,xr(),Error.prepareStackTrace=R}var $=r?r.displayName||r.name:"",Q=$?yr($):"";return typeof r=="function"&&mr.set(r,Q),Q}function pt(r,n,u){return Qr(r,!1)}function gt(r){var n=r.prototype;return!!(n&&n.isReactComponent)}function wr(r,n,u){if(r==null)return"";if(typeof r=="function")return Qr(r,gt(r));if(typeof r=="string")return yr(r);switch(r){case _:return yr("Suspense");case y:return yr("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case f:return pt(r.render);case m:return wr(r.type,n,u);case j:{var v=r,R=v._payload,S=v._init;try{return wr(S(R),n,u)}catch{}}}return""}var sr=Object.prototype.hasOwnProperty,Kr={},qr=d.ReactDebugCurrentFrame;function _r(r){if(r){var n=r._owner,u=wr(r.type,r._source,n?n.type:null);qr.setExtraStackFrame(u)}else qr.setExtraStackFrame(null)}function bt(r,n,u,v,R){{var S=Function.call.bind(sr);for(var x in r)if(S(r,x)){var h=void 0;try{if(typeof r[x]!="function"){var N=Error((v||"React class")+": "+u+" type `"+x+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[x]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw N.name="Invariant Violation",N}h=r[x](n,x,v,u,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(D){h=D}h&&!(h instanceof Error)&&(_r(R),g("%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).",v||"React class",u,x,typeof h),_r(null)),h instanceof Error&&!(h.message in Kr)&&(Kr[h.message]=!0,_r(R),g("Failed %s type: %s",u,h.message),_r(null))}}}var ht=Array.isArray;function Dr(r){return ht(r)}function xt(r){{var n=typeof Symbol=="function"&&Symbol.toStringTag,u=n&&r[Symbol.toStringTag]||r.constructor.name||"Object";return u}}function yt(r){try{return $r(r),!1}catch{return!0}}function $r(r){return""+r}function re(r){if(yt(r))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",xt(r)),$r(r)}var ee=d.ReactCurrentOwner,mt={key:!0,ref:!0,__self:!0,__source:!0},te,oe;function wt(r){if(sr.call(r,"ref")){var n=Object.getOwnPropertyDescriptor(r,"ref").get;if(n&&n.isReactWarning)return!1}return r.ref!==void 0}function _t(r){if(sr.call(r,"key")){var n=Object.getOwnPropertyDescriptor(r,"key").get;if(n&&n.isReactWarning)return!1}return r.key!==void 0}function Et(r,n){typeof r.ref=="string"&&ee.current}function Rt(r,n){{var u=function(){te||(te=!0,g("%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)",n))};u.isReactWarning=!0,Object.defineProperty(r,"key",{get:u,configurable:!0})}}function St(r,n){{var u=function(){oe||(oe=!0,g("%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)",n))};u.isReactWarning=!0,Object.defineProperty(r,"ref",{get:u,configurable:!0})}}var Ct=function(r,n,u,v,R,S,x){var h={$$typeof:o,type:r,key:n,ref:u,props:x,_owner:S};return h._store={},Object.defineProperty(h._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(h,"_self",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.defineProperty(h,"_source",{configurable:!1,enumerable:!1,writable:!1,value:R}),Object.freeze&&(Object.freeze(h.props),Object.freeze(h)),h};function kt(r,n,u,v,R){{var S,x={},h=null,N=null;u!==void 0&&(re(u),h=""+u),_t(n)&&(re(n.key),h=""+n.key),wt(n)&&(N=n.ref,Et(n,R));for(S in n)sr.call(n,S)&&!mt.hasOwnProperty(S)&&(x[S]=n[S]);if(r&&r.defaultProps){var D=r.defaultProps;for(S in D)x[S]===void 0&&(x[S]=D[S])}if(h||N){var O=typeof r=="function"?r.displayName||r.name||"Unknown":r;h&&Rt(x,O),N&&St(x,O)}return Ct(r,h,N,R,v,ee.current,x)}}var Ir=d.ReactCurrentOwner,ne=d.ReactDebugCurrentFrame;function q(r){if(r){var n=r._owner,u=wr(r.type,r._source,n?n.type:null);ne.setExtraStackFrame(u)}else ne.setExtraStackFrame(null)}var Or;Or=!1;function Lr(r){return typeof r=="object"&&r!==null&&r.$$typeof===o}function ie(){{if(Ir.current){var r=T(Ir.current.type);if(r)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+
|
|
23
|
+
Check the render method of \``+r+"`."}return""}}function Pt(r){return""}var ae={};function jt(r){{var n=ie();if(!n){var u=typeof r=="string"?r:r.displayName||r.name;u&&(n=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+u+">.")}return n}}function le(r,n){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var u=jt(n);if(ae[u])return;ae[u]=!0;var v="";r&&r._owner&&r._owner!==Ir.current&&(v=" It was passed a child from "+T(r._owner.type)+"."),q(r),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',u,v),q(null)}}function ue(r,n){{if(typeof r!="object")return;if(Dr(r))for(var u=0;u<r.length;u++){var v=r[u];Lr(v)&&le(v,n)}else if(Lr(r))r._store&&(r._store.validated=!0);else if(r){var R=L(r);if(typeof R=="function"&&R!==r.entries)for(var S=R.call(r),x;!(x=S.next()).done;)Lr(x.value)&&le(x.value,n)}}}function Vt(r){{var n=r.type;if(n==null||typeof n=="string")return;var u;if(typeof n=="function")u=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===f||n.$$typeof===m))u=n.propTypes;else return;if(u){var v=T(n);bt(u,r.props,"prop",v,r)}else if(n.PropTypes!==void 0&&!Or){Or=!0;var R=T(n);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tt(r){{for(var n=Object.keys(r.props),u=0;u<n.length;u++){var v=n[u];if(v!=="children"&&v!=="key"){q(r),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),q(null);break}}r.ref!==null&&(q(r),g("Invalid attribute `ref` supplied to `React.Fragment`."),q(null))}}var se={};function ce(r,n,u,v,R,S){{var x=w(r);if(!x){var h="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(h+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var N=Pt();N?h+=N:h+=ie();var D;r===null?D="null":Dr(r)?D="array":r!==void 0&&r.$$typeof===o?(D="<"+(T(r.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):D=typeof r,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",D,h)}var O=kt(r,n,u,R,S);if(O==null)return O;if(x){var Y=n.children;if(Y!==void 0)if(v)if(Dr(Y)){for(var $=0;$<Y.length;$++)ue(Y[$],r);Object.freeze&&Object.freeze(Y)}else g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ue(Y,r)}if(sr.call(n,"key")){var Q=T(r),W=Object.keys(n).filter(function(At){return At!=="key"}),zr=W.length>0?"{key: someKey, "+W.join(": ..., ")+": ...}":"{key: someKey}";if(!se[Q+zr]){var zt=W.length>0?"{"+W.join(": ..., ")+": ...}":"{}";g(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,ke,K,Rn,K),tt[K+ke]=!0}}return e===a?mn(P):yn(P),P}}function En(e,n,s){return nt(e,n,s,!0)}function xn(e,n,s){return nt(e,n,s,!1)}var bn=xn,wn=En;ne.Fragment=a,ne.jsx=bn,ne.jsxs=wn}()),ne}process.env.NODE_ENV==="production"?ye.exports=rt():ye.exports=ot();var u=ye.exports;function at(t){if(t.id&&/^[a-zA-Z][\w-]*$/.test(t.id))return`#${t.id}`;const o=[];let r=t;for(;r&&r.nodeType===Node.ELEMENT_NODE;){let a=r.nodeName.toLowerCase();if(r.id&&/^[a-zA-Z][\w-]*$/.test(r.id)){o.unshift(`#${r.id}`);break}if(r.className&&typeof r.className=="string"){const i=r.className.trim().split(/\s+/).filter(Boolean);if(i.length>0){const d=i.filter(y=>/^[a-zA-Z][\w-]*$/.test(y)).slice(0,2).map(y=>`.${y}`).join("");d&&(a+=d)}}if(o.length>0){const i=r.parentElement;if(i){const d=Array.from(i.children).filter(y=>y.nodeName===r.nodeName);if(d.length>1){const y=d.indexOf(r)+1;a+=`:nth-child(${y})`}}}o.unshift(a),r=r.parentElement}return o.join(" > ")}function Oe(t){if(typeof document>"u"||!(t!=null&&t.trim()))return null;try{const o=document.querySelector(t);return o?o.getBoundingClientRect():null}catch{return null}}function it(t){if(typeof window>"u")return{relativeX:0,relativeY:0};const o=window.innerWidth,r=window.innerHeight;return{relativeX:o>0?t.left/o:0,relativeY:r>0?t.top/r:0}}function st(t){if(typeof window>"u")return{x:t.x??0,y:t.y??0};const o=t.relativeX??null,r=t.relativeY??null;return o!=null&&r!=null?{x:o*window.innerWidth,y:r*window.innerHeight}:{x:t.x??0,y:t.y??0}}function fe(t){if(t.selector){const o=Oe(t.selector);if(o!=null)return{x:o.left,y:o.top}}return st(t)}const O={PENDING:"pending",DEV_FIXED:"dev_fixed",VALIDATED:"validated"};function re(t){return{"Content-Type":"application/json","x-review-key":t}}async function lt(t,o,r){const a=await fetch(`${t}/reviewers`,{headers:re(o),signal:r==null?void 0:r.signal});if(!a.ok)throw new Error("Failed to fetch reviewers");return(await a.json()).data??[]}async function ut(t,o,r){const a=await fetch(`${t}/comments`,{method:"POST",headers:re(o),body:JSON.stringify(r)});if(!a.ok){const d=await a.json().catch(()=>({}));throw new Error(d.message||"Failed to create comment")}return(await a.json()).data}async function ct(t,o,r,a){const i=new URLSearchParams({url:r}),d=await fetch(`${t}/comments?${i}`,{headers:re(o),signal:a==null?void 0:a.signal});if(!d.ok)throw new Error("Failed to fetch comments");return(await d.json()).data??[]}async function ft(t,o,r,a){const i=await fetch(`${t}/comments/${r}/status`,{method:"PATCH",headers:re(o),body:JSON.stringify({status:a})});if(!i.ok){const y=await i.json().catch(()=>({}));throw new Error(y.message||"Failed to update comment status")}return(await i.json()).data}async function dt(t,o,r){const a=await fetch(`${t}/comments/${r}`,{method:"DELETE",headers:re(o)});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.message||"Failed to delete comment")}}const pt={position:"fixed",inset:0,zIndex:999997,backgroundColor:"transparent"},ht={position:"fixed",minWidth:320,maxWidth:400,padding:16,backgroundColor:"#fff",border:"1px solid #e8e8e8",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.15)",zIndex:999998},vt={width:"100%",minHeight:80,padding:"8px 12px",marginBottom:12,border:"1px solid #d9d9d9",borderRadius:6,fontSize:14,resize:"vertical",boxSizing:"border-box"},gt={width:"100%",padding:"8px 12px",marginBottom:12,border:"1px solid #d9d9d9",borderRadius:6,fontSize:14},yt={padding:"8px 16px",backgroundColor:"#ff4d4f",color:"#fff",border:"none",borderRadius:6,fontSize:14,cursor:"pointer",fontWeight:500};function mt({apiUrl:t,apiKey:o,reviewers:r,position:a,payload:i,onClose:d,onSuccess:y}){var M;const[h,E]=l.useState(""),[S,v]=l.useState(((M=r[0])==null?void 0:M.id)??0),[_,w]=l.useState(!1),[L,j]=l.useState(null);l.useEffect(()=>{r.length>0&&!S&&v(r[0].id)},[r,S]);const I=async c=>{if(c.preventDefault(),!(!h.trim()||!S)){w(!0),j(null);try{await ut(t,o,{...i,message:h.trim(),reviewerId:S}),y(),d()}catch(p){j(p instanceof Error?p.message:"Failed to send comment")}finally{w(!1)}}};return u.jsxs(u.Fragment,{children:[u.jsx("div",{role:"presentation",style:pt,onClick:d,onKeyDown:c=>c.key==="Escape"&&d()}),u.jsx("div",{style:{...ht,left:Math.min(a.x,typeof window<"u"?window.innerWidth-420:a.x),top:a.y+12},onClick:c=>c.stopPropagation(),children:u.jsxs("form",{onSubmit:I,children:[u.jsx("textarea",{placeholder:"Escribe tu comentario...",value:h,onChange:c=>E(c.target.value),style:vt,required:!0,autoFocus:!0}),u.jsxs("select",{value:S,onChange:c=>v(Number(c.target.value)),style:gt,required:!0,disabled:r.length===0,children:[u.jsx("option",{value:"",children:r.length===0?"No hay revisores (ejecuta php artisan db:seed en la API)":"Selecciona revisor"}),r.map(c=>u.jsx("option",{value:c.id,children:c.name},c.id))]}),L&&u.jsx("div",{style:{color:"#ff4d4f",fontSize:12,marginBottom:8},children:L}),u.jsx("button",{type:"submit",style:yt,disabled:_||r.length===0,children:_?"Enviando...":"Enviar comentario"})]})})]})}const Et={position:"fixed",outline:"2px solid #ff4d4f",outlineOffset:"2px",pointerEvents:"none",zIndex:999997,boxSizing:"border-box"};function xt({selector:t,active:o}){const[r,a]=l.useState(null),i=l.useCallback(()=>{if(!o||!(t!=null&&t.trim())){a(null);return}const d=Oe(t);a(d)},[t,o]);return l.useEffect(()=>{i()},[i]),l.useEffect(()=>{if(!(!o||!(t!=null&&t.trim())))return window.addEventListener("scroll",i,!0),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i,!0),window.removeEventListener("resize",i)}},[o,t,i]),!o||r==null?null:u.jsx("div",{"aria-hidden":!0,style:{...Et,left:r.left,top:r.top,width:r.width,height:r.height}})}const me=32,Le=5e6,N={cardBg:"#ffffff",textDark:"#333333",textMuted:"#888888",border:"#cccccc",shadow:"0 4px 16px rgba(0, 0, 0, 0.12)"},bt={[O.PENDING]:"Pendiente",[O.DEV_FIXED]:"Corregido Desarrollo",[O.VALIDATED]:"Validado"},wt={[O.PENDING]:"PENDIENTE",[O.DEV_FIXED]:"CORREGIDO DESARROLLO",[O.VALIDATED]:"VALIDADO"},J={[O.PENDING]:"rgb(240, 69, 69)",[O.DEV_FIXED]:"rgb(235, 179, 8)",[O.VALIDATED]:"rgb(33, 196, 94)"};function Rt(t){const o=t.trim().split(/\s+/);return o.length>=2?(o[0][0]+o[o.length-1][0]).toUpperCase():t.slice(0,2).toUpperCase()||"?"}const St=()=>u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{marginRight:4,flexShrink:0},children:u.jsx("path",{d:"M10 3L4.5 8.5L2 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),Ct=({color:t})=>u.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",style:{flexShrink:0},children:[u.jsx("path",{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",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),u.jsx("path",{d:"M8 10h.01M12 10h.01M16 10h.01",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round"})]}),_t=t=>({position:"fixed",width:me,height:me,borderRadius:"50%",backgroundColor:J[t]??J[O.PENDING],color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontFamily:"'Inter', sans-serif",boxShadow:"0 2px 8px rgba(0,0,0,0.2)",zIndex:999998,border:"2px solid #fff"}),jt={position:"fixed",maxWidth:320,padding:"16px 14px",backgroundColor:N.cardBg,borderRadius:12,boxShadow:N.shadow,fontSize:13,fontFamily:"'Inter', sans-serif",zIndex:999999,pointerEvents:"auto"},kt={display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginBottom:12},Tt=t=>({width:40,height:40,borderRadius:"50%",backgroundColor:J[t]??J[O.PENDING],color:"#fff",border:"2px solid #fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,fontWeight:700,flexShrink:0}),Pt={flexShrink:0,width:24,height:24,padding:0,border:"none",borderRadius:6,backgroundColor:"transparent",color:N.textDark,cursor:"pointer",fontSize:18,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},Dt=t=>{const o=t===O.DEV_FIXED;return{display:"inline-flex",alignItems:"center",marginBottom:10,padding:"4px 10px",borderRadius:9999,fontSize:10,fontWeight:700,fontFamily:"'Inter', sans-serif",textTransform:"uppercase",letterSpacing:"0.02em",backgroundColor:J[t]??J[O.PENDING],color:o?N.textDark:"#fff"}},Ot={display:"block",marginTop:12,marginBottom:6,fontSize:10,fontWeight:600,fontFamily:"'Inter', sans-serif",color:N.textMuted,textTransform:"uppercase",letterSpacing:"0.04em"},Lt={width:"100%",padding:"8px 12px",paddingRight:32,fontSize:13,fontFamily:"'Inter', sans-serif",borderRadius:8,border:`1px solid ${N.border}`,backgroundColor:N.cardBg,color:N.textDark,cursor:"pointer",appearance:"none",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")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 10px center"},It={display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,marginTop:14,paddingTop:12,borderTop:`1px solid ${N.border}`},Ie={minWidth:100,padding:"8px 14px",fontSize:13,fontWeight:600,fontFamily:"'Inter', sans-serif",borderRadius:8,cursor:"pointer",border:"none"},At={...Ie,backgroundColor:"transparent",color:N.textDark},Ft={...Ie,backgroundColor:J[O.VALIDATED],color:"#fff"};function Nt({comment:t,offset:o={dx:0,dy:0},apiUrl:r,apiKey:a,onStatusChange:i}){var ae,ie;const[d,y]=l.useState(!1),[h,E]=l.useState(!1),[S,v]=l.useState(()=>fe(t)),[_,w]=l.useState(!1),[L,j]=l.useState(null),I=l.useRef(null),M=l.useRef(null),c=l.useRef(null),p=l.useCallback(()=>{v(fe(t))},[t]);l.useEffect(()=>{p()},[p]),l.useEffect(()=>{if(!(typeof window>"u"))return window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[p]);const D=l.useCallback(()=>{I.current!==null&&(clearTimeout(I.current),I.current=null)},[]),Y=l.useCallback(()=>{D(),y(!0)},[D]),X=l.useCallback(()=>{h||(I.current=setTimeout(()=>{I.current=null,y(!1)},Le))},[h]),q=l.useCallback(()=>{D(),y(!0)},[D]),C=l.useCallback(()=>{h||(I.current=setTimeout(()=>{I.current=null,y(!1)},Le))},[h]),k=l.useCallback(()=>{h?(E(!1),y(!1)):(E(!0),y(!0))},[h]);l.useEffect(()=>{if(!h)return;const x=Q=>{var le,ue;const se=Q.target;(le=M.current)!=null&&le.contains(se)||(ue=c.current)!=null&&ue.contains(se)||(E(!1),y(!1))};return document.addEventListener("mousedown",x,!0),()=>document.removeEventListener("mousedown",x,!0)},[h]),l.useEffect(()=>()=>D(),[D]);const z=S.x+o.dx,W=S.y+o.dy,oe=d,G=l.useCallback(()=>{E(!1),y(!1)},[]),V=async x=>{if(x!==t.status){j(null),w(!0);try{await ft(r,a,t.id,x),i()}catch(Q){j(Q instanceof Error?Q.message:"Error al actualizar")}finally{w(!1)}}},H=async()=>{j(null),w(!0);try{await dt(r,a,t.id),i(),G()}catch(x){j(x instanceof Error?x.message:"Error al eliminar")}finally{w(!1)}},Z=["pending","dev_fixed","validated"];return u.jsxs(u.Fragment,{children:[u.jsx(xt,{selector:t.selector,active:oe}),u.jsx("div",{ref:M,role:"button",tabIndex:0,"aria-label":`Comentario: ${t.message.slice(0,30)}...`,"aria-expanded":d,style:{..._t(t.status),left:z,top:W,transform:"translate(-50%, -50%)"},onMouseEnter:Y,onMouseLeave:X,onClick:k,children:u.jsx(Ct,{color:"#fff"})}),d&&u.jsxs("div",{ref:c,role:"dialog","aria-label":"Detalle del comentario",style:{...jt,left:z+me/2+6,top:W},onMouseEnter:q,onMouseLeave:C,children:[u.jsxs("div",{style:kt,children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flex:1,minWidth:0},children:[u.jsx("div",{style:Tt(t.status),children:Rt(((ae=t.reviewer)==null?void 0:ae.name)??"Revisor")}),u.jsxs("div",{children:[u.jsx("div",{style:{fontWeight:700,fontSize:14,color:N.textDark},children:((ie=t.reviewer)==null?void 0:ie.name)??"Revisor"}),u.jsx("div",{style:{fontSize:12,color:N.textMuted},children:"Revisor"})]})]}),u.jsx("button",{type:"button","aria-label":t.status===O.VALIDATED?"Eliminar comentario":"Cerrar",style:Pt,disabled:_,onClick:x=>{x.stopPropagation(),t.status===O.VALIDATED?H():G()},onMouseDown:x=>x.stopPropagation(),children:"✕"})]}),u.jsxs("div",{style:Dt(t.status),children:[t.status===O.VALIDATED&&u.jsx(St,{}),wt[t.status]??t.status]}),u.jsx("div",{style:{color:N.textDark,lineHeight:1.5},children:t.message}),u.jsx("label",{style:Ot,htmlFor:`comment-status-${t.id}`,children:"Cambiar estado"}),u.jsx("select",{id:`comment-status-${t.id}`,style:Lt,value:t.status,disabled:_,onChange:x=>V(x.target.value),onMouseDown:x=>x.stopPropagation(),"aria-label":"Cambiar estado del comentario",children:Z.map(x=>u.jsx("option",{value:x,children:bt[x]},x))}),L&&u.jsx("div",{style:{marginTop:8,fontSize:11,color:"rgb(240, 69, 69)"},children:L}),u.jsxs("div",{style:It,children:[u.jsx("button",{type:"button",style:At,onMouseDown:x=>x.stopPropagation(),onClick:x=>{x.stopPropagation(),G()},children:"Cerrar"}),t.status!==O.VALIDATED&&u.jsx("button",{type:"button",style:Ft,disabled:_,onMouseDown:x=>x.stopPropagation(),onClick:x=>{x.stopPropagation(),V("validated")},children:"Resolver hilo"})]})]})]})}const Mt=25,zt=36;function Wt(t){const o=new Map;for(let r=0;r<t.length;r++){const a=t[r],{x:i,y:d}=fe(a);let y=0;for(let h=0;h<r;h++){const E=t[h],{x:S,y:v}=fe(E);Math.hypot(i-S,d-v)<Mt&&y++}o.set(a.id,{dx:y*zt,dy:0})}return o}function Vt(){return typeof window>"u"?"":`${window.innerWidth}x${window.innerHeight}`}function Bt({apiUrl:t,apiKey:o,reviewMode:r,reviewers:a,comments:i,loadComments:d,commentsLoadFailed:y=!1}){const[h,E]=l.useState(null),S=l.useRef(null),[v,_]=l.useState(null),w=l.useCallback(()=>{h&&(h.style.outline="",h.style.outlineOffset="",E(null))},[h]),L=l.useCallback(()=>{S.current&&(S.current.style.outline="",S.current.style.outlineOffset="",S.current=null)},[]);l.useEffect(()=>{r||(w(),L())},[r,w,L]),l.useEffect(()=>{if(typeof document>"u")return;const C=document.body.style.cursor;return v?document.body.style.cursor="default":r&&(document.body.style.cursor="crosshair"),()=>{document.body.style.cursor=C}},[r,v]);const j=l.useCallback(C=>{if(!r||v)return;const k=C.target.nodeType===Node.ELEMENT_NODE?C.target:C.target.parentElement;k&&(w(),E(k),k.style.outline="2px solid #ff4d4f",k.style.outlineOffset="2px")},[r,v,w]),I=l.useCallback(C=>{var z;if(v)return;const k=C.relatedTarget;h&&(!k||!h.contains(k))&&!(k&&((z=h.contains)!=null&&z.call(h,k)))&&w()},[h,v,w]),M=l.useCallback(C=>{if(!r||v)return;C.preventDefault(),C.stopPropagation();const k=C.target;if(!k||k.closest("[data-review-layer-pin]")||k.closest("[data-review-layer-modal]"))return;w();const z=k;S.current=z,z.style.outline="2px solid #ff4d4f",z.style.outlineOffset="2px";const W=z.getBoundingClientRect(),oe=at(k),{relativeX:G,relativeY:V}=it(W);_({position:{x:W.left+W.width/2,y:W.bottom},payload:{selector:oe,x:Math.round(W.left),y:Math.round(W.top),relativeX:G,relativeY:V,width:Math.round(W.width),height:Math.round(W.height),url:typeof window<"u"&&window.location.pathname||"/",viewport:Vt(),userAgent:typeof navigator<"u"?navigator.userAgent:"",pageTitle:typeof document<"u"?document.title:""}})},[r,v,w]);l.useEffect(()=>{if(r)return document.addEventListener("mouseover",j,!0),document.addEventListener("mouseout",I,!0),document.addEventListener("click",M,!0),()=>{document.removeEventListener("mouseover",j,!0),document.removeEventListener("mouseout",I,!0),document.removeEventListener("click",M,!0)}},[r,j,I,M]);const[c,p]=l.useState(0);l.useEffect(()=>{if(typeof window>"u")return;const C=()=>p(k=>k+1);return window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[]);const D=l.useMemo(()=>Wt(i),[i,c]),Y={position:"fixed",inset:0,zIndex:999999,pointerEvents:"none",cursor:r?"crosshair":void 0},X=u.jsxs("div",{style:Y,"aria-hidden":!0,children:[r&&u.jsx("div",{style:{position:"fixed",top:10,left:10,zIndex:1e6,padding:"6px 12px",backgroundColor:"#ff4d4f",color:"#fff",borderRadius:6,fontSize:12,fontWeight:500,pointerEvents:"auto"},children:"Modo revisión (Shift+R para salir)"}),y&&u.jsxs("div",{style:{position:"fixed",bottom:16,left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:10,padding:"8px 14px",backgroundColor:"#fff",border:"1px solid #e8e8e8",borderRadius:8,boxShadow:"0 2px 12px rgba(0,0,0,0.1)",fontSize:12,color:"#333",zIndex:999997,pointerEvents:"auto"},children:[u.jsx("span",{children:"No se pudo conectar. Mostrando últimos datos guardados. Reintentar no garantiza respuesta hasta que el servicio esté activo."}),u.jsx("button",{type:"button",onClick:()=>d(),style:{padding:"4px 10px",fontSize:12,fontWeight:600,backgroundColor:"rgb(33, 196, 94)",color:"#fff",border:"none",borderRadius:6,cursor:"pointer"},children:"Reintentar"})]}),i.map(C=>u.jsx("div",{"data-review-layer-pin":!0,style:{pointerEvents:"auto"},children:u.jsx(Nt,{comment:C,offset:D.get(C.id),apiUrl:t,apiKey:o,onStatusChange:d})},C.id)),v&&u.jsx("div",{"data-review-layer-modal":!0,style:{pointerEvents:"auto"},children:u.jsx(mt,{apiUrl:t,apiKey:o,reviewers:a,position:v.position,payload:v.payload,onClose:()=>{L(),_(null)},onSuccess:d})})]}),q=typeof document<"u"?document.body:null;return q?Te.createPortal(X,q):null}function Yt(t,o,r){const a=l.useCallback(()=>{t&&r(i=>!i)},[t,r]);l.useEffect(()=>{if(!t)return;const i=d=>{(d.key==="r"||d.key==="R"||d.code==="KeyR")&&d.shiftKey&&(d.preventDefault(),a())};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[t,a])}const Ut="review_layer:v1:";function Ht(t,o){if(t==null)return o;try{return JSON.parse(t)??o}catch{return o}}function de(t,o,r,a){const i=`${Ut}${Xt(t)}:${r}`;return a!=null?`${i}:${a}`:i}function Xt(t){return t.replace(/\/+$/,"")||"/"}function Ae(t){if(typeof localStorage>"u")return null;const o=localStorage.getItem(t);return Ht(o,null)}function Fe(t,o){if(!(typeof localStorage>"u"))try{localStorage.setItem(t,JSON.stringify({data:o,at:Date.now()}))}catch{}}function Ee(t,o,r){const a=Ae(de(t,o,"comments",r));return(a==null?void 0:a.data)??null}function Gt(t,o,r,a){Fe(de(t,o,"comments",r),a)}function Ne(t,o){const r=Ae(de(t,o,"reviewers"));return(r==null?void 0:r.data)??null}function Jt(t,o,r){Fe(de(t,o,"reviewers"),r)}const Me="https://review-layer-api.onrender.com/api";function ze(){return typeof window>"u"?"/":window.location.pathname||"/"}const We=l.createContext(null);let xe=null;function Zt(){const t=l.useContext(We);if(!t)throw new Error("useReview must be used within ReviewProvider");return t}function Qt({children:t,enabled:o=!0,apiUrl:r,apiKey:a}){const i=(r==null?void 0:r.trim())||Me,[d,y]=l.useState(!1),[h,E]=l.useState([]),[S,v]=l.useState([]),[_,w]=l.useState(!1);Yt(o,d,y);const L=l.useCallback(async c=>{if(!(!o||!i||!a))try{const p=await lt(i,a,{signal:c});c!=null&&c.aborted||(E(p),Jt(i,a,p))}catch(p){if(p instanceof Error&&p.name==="AbortError")return;if(!(c!=null&&c.aborted)){const D=Ne(i,a);D!=null&&E(D)}}},[o,i,a]),j=l.useCallback(async c=>{if(!o||!i||!a)return;const p=ze(),D=Ee(i,a,p);D!=null&&v(D);try{w(!1);const Y=await ct(i,a,p,{signal:c});c!=null&&c.aborted||(v(Y),Gt(i,a,p,Y))}catch(Y){if(Y instanceof Error&&Y.name==="AbortError")return;if(!(c!=null&&c.aborted)){w(!0);const X=Ee(i,a,p);X!=null&&v(X)}}},[o,i,a]);l.useEffect(()=>{if(!o||!i||!a)return;const c=ze(),p=Ne(i,a),D=Ee(i,a,c);p!=null&&E(p),D!=null&&v(D)},[o,i,a]),l.useEffect(()=>{if(!o||!i||!a)return;const c=`${i}:${a}`;if(xe!==c)return xe=c,L(),j(),()=>{setTimeout(()=>{xe=null},0)}},[o,i,a,L,j]),l.useEffect(()=>{if(!o)return;const c=()=>j();return window.addEventListener("popstate",c),()=>window.removeEventListener("popstate",c)},[o,j]);const I={apiUrl:i,apiKey:a,reviewMode:d,setReviewMode:y,reviewers:h,comments:S,loadComments:j,commentsLoadFailed:_},M=o&&typeof document<"u"?Te.createPortal(u.jsx(Bt,{apiUrl:i,apiKey:a,reviewMode:d,reviewers:h,comments:S,loadComments:j,commentsLoadFailed:_}),document.body):null;return u.jsxs(We.Provider,{value:I,children:[t,M]})}U.DEFAULT_API_URL=Me,U.ReviewProvider=Qt,U.useReview=Zt,Object.defineProperty(U,Symbol.toStringTag,{value:"Module"})});
|
|
30
|
+
<%s key={someKey} {...props} />`,zr,Q,zt,Q),se[Q+zr]=!0}}return r===i?Tt(O):Vt(O),O}}function Dt(r,n,u){return ce(r,n,u,!0)}function It(r,n,u){return ce(r,n,u,!1)}var Ot=It,Lt=Dt;er.Fragment=i,er.jsx=Ot,er.jsxs=Lt}()),er}process.env.NODE_ENV==="production"?Er.exports=de():Er.exports=fe();var s=Er.exports;function ve(e){if(e.id&&/^[a-zA-Z][\w-]*$/.test(e.id))return`#${e.id}`;const o=[];let t=e;for(;t&&t.nodeType===Node.ELEMENT_NODE;){let i=t.nodeName.toLowerCase();if(t.id&&/^[a-zA-Z][\w-]*$/.test(t.id)){o.unshift(`#${t.id}`);break}if(t.className&&typeof t.className=="string"){const l=t.className.trim().split(/\s+/).filter(Boolean);if(l.length>0){const c=l.filter(p=>/^[a-zA-Z][\w-]*$/.test(p)).slice(0,2).map(p=>`.${p}`).join("");c&&(i+=c)}}if(o.length>0){const l=t.parentElement;if(l){const c=Array.from(l.children).filter(p=>p.nodeName===t.nodeName);if(c.length>1){const p=c.indexOf(t)+1;i+=`:nth-child(${p})`}}}o.unshift(i),t=t.parentElement}return o.join(" > ")}const pe="[data-review-layer-root]",ge=16;function Rr(e,o,t=ge){if(typeof window>"u")return{x:e,y:o};const i=t,l=t,c=window.innerWidth-t,p=window.innerHeight-t;return{x:Math.max(i,Math.min(c,e)),y:Math.max(l,Math.min(p,o))}}function Mr(e){var o;if(typeof document>"u"||!(e!=null&&e.trim()))return null;try{const t=document.querySelector(e);return!t||(o=t.closest)!=null&&o.call(t,pe)?null:t.getBoundingClientRect()}catch{return null}}function be(e){if(typeof window>"u")return{relativeX:0,relativeY:0};const o=window.innerWidth,t=window.innerHeight;return{relativeX:o>0?e.left/o:0,relativeY:t>0?e.top/t:0}}function Sr(e){if(typeof window>"u")return{x:e.x??0,y:e.y??0};const o=e.relativeX??e.relative_x??null,t=e.relativeY??e.relative_y??null;return o!=null&&t!=null?{x:o*window.innerWidth,y:t*window.innerHeight}:{x:e.x??0,y:e.y??0}}function he(e){const{x:o,y:t}=Sr(e),i=e.width??100,l=e.height??40;return new DOMRect(o,t,i,l)}function cr(e){const o=(e.relativeX??e.relative_x)!=null&&(e.relativeY??e.relative_y)!=null,t=e.x!=null&&e.y!=null;if(o||t)return Sr(e);if(e.selector){const i=Mr(e.selector);if(i!=null)return{x:i.left,y:i.top}}return Sr(e)}const k={PENDING:"pending",DEV_FIXED:"dev_fixed",VALIDATED:"validated"};function tr(e){return{"Content-Type":"application/json","x-review-key":e}}async function xe(e,o,t){const i=await fetch(`${e}/reviewers`,{headers:tr(o),signal:t==null?void 0:t.signal});if(!i.ok)throw new Error("Failed to fetch reviewers");return(await i.json()).data??[]}async function ye(e,o,t){const i=await fetch(`${e}/comments`,{method:"POST",headers:tr(o),body:JSON.stringify(t)});if(!i.ok){const c=await i.json().catch(()=>({}));throw new Error(c.message||"Failed to create comment")}return(await i.json()).data}async function me(e,o,t,i){const l=new URLSearchParams({url:t}),c=await fetch(`${e}/comments?${l}`,{headers:tr(o),signal:i==null?void 0:i.signal});if(!c.ok)throw new Error("Failed to fetch comments");return(await c.json()).data??[]}async function we(e,o,t,i){const l=await fetch(`${e}/comments/${t}/status`,{method:"PATCH",headers:tr(o),body:JSON.stringify({status:i})});if(!l.ok){const p=await l.json().catch(()=>({}));throw new Error(p.message||"Failed to update comment status")}return(await l.json()).data}async function _e(e,o,t){const i=await fetch(`${e}/comments/${t}`,{method:"DELETE",headers:tr(o)});if(!i.ok){const l=await i.json().catch(()=>({}));throw new Error(l.message||"Failed to delete comment")}}const Ee={position:"fixed",inset:0,zIndex:999997,backgroundColor:"transparent"},Re={position:"fixed",minWidth:320,maxWidth:400,padding:"var(--ui-positive-Value_400, 16px)",backgroundColor:"var(--ui-color-bg-surface-default, #fff)",border:"1px solid var(--ui-color-border-subtle, #e8e8e8)",borderRadius:"var(--ui-radius_8, 8px)",boxShadow:"0 8px 24px var(--ui-color-black-alpha-20, rgba(0,0,0,0.15))",zIndex:999998},Se={width:"100%",minHeight:80,padding:"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_300, 12px)",marginBottom:"var(--ui-positive-Value_200, 12px)",border:"1px solid var(--ui-color-border-default, #d9d9d9)",borderRadius:"var(--ui-radius_6, 6px)",fontSize:"var(--ui-font-size-sm, 14px)",fontFamily:"var(--ui-font-family-ui, 'Inter', sans-serif)",resize:"vertical",boxSizing:"border-box"},Ce={width:"100%",padding:"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_300, 12px)",marginBottom:"var(--ui-positive-Value_300, 12px)",border:"1px solid var(--ui-color-border-default, #d9d9d9)",borderRadius:"var(--ui-radius_6, 6px)",fontSize:"var(--ui-font-size-sm, 14px)"},ke={padding:"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_400, 16px)",backgroundColor:"var(--ui-color-bg-fill-danger-default, #ff4d4f)",color:"var(--ui-color-text-on-color, #fff)",border:"none",borderRadius:"var(--ui-radius_6, 6px)",fontSize:"var(--ui-font-size-sm, 14px)",cursor:"pointer",fontWeight:"var(--ui-font-weight-medium, 500)"};function Pe({apiUrl:e,apiKey:o,reviewers:t,position:i,payload:l,onClose:c,onSuccess:p}){var L;const[b,f]=a.useState(""),[_,y]=a.useState(((L=t[0])==null?void 0:L.id)??0),[m,j]=a.useState(!1),[C,V]=a.useState(null);a.useEffect(()=>{t.length>0&&!_&&y(t[0].id)},[t,_]);const F=a.useCallback(async d=>{if(d.preventDefault(),!(!b.trim()||!_)){j(!0),V(null);try{await ye(e,o,{...l,message:b.trim(),reviewerId:_}),p(),c()}catch(g){V(g instanceof Error?g.message:"Failed to send comment")}finally{j(!1)}}},[e,o,l,b,_,p,c]);return s.jsxs(s.Fragment,{children:[s.jsx("div",{role:"presentation",style:Ee,onClick:c,onKeyDown:d=>d.key==="Escape"&&c()}),s.jsx("div",{style:{...Re,left:Math.min(i.x,typeof window<"u"?window.innerWidth-420:i.x),top:i.y+12},onClick:d=>d.stopPropagation(),children:s.jsxs("form",{onSubmit:F,children:[s.jsx("textarea",{placeholder:"Escribe tu comentario...",value:b,onChange:d=>f(d.target.value),style:Se,required:!0,autoFocus:!0}),s.jsxs("select",{value:_,onChange:d=>y(Number(d.target.value)),style:Ce,required:!0,disabled:t.length===0,children:[s.jsx("option",{value:"",children:t.length===0?"No hay revisores (ejecuta php artisan db:seed en la API)":"Selecciona revisor"}),t.map(d=>s.jsx("option",{value:d.id,children:d.name},d.id))]}),C&&s.jsx("div",{style:{color:"var(--ui-color-text-danger-default, #ff4d4f)",fontSize:"var(--ui-font-size-xs, 12px)",marginBottom:"var(--ui-positive-Value_200, 8px)"},children:C}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:s.jsx("button",{type:"submit",style:ke,disabled:m||t.length===0,children:m?"Enviando...":"Enviar comentario"})})]})})]})}const je=a.memo(Pe),Ve="var(--ui-color-red-500, #ef4444)";function Te(e){return{position:"fixed",outline:`2px solid ${e}`,outlineOffset:"var(--ui-positive-Value_200, 2px)",pointerEvents:"none",zIndex:999997,boxSizing:"border-box"}}const De=a.memo(function({selector:o,active:t,fallbackComment:i,outlineColor:l=Ve}){const[c,p]=a.useState(null),b=a.useCallback(()=>{if(!t){p(null);return}const f=o!=null&&o.trim()?Mr(o):null;if(f){p(f);return}if(i){p(he(i));return}p(null)},[o,t,i]);return a.useEffect(()=>{b()},[b]),a.useEffect(()=>{if(t)return window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}},[t,b]),!t||c==null?null:s.jsx("div",{"aria-hidden":!0,style:{...Te(l),left:c.left,top:c.top,width:c.width,height:c.height}})}),dr=32,Wr=15e5,Cr=250,M={cardBg:"var(--ui-color-bg-surface-default, #ffffff)",cardFooterBg:"var(--ui-color-bg-surface-secondary-default, #f8fafc)",textDark:"var(--ui-color-text-primary, #333333)",textMuted:"var(--ui-color-text-secondary, #888888)",border:"var(--ui-color-border-default, #cccccc)",shadow:"var(--ui-shadow-card, 0 4px 16px rgba(0, 0, 0, 0.12))"},Ie={[k.PENDING]:"Pendiente",[k.DEV_FIXED]:"Corregido",[k.VALIDATED]:"Validado"},Oe={[k.PENDING]:"PENDIENTE",[k.DEV_FIXED]:"CORREGIDO",[k.VALIDATED]:"VALIDADO"},K={[k.PENDING]:"var(--ui-color-red-500, rgb(240, 69, 69))",[k.DEV_FIXED]:"var(--ui-color-yellow-500, rgb(235, 179, 8))",[k.VALIDATED]:"var(--ui-color-green-500, rgb(33, 196, 94))"},Br={[k.PENDING]:"var(--ui-color-bg-surface-danger-default, #fef2f2)",[k.DEV_FIXED]:"var(--ui-color-bg-surface-warning-default, #fffbeb)",[k.VALIDATED]:"var(--ui-color-bg-surface-success-default, #f0fdf4)"},fr={[k.PENDING]:"var(--ui-color-red-500, #ef4444)",[k.DEV_FIXED]:"var(--ui-color-orange-500, #f59e0b)",[k.VALIDATED]:"var(--ui-color-green-500, #22c55e)"};function Le(e){const o=e.trim().split(/\s+/);return o.length>=2?(o[0][0]+o[o.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()||"?"}const ze=()=>s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{marginRight:4,flexShrink:0},children:s.jsx("path",{d:"M10 3L4.5 8.5L2 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),Ae=({color:e})=>s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",style:{flexShrink:0},children:[s.jsx("path",{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",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),s.jsx("path",{d:"M8 10h.01M12 10h.01M16 10h.01",stroke:"var(--ui-color-white, #fff)",strokeWidth:"1.5",strokeLinecap:"round"})]}),Fe=e=>({position:"fixed",width:dr,height:dr,borderRadius:"50%",backgroundColor:K[e]??K[k.PENDING],color:"var(--ui-color-text-on-color, #fff)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontFamily:"var(--ui-font-family-ui, 'Inter', sans-serif)",boxShadow:"0 2px 8px var(--ui-color-black-alpha-20, rgba(0,0,0,0.2))",zIndex:999998,border:"2px solid var(--ui-color-white, #fff)"}),Ne={position:"fixed",width:Cr,minWidth:Cr,maxWidth:Cr,boxSizing:"border-box",backgroundColor:M.cardBg,borderRadius:"var(--ui-radius_12, 12px)",boxShadow:M.shadow,fontSize:"var(--ui-font-size-sm, 14px)",fontFamily:"var(--ui-font-family-ui, 'Inter', sans-serif)",zIndex:999999,pointerEvents:"auto"},Me={display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--ui-positive-Value_250, 10px)",borderBottom:`1px solid ${M.border}`,padding:"var(--ui-positive-Value_300, 12px)"},We=e=>({width:40,height:40,borderRadius:"50%",backgroundColor:K[e]??K[k.PENDING],color:"var(--ui-color-text-on-color, #fff)",border:"2px solid var(--ui-color-white, #fff)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"var(--ui-font-size-sm, 14px)",fontWeight:"var(--ui-font-weight-bold, 700)",flexShrink:0,overflow:"hidden"}),Be=a.memo(function({reviewer:o,status:t}){const i=o==null?void 0:o.image_url,l=(o==null?void 0:o.name)??"Revisor",c=We(t);if(i&&i.trim()){const p=K[t]??K[k.PENDING];return s.jsx("div",{style:{...c,border:`2px solid ${p}`},children:s.jsx("img",{src:i,alt:l,style:{width:"100%",height:"100%",objectFit:"cover"},loading:"lazy"})})}return s.jsx("div",{style:c,children:Le(l)})}),Ye={flexShrink:0,width:"var(--ui-positive-Value_600, 24px)",height:"var(--ui-positive-Value_600, 24px)",padding:0,border:"none",borderRadius:"var(--ui-radius_6, 6px)",backgroundColor:"transparent",color:M.textDark,cursor:"pointer",fontSize:"var(--ui-positive-Value_450, 18px)",lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},Ue=e=>{const o=fr[e]??fr[k.PENDING];return{display:"inline-flex",alignItems:"center",padding:"var(--ui-positive-Value_50, 4px) var(--ui-positive-Value_100, 10px)",borderRadius:"var(--ui-radius_full, 9999px)",fontSize:"8px",fontWeight:"var(--ui-font-weight-bold, 700)",fontFamily:"var(--ui-font-family-ui, 'Inter', sans-serif)",textTransform:"uppercase",letterSpacing:"0.02em",backgroundColor:Br[e]??Br[k.PENDING],color:o,border:`1px solid ${o}`}},Ge={display:"block",fontSize:"var(--ui-font-size-2xs, 10px)",fontWeight:"var(--ui-font-weight-semibold, 600)",fontFamily:"var(--ui-font-family-ui, 'Inter', sans-serif)",color:M.textMuted,textTransform:"uppercase",letterSpacing:"0.04em"},He={width:"100%",padding:"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_300, 12px)",paddingRight:"var(--ui-positive-Value_800, 32px)",fontSize:"var(--ui-font-size-xs, 13px)",fontFamily:"var(--ui-font-family-ui, 'Inter', sans-serif)",borderRadius:"var(--ui-radius_8, 8px)",border:`1px solid ${M.border}`,backgroundColor:M.cardBg,color:M.textDark,cursor:"pointer",appearance:"none",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")`,backgroundRepeat:"no-repeat",backgroundPosition:"right var(--ui-positive-Value_250, 10px) center"},Xe={display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--ui-positive-Value_200, 8px)",padding:"var(--ui-positive-Value_300, 12px)",borderTop:`1px solid ${M.border}`,backgroundColor:M.cardFooterBg},Yr={minWidth:100,padding:"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_350, 14px)",fontSize:"var(--ui-font-size-xs, 13px)",fontWeight:"var(--ui-font-weight-semibold, 600)",fontFamily:"var(--ui-font-family-ui, 'Inter', sans-serif)",borderRadius:"var(--ui-radius_8, 8px)",cursor:"pointer",border:"none"},Je={...Yr,backgroundColor:"transparent",color:M.textDark},vr="review-layer-resolve-btn",Ze=["pending","dev_fixed","validated"],Qe={...Yr,backgroundColor:"var(--ui-color-bg-fill-success-default, #22c55e)",color:"var(--ui-color-text-on-color, #fff)"};function Ke({comment:e,offset:o={dx:0,dy:0},apiUrl:t,apiKey:i,onStatusChange:l,reviewMode:c=!1}){var ar,lr;const[p,b]=a.useState(!1),[f,_]=a.useState(!1),[y,m]=a.useState(()=>cr(e)),[j,C]=a.useState(!1),[V,F]=a.useState(null),L=a.useRef(null),d=a.useRef(null),g=a.useRef(null),I=a.useCallback(()=>{m(cr(e))},[e]);a.useEffect(()=>{I()},[I]),a.useEffect(()=>{if(!(typeof window>"u"))return window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[I]);const A=a.useCallback(()=>{L.current!==null&&(clearTimeout(L.current),L.current=null)},[]),H=a.useCallback(()=>{c||(A(),b(!0))},[c,A]),or=a.useCallback(()=>{f||(L.current=setTimeout(()=>{L.current=null,b(!1)},Wr))},[f]),nr=a.useCallback(()=>{A(),b(!0)},[A]),ir=a.useCallback(()=>{f||(L.current=setTimeout(()=>{L.current=null,b(!1)},Wr))},[f]),X=a.useCallback(()=>{if(c){f&&(_(!1),b(!1));return}f?(_(!1),b(!1)):(_(!0),b(!0))},[c,f]);a.useEffect(()=>{if(!f)return;const E=Z=>{var hr,xr;const ur=Z.target;(hr=d.current)!=null&&hr.contains(ur)||(xr=g.current)!=null&&xr.contains(ur)||(_(!1),b(!1))};return document.addEventListener("mousedown",E,!0),()=>document.removeEventListener("mousedown",E,!0)},[f]),a.useEffect(()=>()=>A(),[A]),a.useEffect(()=>{c&&(_(!1),b(!1))},[c]);const w=y.x+o.dx,P=y.y+o.dy,{x:z,y:T}=Rr(w,P,dr/2),U=p&&!f,B=a.useCallback(()=>{_(!1),b(!1)},[]),J=a.useCallback(async E=>{if(E!==e.status){F(null),C(!0);try{await we(t,i,e.id,E),l()}catch(Z){F(Z instanceof Error?Z.message:"Error al actualizar")}finally{C(!1)}}},[t,i,e.id,e.status,l]),gr=a.useCallback(async()=>{F(null),C(!0);try{await _e(t,i,e.id),l(),B()}catch(E){F(E instanceof Error?E.message:"Error al eliminar")}finally{C(!1)}},[t,i,e.id,l,B]),br=a.useMemo(()=>({...Fe(e.status),left:z,top:T,transform:"translate(-50%, -50%)"}),[e.status,z,T]);return s.jsxs(s.Fragment,{children:[s.jsx(De,{selector:e.selector,active:U,fallbackComment:e,outlineColor:fr[e.status]??fr[k.PENDING]}),s.jsx("div",{ref:d,role:"button",tabIndex:0,"aria-label":`Comentario: ${e.message.slice(0,30)}...`,"aria-expanded":p,style:br,onMouseEnter:H,onMouseLeave:or,onClick:X,children:s.jsx(Ae,{color:"var(--ui-color-white, #fff)"})}),p&&s.jsxs("div",{ref:g,role:"dialog","aria-label":"Detalle del comentario",style:{...Ne,left:z+dr/2+6,top:T},onMouseEnter:nr,onMouseLeave:ir,children:[s.jsxs("div",{style:Me,children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flex:1,minWidth:0},children:[s.jsx(Be,{reviewer:e.reviewer,status:e.status}),s.jsxs("div",{children:[s.jsx("div",{style:{fontWeight:700,fontSize:14,color:M.textDark},children:((ar=e.reviewer)==null?void 0:ar.name)??"Revisor"}),s.jsx("div",{style:{fontSize:12,color:M.textMuted},children:((lr=e.reviewer)==null?void 0:lr.job_title)??"Revisor"})]})]}),s.jsx("button",{type:"button","aria-label":e.status===k.VALIDATED?"Eliminar comentario":"Cerrar",style:Ye,disabled:j,onClick:E=>{E.stopPropagation(),e.status===k.VALIDATED?gr():B()},onMouseDown:E=>E.stopPropagation(),children:"✕"})]}),s.jsxs("div",{style:{padding:12,display:"flex",alignItems:"flex-start",flexDirection:"column",gap:4},children:[s.jsxs("div",{style:Ue(e.status),children:[e.status===k.VALIDATED&&s.jsx(ze,{}),Oe[e.status]??e.status]}),s.jsx("div",{style:{color:M.textDark,lineHeight:1.5,marginBottom:12,marginTop:12},children:e.message}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[s.jsx("label",{style:Ge,htmlFor:`comment-status-${e.id}`,children:"Cambiar estado"}),s.jsx("select",{id:`comment-status-${e.id}`,style:He,value:e.status,disabled:j,onChange:E=>J(E.target.value),onMouseDown:E=>E.stopPropagation(),"aria-label":"Cambiar estado del comentario",children:Ze.map(E=>s.jsx("option",{value:E,children:Ie[E]},E))}),V&&s.jsx("div",{style:{marginTop:8,fontSize:11,color:"var(--ui-color-text-danger-default, rgb(240, 69, 69))"},children:V})]})]}),s.jsxs("div",{style:Xe,children:[s.jsx("button",{type:"button",style:Je,onMouseDown:E=>E.stopPropagation(),onClick:E=>{E.stopPropagation(),B()},children:"Cerrar"}),e.status!==k.VALIDATED&&s.jsxs(s.Fragment,{children:[s.jsx("style",{children:`
|
|
31
|
+
.${vr}:hover:not(:disabled) {
|
|
32
|
+
background-color: var(--ui-color-bg-fill-success-hover, #16a34a) !important;
|
|
33
|
+
}
|
|
34
|
+
.${vr}:active:not(:disabled) {
|
|
35
|
+
background-color: var(--ui-color-bg-fill-success-pressed, #15803d) !important;
|
|
36
|
+
}
|
|
37
|
+
.${vr}:disabled {
|
|
38
|
+
background-color: var(--ui-color-bg-fill-success-default, #22c55e) !important;
|
|
39
|
+
opacity: 0.7;
|
|
40
|
+
cursor: not-allowed;
|
|
41
|
+
}
|
|
42
|
+
`}),s.jsx("button",{type:"button",className:vr,style:Qe,disabled:j,onMouseDown:E=>E.stopPropagation(),onClick:E=>{E.stopPropagation(),J("validated")},children:"Validar"})]})]})]})]})}const qe=a.memo(Ke),$e=25,rt=36;function et(e){const o=new Map;for(let t=0;t<e.length;t++){const i=e[t],{x:l,y:c}=cr(i),{x:p,y:b}=Rr(l,c);let f=0;for(let _=0;_<t;_++){const{x:y,y:m}=cr(e[_]),{x:j,y:C}=Rr(y,m);Math.hypot(p-j,b-C)<$e&&f++}o.set(i.id,{dx:f*rt,dy:0})}return o}function tt(){return typeof window>"u"?"":`${window.innerWidth}x${window.innerHeight}`}function ot({apiUrl:e,apiKey:o,reviewMode:t,setReviewMode:i,reviewers:l,comments:c,loadComments:p,commentsLoadFailed:b=!1}){const[f,_]=a.useState(null),y=a.useRef(null),[m,j]=a.useState(null),C=a.useCallback(()=>{f&&(f.style.outline="",f.style.outlineOffset="",_(null))},[f]),V=a.useCallback(()=>{y.current&&(y.current.style.outline="",y.current.style.outlineOffset="",y.current=null)},[]);a.useEffect(()=>{t||(C(),V())},[t,C,V]),a.useEffect(()=>{if(typeof document>"u")return;const w=document.body.style.cursor;return m?document.body.style.cursor="default":t&&(document.body.style.cursor="crosshair"),()=>{document.body.style.cursor=w}},[t,m]);const F=a.useCallback(w=>{var z;if(!w||typeof document>"u"||w===document.body||w===document.documentElement)return!0;const P=(z=w.tagName)==null?void 0:z.toUpperCase();return P==="BODY"||P==="HTML"?!0:w.parentElement!==document.body?!1:w.id==="root"||w.getAttribute("data-review-layer-host")!=null||document.body.children.length===1},[]),L=a.useCallback(w=>{if(!t||m)return;const P=w.target.nodeType===Node.ELEMENT_NODE?w.target:w.target.parentElement;!P||F(P)||(C(),_(P),P.style.outline="2px solid var(--ui-color-bg-fill-danger-default, #ff4d4f)",P.style.outlineOffset="2px")},[t,m,C,F]),d=a.useCallback(w=>{var z;if(m)return;const P=w.relatedTarget;f&&(!P||!f.contains(P))&&!(P&&((z=f.contains)!=null&&z.call(f,P)))&&C()},[f,m,C]),g=a.useCallback(w=>{if(!t||m)return;const P=w.target;if(!P||F(P)||P.closest("[data-review-layer-root]"))return;w.preventDefault(),w.stopPropagation(),C();const z=P;y.current=z,z.style.outline="2px solid var(--ui-color-bg-fill-danger-default, #ff4d4f)",z.style.outlineOffset="2px";const T=z.getBoundingClientRect(),U=ve(P),{relativeX:B,relativeY:J}=be(T);j({position:{x:T.left+T.width/2,y:T.bottom},payload:{selector:U,x:Math.round(T.left),y:Math.round(T.top),relativeX:B,relativeY:J,width:Math.round(T.width),height:Math.round(T.height),url:typeof window<"u"&&window.location.pathname||"/",viewport:tt(),userAgent:typeof navigator<"u"?navigator.userAgent:"",pageTitle:typeof document<"u"?document.title:""}})},[t,m,C,F]);a.useEffect(()=>{if(t)return document.addEventListener("mouseover",L,!0),document.addEventListener("mouseout",d,!0),document.addEventListener("click",g,!0),()=>{document.removeEventListener("mouseover",L,!0),document.removeEventListener("mouseout",d,!0),document.removeEventListener("click",g,!0)}},[t,L,d,g]);const[I,A]=a.useState(0);a.useEffect(()=>{if(typeof window>"u")return;const w=()=>A(P=>P+1);return window.addEventListener("resize",w),window.addEventListener("scroll",w,!0),()=>{window.removeEventListener("resize",w),window.removeEventListener("scroll",w,!0)}},[]);const H=a.useMemo(()=>et(c),[c,I]),or=a.useCallback(()=>{V(),j(null)},[V]),nr={position:"fixed",inset:0,zIndex:999999,pointerEvents:"none",cursor:t?"crosshair":void 0},ir=s.jsxs(s.Fragment,{children:[s.jsx("div",{style:nr,"aria-hidden":!0,"data-review-layer-root":!0}),t&&s.jsxs("div",{"data-review-layer-root":!0,style:{position:"fixed",top:"var(--ui-positive-Value_250, 10px)",left:"var(--ui-positive-Value_250, 10px)",zIndex:1e6,display:"flex",alignItems:"center",gap:"var(--ui-positive-Value_250, 10px)",padding:"var(--ui-positive-Value_150, 6px) var(--ui-positive-Value_300, 12px)",backgroundColor:"var(--ui-color-bg-fill-danger-default, #ff4d4f)",color:"var(--ui-color-text-on-color, #fff)",borderRadius:"var(--ui-radius_6, 6px)",fontSize:"var(--ui-font-size-xs, 12px)",fontWeight:"var(--ui-font-weight-medium, 500)",pointerEvents:"auto"},children:[s.jsx("span",{children:"Modo revisión (Shift+R para salir)"}),s.jsx("button",{type:"button",onClick:()=>i(!1),"aria-label":"Salir del modo revisión",style:{padding:0,margin:0,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:"var(--ui-radius_6, 6px)",backgroundColor:"rgba(255,255,255,0.2)",color:"inherit",fontSize:14,lineHeight:1,cursor:"pointer"},children:"×"})]}),b&&s.jsxs("div",{style:{position:"fixed",bottom:"var(--ui-positive-Value_400, 16px)",left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:"var(--ui-positive-Value_250, 10px)",padding:"var(--ui-positive-Value_200, 8px) var(--ui-positive-Value_350, 14px)",backgroundColor:"var(--ui-color-bg-surface-default, #fff)",border:"1px solid var(--ui-color-border-subtle, #e8e8e8)",borderRadius:"var(--ui-radius_8, 8px)",boxShadow:"0 2px 12px var(--ui-color-black-alpha-10, rgba(0,0,0,0.1))",fontSize:"var(--ui-font-size-xs, 12px)",color:"var(--ui-color-text-primary, #333)",zIndex:999997,pointerEvents:"auto"},children:[s.jsx("span",{children:"No se pudo conectar. Mostrando últimos datos guardados. Reintentar no garantiza respuesta hasta que el servicio esté activo."}),s.jsx("button",{type:"button",onClick:()=>p(),style:{padding:"var(--ui-positive-Value_100, 4px) var(--ui-positive-Value_250, 10px)",fontSize:"var(--ui-font-size-xs, 12px)",fontWeight:"var(--ui-font-weight-semibold, 600)",backgroundColor:"var(--ui-color-bg-fill-success-default, rgb(33, 196, 94))",color:"var(--ui-color-text-on-color, #fff)",border:"none",borderRadius:"var(--ui-radius_6, 6px)",cursor:"pointer"},children:"Reintentar"})]}),c.map(w=>s.jsx("div",{"data-review-layer-pin":!0,style:{pointerEvents:"auto"},children:s.jsx(qe,{comment:w,offset:H.get(w.id),apiUrl:e,apiKey:o,onStatusChange:p,reviewMode:t})},w.id)),m&&s.jsx("div",{"data-review-layer-modal":!0,style:{pointerEvents:"auto"},children:s.jsx(je,{apiUrl:e,apiKey:o,reviewers:l,position:m.position,payload:m.payload,onClose:or,onSuccess:p})})]}),X=typeof document<"u"?document.body:null;return X?Ar.createPortal(ir,X):null}const nt=`/**\r
|
|
43
|
+
* Tokens de diseño UI para review-layer-react.\r
|
|
44
|
+
* Las variables se inyectan en :root al montar ReviewProvider.\r
|
|
45
|
+
* Puedes sobrescribirlas en tu app para adaptar el tema.\r
|
|
46
|
+
*/\r
|
|
47
|
+
:root {\r
|
|
48
|
+
/* Colores base */\r
|
|
49
|
+
--ui-color-white: rgb(255, 255, 255);\r
|
|
50
|
+
--ui-color-black: rgb(0, 0, 0);\r
|
|
51
|
+
--ui-color-red-50: rgb(255, 242, 242);\r
|
|
52
|
+
--ui-color-red-100: rgb(252, 227, 227);\r
|
|
53
|
+
--ui-color-red-200: rgb(250, 189, 189);\r
|
|
54
|
+
--ui-color-red-300: rgb(245, 148, 148);\r
|
|
55
|
+
--ui-color-red-400: rgb(242, 107, 107);\r
|
|
56
|
+
--ui-color-red-500: rgb(240, 69, 69);\r
|
|
57
|
+
--ui-color-red-600: rgb(212, 61, 61);\r
|
|
58
|
+
--ui-color-red-700: rgb(184, 51, 51);\r
|
|
59
|
+
--ui-color-red-800: rgb(156, 43, 43);\r
|
|
60
|
+
--ui-color-red-900: rgb(128, 36, 36);\r
|
|
61
|
+
--ui-color-orange-50: rgb(255, 247, 242);\r
|
|
62
|
+
--ui-color-orange-100: rgb(252, 237, 227);\r
|
|
63
|
+
--ui-color-orange-200: rgb(252, 209, 176);\r
|
|
64
|
+
--ui-color-orange-300: rgb(250, 176, 125);\r
|
|
65
|
+
--ui-color-orange-400: rgb(250, 145, 74);\r
|
|
66
|
+
--ui-color-orange-500: rgb(250, 115, 23);\r
|
|
67
|
+
--ui-color-orange-600: rgb(219, 102, 20);\r
|
|
68
|
+
--ui-color-orange-700: rgb(189, 87, 18);\r
|
|
69
|
+
--ui-color-orange-800: rgb(158, 74, 13);\r
|
|
70
|
+
--ui-color-orange-900: rgb(128, 59, 10);\r
|
|
71
|
+
--ui-color-yellow-50: rgb(255, 250, 242);\r
|
|
72
|
+
--ui-color-yellow-100: rgb(252, 245, 227);\r
|
|
73
|
+
--ui-color-yellow-200: rgb(247, 230, 173);\r
|
|
74
|
+
--ui-color-yellow-300: rgb(242, 214, 117);\r
|
|
75
|
+
--ui-color-yellow-400: rgb(240, 196, 64);\r
|
|
76
|
+
--ui-color-yellow-500: rgb(235, 179, 8);\r
|
|
77
|
+
--ui-color-yellow-600: rgb(209, 158, 8);\r
|
|
78
|
+
--ui-color-yellow-700: rgb(181, 140, 5);\r
|
|
79
|
+
--ui-color-yellow-800: rgb(156, 120, 5);\r
|
|
80
|
+
--ui-color-yellow-900: rgb(128, 97, 5);\r
|
|
81
|
+
--ui-color-lime-50: rgb(250, 255, 242);\r
|
|
82
|
+
--ui-color-lime-100: rgb(242, 252, 227);\r
|
|
83
|
+
--ui-color-lime-200: rgb(214, 240, 176);\r
|
|
84
|
+
--ui-color-lime-300: rgb(186, 227, 125);\r
|
|
85
|
+
--ui-color-lime-400: rgb(161, 217, 74);\r
|
|
86
|
+
--ui-color-lime-500: rgb(133, 204, 23);\r
|
|
87
|
+
--ui-color-lime-600: rgb(120, 186, 20);\r
|
|
88
|
+
--ui-color-lime-700: rgb(107, 166, 18);\r
|
|
89
|
+
--ui-color-lime-800: rgb(97, 148, 15);\r
|
|
90
|
+
--ui-color-lime-900: rgb(84, 128, 13);\r
|
|
91
|
+
--ui-color-green-50: rgb(242, 255, 245);\r
|
|
92
|
+
--ui-color-green-100: rgb(227, 252, 237);\r
|
|
93
|
+
--ui-color-green-200: rgb(179, 240, 201);\r
|
|
94
|
+
--ui-color-green-300: rgb(130, 224, 166);\r
|
|
95
|
+
--ui-color-green-400: rgb(84, 212, 130);\r
|
|
96
|
+
--ui-color-green-500: rgb(33, 196, 94);\r
|
|
97
|
+
--ui-color-green-600: rgb(31, 181, 87);\r
|
|
98
|
+
--ui-color-green-700: rgb(28, 163, 79);\r
|
|
99
|
+
--ui-color-green-800: rgb(26, 145, 69);\r
|
|
100
|
+
--ui-color-green-900: rgb(23, 128, 61);\r
|
|
101
|
+
--ui-color-cyan-50: rgb(242, 252, 255);\r
|
|
102
|
+
--ui-color-cyan-100: rgb(227, 250, 252);\r
|
|
103
|
+
--ui-color-cyan-200: rgb(171, 232, 242);\r
|
|
104
|
+
--ui-color-cyan-300: rgb(117, 217, 232);\r
|
|
105
|
+
--ui-color-cyan-400: rgb(61, 199, 222);\r
|
|
106
|
+
--ui-color-cyan-500: rgb(5, 181, 212);\r
|
|
107
|
+
--ui-color-cyan-600: rgb(5, 163, 191);\r
|
|
108
|
+
--ui-color-cyan-700: rgb(5, 145, 171);\r
|
|
109
|
+
--ui-color-cyan-800: rgb(5, 128, 148);\r
|
|
110
|
+
--ui-color-cyan-900: rgb(5, 110, 128);\r
|
|
111
|
+
--ui-color-azure-50: rgb(242, 250, 255);\r
|
|
112
|
+
--ui-color-azure-100: rgb(227, 245, 252);\r
|
|
113
|
+
--ui-color-azure-200: rgb(173, 224, 247);\r
|
|
114
|
+
--ui-color-azure-300: rgb(120, 204, 242);\r
|
|
115
|
+
--ui-color-azure-400: rgb(69, 186, 237);\r
|
|
116
|
+
--ui-color-azure-500: rgb(13, 166, 232);\r
|
|
117
|
+
--ui-color-azure-600: rgb(13, 148, 207);\r
|
|
118
|
+
--ui-color-azure-700: rgb(10, 128, 181);\r
|
|
119
|
+
--ui-color-azure-800: rgb(10, 110, 156);\r
|
|
120
|
+
--ui-color-azure-900: rgb(8, 89, 128);\r
|
|
121
|
+
--ui-color-blue-50: rgb(242, 245, 255);\r
|
|
122
|
+
--ui-color-blue-100: rgb(227, 232, 252);\r
|
|
123
|
+
--ui-color-blue-200: rgb(184, 196, 237);\r
|
|
124
|
+
--ui-color-blue-300: rgb(140, 161, 222);\r
|
|
125
|
+
--ui-color-blue-400: rgb(97, 125, 209);\r
|
|
126
|
+
--ui-color-blue-500: rgb(54, 89, 194);\r
|
|
127
|
+
--ui-color-blue-600: rgb(51, 82, 176);\r
|
|
128
|
+
--ui-color-blue-700: rgb(46, 74, 161);\r
|
|
129
|
+
--ui-color-blue-800: rgb(41, 66, 145);\r
|
|
130
|
+
--ui-color-blue-900: rgb(36, 59, 128);\r
|
|
131
|
+
--ui-color-violet-50: rgb(245, 242, 255);\r
|
|
132
|
+
--ui-color-violet-100: rgb(237, 227, 252);\r
|
|
133
|
+
--ui-color-violet-200: rgb(209, 186, 250);\r
|
|
134
|
+
--ui-color-violet-300: rgb(181, 143, 245);\r
|
|
135
|
+
--ui-color-violet-400: rgb(153, 102, 242);\r
|
|
136
|
+
--ui-color-violet-500: rgb(125, 59, 237);\r
|
|
137
|
+
--ui-color-violet-600: rgb(110, 51, 209);\r
|
|
138
|
+
--ui-color-violet-700: rgb(97, 46, 184);\r
|
|
139
|
+
--ui-color-violet-800: rgb(82, 38, 156);\r
|
|
140
|
+
--ui-color-violet-900: rgb(66, 31, 128);\r
|
|
141
|
+
--ui-color-magenta-50: rgb(255, 242, 247);\r
|
|
142
|
+
--ui-color-magenta-100: rgb(252, 227, 240);\r
|
|
143
|
+
--ui-color-magenta-200: rgb(247, 184, 214);\r
|
|
144
|
+
--ui-color-magenta-300: rgb(245, 140, 186);\r
|
|
145
|
+
--ui-color-magenta-400: rgb(240, 94, 161);\r
|
|
146
|
+
--ui-color-magenta-500: rgb(235, 51, 135);\r
|
|
147
|
+
--ui-color-magenta-600: rgb(209, 46, 120);\r
|
|
148
|
+
--ui-color-magenta-700: rgb(181, 41, 105);\r
|
|
149
|
+
--ui-color-magenta-800: rgb(156, 33, 89);\r
|
|
150
|
+
--ui-color-magenta-900: rgb(128, 28, 74);\r
|
|
151
|
+
--ui-color-rose-50: rgb(255, 242, 245);\r
|
|
152
|
+
--ui-color-rose-100: rgb(252, 227, 232);\r
|
|
153
|
+
--ui-color-rose-200: rgb(245, 179, 194);\r
|
|
154
|
+
--ui-color-rose-300: rgb(240, 128, 153);\r
|
|
155
|
+
--ui-color-rose-400: rgb(232, 79, 112);\r
|
|
156
|
+
--ui-color-rose-500: rgb(224, 28, 71);\r
|
|
157
|
+
--ui-color-rose-600: rgb(201, 26, 64);\r
|
|
158
|
+
--ui-color-rose-700: rgb(176, 23, 56);\r
|
|
159
|
+
--ui-color-rose-800: rgb(153, 20, 48);\r
|
|
160
|
+
--ui-color-rose-900: rgb(128, 15, 41);\r
|
|
161
|
+
--ui-color-light-gray-50: rgb(247, 247, 250);\r
|
|
162
|
+
--ui-color-light-gray-100: rgb(240, 242, 242);\r
|
|
163
|
+
--ui-color-light-gray-200: rgb(224, 227, 230);\r
|
|
164
|
+
--ui-color-light-gray-300: rgb(212, 214, 217);\r
|
|
165
|
+
--ui-color-light-gray-400: rgb(199, 199, 204);\r
|
|
166
|
+
--ui-color-light-gray-500: rgb(186, 189, 191);\r
|
|
167
|
+
--ui-color-light-gray-600: rgb(171, 173, 179);\r
|
|
168
|
+
--ui-color-light-gray-700: rgb(158, 163, 166);\r
|
|
169
|
+
--ui-color-light-gray-800: rgb(145, 148, 153);\r
|
|
170
|
+
--ui-color-light-gray-900: rgb(133, 135, 140);\r
|
|
171
|
+
--ui-color-dark-gray-50: rgb(120, 122, 128);\r
|
|
172
|
+
--ui-color-dark-gray-100: rgb(107, 110, 115);\r
|
|
173
|
+
--ui-color-dark-gray-200: rgb(97, 99, 105);\r
|
|
174
|
+
--ui-color-dark-gray-300: rgb(89, 89, 94);\r
|
|
175
|
+
--ui-color-dark-gray-400: rgb(77, 79, 84);\r
|
|
176
|
+
--ui-color-dark-gray-500: rgb(69, 69, 74);\r
|
|
177
|
+
--ui-color-dark-gray-600: rgb(59, 61, 64);\r
|
|
178
|
+
--ui-color-dark-gray-700: rgb(48, 51, 54);\r
|
|
179
|
+
--ui-color-dark-gray-800: rgb(38, 41, 43);\r
|
|
180
|
+
--ui-color-dark-gray-900: rgb(31, 31, 33);\r
|
|
181
|
+
--ui-color-black-alpha-transparent: rgba(0, 0, 0, 0);\r
|
|
182
|
+
--ui-color-black-alpha-5: rgba(0, 0, 0, 0.05);\r
|
|
183
|
+
--ui-color-black-alpha-10: rgba(0, 0, 0, 0.1);\r
|
|
184
|
+
--ui-color-black-alpha-20: rgba(0, 0, 0, 0.2);\r
|
|
185
|
+
--ui-color-black-alpha-30: rgba(0, 0, 0, 0.3);\r
|
|
186
|
+
--ui-color-black-alpha-40: rgba(0, 0, 0, 0.4);\r
|
|
187
|
+
--ui-color-black-alpha-50: rgba(0, 0, 0, 0.5);\r
|
|
188
|
+
--ui-color-black-alpha-60: rgba(0, 0, 0, 0.6);\r
|
|
189
|
+
--ui-color-black-alpha-70: rgba(0, 0, 0, 0.7);\r
|
|
190
|
+
--ui-color-black-alpha-80: rgba(0, 0, 0, 0.8);\r
|
|
191
|
+
--ui-color-black-alpha-90: rgba(0, 0, 0, 0.9);\r
|
|
192
|
+
\r
|
|
193
|
+
/* Espaciado positivo */\r
|
|
194
|
+
--ui-positive-Value_0: 0;\r
|
|
195
|
+
--ui-positive-Value_12: 0.66px;\r
|
|
196
|
+
--ui-positive-Value_25: 1px;\r
|
|
197
|
+
--ui-positive-Value_50: 2px;\r
|
|
198
|
+
--ui-positive-Value_100: 4px;\r
|
|
199
|
+
--ui-positive-Value_150: 6px;\r
|
|
200
|
+
--ui-positive-Value_200: 8px;\r
|
|
201
|
+
--ui-positive-Value_250: 10px;\r
|
|
202
|
+
--ui-positive-Value_275: 11px;\r
|
|
203
|
+
--ui-positive-Value_300: 12px;\r
|
|
204
|
+
--ui-positive-Value_325: 13px;\r
|
|
205
|
+
--ui-positive-Value_350: 14px;\r
|
|
206
|
+
--ui-positive-Value_400: 16px;\r
|
|
207
|
+
--ui-positive-Value_450: 18px;\r
|
|
208
|
+
--ui-positive-Value_500: 20px;\r
|
|
209
|
+
--ui-positive-Value_600: 24px;\r
|
|
210
|
+
--ui-positive-Value_700: 28px;\r
|
|
211
|
+
--ui-positive-Value_750: 30px;\r
|
|
212
|
+
--ui-positive-Value_800: 32px;\r
|
|
213
|
+
--ui-positive-Value_900: 36px;\r
|
|
214
|
+
--ui-positive-Value_1000: 40px;\r
|
|
215
|
+
--ui-positive-Value_1200: 48px;\r
|
|
216
|
+
--ui-positive-Value_1400: 56px;\r
|
|
217
|
+
--ui-positive-Value_1600: 64px;\r
|
|
218
|
+
--ui-positive-Value_2000: 80px;\r
|
|
219
|
+
--ui-positive-Value_2400: 96px;\r
|
|
220
|
+
--ui-positive-Value_2800: 112px;\r
|
|
221
|
+
--ui-positive-Value_3200: 128px;\r
|
|
222
|
+
--ui-positive-Value_full: 9999px;\r
|
|
223
|
+
\r
|
|
224
|
+
/* Sombras */\r
|
|
225
|
+
--ui-shadow-01-x: 0;\r
|
|
226
|
+
--ui-shadow-01-y: 1px;\r
|
|
227
|
+
--ui-shadow-01-blur: 2px;\r
|
|
228
|
+
--ui-shadow-01-Spread: 0;\r
|
|
229
|
+
--ui-shadow-02-x: 0;\r
|
|
230
|
+
--ui-shadow-02-y: 2px;\r
|
|
231
|
+
--ui-shadow-02-blur: 4px;\r
|
|
232
|
+
--ui-shadow-02-Spread: -1px;\r
|
|
233
|
+
--ui-shadow-03-x: 0;\r
|
|
234
|
+
--ui-shadow-03-y: 4px;\r
|
|
235
|
+
--ui-shadow-03-blur: 8px;\r
|
|
236
|
+
--ui-shadow-03-Spread: -2px;\r
|
|
237
|
+
--ui-shadow-04-x: 0;\r
|
|
238
|
+
--ui-shadow-04-y: 8px;\r
|
|
239
|
+
--ui-shadow-04-blur: 16px;\r
|
|
240
|
+
--ui-shadow-04-Spread: -4px;\r
|
|
241
|
+
--ui-shadow-05-x: 0;\r
|
|
242
|
+
--ui-shadow-05-y: 16px;\r
|
|
243
|
+
--ui-shadow-05-blur: 24px;\r
|
|
244
|
+
--ui-shadow-05-Spread: -8px;\r
|
|
245
|
+
--ui-shadow-01-Color: var(--ui-color-black-alpha-10);\r
|
|
246
|
+
--ui-shadow-02-Color: var(--ui-color-black-alpha-20);\r
|
|
247
|
+
--ui-shadow-03-Color: var(--ui-color-black-alpha-20);\r
|
|
248
|
+
--ui-shadow-04-Color: var(--ui-color-black-alpha-30);\r
|
|
249
|
+
--ui-shadow-05-Color: var(--ui-color-black-alpha-30);\r
|
|
250
|
+
\r
|
|
251
|
+
/* Z-index */\r
|
|
252
|
+
--ui-z-hide: -1;\r
|
|
253
|
+
--ui-z-base: 0;\r
|
|
254
|
+
--ui-z-raised: 100;\r
|
|
255
|
+
--ui-z-sticky: 200;\r
|
|
256
|
+
--ui-z-shell: 300;\r
|
|
257
|
+
--ui-z-dropdown: 400;\r
|
|
258
|
+
--ui-z-popover: 500;\r
|
|
259
|
+
--ui-z-tooltip: 600;\r
|
|
260
|
+
--ui-z-modalBackdrop: 690;\r
|
|
261
|
+
--ui-z-modal: 700;\r
|
|
262
|
+
--ui-z-toast: 800;\r
|
|
263
|
+
--ui-z-overlay: 900;\r
|
|
264
|
+
--ui-z-max: 99999;\r
|
|
265
|
+
\r
|
|
266
|
+
/* Tipografía */\r
|
|
267
|
+
--ui-font-family-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;\r
|
|
268
|
+
--ui-font-family-mono: "IBM Plex Mono";\r
|
|
269
|
+
--ui-font-weight-regular: 400;\r
|
|
270
|
+
--ui-font-weight-medium: 500;\r
|
|
271
|
+
--ui-font-weight-semibold: 600;\r
|
|
272
|
+
--ui-font-weight-bold: 700;\r
|
|
273
|
+
\r
|
|
274
|
+
/* Radios */\r
|
|
275
|
+
--ui-radius_0: 0;\r
|
|
276
|
+
--ui-radius_2: 2px;\r
|
|
277
|
+
--ui-radius_4: 4px;\r
|
|
278
|
+
--ui-radius_6: 6px;\r
|
|
279
|
+
--ui-radius_8: 8px;\r
|
|
280
|
+
--ui-radius_10: 10px;\r
|
|
281
|
+
--ui-radius_12: 12px;\r
|
|
282
|
+
--ui-radius_16: 16px;\r
|
|
283
|
+
--ui-radius_24: 24px;\r
|
|
284
|
+
--ui-radius_full: 9999px;\r
|
|
285
|
+
\r
|
|
286
|
+
/* Semánticos: texto */\r
|
|
287
|
+
--ui-color-text-primary: var(--ui-color-dark-gray-700);\r
|
|
288
|
+
--ui-color-text-secondary: var(--ui-color-dark-gray-300);\r
|
|
289
|
+
--ui-color-text-tertiary: var(--ui-color-dark-gray-100);\r
|
|
290
|
+
--ui-color-text-disabled: var(--ui-color-light-gray-500);\r
|
|
291
|
+
--ui-color-text-on-color: var(--ui-color-white);\r
|
|
292
|
+
--ui-color-text-danger-default: var(--ui-color-red-700);\r
|
|
293
|
+
--ui-color-text-danger-hover: var(--ui-color-red-800);\r
|
|
294
|
+
--ui-color-text-danger-pressed: var(--ui-color-red-900);\r
|
|
295
|
+
\r
|
|
296
|
+
/* Semánticos: bordes */\r
|
|
297
|
+
--ui-color-border-default: var(--ui-color-light-gray-400);\r
|
|
298
|
+
--ui-color-border-subtle: var(--ui-color-light-gray-300);\r
|
|
299
|
+
--ui-color-border-strong: var(--ui-color-dark-gray-400);\r
|
|
300
|
+
--ui-color-border-danger: var(--ui-color-red-500);\r
|
|
301
|
+
\r
|
|
302
|
+
/* Semánticos: superficies y fondos */\r
|
|
303
|
+
--ui-color-bg-surface-default: var(--ui-color-white);\r
|
|
304
|
+
--ui-color-bg-surface-secondary-default: var(--ui-color-light-gray-50);\r
|
|
305
|
+
--ui-color-bg-surface-secondary-hover: var(--ui-color-light-gray-100);\r
|
|
306
|
+
--ui-color-bg-fill-danger-default: var(--ui-color-red-500);\r
|
|
307
|
+
--ui-color-bg-fill-danger-hover: var(--ui-color-red-600);\r
|
|
308
|
+
--ui-color-bg-fill-danger-pressed: var(--ui-color-red-700);\r
|
|
309
|
+
--ui-color-bg-fill-success-default: var(--ui-color-green-500);\r
|
|
310
|
+
--ui-color-bg-fill-success-hover: var(--ui-color-green-600);\r
|
|
311
|
+
--ui-color-bg-fill-success-pressed: var(--ui-color-green-700);\r
|
|
312
|
+
--ui-color-bg-surface-success-default: var(--ui-color-green-50);\r
|
|
313
|
+
--ui-color-bg-surface-success-hover: var(--ui-color-green-100);\r
|
|
314
|
+
--ui-color-bg-surface-success-selected: var(--ui-color-green-200);\r
|
|
315
|
+
--ui-color-bg-surface-danger-default: var(--ui-color-red-50);\r
|
|
316
|
+
--ui-color-bg-surface-danger-hover: var(--ui-color-red-100);\r
|
|
317
|
+
--ui-color-bg-surface-danger-selected: var(--ui-color-red-200);\r
|
|
318
|
+
--ui-color-bg-surface-warning-default: var(--ui-color-yellow-50);\r
|
|
319
|
+
--ui-color-bg-surface-warning-hover: var(--ui-color-yellow-100);\r
|
|
320
|
+
--ui-color-bg-surface-warning-selected: var(--ui-color-yellow-200);\r
|
|
321
|
+
\r
|
|
322
|
+
/* Espaciado (space) */\r
|
|
323
|
+
--ui-Positive-space_0: var(--ui-positive-Value_0);\r
|
|
324
|
+
--ui-Positive-space_2: var(--ui-positive-Value_100);\r
|
|
325
|
+
--ui-Positive-space_4: var(--ui-positive-Value_100);\r
|
|
326
|
+
--ui-Positive-space_6: var(--ui-positive-Value_150);\r
|
|
327
|
+
--ui-Positive-space_8: var(--ui-positive-Value_200);\r
|
|
328
|
+
--ui-Positive-space_10: var(--ui-positive-Value_250);\r
|
|
329
|
+
--ui-Positive-space_12: var(--ui-positive-Value_300);\r
|
|
330
|
+
--ui-Positive-space_16: var(--ui-positive-Value_400);\r
|
|
331
|
+
--ui-Positive-space_20: var(--ui-positive-Value_500);\r
|
|
332
|
+
--ui-Positive-space_24: var(--ui-positive-Value_600);\r
|
|
333
|
+
--ui-Positive-space_28: var(--ui-positive-Value_700);\r
|
|
334
|
+
--ui-Positive-space_32: var(--ui-positive-Value_800);\r
|
|
335
|
+
--ui-Positive-space_40: var(--ui-positive-Value_1000);\r
|
|
336
|
+
--ui-Positive-space_48: var(--ui-positive-Value_1200);\r
|
|
337
|
+
--ui-Positive-space_56: var(--ui-positive-Value_1400);\r
|
|
338
|
+
--ui-Positive-space_64: var(--ui-positive-Value_1600);\r
|
|
339
|
+
--ui-Positive-space_80: var(--ui-positive-Value_2000);\r
|
|
340
|
+
--ui-Positive-space_96: var(--ui-positive-Value_2400);\r
|
|
341
|
+
\r
|
|
342
|
+
/* Tamaños de fuente */\r
|
|
343
|
+
--ui-font-size-2xs: var(--ui-positive-Value_250);\r
|
|
344
|
+
--ui-font-size-xs: var(--ui-positive-Value_300);\r
|
|
345
|
+
--ui-font-size-sm: var(--ui-positive-Value_350);\r
|
|
346
|
+
--ui-font-size-md: var(--ui-positive-Value_400);\r
|
|
347
|
+
--ui-font-size-lg: var(--ui-positive-Value_450);\r
|
|
348
|
+
--ui-font-size-xl: var(--ui-positive-Value_500);\r
|
|
349
|
+
--ui-font-size-2xl: var(--ui-positive-Value_600);\r
|
|
350
|
+
--ui-font-size-3xl: var(--ui-positive-Value_750);\r
|
|
351
|
+
--ui-font-size-4xl: var(--ui-positive-Value_900);\r
|
|
352
|
+
--ui-font-size-5xl: var(--ui-positive-Value_1200);\r
|
|
353
|
+
\r
|
|
354
|
+
/* Line height (muestra) */\r
|
|
355
|
+
--ui-font-lh-10-normal: 14.5px;\r
|
|
356
|
+
--ui-font-lh-12-normal: 17.5px;\r
|
|
357
|
+
--ui-font-lh-14-normal: 20.5px;\r
|
|
358
|
+
--ui-font-lh-16-normal: 23px;\r
|
|
359
|
+
--ui-font-lh-18-normal: 26px;\r
|
|
360
|
+
--ui-font-lh-20-snug: 25px;\r
|
|
361
|
+
\r
|
|
362
|
+
/* Sombras compuestas (para uso en box-shadow) */\r
|
|
363
|
+
--ui-shadow-card: 0 4px 16px var(--ui-shadow-01-Color);\r
|
|
364
|
+
--ui-shadow-popover: 0 var(--ui-shadow-02-y) var(--ui-shadow-02-blur) var(--ui-shadow-02-Color);\r
|
|
365
|
+
--ui-shadow-modal: 0 var(--ui-shadow-04-y) var(--ui-shadow-04-blur) var(--ui-shadow-04-Color);\r
|
|
366
|
+
}\r
|
|
367
|
+
`;function it(e,o,t){const i=a.useCallback(()=>{e&&t(l=>!l)},[e,t]);a.useEffect(()=>{if(!e)return;const l=c=>{(c.key==="r"||c.key==="R"||c.code==="KeyR")&&c.shiftKey&&!c.ctrlKey&&!c.metaKey&&(c.preventDefault(),i())};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[e,i])}const at="review_layer:v1:";function lt(e,o){if(e==null)return o;try{return JSON.parse(e)??o}catch{return o}}function pr(e,o,t,i){const l=`${at}${ut(e)}:${t}`;return i!=null?`${l}:${i}`:l}function ut(e){return e.replace(/\/+$/,"")||"/"}function Ur(e){if(typeof localStorage>"u")return null;const o=localStorage.getItem(e);return lt(o,null)}function Gr(e,o){if(!(typeof localStorage>"u"))try{localStorage.setItem(e,JSON.stringify({data:o,at:Date.now()}))}catch{}}function kr(e,o,t){const i=Ur(pr(e,o,"comments",t));return(i==null?void 0:i.data)??null}function st(e,o,t,i){Gr(pr(e,o,"comments",t),i)}function Hr(e,o){const t=Ur(pr(e,o,"reviewers"));return(t==null?void 0:t.data)??null}function ct(e,o,t){Gr(pr(e,o,"reviewers"),t)}const Xr="https://review-layer-api.onrender.com/api";function Jr(){return typeof window>"u"?"/":window.location.pathname||"/"}const Zr=a.createContext(null);let Pr=null;function dt(){const e=a.useContext(Zr);if(!e)throw new Error("useReview must be used within ReviewProvider");return e}function ft({children:e,enabled:o=!0,apiUrl:t,apiKey:i}){const l=(t==null?void 0:t.trim())||Xr,[c,p]=a.useState(!1),[b,f]=a.useState([]),[_,y]=a.useState([]),[m,j]=a.useState(!1);it(o,c,p);const C=a.useCallback(async d=>{if(!(!o||!l||!i))try{const g=await xe(l,i,{signal:d});d!=null&&d.aborted||(f(g),ct(l,i,g))}catch(g){if(g instanceof Error&&g.name==="AbortError")return;if(!(d!=null&&d.aborted)){const I=Hr(l,i);I!=null&&f(I)}}},[o,l,i]),V=a.useCallback(async d=>{if(!o||!l||!i)return;const g=Jr(),I=kr(l,i,g);I!=null&&y(I);try{j(!1);const A=await me(l,i,g,{signal:d});d!=null&&d.aborted||(y(A),st(l,i,g,A))}catch(A){if(A instanceof Error&&A.name==="AbortError")return;if(!(d!=null&&d.aborted)){j(!0);const H=kr(l,i,g);H!=null&&y(H)}}},[o,l,i]);a.useEffect(()=>{if(!o||!l||!i)return;const d=Jr(),g=Hr(l,i),I=kr(l,i,d);g!=null&&f(g),I!=null&&y(I)},[o,l,i]),a.useEffect(()=>{if(typeof document>"u")return;const d="review-layer-ui-variables";if(!document.getElementById(d)){const g=document.createElement("style");g.id=d,g.textContent=nt,document.head.appendChild(g)}},[]),a.useEffect(()=>{if(!o||!l||!i)return;const d=`${l}:${i}`;if(Pr!==d)return Pr=d,C(),V(),()=>{setTimeout(()=>{Pr=null},0)}},[o,l,i,C,V]),a.useEffect(()=>{if(!o)return;const d=()=>V();return window.addEventListener("popstate",d),()=>window.removeEventListener("popstate",d)},[o,V]);const F=a.useMemo(()=>({apiUrl:l,apiKey:i,reviewMode:c,setReviewMode:p,reviewers:b,comments:_,loadComments:V,commentsLoadFailed:m}),[l,i,c,p,b,_,V,m]),L=o&&typeof document<"u"?Ar.createPortal(s.jsx(ot,{apiUrl:l,apiKey:i,reviewMode:c,setReviewMode:p,reviewers:b,comments:_,loadComments:V,commentsLoadFailed:m}),document.body):null;return s.jsxs(Zr.Provider,{value:F,children:[e,L]})}G.DEFAULT_API_URL=Xr,G.ReviewProvider=ft,G.useReview=dt,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})});
|
|
31
368
|
//# sourceMappingURL=review-layer-react.umd.cjs.map
|