@viswa-test/test-citation 0.0.157 → 0.0.159

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,2 +1,2 @@
1
- import{useState as e,useRef as n,useCallback as r,useEffect as t}from"react";import{DEVIATION_BADGE_SEPARATOR as i,smoothScrollTo as l,resetClauseHighlight as u}from"../CognitiveComparehelpers.js";var o=function(o){var c=o.maintainRelativeOrder,d=o.proposedSections,s=o.existingSections,a=o.leftContainerRef,v=o.rightContainerRef,p=o.scrollContainerRef,g=o.sectionLeftRefs,f=o.sectionRightRefs,h=o.subSectionLeftRefs,y=o.subSectionRightRefs,R=o.lhsBadgeRefs,x=o.rhsBadgeRefs,S=o.sectionRowRefs,m=o.sectionRightRowRefs,B=o.rhsTopSpacerRef,T=o.rhsBottomSpacerRef,C=o.lhsTopSpacerRef,b=o.lhsBottomSpacerRef,I=o.calculateLinesRef,A=o.setConnectedSections,E=o.setConnectedLines,N=o.cachedConnectedPositions,w=o.closeMoreFunctionsPopup,L=o.setErrorToast,F=o.moreFunctions,M=o.closeSummaryPopup,q=e(!0),H=q[0],P=q[1],O=e(!1),z=O[0],V=O[1],j=e(!1),k=j[0],D=j[1],G=e(!1),J=G[0],K=G[1],Q=e(null),U=Q[0],W=Q[1],X=n(!1),Y=n(null),Z=n(!1),$=n(null),_=n(null),ee=n(null),ne=n(new Set),re=function(){ne.current.forEach(function(e){u(e)}),ne.current.clear()},te=function(e,n,r){var t,l,u,o,c,d,s,p,B,T,C,b,I=null,A=null,E=null,N=null,w=null,L=null,F=function(e,n){if(!e||!n)return!0;var r=e.getBoundingClientRect(),t=n.getBoundingClientRect();return r.bottom>=t.top&&r.top<=t.bottom};if(e){var M=n.split(i),q="".concat(M[0]).concat(i).concat(M[1]);I=(null===(t=h.current[M[2]])||void 0===t?void 0:t.current)||(null===(l=g.current[Number(M[2])])||void 0===l?void 0:l.current)||null,A=(null===(u=y.current[M[3]])||void 0===u?void 0:u.current)||(null===(o=f.current[Number(M[3])])||void 0===o?void 0:o.current)||null,E=(null===(c=R.current[q])||void 0===c?void 0:c.current)||I,N=(null===(d=x.current[q])||void 0===d?void 0:d.current)||A}else{var H=Number(n),P=null!==r?Number(r):H;I=(null===(s=g.current[H])||void 0===s?void 0:s.current)||null,A=(null===(p=f.current[P])||void 0===p?void 0:p.current)||null,w=(null===(B=R.current[H])||void 0===B?void 0:B.current)||null,L=(null===(T=x.current[P])||void 0===T?void 0:T.current)||null,E=w||(null===(C=S.current[H])||void 0===C?void 0:C.current)||I,N=L||(null===(b=m.current[P])||void 0===b?void 0:b.current)||A}if(I&&(I.style.paddingTop="0px"),A&&(A.style.paddingTop="0px"),e||(w&&(w.style.marginTop="0px"),L&&(L.style.marginTop="0px")),!e&&w&&L){var O=a.current,z=v.current;if(!F(w,O)||!F(L,z))return;var V=w.getBoundingClientRect(),j=L.getBoundingClientRect(),k=V.top-j.top;if(Math.abs(k)>32)return;k>0?L.style.marginTop="".concat(k,"px"):k<0&&(w.style.marginTop="".concat(Math.abs(k),"px"))}else if(E&&N&&I&&A){V=E.getBoundingClientRect(),j=N.getBoundingClientRect();(k=V.top-j.top)>0?A.style.paddingTop="".concat(k,"px"):k<0&&(I.style.paddingTop="".concat(Math.abs(k),"px"))}},ie=r(function(){var e,n,r,t,l,u,o,c,d=$.current,s=_.current;if(null!==d)if("string"==typeof d&&d.includes(i)){var a=d.split(i),v=(null===(e=h.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=g.current[Number(a[2])])||void 0===n?void 0:n.current)||null,p=(null===(r=y.current[a[3]])||void 0===r?void 0:r.current)||(null===(t=f.current[Number(a[3])])||void 0===t?void 0:t.current)||null;v&&(v.style.paddingTop="0px"),p&&(p.style.paddingTop="0px")}else{v=(null===(l=g.current[d])||void 0===l?void 0:l.current)||null,p=(null===(u=f.current[null!=s?s:d])||void 0===u?void 0:u.current)||null;v&&(v.style.paddingTop="0px"),p&&(p.style.paddingTop="0px");var S=(null===(o=R.current[d])||void 0===o?void 0:o.current)||null,m=(null===(c=x.current[null!=s?s:d])||void 0===c?void 0:c.current)||null;S&&(S.style.marginTop="0px"),m&&(m.style.marginTop="0px")}B.current&&(B.current.style.height="0px"),T.current&&(T.current.style.height="0px"),C.current&&(C.current.style.height="0px"),b.current&&(b.current.style.height="0px")},[]);t(function(){Z.current=H},[H]),t(function(){$.current=U},[U]);var le=r(function(){var e,n,r,t,l,u,o,c;re(),P(!1),Z.current=!1,Y.current=null;var d=$.current,s=_.current;if(null!==d)if("string"==typeof d&&d.includes(i)){var a=d.split(i);(v=(null===(e=h.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=g.current[Number(a[2])])||void 0===n?void 0:n.current))&&(v.style.paddingTop="0px")}else{var v;(v=null===(r=g.current[d])||void 0===r?void 0:r.current)&&(v.style.paddingTop="0px");var p=null===(t=R.current[d])||void 0===t?void 0:t.current;p&&(p.style.marginTop="0px")}if(null!==s)if("string"==typeof s&&s.includes(i)){a=s.split(i);(S=(null===(l=y.current[a[3]])||void 0===l?void 0:l.current)||(null===(u=f.current[Number(a[3])])||void 0===u?void 0:u.current))&&(S.style.paddingTop="0px")}else{var S;(S=null===(o=f.current[s])||void 0===o?void 0:o.current)&&(S.style.paddingTop="0px");var m=null===(c=x.current[s])||void 0===c?void 0:c.current;m&&(m.style.marginTop="0px")}W(null),$.current=null,_.current=null,V(!1),K(!1),B.current&&(B.current.style.height="0px"),T.current&&(T.current.style.height="0px"),C.current&&(C.current.style.height="0px"),b.current&&(b.current.style.height="0px")},[]),ue=r(function(e,n,r){var t,u,o=null===(t=null==r?void 0:r.toggleIfSame)||void 0===t||t,h=null==r?void 0:r.onReady,y=null!==(u=null==r?void 0:r.sourceSide)&&void 0!==u?u:"left";if(w(),null!=e)if(n)L("No counterpart exists for this section.");else{re();var F=H&&U===e;H&&null!==U&&ie(),F&&o?le():(A(new Set([e])),E([]),N.current=[],K(!0),X.current=!0,W(e),$.current=e,P(!0),Z.current=!0,V(!1),B.current&&(B.current.style.height="0px"),T.current&&(T.current.style.height="0px"),C.current&&(C.current.style.height="0px"),b.current&&(b.current.style.height="0px"),requestAnimationFrame(function(){var n,r,t,u,o,A,E,N,w="string"==typeof e&&e.includes(i),L=null,F=null,M=null;if(w){var q=e.split(i),H="".concat(q[0]).concat(i).concat(q[1]);L=(null===(n=R.current[H])||void 0===n?void 0:n.current)||null,F=(null===(r=x.current[H])||void 0===r?void 0:r.current)||null,M=F?e:null}else if(L=(null===(t=g.current[e])||void 0===t?void 0:t.current)||(null===(u=S.current[e])||void 0===u?void 0:u.current)||null,c){var P=d[e],O=(null==P?void 0:P.refIndexes)||[];if(O.length>0){var z=O[0],j=s.findIndex(function(e){return e.selfIndex===z});-1!==j&&(F=(null===(E=f.current[j])||void 0===E?void 0:E.current)||(null===(N=m.current[j])||void 0===N?void 0:N.current)||null,M=j)}}else F=(null===(o=f.current[e])||void 0===o?void 0:o.current)||(null===(A=m.current[e])||void 0===A?void 0:A.current)||null,M=F?e:null;_.current=M;var k=a.current,D=v.current,G=function(){te(w,e,M),V(!0),I.current&&I.current(),X.current=!1,"right"===y&&D?D.dispatchEvent(new Event("scroll")):k&&k.dispatchEvent(new Event("scroll")),K(!1),null==h||h()};if(!L||!k)return X.current=!1,K(!1),void(null==h||h());if(F&&D){if(!c){var J=0;J="right"===y?F?F.getBoundingClientRect().top:0:L?L.getBoundingClientRect().top:0;var Q=p.current,U=(null==Q?void 0:Q.getBoundingClientRect().top)||0,W=Q?Q.scrollTop+J-U-150:0;return Q?void l(Q,W,200,G):void G()}var Y=L.getBoundingClientRect().top-k.getBoundingClientRect().top+k.scrollTop,Z=F.getBoundingClientRect().top-D.getBoundingClientRect().top+D.scrollTop,$=200;if("left"===y){var ee=Z-(Y-k.scrollTop);ee<0&&B.current&&(B.current.style.height="".concat(Math.abs(ee),"px")),requestAnimationFrame(function(){var e,n=D.scrollHeight-D.clientHeight;if(ee<0)e=0;else{if(ee>n){var r=ee-n;return T.current&&(T.current.style.height="".concat(r+150,"px")),void requestAnimationFrame(function(){l(D,ee,$,G)})}e=ee}l(D,e,$,G)})}else{var ne=Y-(Z-D.scrollTop);ne<0&&C.current&&(C.current.style.height="".concat(Math.abs(ne),"px")),requestAnimationFrame(function(){var e,n=k.scrollHeight-k.clientHeight;if(ne<0)e=0;else{if(ne>n){var r=ne-n;return b.current&&(b.current.style.height="".concat(r+150,"px")),void requestAnimationFrame(function(){l(k,ne,$,G)})}e=ne}l(k,e,$,G)})}}else G()}))}},[U,w,s,H,c,d,ie,le]);return r(function(){var e,n=F.sectionIdx,r=F.isOrphan;if(M(),null!=n){var t="left";F.anchorEl&&(null===(e=v.current)||void 0===e?void 0:e.contains(F.anchorEl))&&(t="right"),ue(n,r,{sourceSide:t})}},[ue,F.isOrphan,F.sectionIdx,F.anchorEl,M]),{isSideBySide:H,setIsSideBySide:P,isArrowVisible:z,setIsArrowVisible:V,isResizing:k,setIsResizing:D,isSideBySideLoading:J,setIsSideBySideLoading:K,activeSideBySideSection:U,setActiveSideBySideSection:W,scrollLock:X,sideBySideCacheRef:Y,isSideBySideRef:Z,activeSideBySideSectionRef:$,activeSideBySideRightSectionRef:_,sideBySideLineRef:ee,highlightedClauseRefs:ne,clearClauseHighlight:re,applyAlignmentPadding:te,resetSideBySide:le,activateSideBySide:ue}};export{o as useSideBySide};
1
+ import{useState as e,useRef as n,useCallback as t,useEffect as r}from"react";import{DEVIATION_BADGE_SEPARATOR as i,smoothScrollTo as l,resetClauseHighlight as u}from"../CognitiveComparehelpers.js";var o=function(o){var c=o.maintainRelativeOrder,d=o.proposedSections,s=o.existingSections,v=o.leftContainerRef,a=o.rightContainerRef,p=o.scrollContainerRef,g=o.sectionLeftRefs,f=o.sectionRightRefs,h=o.subSectionLeftRefs,R=o.subSectionRightRefs,S=o.lhsBadgeRefs,y=o.rhsBadgeRefs,m=o.sectionRowRefs,B=o.sectionRightRowRefs,x=o.rhsTopSpacerRef,C=o.rhsBottomSpacerRef,T=o.lhsTopSpacerRef,b=o.lhsBottomSpacerRef,A=o.calculateLinesRef,w=o.setConnectedSections,I=o.setConnectedLines,L=o.cachedConnectedPositions,F=o.closeMoreFunctionsPopup,N=o.setErrorToast;o.moreFunctions,o.closeSummaryPopup;var E=e(!1),q=E[0],H=E[1],P=e(!1),M=P[0],z=P[1],V=e(!1),j=V[0],k=V[1],O=e(!1),D=O[0],G=O[1],J=e(null),K=J[0],Q=J[1],U=n(!1),W=n(null),X=n(!1),Y=n(null),Z=n(null),$=n(null),_=n(new Set),ee=function(){_.current.forEach(function(e){u(e)}),_.current.clear()},ne=function(e,n,t){var r,l,u,o,c,d,s,p,x,C,T,b,A=null,w=null,I=null,L=null,F=null,N=null,E=function(e,n){if(!e||!n)return!0;var t=e.getBoundingClientRect(),r=n.getBoundingClientRect();return t.bottom>=r.top&&t.top<=r.bottom};if(e){var q=n.split(i),H="".concat(q[0]).concat(i).concat(q[1]);A=(null===(r=h.current[q[2]])||void 0===r?void 0:r.current)||(null===(l=g.current[Number(q[2])])||void 0===l?void 0:l.current)||null,w=(null===(u=R.current[q[3]])||void 0===u?void 0:u.current)||(null===(o=f.current[Number(q[3])])||void 0===o?void 0:o.current)||null,I=(null===(c=S.current[H])||void 0===c?void 0:c.current)||A,L=(null===(d=y.current[H])||void 0===d?void 0:d.current)||w}else{var P=Number(n),M=null!==t?Number(t):P;A=(null===(s=g.current[P])||void 0===s?void 0:s.current)||null,w=(null===(p=f.current[M])||void 0===p?void 0:p.current)||null,F=(null===(x=S.current[P])||void 0===x?void 0:x.current)||null,N=(null===(C=y.current[M])||void 0===C?void 0:C.current)||null,I=F||(null===(T=m.current[P])||void 0===T?void 0:T.current)||A,L=N||(null===(b=B.current[M])||void 0===b?void 0:b.current)||w}if(A&&(A.style.paddingTop="0px"),w&&(w.style.paddingTop="0px"),e||(F&&(F.style.marginTop="0px"),N&&(N.style.marginTop="0px")),!e&&F&&N){var z=v.current,V=a.current;if(!E(F,z)||!E(N,V))return;var j=F.getBoundingClientRect(),k=N.getBoundingClientRect(),O=j.top-k.top;if(Math.abs(O)>32)return;O>0&&(N.style.marginTop="".concat(O,"px"))}else if(I&&L&&A&&w){j=I.getBoundingClientRect(),k=L.getBoundingClientRect();(O=j.top-k.top)>0&&(w.style.paddingTop="".concat(O,"px"))}},te=t(function(){var e,n,t,r,l,u,o,c,d=Y.current,s=Z.current;if(null!==d)if("string"==typeof d&&d.includes(i)){var v=d.split(i),a=(null===(e=h.current[v[2]])||void 0===e?void 0:e.current)||(null===(n=g.current[Number(v[2])])||void 0===n?void 0:n.current)||null,p=(null===(t=R.current[v[3]])||void 0===t?void 0:t.current)||(null===(r=f.current[Number(v[3])])||void 0===r?void 0:r.current)||null;a&&(a.style.paddingTop="0px"),p&&(p.style.paddingTop="0px")}else{a=(null===(l=g.current[d])||void 0===l?void 0:l.current)||null,p=(null===(u=f.current[null!=s?s:d])||void 0===u?void 0:u.current)||null;a&&(a.style.paddingTop="0px"),p&&(p.style.paddingTop="0px");var m=(null===(o=S.current[d])||void 0===o?void 0:o.current)||null,B=(null===(c=y.current[null!=s?s:d])||void 0===c?void 0:c.current)||null;m&&(m.style.marginTop="0px"),B&&(B.style.marginTop="0px")}x.current&&(x.current.style.height="0px"),C.current&&(C.current.style.height="0px"),T.current&&(T.current.style.height="0px"),b.current&&(b.current.style.height="0px")},[]);r(function(){X.current=q},[q]),r(function(){Y.current=K},[K]);var re=t(function(){ee(),H(!1),X.current=!1,W.current=null,te(),Q(null),Y.current=null,Z.current=null,z(!1),G(!1)},[te]),ie=t(function(e,n,t){var r,u,o=null===(r=null==t?void 0:t.toggleIfSame)||void 0===r||r,h=null==t?void 0:t.onReady,R=null!==(u=null==t?void 0:t.sourceSide)&&void 0!==u?u:"left";if(F(),null!=e)if(n)N("No counterpart exists for this section.");else{ee();var E=q&&K===e;q&&null!==K&&te(),E&&o?re():(w(new Set([e])),I([]),L.current=[],G(!0),U.current=!0,Q(e),Y.current=e,H(!0),X.current=!0,z(!1),x.current&&(x.current.style.height="0px"),C.current&&(C.current.style.height="0px"),T.current&&(T.current.style.height="0px"),b.current&&(b.current.style.height="0px"),requestAnimationFrame(function(){var n,t,r,u,o,T,b,w,I="string"==typeof e&&e.includes(i),L=null,F=null,N=null;if(I){var E=e.split(i),q="".concat(E[0]).concat(i).concat(E[1]);L=(null===(n=S.current[q])||void 0===n?void 0:n.current)||null,F=(null===(t=y.current[q])||void 0===t?void 0:t.current)||null,N=F?e:null}else if(L=(null===(r=g.current[e])||void 0===r?void 0:r.current)||(null===(u=m.current[e])||void 0===u?void 0:u.current)||null,c){var H=d[e],P=(null==H?void 0:H.refIndexes)||[];if(P.length>0){var M=P[0],V=s.findIndex(function(e){return e.selfIndex===M});-1!==V&&(F=(null===(b=f.current[V])||void 0===b?void 0:b.current)||(null===(w=B.current[V])||void 0===w?void 0:w.current)||null,N=V)}}else F=(null===(o=f.current[e])||void 0===o?void 0:o.current)||(null===(T=B.current[e])||void 0===T?void 0:T.current)||null,N=F?e:null;Z.current=N;var j=v.current,k=a.current,O=function(){ne(I,e,N),z(!0),A.current&&A.current(),U.current=!1,"right"===R&&k?k.dispatchEvent(new Event("scroll")):j&&j.dispatchEvent(new Event("scroll")),G(!1),null==h||h()};if(!L||!j)return U.current=!1,G(!1),void(null==h||h());if(F&&k){if(!c){var D=0;D="right"===R?F?F.getBoundingClientRect().top:0:L?L.getBoundingClientRect().top:0;var J=p.current,K=(null==J?void 0:J.getBoundingClientRect().top)||0,Q=J?J.scrollTop+D-K-150:0;return J?void l(J,Q,200,O):void O()}var W=L.getBoundingClientRect().top-j.getBoundingClientRect().top+j.scrollTop,X=F.getBoundingClientRect().top-k.getBoundingClientRect().top+k.scrollTop,Y=200;if("left"===R){var $=X-(W-j.scrollTop);$<0&&x.current&&(x.current.style.height="".concat(Math.abs($),"px")),requestAnimationFrame(function(){var e,n=k.scrollHeight-k.clientHeight;if($<0)e=0;else{if($>n){var t=$-n;return C.current&&(C.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){l(k,$,Y,O)})}e=$}l(k,e,Y,O)})}else{var _=W-(X-k.scrollTop);requestAnimationFrame(function(){var e,n=j.scrollHeight-j.clientHeight;if(_<0)e=0;else{if(_>n)return void requestAnimationFrame(function(){return l(j,n,Y,O)});e=_}l(j,e,Y,O)})}}else O()}))}},[K,F,s,q,c,d,te,re]);return{isSideBySide:q,setIsSideBySide:H,isArrowVisible:M,setIsArrowVisible:z,isResizing:j,setIsResizing:k,isSideBySideLoading:D,setIsSideBySideLoading:G,activeSideBySideSection:K,setActiveSideBySideSection:Q,scrollLock:U,sideBySideCacheRef:W,isSideBySideRef:X,activeSideBySideSectionRef:Y,activeSideBySideRightSectionRef:Z,sideBySideLineRef:$,highlightedClauseRefs:_,clearClauseHighlight:ee,applyAlignmentPadding:ne,resetSideBySide:re,activateSideBySide:ie}};export{o as useSideBySide};
2
2
  //# sourceMappingURL=useSideBySide.js.map