texlite 0.7.3 → 0.7.6
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/README.md +20 -9
- package/README.zh-CN.md +9 -9
- package/dist/client/assets/{GitDialog-BmRzMv-C.js → GitDialog-W3hLOWrF.js} +2 -2
- package/dist/client/assets/HistoryDialog-7ADYJcGi.js +5 -0
- package/dist/client/assets/LatexEditor-ChHQwJXZ.js +59 -0
- package/dist/client/assets/PdfPreview-CuvWphzY.js +1 -0
- package/dist/client/assets/{ProjectNavigationDialogs-BVQb4qdD.js → ProjectNavigationDialogs-CzFhIw6B.js} +1 -1
- package/dist/client/assets/SystemMetricsDialog-C0m9JUDy.js +1 -0
- package/dist/client/assets/index-DRShM2ob.js +64 -0
- package/dist/client/assets/index-DzcH7hBu.css +1 -0
- package/dist/client/assets/latexFormatterWorker-DYkYtcFy.js +6 -0
- package/dist/client/assets/minus-BfqMIeUg.js +1 -0
- package/dist/client/assets/pdf-BB1XvBIF.js +55 -0
- package/dist/client/assets/{react-CsO_xvbl.js → react-BoEjKzFZ.js} +1 -1
- package/dist/client/assets/spellCheck-BBnCnxmQ.js +4 -0
- package/dist/client/assets/tex_fmt_bg-VEAUIuFz.wasm +0 -0
- package/dist/client/index.html +3 -3
- package/dist/server/anchors.js +22 -1
- package/dist/server/app.js +103 -2375
- package/dist/server/auth.js +3 -2
- package/dist/server/cli.js +8 -2
- package/dist/server/collaboration.js +250 -2
- package/dist/server/compileArtifacts.js +10 -7
- package/dist/server/compiler.js +9 -4
- package/dist/server/config.js +25 -1
- package/dist/server/environment.js +5 -1
- package/dist/server/files.js +7 -6
- package/dist/server/git.js +28 -39
- package/dist/server/harper.js +144 -0
- package/dist/server/harperRuntime.js +38 -0
- package/dist/server/harperWorker.js +15 -0
- package/dist/server/history.js +11 -9
- package/dist/server/http.js +33 -13
- package/dist/server/i18n.js +276 -0
- package/dist/server/latexRoot.js +78 -0
- package/dist/server/limits.js +9 -0
- package/dist/server/projectSearch.js +3 -4
- package/dist/server/routes/auth.js +77 -0
- package/dist/server/routes/citations.js +331 -0
- package/dist/server/routes/collaboration.js +17 -0
- package/dist/server/routes/comments.js +176 -0
- package/dist/server/routes/compile.js +71 -50
- package/dist/server/routes/projectFiles.js +572 -0
- package/dist/server/routes/projectGit.js +145 -0
- package/dist/server/routes/projectHistory.js +150 -0
- package/dist/server/routes/projectMembers.js +112 -0
- package/dist/server/routes/projectShared.js +238 -0
- package/dist/server/routes/projects.js +473 -0
- package/dist/server/routes/system.js +37 -0
- package/dist/server/routes/users.js +163 -0
- package/dist/server/security.js +2 -4
- package/dist/server/synctex.js +7 -4
- package/dist/server/zip.js +29 -13
- package/package.json +4 -2
- package/texlite.config.example.json +5 -1
- package/dist/client/assets/BinaryModule-Aj1vLnwf-_qIOaefD.js +0 -4
- package/dist/client/assets/HistoryDialog-V0IkSDtJ.js +0 -1
- package/dist/client/assets/LatexEditor-CokkLLxi.js +0 -59
- package/dist/client/assets/PdfPreview-Cs1WYPsC.js +0 -1
- package/dist/client/assets/SystemMetricsDialog-DBrendnp.js +0 -1
- package/dist/client/assets/__vite-browser-external-BIHI7g3E.js +0 -1
- package/dist/client/assets/binary-BQKEW09b.js +0 -1
- package/dist/client/assets/harper_wasm_bg-LWXDb7Ll.wasm +0 -0
- package/dist/client/assets/index-BS1IMOaB.js +0 -62
- package/dist/client/assets/index-Lw53KTaT.css +0 -1
- package/dist/client/assets/index-QyVe7I1s.js +0 -3456
- package/dist/client/assets/index-rBWMBTI-.js +0 -5
- package/dist/client/assets/minus-yEV4SLvG.js +0 -1
- package/dist/client/assets/pdf-DPnwNQHb.js +0 -55
- package/dist/client/assets/spellCheck-OZGa6ljx.js +0 -5
- package/dist/server/latexFormatter.js +0 -118
|
@@ -46,4 +46,4 @@ Error generating stack: `+a.message+`
|
|
|
46
46
|
`)},Dv=function(){var i=parseInt(document.body.getAttribute(Fa)||"0",10);return isFinite(i)?i:0},Ch=function(){x.useEffect(function(){return document.body.setAttribute(Fa,(Dv()+1).toString()),function(){var i=Dv()-1;i<=0?document.body.removeAttribute(Fa):document.body.setAttribute(Fa,i.toString())}},[])},Rh=function(i){var o=i.noRelative,s=i.noImportant,f=i.gapMode,h=f===void 0?"margin":f;Ch();var v=x.useMemo(function(){return Mh(h)},[h]);return x.createElement(Oh,{styles:Dh(v,!o,h,s?"":"!important")})},fo=!1;if(typeof window<"u")try{var Si=Object.defineProperty({},"passive",{get:function(){return fo=!0,!0}});window.addEventListener("test",Si,Si),window.removeEventListener("test",Si,Si)}catch{fo=!1}var Ja=fo?{passive:!1}:!1,Nh=function(i){return i.tagName==="TEXTAREA"},$v=function(i,o){if(!(i instanceof Element))return!1;var s=window.getComputedStyle(i);return s[o]!=="hidden"&&!(s.overflowY===s.overflowX&&!Nh(i)&&s[o]==="visible")},Uh=function(i){return $v(i,"overflowY")},Hh=function(i){return $v(i,"overflowX")},Cv=function(i,o){var s=o.ownerDocument,f=o;do{typeof ShadowRoot<"u"&&f instanceof ShadowRoot&&(f=f.host);var h=Wv(i,f);if(h){var v=kv(i,f),_=v[1],A=v[2];if(_>A)return!0}f=f.parentNode}while(f&&f!==s.body);return!1},xh=function(i){var o=i.scrollTop,s=i.scrollHeight,f=i.clientHeight;return[o,s,f]},Bh=function(i){var o=i.scrollLeft,s=i.scrollWidth,f=i.clientWidth;return[o,s,f]},Wv=function(i,o){return i==="v"?Uh(o):Hh(o)},kv=function(i,o){return i==="v"?xh(o):Bh(o)},qh=function(i,o){return i==="h"&&o==="rtl"?-1:1},Yh=function(i,o,s,f,h){var v=qh(i,window.getComputedStyle(o).direction),_=v*f,A=s.target,E=o.contains(A),S=!1,G=_>0,U=0,B=0;do{if(!A)break;var J=kv(i,A),V=J[0],Y=J[1],Z=J[2],K=Y-Z-v*V;(V||K)&&Wv(i,A)&&(U+=K,B+=V);var k=A.parentNode;A=k&&k.nodeType===Node.DOCUMENT_FRAGMENT_NODE?k.host:k}while(!E&&A!==document.body||E&&(o.contains(A)||o===A));return(G&&Math.abs(U)<1||!G&&Math.abs(B)<1)&&(S=!0),S},bi=function(i){return"changedTouches"in i?[i.changedTouches[0].clientX,i.changedTouches[0].clientY]:[0,0]},Rv=function(i){return[i.deltaX,i.deltaY]},Nv=function(i){return i&&"current"in i?i.current:i},Gh=function(i,o){return i[0]===o[0]&&i[1]===o[1]},Lh=function(i){return`
|
|
47
47
|
.block-interactivity-`.concat(i,` {pointer-events: none;}
|
|
48
48
|
.allow-interactivity-`).concat(i,` {pointer-events: all;}
|
|
49
|
-
`)},Xh=0,wa=[];function jh(i){var o=x.useRef([]),s=x.useRef([0,0]),f=x.useRef(),h=x.useState(Xh++)[0],v=x.useState(wv)[0],_=x.useRef(i);x.useEffect(function(){_.current=i},[i]),x.useEffect(function(){if(i.inert){document.body.classList.add("block-interactivity-".concat(h));var Y=fh([i.lockRef.current],(i.shards||[]).map(Nv),!0).filter(Boolean);return Y.forEach(function(Z){return Z.classList.add("allow-interactivity-".concat(h))}),function(){document.body.classList.remove("block-interactivity-".concat(h)),Y.forEach(function(Z){return Z.classList.remove("allow-interactivity-".concat(h))})}}},[i.inert,i.lockRef.current,i.shards]);var A=x.useCallback(function(Y,Z){if("touches"in Y&&Y.touches.length===2||Y.type==="wheel"&&Y.ctrlKey)return!_.current.allowPinchZoom;var K=bi(Y),k=s.current,I="deltaX"in Y?Y.deltaX:k[0]-K[0],tt="deltaY"in Y?Y.deltaY:k[1]-K[1],nt,W=Y.target,q=Math.abs(I)>Math.abs(tt)?"h":"v";if("touches"in Y&&q==="h"&&W.type==="range")return!1;var Et=window.getSelection(),xt=Et&&Et.anchorNode,qt=xt?xt===W||xt.contains(W):!1;if(qt)return!1;var bt=Cv(q,W);if(!bt)return!0;if(bt?nt=q:(nt=q==="v"?"h":"v",bt=Cv(q,W)),!bt)return!1;if(!f.current&&"changedTouches"in Y&&(I||tt)&&(f.current=nt),!nt)return!0;var ot=f.current||nt;return Yh(ot,Z,Y,ot==="h"?I:tt)},[]),E=x.useCallback(function(Y){var Z=Y;if(!(!wa.length||wa[wa.length-1]!==v)){var K="deltaY"in Z?Rv(Z):bi(Z),k=o.current.filter(function(nt){return nt.name===Z.type&&(nt.target===Z.target||Z.target===nt.shadowParent)&&Gh(nt.delta,K)})[0];if(k&&k.should){Z.cancelable&&Z.preventDefault();return}if(!k){var I=(_.current.shards||[]).map(Nv).filter(Boolean).filter(function(nt){return nt.contains(Z.target)}),tt=I.length>0?A(Z,I[0]):!_.current.noIsolation;tt&&Z.cancelable&&Z.preventDefault()}}},[]),S=x.useCallback(function(Y,Z,K,k){var I={name:Y,delta:Z,target:K,should:k,shadowParent:Qh(K)};o.current.push(I),setTimeout(function(){o.current=o.current.filter(function(tt){return tt!==I})},1)},[]),G=x.useCallback(function(Y){s.current=bi(Y),f.current=void 0},[]),U=x.useCallback(function(Y){S(Y.type,Rv(Y),Y.target,A(Y,i.lockRef.current))},[]),B=x.useCallback(function(Y){S(Y.type,bi(Y),Y.target,A(Y,i.lockRef.current))},[]);x.useEffect(function(){return wa.push(v),i.setCallbacks({onScrollCapture:U,onWheelCapture:U,onTouchMoveCapture:B}),document.addEventListener("wheel",E,Ja),document.addEventListener("touchmove",E,Ja),document.addEventListener("touchstart",G,Ja),function(){wa=wa.filter(function(Y){return Y!==v}),document.removeEventListener("wheel",E,Ja),document.removeEventListener("touchmove",E,Ja),document.removeEventListener("touchstart",G,Ja)}},[]);var J=i.removeScrollBar,V=i.inert;return x.createElement(x.Fragment,null,V?x.createElement(v,{styles:Lh(h)}):null,J?x.createElement(Rh,{noRelative:i.noRelative,gapMode:i.gapMode}):null)}function Qh(i){for(var o=null;i!==null;)i instanceof ShadowRoot&&(o=i.host,i=i.host),i=i.parentNode;return o}const Zh=gh(Jv,jh);var Vh=x.forwardRef(function(i,o){return x.createElement(Mi,Zl({},i,{ref:o,sideCar:Zh}))});Vh.classNames=Mi.classNames;const Oi=x.createContext(null);Oi.displayName="PanelGroupContext";const Lt={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},so=10,ua=x.useLayoutEffect,Uv=jm.useId,Kh=typeof Uv=="function"?Uv:()=>null;let Jh=0;function vo(i=null){const o=Kh(),s=x.useRef(i||o||null);return s.current===null&&(s.current=""+Jh++),i??s.current}function Fv({children:i,className:o="",collapsedSize:s,collapsible:f,defaultSize:h,forwardedRef:v,id:_,maxSize:A,minSize:E,onCollapse:S,onExpand:G,onResize:U,order:B,style:J,tagName:V="div",...Y}){const Z=x.useContext(Oi);if(Z===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:K,expandPanel:k,getPanelSize:I,getPanelStyle:tt,groupId:nt,isPanelCollapsed:W,reevaluatePanelConstraints:q,registerPanel:Et,resizePanel:xt,unregisterPanel:qt}=Z,bt=vo(_),ot=x.useRef({callbacks:{onCollapse:S,onExpand:G,onResize:U},constraints:{collapsedSize:s,collapsible:f,defaultSize:h,maxSize:A,minSize:E},id:bt,idIsFromProps:_!==void 0,order:B});x.useRef({didLogMissingDefaultSizeWarning:!1}),ua(()=>{const{callbacks:Ct,constraints:pt}=ot.current,M={...pt};ot.current.id=bt,ot.current.idIsFromProps=_!==void 0,ot.current.order=B,Ct.onCollapse=S,Ct.onExpand=G,Ct.onResize=U,pt.collapsedSize=s,pt.collapsible=f,pt.defaultSize=h,pt.maxSize=A,pt.minSize=E,(M.collapsedSize!==pt.collapsedSize||M.collapsible!==pt.collapsible||M.maxSize!==pt.maxSize||M.minSize!==pt.minSize)&&q(ot.current,M)}),ua(()=>{const Ct=ot.current;return Et(Ct),()=>{qt(Ct)}},[B,bt,Et,qt]),x.useImperativeHandle(v,()=>({collapse:()=>{K(ot.current)},expand:Ct=>{k(ot.current,Ct)},getId(){return bt},getSize(){return I(ot.current)},isCollapsed(){return W(ot.current)},isExpanded(){return!W(ot.current)},resize:Ct=>{xt(ot.current,Ct)}}),[K,k,I,W,bt,xt]);const al=tt(ot.current,h);return x.createElement(V,{...Y,children:i,className:o,id:bt,style:{...al,...J},[Lt.groupId]:nt,[Lt.panel]:"",[Lt.panelCollapsible]:f||void 0,[Lt.panelId]:bt,[Lt.panelSize]:parseFloat(""+al.flexGrow).toFixed(1)})}const wh=x.forwardRef((i,o)=>x.createElement(Fv,{...i,forwardedRef:o}));Fv.displayName="Panel";wh.displayName="forwardRef(Panel)";let oo=null,Ai=-1,Ye=null;function $h(i,o){if(o){const s=(o&e0)!==0,f=(o&a0)!==0,h=(o&n0)!==0,v=(o&u0)!==0;if(s)return h?"se-resize":v?"ne-resize":"e-resize";if(f)return h?"sw-resize":v?"nw-resize":"w-resize";if(h)return"s-resize";if(v)return"n-resize"}switch(i){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Wh(){Ye!==null&&(document.head.removeChild(Ye),oo=null,Ye=null,Ai=-1)}function to(i,o){var s,f;const h=$h(i,o);if(oo!==h){if(oo=h,Ye===null&&(Ye=document.createElement("style"),document.head.appendChild(Ye)),Ai>=0){var v;(v=Ye.sheet)===null||v===void 0||v.removeRule(Ai)}Ai=(s=(f=Ye.sheet)===null||f===void 0?void 0:f.insertRule(`*{cursor: ${h} !important;}`))!==null&&s!==void 0?s:-1}}function Iv(i){return i.type==="keydown"}function Pv(i){return i.type.startsWith("pointer")}function t0(i){return i.type.startsWith("mouse")}function Di(i){if(Pv(i)){if(i.isPrimary)return{x:i.clientX,y:i.clientY}}else if(t0(i))return{x:i.clientX,y:i.clientY};return{x:1/0,y:1/0}}function kh(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Fh(i,o,s){return i.x<o.x+o.width&&i.x+i.width>o.x&&i.y<o.y+o.height&&i.y+i.height>o.y}function Ih(i,o){if(i===o)throw new Error("Cannot compare node with itself");const s={a:Bv(i),b:Bv(o)};let f;for(;s.a.at(-1)===s.b.at(-1);)i=s.a.pop(),o=s.b.pop(),f=i;ft(f,"Stacking order can only be calculated for elements with a common ancestor");const h={a:xv(Hv(s.a)),b:xv(Hv(s.b))};if(h.a===h.b){const v=f.childNodes,_={a:s.a.at(-1),b:s.b.at(-1)};let A=v.length;for(;A--;){const E=v[A];if(E===_.a)return 1;if(E===_.b)return-1}}return Math.sign(h.a-h.b)}const Ph=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function tg(i){var o;const s=getComputedStyle((o=l0(i))!==null&&o!==void 0?o:i).display;return s==="flex"||s==="inline-flex"}function lg(i){const o=getComputedStyle(i);return!!(o.position==="fixed"||o.zIndex!=="auto"&&(o.position!=="static"||tg(i))||+o.opacity<1||"transform"in o&&o.transform!=="none"||"webkitTransform"in o&&o.webkitTransform!=="none"||"mixBlendMode"in o&&o.mixBlendMode!=="normal"||"filter"in o&&o.filter!=="none"||"webkitFilter"in o&&o.webkitFilter!=="none"||"isolation"in o&&o.isolation==="isolate"||Ph.test(o.willChange)||o.webkitOverflowScrolling==="touch")}function Hv(i){let o=i.length;for(;o--;){const s=i[o];if(ft(s,"Missing node"),lg(s))return s}return null}function xv(i){return i&&Number(getComputedStyle(i).zIndex)||0}function Bv(i){const o=[];for(;i;)o.push(i),i=l0(i);return o}function l0(i){const{parentNode:o}=i;return o&&o instanceof ShadowRoot?o.host:o}const e0=1,a0=2,n0=4,u0=8,eg=kh()==="coarse";let Gl=[],Ia=!1,aa=new Map,Ci=new Map;const In=new Set;function ag(i,o,s,f,h){var v;const{ownerDocument:_}=o,A={direction:s,element:o,hitAreaMargins:f,setResizeHandlerState:h},E=(v=aa.get(_))!==null&&v!==void 0?v:0;return aa.set(_,E+1),In.add(A),Ti(),function(){var G;Ci.delete(i),In.delete(A);const U=(G=aa.get(_))!==null&&G!==void 0?G:1;if(aa.set(_,U-1),Ti(),U===1&&aa.delete(_),Gl.includes(A)){const B=Gl.indexOf(A);B>=0&&Gl.splice(B,1),mo(),h("up",!0,null)}}}function ng(i){const{target:o}=i,{x:s,y:f}=Di(i);Ia=!0,yo({target:o,x:s,y:f}),Ti(),Gl.length>0&&(_i("down",i),i.preventDefault(),i0(o)||i.stopImmediatePropagation())}function lo(i){const{x:o,y:s}=Di(i);if(Ia&&i.buttons===0&&(Ia=!1,_i("up",i)),!Ia){const{target:f}=i;yo({target:f,x:o,y:s})}_i("move",i),mo(),Gl.length>0&&i.preventDefault()}function eo(i){const{target:o}=i,{x:s,y:f}=Di(i);Ci.clear(),Ia=!1,Gl.length>0&&(i.preventDefault(),i0(o)||i.stopImmediatePropagation()),_i("up",i),yo({target:o,x:s,y:f}),mo(),Ti()}function i0(i){let o=i;for(;o;){if(o.hasAttribute(Lt.resizeHandle))return!0;o=o.parentElement}return!1}function yo({target:i,x:o,y:s}){Gl.splice(0);let f=null;(i instanceof HTMLElement||i instanceof SVGElement)&&(f=i),In.forEach(h=>{const{element:v,hitAreaMargins:_}=h,A=v.getBoundingClientRect(),{bottom:E,left:S,right:G,top:U}=A,B=eg?_.coarse:_.fine;if(o>=S-B&&o<=G+B&&s>=U-B&&s<=E+B){if(f!==null&&document.contains(f)&&v!==f&&!v.contains(f)&&!f.contains(v)&&Ih(f,v)>0){let V=f,Y=!1;for(;V&&!V.contains(v);){if(Fh(V.getBoundingClientRect(),A)){Y=!0;break}V=V.parentElement}if(Y)return}Gl.push(h)}})}function ao(i,o){Ci.set(i,o)}function mo(){let i=!1,o=!1;Gl.forEach(f=>{const{direction:h}=f;h==="horizontal"?i=!0:o=!0});let s=0;Ci.forEach(f=>{s|=f}),i&&o?to("intersection",s):i?to("horizontal",s):o?to("vertical",s):Wh()}let no=new AbortController;function Ti(){no.abort(),no=new AbortController;const i={capture:!0,signal:no.signal};In.size&&(Ia?(Gl.length>0&&aa.forEach((o,s)=>{const{body:f}=s;o>0&&(f.addEventListener("contextmenu",eo,i),f.addEventListener("pointerleave",lo,i),f.addEventListener("pointermove",lo,i))}),window.addEventListener("pointerup",eo,i),window.addEventListener("pointercancel",eo,i)):aa.forEach((o,s)=>{const{body:f}=s;o>0&&(f.addEventListener("pointerdown",ng,i),f.addEventListener("pointermove",lo,i))}))}function _i(i,o){In.forEach(s=>{const{setResizeHandlerState:f}=s,h=Gl.includes(s);f(i,h,o)})}function ug(){const[i,o]=x.useState(0);return x.useCallback(()=>o(s=>s+1),[])}function ft(i,o){if(!i)throw console.error(o),Error(o)}function ia(i,o,s=so){return i.toFixed(s)===o.toFixed(s)?0:i>o?1:-1}function re(i,o,s=so){return ia(i,o,s)===0}function Tl(i,o,s){return ia(i,o,s)===0}function ig(i,o,s){if(i.length!==o.length)return!1;for(let f=0;f<i.length;f++){const h=i[f],v=o[f];if(!Tl(h,v,s))return!1}return!0}function ka({panelConstraints:i,panelIndex:o,size:s}){const f=i[o];ft(f!=null,`Panel constraints not found for index ${o}`);let{collapsedSize:h=0,collapsible:v,maxSize:_=100,minSize:A=0}=f;if(ia(s,A)<0)if(v){const E=(h+A)/2;ia(s,E)<0?s=h:s=A}else s=A;return s=Math.min(_,s),s=parseFloat(s.toFixed(so)),s}function kn({delta:i,initialLayout:o,panelConstraints:s,pivotIndices:f,prevLayout:h,trigger:v}){if(Tl(i,0))return o;const _=[...o],[A,E]=f;ft(A!=null,"Invalid first pivot index"),ft(E!=null,"Invalid second pivot index");let S=0;if(v==="keyboard"){{const U=i<0?E:A,B=s[U];ft(B,`Panel constraints not found for index ${U}`);const{collapsedSize:J=0,collapsible:V,minSize:Y=0}=B;if(V){const Z=o[U];if(ft(Z!=null,`Previous layout not found for panel index ${U}`),Tl(Z,J)){const K=Y-Z;ia(K,Math.abs(i))>0&&(i=i<0?0-K:K)}}}{const U=i<0?A:E,B=s[U];ft(B,`No panel constraints found for index ${U}`);const{collapsedSize:J=0,collapsible:V,minSize:Y=0}=B;if(V){const Z=o[U];if(ft(Z!=null,`Previous layout not found for panel index ${U}`),Tl(Z,Y)){const K=Z-J;ia(K,Math.abs(i))>0&&(i=i<0?0-K:K)}}}}{const U=i<0?1:-1;let B=i<0?E:A,J=0;for(;;){const Y=o[B];ft(Y!=null,`Previous layout not found for panel index ${B}`);const K=ka({panelConstraints:s,panelIndex:B,size:100})-Y;if(J+=K,B+=U,B<0||B>=s.length)break}const V=Math.min(Math.abs(i),Math.abs(J));i=i<0?0-V:V}{let B=i<0?A:E;for(;B>=0&&B<s.length;){const J=Math.abs(i)-Math.abs(S),V=o[B];ft(V!=null,`Previous layout not found for panel index ${B}`);const Y=V-J,Z=ka({panelConstraints:s,panelIndex:B,size:Y});if(!Tl(V,Z)&&(S+=V-Z,_[B]=Z,S.toPrecision(3).localeCompare(Math.abs(i).toPrecision(3),void 0,{numeric:!0})>=0))break;i<0?B--:B++}}if(ig(h,_))return h;{const U=i<0?E:A,B=o[U];ft(B!=null,`Previous layout not found for panel index ${U}`);const J=B+S,V=ka({panelConstraints:s,panelIndex:U,size:J});if(_[U]=V,!Tl(V,J)){let Y=J-V,K=i<0?E:A;for(;K>=0&&K<s.length;){const k=_[K];ft(k!=null,`Previous layout not found for panel index ${K}`);const I=k+Y,tt=ka({panelConstraints:s,panelIndex:K,size:I});if(Tl(k,tt)||(Y-=tt-k,_[K]=tt),Tl(Y,0))break;i>0?K--:K++}}}const G=_.reduce((U,B)=>B+U,0);return Tl(G,100)?_:h}function cg({layout:i,panelsArray:o,pivotIndices:s}){let f=0,h=100,v=0,_=0;const A=s[0];ft(A!=null,"No pivot index found"),o.forEach((U,B)=>{const{constraints:J}=U,{maxSize:V=100,minSize:Y=0}=J;B===A?(f=Y,h=V):(v+=Y,_+=V)});const E=Math.min(h,100-v),S=Math.max(f,100-_),G=i[A];return{valueMax:E,valueMin:S,valueNow:G}}function Pn(i,o=document){return Array.from(o.querySelectorAll(`[${Lt.resizeHandleId}][data-panel-group-id="${i}"]`))}function c0(i,o,s=document){const h=Pn(i,s).findIndex(v=>v.getAttribute(Lt.resizeHandleId)===o);return h??null}function f0(i,o,s){const f=c0(i,o,s);return f!=null?[f,f+1]:[-1,-1]}function o0(i,o=document){var s;if(o instanceof HTMLElement&&(o==null||(s=o.dataset)===null||s===void 0?void 0:s.panelGroupId)==i)return o;const f=o.querySelector(`[data-panel-group][data-panel-group-id="${i}"]`);return f||null}function Ri(i,o=document){const s=o.querySelector(`[${Lt.resizeHandleId}="${i}"]`);return s||null}function fg(i,o,s,f=document){var h,v,_,A;const E=Ri(o,f),S=Pn(i,f),G=E?S.indexOf(E):-1,U=(h=(v=s[G])===null||v===void 0?void 0:v.id)!==null&&h!==void 0?h:null,B=(_=(A=s[G+1])===null||A===void 0?void 0:A.id)!==null&&_!==void 0?_:null;return[U,B]}function og({committedValuesRef:i,eagerValuesRef:o,groupId:s,layout:f,panelDataArray:h,panelGroupElement:v,setLayout:_}){x.useRef({didWarnAboutMissingResizeHandle:!1}),ua(()=>{if(!v)return;const A=Pn(s,v);for(let E=0;E<h.length-1;E++){const{valueMax:S,valueMin:G,valueNow:U}=cg({layout:f,panelsArray:h,pivotIndices:[E,E+1]}),B=A[E];if(B!=null){const J=h[E];ft(J,`No panel data found for index "${E}"`),B.setAttribute("aria-controls",J.id),B.setAttribute("aria-valuemax",""+Math.round(S)),B.setAttribute("aria-valuemin",""+Math.round(G)),B.setAttribute("aria-valuenow",U!=null?""+Math.round(U):"")}}return()=>{A.forEach((E,S)=>{E.removeAttribute("aria-controls"),E.removeAttribute("aria-valuemax"),E.removeAttribute("aria-valuemin"),E.removeAttribute("aria-valuenow")})}},[s,f,h,v]),x.useEffect(()=>{if(!v)return;const A=o.current;ft(A,"Eager values not found");const{panelDataArray:E}=A,S=o0(s,v);ft(S!=null,`No group found for id "${s}"`);const G=Pn(s,v);ft(G,`No resize handles found for group id "${s}"`);const U=G.map(B=>{const J=B.getAttribute(Lt.resizeHandleId);ft(J,"Resize handle element has no handle id attribute");const[V,Y]=fg(s,J,E,v);if(V==null||Y==null)return()=>{};const Z=K=>{if(!K.defaultPrevented)switch(K.key){case"Enter":{K.preventDefault();const k=E.findIndex(I=>I.id===V);if(k>=0){const I=E[k];ft(I,`No panel data found for index ${k}`);const tt=f[k],{collapsedSize:nt=0,collapsible:W,minSize:q=0}=I.constraints;if(tt!=null&&W){const Et=kn({delta:Tl(tt,nt)?q-nt:nt-tt,initialLayout:f,panelConstraints:E.map(xt=>xt.constraints),pivotIndices:f0(s,J,v),prevLayout:f,trigger:"keyboard"});f!==Et&&_(Et)}}break}}};return B.addEventListener("keydown",Z),()=>{B.removeEventListener("keydown",Z)}});return()=>{U.forEach(B=>B())}},[v,i,o,s,f,h,_])}function qv(i,o){if(i.length!==o.length)return!1;for(let s=0;s<i.length;s++)if(i[s]!==o[s])return!1;return!0}function r0(i,o){const s=i==="horizontal",{x:f,y:h}=Di(o);return s?f:h}function rg(i,o,s,f,h){const v=s==="horizontal",_=Ri(o,h);ft(_,`No resize handle element found for id "${o}"`);const A=_.getAttribute(Lt.groupId);ft(A,"Resize handle element has no group id attribute");let{initialCursorPosition:E}=f;const S=r0(s,i),G=o0(A,h);ft(G,`No group element found for id "${A}"`);const U=G.getBoundingClientRect(),B=v?U.width:U.height;return(S-E)/B*100}function sg(i,o,s,f,h,v){if(Iv(i)){const _=s==="horizontal";let A=0;i.shiftKey?A=100:h!=null?A=h:A=10;let E=0;switch(i.key){case"ArrowDown":E=_?0:A;break;case"ArrowLeft":E=_?-A:0;break;case"ArrowRight":E=_?A:0;break;case"ArrowUp":E=_?0:-A;break;case"End":E=100;break;case"Home":E=-100;break}return E}else return f==null?0:rg(i,o,s,f,v)}function dg({panelDataArray:i}){const o=Array(i.length),s=i.map(v=>v.constraints);let f=0,h=100;for(let v=0;v<i.length;v++){const _=s[v];ft(_,`Panel constraints not found for index ${v}`);const{defaultSize:A}=_;A!=null&&(f++,o[v]=A,h-=A)}for(let v=0;v<i.length;v++){const _=s[v];ft(_,`Panel constraints not found for index ${v}`);const{defaultSize:A}=_;if(A!=null)continue;const E=i.length-f,S=h/E;f++,o[v]=S,h-=S}return o}function $a(i,o,s){o.forEach((f,h)=>{const v=i[h];ft(v,`Panel data not found for index ${h}`);const{callbacks:_,constraints:A,id:E}=v,{collapsedSize:S=0,collapsible:G}=A,U=s[E];if(U==null||f!==U){s[E]=f;const{onCollapse:B,onExpand:J,onResize:V}=_;V&&V(f,U),G&&(B||J)&&(J&&(U==null||re(U,S))&&!re(f,S)&&J(),B&&(U==null||!re(U,S))&&re(f,S)&&B())}})}function zi(i,o){if(i.length!==o.length)return!1;for(let s=0;s<i.length;s++)if(i[s]!=o[s])return!1;return!0}function vg({defaultSize:i,dragState:o,layout:s,panelData:f,panelIndex:h,precision:v=3}){const _=s[h];let A;return _==null?A=i!=null?i.toPrecision(v):"1":f.length===1?A="1":A=_.toPrecision(v),{flexBasis:0,flexGrow:A,flexShrink:1,overflow:"hidden",pointerEvents:o!==null?"none":void 0}}function yg(i,o=10){let s=null;return(...h)=>{s!==null&&clearTimeout(s),s=setTimeout(()=>{i(...h)},o)}}function Yv(i){try{if(typeof localStorage<"u")i.getItem=o=>localStorage.getItem(o),i.setItem=(o,s)=>{localStorage.setItem(o,s)};else throw new Error("localStorage not supported in this environment")}catch(o){console.error(o),i.getItem=()=>null,i.setItem=()=>{}}}function s0(i){return`react-resizable-panels:${i}`}function d0(i){return i.map(o=>{const{constraints:s,id:f,idIsFromProps:h,order:v}=o;return h?f:v?`${v}:${JSON.stringify(s)}`:JSON.stringify(s)}).sort((o,s)=>o.localeCompare(s)).join(",")}function v0(i,o){try{const s=s0(i),f=o.getItem(s);if(f){const h=JSON.parse(f);if(typeof h=="object"&&h!=null)return h}}catch{}return null}function mg(i,o,s){var f,h;const v=(f=v0(i,s))!==null&&f!==void 0?f:{},_=d0(o);return(h=v[_])!==null&&h!==void 0?h:null}function hg(i,o,s,f,h){var v;const _=s0(i),A=d0(o),E=(v=v0(i,h))!==null&&v!==void 0?v:{};E[A]={expandToSizes:Object.fromEntries(s.entries()),layout:f};try{h.setItem(_,JSON.stringify(E))}catch(S){console.error(S)}}function Gv({layout:i,panelConstraints:o}){const s=[...i],f=s.reduce((v,_)=>v+_,0);if(s.length!==o.length)throw Error(`Invalid ${o.length} panel layout: ${s.map(v=>`${v}%`).join(", ")}`);if(!Tl(f,100)&&s.length>0)for(let v=0;v<o.length;v++){const _=s[v];ft(_!=null,`No layout data found for index ${v}`);const A=100/f*_;s[v]=A}let h=0;for(let v=0;v<o.length;v++){const _=s[v];ft(_!=null,`No layout data found for index ${v}`);const A=ka({panelConstraints:o,panelIndex:v,size:_});_!=A&&(h+=_-A,s[v]=A)}if(!Tl(h,0))for(let v=0;v<o.length;v++){const _=s[v];ft(_!=null,`No layout data found for index ${v}`);const A=_+h,E=ka({panelConstraints:o,panelIndex:v,size:A});if(_!==E&&(h-=E-_,s[v]=E,Tl(h,0)))break}return s}const gg=100,Fn={getItem:i=>(Yv(Fn),Fn.getItem(i)),setItem:(i,o)=>{Yv(Fn),Fn.setItem(i,o)}},Lv={};function y0({autoSaveId:i=null,children:o,className:s="",direction:f,forwardedRef:h,id:v=null,onLayout:_=null,keyboardResizeBy:A=null,storage:E=Fn,style:S,tagName:G="div",...U}){const B=vo(v),J=x.useRef(null),[V,Y]=x.useState(null),[Z,K]=x.useState([]),k=ug(),I=x.useRef({}),tt=x.useRef(new Map),nt=x.useRef(0),W=x.useRef({autoSaveId:i,direction:f,dragState:V,id:B,keyboardResizeBy:A,onLayout:_,storage:E}),q=x.useRef({layout:Z,panelDataArray:[],panelDataArrayChanged:!1});x.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),x.useImperativeHandle(h,()=>({getId:()=>W.current.id,getLayout:()=>{const{layout:O}=q.current;return O},setLayout:O=>{const{onLayout:H}=W.current,{layout:X,panelDataArray:j}=q.current,L=Gv({layout:O,panelConstraints:j.map(F=>F.constraints)});qv(X,L)||(K(L),q.current.layout=L,H&&H(L),$a(j,L,I.current))}}),[]),ua(()=>{W.current.autoSaveId=i,W.current.direction=f,W.current.dragState=V,W.current.id=B,W.current.onLayout=_,W.current.storage=E}),og({committedValuesRef:W,eagerValuesRef:q,groupId:B,layout:Z,panelDataArray:q.current.panelDataArray,setLayout:K,panelGroupElement:J.current}),x.useEffect(()=>{const{panelDataArray:O}=q.current;if(i){if(Z.length===0||Z.length!==O.length)return;let H=Lv[i];H==null&&(H=yg(hg,gg),Lv[i]=H);const X=[...O],j=new Map(tt.current);H(i,X,j,Z,E)}},[i,Z,E]),x.useEffect(()=>{});const Et=x.useCallback(O=>{const{onLayout:H}=W.current,{layout:X,panelDataArray:j}=q.current;if(O.constraints.collapsible){const L=j.map(nl=>nl.constraints),{collapsedSize:F=0,panelSize:at,pivotIndices:Rt}=ea(j,O,X);if(ft(at!=null,`Panel size not found for panel "${O.id}"`),!re(at,F)){tt.current.set(O.id,at);const il=Wa(j,O)===j.length-1?at-F:F-at,Nt=kn({delta:il,initialLayout:X,panelConstraints:L,pivotIndices:Rt,prevLayout:X,trigger:"imperative-api"});zi(X,Nt)||(K(Nt),q.current.layout=Nt,H&&H(Nt),$a(j,Nt,I.current))}}},[]),xt=x.useCallback((O,H)=>{const{onLayout:X}=W.current,{layout:j,panelDataArray:L}=q.current;if(O.constraints.collapsible){const F=L.map(Jt=>Jt.constraints),{collapsedSize:at=0,panelSize:Rt=0,minSize:nl=0,pivotIndices:il}=ea(L,O,j),Nt=H??nl;if(re(Rt,at)){const Jt=tt.current.get(O.id),Vl=Jt!=null&&Jt>=Nt?Jt:Nt,Pa=Wa(L,O)===L.length-1?Rt-Vl:Vl-Rt,kt=kn({delta:Pa,initialLayout:j,panelConstraints:F,pivotIndices:il,prevLayout:j,trigger:"imperative-api"});zi(j,kt)||(K(kt),q.current.layout=kt,X&&X(kt),$a(L,kt,I.current))}}},[]),qt=x.useCallback(O=>{const{layout:H,panelDataArray:X}=q.current,{panelSize:j}=ea(X,O,H);return ft(j!=null,`Panel size not found for panel "${O.id}"`),j},[]),bt=x.useCallback((O,H)=>{const{panelDataArray:X}=q.current,j=Wa(X,O);return vg({defaultSize:H,dragState:V,layout:Z,panelData:X,panelIndex:j})},[V,Z]),ot=x.useCallback(O=>{const{layout:H,panelDataArray:X}=q.current,{collapsedSize:j=0,collapsible:L,panelSize:F}=ea(X,O,H);return ft(F!=null,`Panel size not found for panel "${O.id}"`),L===!0&&re(F,j)},[]),al=x.useCallback(O=>{const{layout:H,panelDataArray:X}=q.current,{collapsedSize:j=0,collapsible:L,panelSize:F}=ea(X,O,H);return ft(F!=null,`Panel size not found for panel "${O.id}"`),!L||ia(F,j)>0},[]),Ct=x.useCallback(O=>{const{panelDataArray:H}=q.current;H.push(O),H.sort((X,j)=>{const L=X.order,F=j.order;return L==null&&F==null?0:L==null?-1:F==null?1:L-F}),q.current.panelDataArrayChanged=!0,k()},[k]);ua(()=>{if(q.current.panelDataArrayChanged){q.current.panelDataArrayChanged=!1;const{autoSaveId:O,onLayout:H,storage:X}=W.current,{layout:j,panelDataArray:L}=q.current;let F=null;if(O){const Rt=mg(O,L,X);Rt&&(tt.current=new Map(Object.entries(Rt.expandToSizes)),F=Rt.layout)}F==null&&(F=dg({panelDataArray:L}));const at=Gv({layout:F,panelConstraints:L.map(Rt=>Rt.constraints)});qv(j,at)||(K(at),q.current.layout=at,H&&H(at),$a(L,at,I.current))}}),ua(()=>{const O=q.current;return()=>{O.layout=[]}},[]);const pt=x.useCallback(O=>{let H=!1;const X=J.current;return X&&window.getComputedStyle(X,null).getPropertyValue("direction")==="rtl"&&(H=!0),function(L){L.preventDefault();const F=J.current;if(!F)return()=>null;const{direction:at,dragState:Rt,id:nl,keyboardResizeBy:il,onLayout:Nt}=W.current,{layout:Jt,panelDataArray:Vl}=q.current,{initialLayout:se}=Rt??{},Pa=f0(nl,O,F);let kt=sg(L,O,at,Rt,il,F);const ca=at==="horizontal";ca&&H&&(kt=-kt);const tn=Vl.map(Ni=>Ni.constraints),Kl=kn({delta:kt,initialLayout:se??Jt,panelConstraints:tn,pivotIndices:Pa,prevLayout:Jt,trigger:Iv(L)?"keyboard":"mouse-or-touch"}),tu=!zi(Jt,Kl);(Pv(L)||t0(L))&&nt.current!=kt&&(nt.current=kt,!tu&&kt!==0?ca?ao(O,kt<0?e0:a0):ao(O,kt<0?n0:u0):ao(O,0)),tu&&(K(Kl),q.current.layout=Kl,Nt&&Nt(Kl),$a(Vl,Kl,I.current))}},[]),M=x.useCallback((O,H)=>{const{onLayout:X}=W.current,{layout:j,panelDataArray:L}=q.current,F=L.map(Jt=>Jt.constraints),{panelSize:at,pivotIndices:Rt}=ea(L,O,j);ft(at!=null,`Panel size not found for panel "${O.id}"`);const il=Wa(L,O)===L.length-1?at-H:H-at,Nt=kn({delta:il,initialLayout:j,panelConstraints:F,pivotIndices:Rt,prevLayout:j,trigger:"imperative-api"});zi(j,Nt)||(K(Nt),q.current.layout=Nt,X&&X(Nt),$a(L,Nt,I.current))},[]),Q=x.useCallback((O,H)=>{const{layout:X,panelDataArray:j}=q.current,{collapsedSize:L=0,collapsible:F}=H,{collapsedSize:at=0,collapsible:Rt,maxSize:nl=100,minSize:il=0}=O.constraints,{panelSize:Nt}=ea(j,O,X);Nt!=null&&(F&&Rt&&re(Nt,L)?re(L,at)||M(O,at):Nt<il?M(O,il):Nt>nl&&M(O,nl))},[M]),lt=x.useCallback((O,H)=>{const{direction:X}=W.current,{layout:j}=q.current;if(!J.current)return;const L=Ri(O,J.current);ft(L,`Drag handle element not found for id "${O}"`);const F=r0(X,H);Y({dragHandleId:O,dragHandleRect:L.getBoundingClientRect(),initialCursorPosition:F,initialLayout:j})},[]),mt=x.useCallback(()=>{Y(null)},[]),ht=x.useCallback(O=>{const{panelDataArray:H}=q.current,X=Wa(H,O);X>=0&&(H.splice(X,1),delete I.current[O.id],q.current.panelDataArrayChanged=!0,k())},[k]),m=x.useMemo(()=>({collapsePanel:Et,direction:f,dragState:V,expandPanel:xt,getPanelSize:qt,getPanelStyle:bt,groupId:B,isPanelCollapsed:ot,isPanelExpanded:al,reevaluatePanelConstraints:Q,registerPanel:Ct,registerResizeHandle:pt,resizePanel:M,startDragging:lt,stopDragging:mt,unregisterPanel:ht,panelGroupElement:J.current}),[Et,V,f,xt,qt,bt,B,ot,al,Q,Ct,pt,M,lt,mt,ht]),R={display:"flex",flexDirection:f==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return x.createElement(Oi.Provider,{value:m},x.createElement(G,{...U,children:o,className:s,id:v,ref:J,style:{...R,...S},[Lt.group]:"",[Lt.groupDirection]:f,[Lt.groupId]:B}))}const Sg=x.forwardRef((i,o)=>x.createElement(y0,{...i,forwardedRef:o}));y0.displayName="PanelGroup";Sg.displayName="forwardRef(PanelGroup)";function Wa(i,o){return i.findIndex(s=>s===o||s.id===o.id)}function ea(i,o,s){const f=Wa(i,o),v=f===i.length-1?[f-1,f]:[f,f+1],_=s[f];return{...o.constraints,panelSize:_,pivotIndices:v}}function bg({disabled:i,handleId:o,resizeHandler:s,panelGroupElement:f}){x.useEffect(()=>{if(i||s==null||f==null)return;const h=Ri(o,f);if(h==null)return;const v=_=>{if(!_.defaultPrevented)switch(_.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{_.preventDefault(),s(_);break}case"F6":{_.preventDefault();const A=h.getAttribute(Lt.groupId);ft(A,`No group element found for id "${A}"`);const E=Pn(A,f),S=c0(A,o,f);ft(S!==null,`No resize element found for id "${o}"`);const G=_.shiftKey?S>0?S-1:E.length-1:S+1<E.length?S+1:0;E[G].focus();break}}};return h.addEventListener("keydown",v),()=>{h.removeEventListener("keydown",v)}},[f,i,o,s])}function zg({children:i=null,className:o="",disabled:s=!1,hitAreaMargins:f,id:h,onBlur:v,onClick:_,onDragging:A,onFocus:E,onPointerDown:S,onPointerUp:G,style:U={},tabIndex:B=0,tagName:J="div",...V}){var Y,Z;const K=x.useRef(null),k=x.useRef({onClick:_,onDragging:A,onPointerDown:S,onPointerUp:G});x.useEffect(()=>{k.current.onClick=_,k.current.onDragging=A,k.current.onPointerDown=S,k.current.onPointerUp=G});const I=x.useContext(Oi);if(I===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:tt,groupId:nt,registerResizeHandle:W,startDragging:q,stopDragging:Et,panelGroupElement:xt}=I,qt=vo(h),[bt,ot]=x.useState("inactive"),[al,Ct]=x.useState(!1),[pt,M]=x.useState(null),Q=x.useRef({state:bt});ua(()=>{Q.current.state=bt}),x.useEffect(()=>{if(s)M(null);else{const m=W(qt);M(()=>m)}},[s,qt,W]);const lt=(Y=f?.coarse)!==null&&Y!==void 0?Y:15,mt=(Z=f?.fine)!==null&&Z!==void 0?Z:5;x.useEffect(()=>{if(s||pt==null)return;const m=K.current;ft(m,"Element ref not attached");let R=!1;return ag(qt,m,tt,{coarse:lt,fine:mt},(H,X,j)=>{if(!X){ot("inactive");return}switch(H){case"down":{ot("drag"),R=!1,ft(j,'Expected event to be defined for "down" action'),q(qt,j);const{onDragging:L,onPointerDown:F}=k.current;L?.(!0),F?.();break}case"move":{const{state:L}=Q.current;R=!0,L!=="drag"&&ot("hover"),ft(j,'Expected event to be defined for "move" action'),pt(j);break}case"up":{ot("hover"),Et();const{onClick:L,onDragging:F,onPointerUp:at}=k.current;F?.(!1),at?.(),R||L?.();break}}})},[lt,tt,s,mt,W,qt,pt,q,Et]),bg({disabled:s,handleId:qt,resizeHandler:pt,panelGroupElement:xt});const ht={touchAction:"none",userSelect:"none"};return x.createElement(J,{...V,children:i,className:o,id:h,onBlur:()=>{Ct(!1),v?.()},onFocus:()=>{Ct(!0),E?.()},ref:K,role:"separator",style:{...ht,...U},tabIndex:B,[Lt.groupDirection]:tt,[Lt.groupId]:nt,[Lt.resizeHandle]:"",[Lt.resizeHandleActive]:bt==="drag"?"pointer":al?"keyboard":void 0,[Lt.resizeHandleEnabled]:!s,[Lt.resizeHandleId]:qt,[Lt.resizeHandleState]:bt})}zg.displayName="PanelResizeHandle";export{Sg as P,jm as R,_g as a,Vh as b,wh as c,zg as d,Eg as e,qm as g,Ag as i,pg as j,x as r,Tg as u};
|
|
49
|
+
`)},Xh=0,wa=[];function jh(i){var o=x.useRef([]),s=x.useRef([0,0]),f=x.useRef(),h=x.useState(Xh++)[0],v=x.useState(wv)[0],_=x.useRef(i);x.useEffect(function(){_.current=i},[i]),x.useEffect(function(){if(i.inert){document.body.classList.add("block-interactivity-".concat(h));var Y=fh([i.lockRef.current],(i.shards||[]).map(Nv),!0).filter(Boolean);return Y.forEach(function(Z){return Z.classList.add("allow-interactivity-".concat(h))}),function(){document.body.classList.remove("block-interactivity-".concat(h)),Y.forEach(function(Z){return Z.classList.remove("allow-interactivity-".concat(h))})}}},[i.inert,i.lockRef.current,i.shards]);var A=x.useCallback(function(Y,Z){if("touches"in Y&&Y.touches.length===2||Y.type==="wheel"&&Y.ctrlKey)return!_.current.allowPinchZoom;var K=bi(Y),k=s.current,I="deltaX"in Y?Y.deltaX:k[0]-K[0],tt="deltaY"in Y?Y.deltaY:k[1]-K[1],nt,W=Y.target,q=Math.abs(I)>Math.abs(tt)?"h":"v";if("touches"in Y&&q==="h"&&W.type==="range")return!1;var Et=window.getSelection(),xt=Et&&Et.anchorNode,qt=xt?xt===W||xt.contains(W):!1;if(qt)return!1;var bt=Cv(q,W);if(!bt)return!0;if(bt?nt=q:(nt=q==="v"?"h":"v",bt=Cv(q,W)),!bt)return!1;if(!f.current&&"changedTouches"in Y&&(I||tt)&&(f.current=nt),!nt)return!0;var ot=f.current||nt;return Yh(ot,Z,Y,ot==="h"?I:tt)},[]),E=x.useCallback(function(Y){var Z=Y;if(!(!wa.length||wa[wa.length-1]!==v)){var K="deltaY"in Z?Rv(Z):bi(Z),k=o.current.filter(function(nt){return nt.name===Z.type&&(nt.target===Z.target||Z.target===nt.shadowParent)&&Gh(nt.delta,K)})[0];if(k&&k.should){Z.cancelable&&Z.preventDefault();return}if(!k){var I=(_.current.shards||[]).map(Nv).filter(Boolean).filter(function(nt){return nt.contains(Z.target)}),tt=I.length>0?A(Z,I[0]):!_.current.noIsolation;tt&&Z.cancelable&&Z.preventDefault()}}},[]),S=x.useCallback(function(Y,Z,K,k){var I={name:Y,delta:Z,target:K,should:k,shadowParent:Qh(K)};o.current.push(I),setTimeout(function(){o.current=o.current.filter(function(tt){return tt!==I})},1)},[]),G=x.useCallback(function(Y){s.current=bi(Y),f.current=void 0},[]),U=x.useCallback(function(Y){S(Y.type,Rv(Y),Y.target,A(Y,i.lockRef.current))},[]),B=x.useCallback(function(Y){S(Y.type,bi(Y),Y.target,A(Y,i.lockRef.current))},[]);x.useEffect(function(){return wa.push(v),i.setCallbacks({onScrollCapture:U,onWheelCapture:U,onTouchMoveCapture:B}),document.addEventListener("wheel",E,Ja),document.addEventListener("touchmove",E,Ja),document.addEventListener("touchstart",G,Ja),function(){wa=wa.filter(function(Y){return Y!==v}),document.removeEventListener("wheel",E,Ja),document.removeEventListener("touchmove",E,Ja),document.removeEventListener("touchstart",G,Ja)}},[]);var J=i.removeScrollBar,V=i.inert;return x.createElement(x.Fragment,null,V?x.createElement(v,{styles:Lh(h)}):null,J?x.createElement(Rh,{noRelative:i.noRelative,gapMode:i.gapMode}):null)}function Qh(i){for(var o=null;i!==null;)i instanceof ShadowRoot&&(o=i.host,i=i.host),i=i.parentNode;return o}const Zh=gh(Jv,jh);var Vh=x.forwardRef(function(i,o){return x.createElement(Mi,Zl({},i,{ref:o,sideCar:Zh}))});Vh.classNames=Mi.classNames;const Oi=x.createContext(null);Oi.displayName="PanelGroupContext";const Lt={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},so=10,ua=x.useLayoutEffect,Uv=jm.useId,Kh=typeof Uv=="function"?Uv:()=>null;let Jh=0;function vo(i=null){const o=Kh(),s=x.useRef(i||o||null);return s.current===null&&(s.current=""+Jh++),i??s.current}function Fv({children:i,className:o="",collapsedSize:s,collapsible:f,defaultSize:h,forwardedRef:v,id:_,maxSize:A,minSize:E,onCollapse:S,onExpand:G,onResize:U,order:B,style:J,tagName:V="div",...Y}){const Z=x.useContext(Oi);if(Z===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:K,expandPanel:k,getPanelSize:I,getPanelStyle:tt,groupId:nt,isPanelCollapsed:W,reevaluatePanelConstraints:q,registerPanel:Et,resizePanel:xt,unregisterPanel:qt}=Z,bt=vo(_),ot=x.useRef({callbacks:{onCollapse:S,onExpand:G,onResize:U},constraints:{collapsedSize:s,collapsible:f,defaultSize:h,maxSize:A,minSize:E},id:bt,idIsFromProps:_!==void 0,order:B});x.useRef({didLogMissingDefaultSizeWarning:!1}),ua(()=>{const{callbacks:Ct,constraints:pt}=ot.current,M={...pt};ot.current.id=bt,ot.current.idIsFromProps=_!==void 0,ot.current.order=B,Ct.onCollapse=S,Ct.onExpand=G,Ct.onResize=U,pt.collapsedSize=s,pt.collapsible=f,pt.defaultSize=h,pt.maxSize=A,pt.minSize=E,(M.collapsedSize!==pt.collapsedSize||M.collapsible!==pt.collapsible||M.maxSize!==pt.maxSize||M.minSize!==pt.minSize)&&q(ot.current,M)}),ua(()=>{const Ct=ot.current;return Et(Ct),()=>{qt(Ct)}},[B,bt,Et,qt]),x.useImperativeHandle(v,()=>({collapse:()=>{K(ot.current)},expand:Ct=>{k(ot.current,Ct)},getId(){return bt},getSize(){return I(ot.current)},isCollapsed(){return W(ot.current)},isExpanded(){return!W(ot.current)},resize:Ct=>{xt(ot.current,Ct)}}),[K,k,I,W,bt,xt]);const al=tt(ot.current,h);return x.createElement(V,{...Y,children:i,className:o,id:bt,style:{...al,...J},[Lt.groupId]:nt,[Lt.panel]:"",[Lt.panelCollapsible]:f||void 0,[Lt.panelId]:bt,[Lt.panelSize]:parseFloat(""+al.flexGrow).toFixed(1)})}const wh=x.forwardRef((i,o)=>x.createElement(Fv,{...i,forwardedRef:o}));Fv.displayName="Panel";wh.displayName="forwardRef(Panel)";let oo=null,Ai=-1,Ye=null;function $h(i,o){if(o){const s=(o&e0)!==0,f=(o&a0)!==0,h=(o&n0)!==0,v=(o&u0)!==0;if(s)return h?"se-resize":v?"ne-resize":"e-resize";if(f)return h?"sw-resize":v?"nw-resize":"w-resize";if(h)return"s-resize";if(v)return"n-resize"}switch(i){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Wh(){Ye!==null&&(document.head.removeChild(Ye),oo=null,Ye=null,Ai=-1)}function to(i,o){var s,f;const h=$h(i,o);if(oo!==h){if(oo=h,Ye===null&&(Ye=document.createElement("style"),document.head.appendChild(Ye)),Ai>=0){var v;(v=Ye.sheet)===null||v===void 0||v.removeRule(Ai)}Ai=(s=(f=Ye.sheet)===null||f===void 0?void 0:f.insertRule(`*{cursor: ${h} !important;}`))!==null&&s!==void 0?s:-1}}function Iv(i){return i.type==="keydown"}function Pv(i){return i.type.startsWith("pointer")}function t0(i){return i.type.startsWith("mouse")}function Di(i){if(Pv(i)){if(i.isPrimary)return{x:i.clientX,y:i.clientY}}else if(t0(i))return{x:i.clientX,y:i.clientY};return{x:1/0,y:1/0}}function kh(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Fh(i,o,s){return i.x<o.x+o.width&&i.x+i.width>o.x&&i.y<o.y+o.height&&i.y+i.height>o.y}function Ih(i,o){if(i===o)throw new Error("Cannot compare node with itself");const s={a:Bv(i),b:Bv(o)};let f;for(;s.a.at(-1)===s.b.at(-1);)i=s.a.pop(),o=s.b.pop(),f=i;ft(f,"Stacking order can only be calculated for elements with a common ancestor");const h={a:xv(Hv(s.a)),b:xv(Hv(s.b))};if(h.a===h.b){const v=f.childNodes,_={a:s.a.at(-1),b:s.b.at(-1)};let A=v.length;for(;A--;){const E=v[A];if(E===_.a)return 1;if(E===_.b)return-1}}return Math.sign(h.a-h.b)}const Ph=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function tg(i){var o;const s=getComputedStyle((o=l0(i))!==null&&o!==void 0?o:i).display;return s==="flex"||s==="inline-flex"}function lg(i){const o=getComputedStyle(i);return!!(o.position==="fixed"||o.zIndex!=="auto"&&(o.position!=="static"||tg(i))||+o.opacity<1||"transform"in o&&o.transform!=="none"||"webkitTransform"in o&&o.webkitTransform!=="none"||"mixBlendMode"in o&&o.mixBlendMode!=="normal"||"filter"in o&&o.filter!=="none"||"webkitFilter"in o&&o.webkitFilter!=="none"||"isolation"in o&&o.isolation==="isolate"||Ph.test(o.willChange)||o.webkitOverflowScrolling==="touch")}function Hv(i){let o=i.length;for(;o--;){const s=i[o];if(ft(s,"Missing node"),lg(s))return s}return null}function xv(i){return i&&Number(getComputedStyle(i).zIndex)||0}function Bv(i){const o=[];for(;i;)o.push(i),i=l0(i);return o}function l0(i){const{parentNode:o}=i;return o&&o instanceof ShadowRoot?o.host:o}const e0=1,a0=2,n0=4,u0=8,eg=kh()==="coarse";let Gl=[],Ia=!1,aa=new Map,Ci=new Map;const In=new Set;function ag(i,o,s,f,h){var v;const{ownerDocument:_}=o,A={direction:s,element:o,hitAreaMargins:f,setResizeHandlerState:h},E=(v=aa.get(_))!==null&&v!==void 0?v:0;return aa.set(_,E+1),In.add(A),Ti(),function(){var G;Ci.delete(i),In.delete(A);const U=(G=aa.get(_))!==null&&G!==void 0?G:1;if(aa.set(_,U-1),Ti(),U===1&&aa.delete(_),Gl.includes(A)){const B=Gl.indexOf(A);B>=0&&Gl.splice(B,1),mo(),h("up",!0,null)}}}function ng(i){const{target:o}=i,{x:s,y:f}=Di(i);Ia=!0,yo({target:o,x:s,y:f}),Ti(),Gl.length>0&&(_i("down",i),i.preventDefault(),i0(o)||i.stopImmediatePropagation())}function lo(i){const{x:o,y:s}=Di(i);if(Ia&&i.buttons===0&&(Ia=!1,_i("up",i)),!Ia){const{target:f}=i;yo({target:f,x:o,y:s})}_i("move",i),mo(),Gl.length>0&&i.preventDefault()}function eo(i){const{target:o}=i,{x:s,y:f}=Di(i);Ci.clear(),Ia=!1,Gl.length>0&&(i.preventDefault(),i0(o)||i.stopImmediatePropagation()),_i("up",i),yo({target:o,x:s,y:f}),mo(),Ti()}function i0(i){let o=i;for(;o;){if(o.hasAttribute(Lt.resizeHandle))return!0;o=o.parentElement}return!1}function yo({target:i,x:o,y:s}){Gl.splice(0);let f=null;(i instanceof HTMLElement||i instanceof SVGElement)&&(f=i),In.forEach(h=>{const{element:v,hitAreaMargins:_}=h,A=v.getBoundingClientRect(),{bottom:E,left:S,right:G,top:U}=A,B=eg?_.coarse:_.fine;if(o>=S-B&&o<=G+B&&s>=U-B&&s<=E+B){if(f!==null&&document.contains(f)&&v!==f&&!v.contains(f)&&!f.contains(v)&&Ih(f,v)>0){let V=f,Y=!1;for(;V&&!V.contains(v);){if(Fh(V.getBoundingClientRect(),A)){Y=!0;break}V=V.parentElement}if(Y)return}Gl.push(h)}})}function ao(i,o){Ci.set(i,o)}function mo(){let i=!1,o=!1;Gl.forEach(f=>{const{direction:h}=f;h==="horizontal"?i=!0:o=!0});let s=0;Ci.forEach(f=>{s|=f}),i&&o?to("intersection",s):i?to("horizontal",s):o?to("vertical",s):Wh()}let no=new AbortController;function Ti(){no.abort(),no=new AbortController;const i={capture:!0,signal:no.signal};In.size&&(Ia?(Gl.length>0&&aa.forEach((o,s)=>{const{body:f}=s;o>0&&(f.addEventListener("contextmenu",eo,i),f.addEventListener("pointerleave",lo,i),f.addEventListener("pointermove",lo,i))}),window.addEventListener("pointerup",eo,i),window.addEventListener("pointercancel",eo,i)):aa.forEach((o,s)=>{const{body:f}=s;o>0&&(f.addEventListener("pointerdown",ng,i),f.addEventListener("pointermove",lo,i))}))}function _i(i,o){In.forEach(s=>{const{setResizeHandlerState:f}=s,h=Gl.includes(s);f(i,h,o)})}function ug(){const[i,o]=x.useState(0);return x.useCallback(()=>o(s=>s+1),[])}function ft(i,o){if(!i)throw console.error(o),Error(o)}function ia(i,o,s=so){return i.toFixed(s)===o.toFixed(s)?0:i>o?1:-1}function re(i,o,s=so){return ia(i,o,s)===0}function Tl(i,o,s){return ia(i,o,s)===0}function ig(i,o,s){if(i.length!==o.length)return!1;for(let f=0;f<i.length;f++){const h=i[f],v=o[f];if(!Tl(h,v,s))return!1}return!0}function ka({panelConstraints:i,panelIndex:o,size:s}){const f=i[o];ft(f!=null,`Panel constraints not found for index ${o}`);let{collapsedSize:h=0,collapsible:v,maxSize:_=100,minSize:A=0}=f;if(ia(s,A)<0)if(v){const E=(h+A)/2;ia(s,E)<0?s=h:s=A}else s=A;return s=Math.min(_,s),s=parseFloat(s.toFixed(so)),s}function kn({delta:i,initialLayout:o,panelConstraints:s,pivotIndices:f,prevLayout:h,trigger:v}){if(Tl(i,0))return o;const _=[...o],[A,E]=f;ft(A!=null,"Invalid first pivot index"),ft(E!=null,"Invalid second pivot index");let S=0;if(v==="keyboard"){{const U=i<0?E:A,B=s[U];ft(B,`Panel constraints not found for index ${U}`);const{collapsedSize:J=0,collapsible:V,minSize:Y=0}=B;if(V){const Z=o[U];if(ft(Z!=null,`Previous layout not found for panel index ${U}`),Tl(Z,J)){const K=Y-Z;ia(K,Math.abs(i))>0&&(i=i<0?0-K:K)}}}{const U=i<0?A:E,B=s[U];ft(B,`No panel constraints found for index ${U}`);const{collapsedSize:J=0,collapsible:V,minSize:Y=0}=B;if(V){const Z=o[U];if(ft(Z!=null,`Previous layout not found for panel index ${U}`),Tl(Z,Y)){const K=Z-J;ia(K,Math.abs(i))>0&&(i=i<0?0-K:K)}}}}{const U=i<0?1:-1;let B=i<0?E:A,J=0;for(;;){const Y=o[B];ft(Y!=null,`Previous layout not found for panel index ${B}`);const K=ka({panelConstraints:s,panelIndex:B,size:100})-Y;if(J+=K,B+=U,B<0||B>=s.length)break}const V=Math.min(Math.abs(i),Math.abs(J));i=i<0?0-V:V}{let B=i<0?A:E;for(;B>=0&&B<s.length;){const J=Math.abs(i)-Math.abs(S),V=o[B];ft(V!=null,`Previous layout not found for panel index ${B}`);const Y=V-J,Z=ka({panelConstraints:s,panelIndex:B,size:Y});if(!Tl(V,Z)&&(S+=V-Z,_[B]=Z,S.toPrecision(3).localeCompare(Math.abs(i).toPrecision(3),void 0,{numeric:!0})>=0))break;i<0?B--:B++}}if(ig(h,_))return h;{const U=i<0?E:A,B=o[U];ft(B!=null,`Previous layout not found for panel index ${U}`);const J=B+S,V=ka({panelConstraints:s,panelIndex:U,size:J});if(_[U]=V,!Tl(V,J)){let Y=J-V,K=i<0?E:A;for(;K>=0&&K<s.length;){const k=_[K];ft(k!=null,`Previous layout not found for panel index ${K}`);const I=k+Y,tt=ka({panelConstraints:s,panelIndex:K,size:I});if(Tl(k,tt)||(Y-=tt-k,_[K]=tt),Tl(Y,0))break;i>0?K--:K++}}}const G=_.reduce((U,B)=>B+U,0);return Tl(G,100)?_:h}function cg({layout:i,panelsArray:o,pivotIndices:s}){let f=0,h=100,v=0,_=0;const A=s[0];ft(A!=null,"No pivot index found"),o.forEach((U,B)=>{const{constraints:J}=U,{maxSize:V=100,minSize:Y=0}=J;B===A?(f=Y,h=V):(v+=Y,_+=V)});const E=Math.min(h,100-v),S=Math.max(f,100-_),G=i[A];return{valueMax:E,valueMin:S,valueNow:G}}function Pn(i,o=document){return Array.from(o.querySelectorAll(`[${Lt.resizeHandleId}][data-panel-group-id="${i}"]`))}function c0(i,o,s=document){const h=Pn(i,s).findIndex(v=>v.getAttribute(Lt.resizeHandleId)===o);return h??null}function f0(i,o,s){const f=c0(i,o,s);return f!=null?[f,f+1]:[-1,-1]}function o0(i,o=document){var s;if(o instanceof HTMLElement&&(o==null||(s=o.dataset)===null||s===void 0?void 0:s.panelGroupId)==i)return o;const f=o.querySelector(`[data-panel-group][data-panel-group-id="${i}"]`);return f||null}function Ri(i,o=document){const s=o.querySelector(`[${Lt.resizeHandleId}="${i}"]`);return s||null}function fg(i,o,s,f=document){var h,v,_,A;const E=Ri(o,f),S=Pn(i,f),G=E?S.indexOf(E):-1,U=(h=(v=s[G])===null||v===void 0?void 0:v.id)!==null&&h!==void 0?h:null,B=(_=(A=s[G+1])===null||A===void 0?void 0:A.id)!==null&&_!==void 0?_:null;return[U,B]}function og({committedValuesRef:i,eagerValuesRef:o,groupId:s,layout:f,panelDataArray:h,panelGroupElement:v,setLayout:_}){x.useRef({didWarnAboutMissingResizeHandle:!1}),ua(()=>{if(!v)return;const A=Pn(s,v);for(let E=0;E<h.length-1;E++){const{valueMax:S,valueMin:G,valueNow:U}=cg({layout:f,panelsArray:h,pivotIndices:[E,E+1]}),B=A[E];if(B!=null){const J=h[E];ft(J,`No panel data found for index "${E}"`),B.setAttribute("aria-controls",J.id),B.setAttribute("aria-valuemax",""+Math.round(S)),B.setAttribute("aria-valuemin",""+Math.round(G)),B.setAttribute("aria-valuenow",U!=null?""+Math.round(U):"")}}return()=>{A.forEach((E,S)=>{E.removeAttribute("aria-controls"),E.removeAttribute("aria-valuemax"),E.removeAttribute("aria-valuemin"),E.removeAttribute("aria-valuenow")})}},[s,f,h,v]),x.useEffect(()=>{if(!v)return;const A=o.current;ft(A,"Eager values not found");const{panelDataArray:E}=A,S=o0(s,v);ft(S!=null,`No group found for id "${s}"`);const G=Pn(s,v);ft(G,`No resize handles found for group id "${s}"`);const U=G.map(B=>{const J=B.getAttribute(Lt.resizeHandleId);ft(J,"Resize handle element has no handle id attribute");const[V,Y]=fg(s,J,E,v);if(V==null||Y==null)return()=>{};const Z=K=>{if(!K.defaultPrevented)switch(K.key){case"Enter":{K.preventDefault();const k=E.findIndex(I=>I.id===V);if(k>=0){const I=E[k];ft(I,`No panel data found for index ${k}`);const tt=f[k],{collapsedSize:nt=0,collapsible:W,minSize:q=0}=I.constraints;if(tt!=null&&W){const Et=kn({delta:Tl(tt,nt)?q-nt:nt-tt,initialLayout:f,panelConstraints:E.map(xt=>xt.constraints),pivotIndices:f0(s,J,v),prevLayout:f,trigger:"keyboard"});f!==Et&&_(Et)}}break}}};return B.addEventListener("keydown",Z),()=>{B.removeEventListener("keydown",Z)}});return()=>{U.forEach(B=>B())}},[v,i,o,s,f,h,_])}function qv(i,o){if(i.length!==o.length)return!1;for(let s=0;s<i.length;s++)if(i[s]!==o[s])return!1;return!0}function r0(i,o){const s=i==="horizontal",{x:f,y:h}=Di(o);return s?f:h}function rg(i,o,s,f,h){const v=s==="horizontal",_=Ri(o,h);ft(_,`No resize handle element found for id "${o}"`);const A=_.getAttribute(Lt.groupId);ft(A,"Resize handle element has no group id attribute");let{initialCursorPosition:E}=f;const S=r0(s,i),G=o0(A,h);ft(G,`No group element found for id "${A}"`);const U=G.getBoundingClientRect(),B=v?U.width:U.height;return(S-E)/B*100}function sg(i,o,s,f,h,v){if(Iv(i)){const _=s==="horizontal";let A=0;i.shiftKey?A=100:h!=null?A=h:A=10;let E=0;switch(i.key){case"ArrowDown":E=_?0:A;break;case"ArrowLeft":E=_?-A:0;break;case"ArrowRight":E=_?A:0;break;case"ArrowUp":E=_?0:-A;break;case"End":E=100;break;case"Home":E=-100;break}return E}else return f==null?0:rg(i,o,s,f,v)}function dg({panelDataArray:i}){const o=Array(i.length),s=i.map(v=>v.constraints);let f=0,h=100;for(let v=0;v<i.length;v++){const _=s[v];ft(_,`Panel constraints not found for index ${v}`);const{defaultSize:A}=_;A!=null&&(f++,o[v]=A,h-=A)}for(let v=0;v<i.length;v++){const _=s[v];ft(_,`Panel constraints not found for index ${v}`);const{defaultSize:A}=_;if(A!=null)continue;const E=i.length-f,S=h/E;f++,o[v]=S,h-=S}return o}function $a(i,o,s){o.forEach((f,h)=>{const v=i[h];ft(v,`Panel data not found for index ${h}`);const{callbacks:_,constraints:A,id:E}=v,{collapsedSize:S=0,collapsible:G}=A,U=s[E];if(U==null||f!==U){s[E]=f;const{onCollapse:B,onExpand:J,onResize:V}=_;V&&V(f,U),G&&(B||J)&&(J&&(U==null||re(U,S))&&!re(f,S)&&J(),B&&(U==null||!re(U,S))&&re(f,S)&&B())}})}function zi(i,o){if(i.length!==o.length)return!1;for(let s=0;s<i.length;s++)if(i[s]!=o[s])return!1;return!0}function vg({defaultSize:i,dragState:o,layout:s,panelData:f,panelIndex:h,precision:v=3}){const _=s[h];let A;return _==null?A=i!=null?i.toPrecision(v):"1":f.length===1?A="1":A=_.toPrecision(v),{flexBasis:0,flexGrow:A,flexShrink:1,overflow:"hidden",pointerEvents:o!==null?"none":void 0}}function yg(i,o=10){let s=null;return(...h)=>{s!==null&&clearTimeout(s),s=setTimeout(()=>{i(...h)},o)}}function Yv(i){try{if(typeof localStorage<"u")i.getItem=o=>localStorage.getItem(o),i.setItem=(o,s)=>{localStorage.setItem(o,s)};else throw new Error("localStorage not supported in this environment")}catch(o){console.error(o),i.getItem=()=>null,i.setItem=()=>{}}}function s0(i){return`react-resizable-panels:${i}`}function d0(i){return i.map(o=>{const{constraints:s,id:f,idIsFromProps:h,order:v}=o;return h?f:v?`${v}:${JSON.stringify(s)}`:JSON.stringify(s)}).sort((o,s)=>o.localeCompare(s)).join(",")}function v0(i,o){try{const s=s0(i),f=o.getItem(s);if(f){const h=JSON.parse(f);if(typeof h=="object"&&h!=null)return h}}catch{}return null}function mg(i,o,s){var f,h;const v=(f=v0(i,s))!==null&&f!==void 0?f:{},_=d0(o);return(h=v[_])!==null&&h!==void 0?h:null}function hg(i,o,s,f,h){var v;const _=s0(i),A=d0(o),E=(v=v0(i,h))!==null&&v!==void 0?v:{};E[A]={expandToSizes:Object.fromEntries(s.entries()),layout:f};try{h.setItem(_,JSON.stringify(E))}catch(S){console.error(S)}}function Gv({layout:i,panelConstraints:o}){const s=[...i],f=s.reduce((v,_)=>v+_,0);if(s.length!==o.length)throw Error(`Invalid ${o.length} panel layout: ${s.map(v=>`${v}%`).join(", ")}`);if(!Tl(f,100)&&s.length>0)for(let v=0;v<o.length;v++){const _=s[v];ft(_!=null,`No layout data found for index ${v}`);const A=100/f*_;s[v]=A}let h=0;for(let v=0;v<o.length;v++){const _=s[v];ft(_!=null,`No layout data found for index ${v}`);const A=ka({panelConstraints:o,panelIndex:v,size:_});_!=A&&(h+=_-A,s[v]=A)}if(!Tl(h,0))for(let v=0;v<o.length;v++){const _=s[v];ft(_!=null,`No layout data found for index ${v}`);const A=_+h,E=ka({panelConstraints:o,panelIndex:v,size:A});if(_!==E&&(h-=E-_,s[v]=E,Tl(h,0)))break}return s}const gg=100,Fn={getItem:i=>(Yv(Fn),Fn.getItem(i)),setItem:(i,o)=>{Yv(Fn),Fn.setItem(i,o)}},Lv={};function y0({autoSaveId:i=null,children:o,className:s="",direction:f,forwardedRef:h,id:v=null,onLayout:_=null,keyboardResizeBy:A=null,storage:E=Fn,style:S,tagName:G="div",...U}){const B=vo(v),J=x.useRef(null),[V,Y]=x.useState(null),[Z,K]=x.useState([]),k=ug(),I=x.useRef({}),tt=x.useRef(new Map),nt=x.useRef(0),W=x.useRef({autoSaveId:i,direction:f,dragState:V,id:B,keyboardResizeBy:A,onLayout:_,storage:E}),q=x.useRef({layout:Z,panelDataArray:[],panelDataArrayChanged:!1});x.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),x.useImperativeHandle(h,()=>({getId:()=>W.current.id,getLayout:()=>{const{layout:O}=q.current;return O},setLayout:O=>{const{onLayout:H}=W.current,{layout:X,panelDataArray:j}=q.current,L=Gv({layout:O,panelConstraints:j.map(F=>F.constraints)});qv(X,L)||(K(L),q.current.layout=L,H&&H(L),$a(j,L,I.current))}}),[]),ua(()=>{W.current.autoSaveId=i,W.current.direction=f,W.current.dragState=V,W.current.id=B,W.current.onLayout=_,W.current.storage=E}),og({committedValuesRef:W,eagerValuesRef:q,groupId:B,layout:Z,panelDataArray:q.current.panelDataArray,setLayout:K,panelGroupElement:J.current}),x.useEffect(()=>{const{panelDataArray:O}=q.current;if(i){if(Z.length===0||Z.length!==O.length)return;let H=Lv[i];H==null&&(H=yg(hg,gg),Lv[i]=H);const X=[...O],j=new Map(tt.current);H(i,X,j,Z,E)}},[i,Z,E]),x.useEffect(()=>{});const Et=x.useCallback(O=>{const{onLayout:H}=W.current,{layout:X,panelDataArray:j}=q.current;if(O.constraints.collapsible){const L=j.map(nl=>nl.constraints),{collapsedSize:F=0,panelSize:at,pivotIndices:Rt}=ea(j,O,X);if(ft(at!=null,`Panel size not found for panel "${O.id}"`),!re(at,F)){tt.current.set(O.id,at);const il=Wa(j,O)===j.length-1?at-F:F-at,Nt=kn({delta:il,initialLayout:X,panelConstraints:L,pivotIndices:Rt,prevLayout:X,trigger:"imperative-api"});zi(X,Nt)||(K(Nt),q.current.layout=Nt,H&&H(Nt),$a(j,Nt,I.current))}}},[]),xt=x.useCallback((O,H)=>{const{onLayout:X}=W.current,{layout:j,panelDataArray:L}=q.current;if(O.constraints.collapsible){const F=L.map(Jt=>Jt.constraints),{collapsedSize:at=0,panelSize:Rt=0,minSize:nl=0,pivotIndices:il}=ea(L,O,j),Nt=H??nl;if(re(Rt,at)){const Jt=tt.current.get(O.id),Vl=Jt!=null&&Jt>=Nt?Jt:Nt,Pa=Wa(L,O)===L.length-1?Rt-Vl:Vl-Rt,kt=kn({delta:Pa,initialLayout:j,panelConstraints:F,pivotIndices:il,prevLayout:j,trigger:"imperative-api"});zi(j,kt)||(K(kt),q.current.layout=kt,X&&X(kt),$a(L,kt,I.current))}}},[]),qt=x.useCallback(O=>{const{layout:H,panelDataArray:X}=q.current,{panelSize:j}=ea(X,O,H);return ft(j!=null,`Panel size not found for panel "${O.id}"`),j},[]),bt=x.useCallback((O,H)=>{const{panelDataArray:X}=q.current,j=Wa(X,O);return vg({defaultSize:H,dragState:V,layout:Z,panelData:X,panelIndex:j})},[V,Z]),ot=x.useCallback(O=>{const{layout:H,panelDataArray:X}=q.current,{collapsedSize:j=0,collapsible:L,panelSize:F}=ea(X,O,H);return ft(F!=null,`Panel size not found for panel "${O.id}"`),L===!0&&re(F,j)},[]),al=x.useCallback(O=>{const{layout:H,panelDataArray:X}=q.current,{collapsedSize:j=0,collapsible:L,panelSize:F}=ea(X,O,H);return ft(F!=null,`Panel size not found for panel "${O.id}"`),!L||ia(F,j)>0},[]),Ct=x.useCallback(O=>{const{panelDataArray:H}=q.current;H.push(O),H.sort((X,j)=>{const L=X.order,F=j.order;return L==null&&F==null?0:L==null?-1:F==null?1:L-F}),q.current.panelDataArrayChanged=!0,k()},[k]);ua(()=>{if(q.current.panelDataArrayChanged){q.current.panelDataArrayChanged=!1;const{autoSaveId:O,onLayout:H,storage:X}=W.current,{layout:j,panelDataArray:L}=q.current;let F=null;if(O){const Rt=mg(O,L,X);Rt&&(tt.current=new Map(Object.entries(Rt.expandToSizes)),F=Rt.layout)}F==null&&(F=dg({panelDataArray:L}));const at=Gv({layout:F,panelConstraints:L.map(Rt=>Rt.constraints)});qv(j,at)||(K(at),q.current.layout=at,H&&H(at),$a(L,at,I.current))}}),ua(()=>{const O=q.current;return()=>{O.layout=[]}},[]);const pt=x.useCallback(O=>{let H=!1;const X=J.current;return X&&window.getComputedStyle(X,null).getPropertyValue("direction")==="rtl"&&(H=!0),function(L){L.preventDefault();const F=J.current;if(!F)return()=>null;const{direction:at,dragState:Rt,id:nl,keyboardResizeBy:il,onLayout:Nt}=W.current,{layout:Jt,panelDataArray:Vl}=q.current,{initialLayout:se}=Rt??{},Pa=f0(nl,O,F);let kt=sg(L,O,at,Rt,il,F);const ca=at==="horizontal";ca&&H&&(kt=-kt);const tn=Vl.map(Ni=>Ni.constraints),Kl=kn({delta:kt,initialLayout:se??Jt,panelConstraints:tn,pivotIndices:Pa,prevLayout:Jt,trigger:Iv(L)?"keyboard":"mouse-or-touch"}),tu=!zi(Jt,Kl);(Pv(L)||t0(L))&&nt.current!=kt&&(nt.current=kt,!tu&&kt!==0?ca?ao(O,kt<0?e0:a0):ao(O,kt<0?n0:u0):ao(O,0)),tu&&(K(Kl),q.current.layout=Kl,Nt&&Nt(Kl),$a(Vl,Kl,I.current))}},[]),M=x.useCallback((O,H)=>{const{onLayout:X}=W.current,{layout:j,panelDataArray:L}=q.current,F=L.map(Jt=>Jt.constraints),{panelSize:at,pivotIndices:Rt}=ea(L,O,j);ft(at!=null,`Panel size not found for panel "${O.id}"`);const il=Wa(L,O)===L.length-1?at-H:H-at,Nt=kn({delta:il,initialLayout:j,panelConstraints:F,pivotIndices:Rt,prevLayout:j,trigger:"imperative-api"});zi(j,Nt)||(K(Nt),q.current.layout=Nt,X&&X(Nt),$a(L,Nt,I.current))},[]),Q=x.useCallback((O,H)=>{const{layout:X,panelDataArray:j}=q.current,{collapsedSize:L=0,collapsible:F}=H,{collapsedSize:at=0,collapsible:Rt,maxSize:nl=100,minSize:il=0}=O.constraints,{panelSize:Nt}=ea(j,O,X);Nt!=null&&(F&&Rt&&re(Nt,L)?re(L,at)||M(O,at):Nt<il?M(O,il):Nt>nl&&M(O,nl))},[M]),lt=x.useCallback((O,H)=>{const{direction:X}=W.current,{layout:j}=q.current;if(!J.current)return;const L=Ri(O,J.current);ft(L,`Drag handle element not found for id "${O}"`);const F=r0(X,H);Y({dragHandleId:O,dragHandleRect:L.getBoundingClientRect(),initialCursorPosition:F,initialLayout:j})},[]),mt=x.useCallback(()=>{Y(null)},[]),ht=x.useCallback(O=>{const{panelDataArray:H}=q.current,X=Wa(H,O);X>=0&&(H.splice(X,1),delete I.current[O.id],q.current.panelDataArrayChanged=!0,k())},[k]),m=x.useMemo(()=>({collapsePanel:Et,direction:f,dragState:V,expandPanel:xt,getPanelSize:qt,getPanelStyle:bt,groupId:B,isPanelCollapsed:ot,isPanelExpanded:al,reevaluatePanelConstraints:Q,registerPanel:Ct,registerResizeHandle:pt,resizePanel:M,startDragging:lt,stopDragging:mt,unregisterPanel:ht,panelGroupElement:J.current}),[Et,V,f,xt,qt,bt,B,ot,al,Q,Ct,pt,M,lt,mt,ht]),R={display:"flex",flexDirection:f==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return x.createElement(Oi.Provider,{value:m},x.createElement(G,{...U,children:o,className:s,id:v,ref:J,style:{...R,...S},[Lt.group]:"",[Lt.groupDirection]:f,[Lt.groupId]:B}))}const Sg=x.forwardRef((i,o)=>x.createElement(y0,{...i,forwardedRef:o}));y0.displayName="PanelGroup";Sg.displayName="forwardRef(PanelGroup)";function Wa(i,o){return i.findIndex(s=>s===o||s.id===o.id)}function ea(i,o,s){const f=Wa(i,o),v=f===i.length-1?[f-1,f]:[f,f+1],_=s[f];return{...o.constraints,panelSize:_,pivotIndices:v}}function bg({disabled:i,handleId:o,resizeHandler:s,panelGroupElement:f}){x.useEffect(()=>{if(i||s==null||f==null)return;const h=Ri(o,f);if(h==null)return;const v=_=>{if(!_.defaultPrevented)switch(_.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{_.preventDefault(),s(_);break}case"F6":{_.preventDefault();const A=h.getAttribute(Lt.groupId);ft(A,`No group element found for id "${A}"`);const E=Pn(A,f),S=c0(A,o,f);ft(S!==null,`No resize element found for id "${o}"`);const G=_.shiftKey?S>0?S-1:E.length-1:S+1<E.length?S+1:0;E[G].focus();break}}};return h.addEventListener("keydown",v),()=>{h.removeEventListener("keydown",v)}},[f,i,o,s])}function zg({children:i=null,className:o="",disabled:s=!1,hitAreaMargins:f,id:h,onBlur:v,onClick:_,onDragging:A,onFocus:E,onPointerDown:S,onPointerUp:G,style:U={},tabIndex:B=0,tagName:J="div",...V}){var Y,Z;const K=x.useRef(null),k=x.useRef({onClick:_,onDragging:A,onPointerDown:S,onPointerUp:G});x.useEffect(()=>{k.current.onClick=_,k.current.onDragging=A,k.current.onPointerDown=S,k.current.onPointerUp=G});const I=x.useContext(Oi);if(I===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:tt,groupId:nt,registerResizeHandle:W,startDragging:q,stopDragging:Et,panelGroupElement:xt}=I,qt=vo(h),[bt,ot]=x.useState("inactive"),[al,Ct]=x.useState(!1),[pt,M]=x.useState(null),Q=x.useRef({state:bt});ua(()=>{Q.current.state=bt}),x.useEffect(()=>{if(s)M(null);else{const m=W(qt);M(()=>m)}},[s,qt,W]);const lt=(Y=f?.coarse)!==null&&Y!==void 0?Y:15,mt=(Z=f?.fine)!==null&&Z!==void 0?Z:5;x.useEffect(()=>{if(s||pt==null)return;const m=K.current;ft(m,"Element ref not attached");let R=!1;return ag(qt,m,tt,{coarse:lt,fine:mt},(H,X,j)=>{if(!X){ot("inactive");return}switch(H){case"down":{ot("drag"),R=!1,ft(j,'Expected event to be defined for "down" action'),q(qt,j);const{onDragging:L,onPointerDown:F}=k.current;L?.(!0),F?.();break}case"move":{const{state:L}=Q.current;R=!0,L!=="drag"&&ot("hover"),ft(j,'Expected event to be defined for "move" action'),pt(j);break}case"up":{ot("hover"),Et();const{onClick:L,onDragging:F,onPointerUp:at}=k.current;F?.(!1),at?.(),R||L?.();break}}})},[lt,tt,s,mt,W,qt,pt,q,Et]),bg({disabled:s,handleId:qt,resizeHandler:pt,panelGroupElement:xt});const ht={touchAction:"none",userSelect:"none"};return x.createElement(J,{...V,children:i,className:o,id:h,onBlur:()=>{Ct(!1),v?.()},onFocus:()=>{Ct(!0),E?.()},ref:K,role:"separator",style:{...ht,...U},tabIndex:B,[Lt.groupDirection]:tt,[Lt.groupId]:nt,[Lt.resizeHandle]:"",[Lt.resizeHandleActive]:bt==="drag"?"pointer":al?"keyboard":void 0,[Lt.resizeHandleEnabled]:!s,[Lt.resizeHandleId]:qt,[Lt.resizeHandleState]:bt})}zg.displayName="PanelResizeHandle";export{wh as P,jm as R,_g as a,Vh as b,zg as c,Sg as d,Eg as e,qm as g,Ag as i,pg as j,x as r,Tg as u};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as z}from"./index-DRShM2ob.js";import"./react-BoEjKzFZ.js";const R=/([A-Za-z][A-Za-z0-9_.:/-]*(?:\s+[A-Za-z][A-Za-z0-9_.:/-]*){0,7})\s*$/,C=new Set(["tabular","tabularx","tabulary","longtable","array","matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix"]),q=new Set(["math","displaymath","equation","equation*","align","align*","alignat","alignat*","gather","gather*","multline","multline*","flalign","flalign*","tikzpicture","axis","scope","pgfonlayer","pgfpicture","tabular","tabularx","tabulary","longtable","array","matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","verbatim","Verbatim","lstlisting","minted","comment","algorithmic","alignat"]),w=new Set(["documentclass","usepackage","RequirePackage","includegraphics","tikzset","pgfplotsset","hypersetup","lstset","definecolor","colorlet","setlength","setcounter","draw","path","fill","filldraw","shade","node","addplot","color","textcolor","colorbox","pagecolor"]),E=new Set(["label","hypertarget","ref","pageref","autoref","nameref","hyperref","index","gls","Gls","glspl","Glspl","cite","citep","citet","citeauthor","citeyear","citenum","parencite","textcite","autocite","footcite"]),$=5,p=new Map,Z=12;let y=!1,x=null;class b extends Error{constructor(){super("A newer writing check replaced this request."),this.name="HarperLintSupersededError"}}function D(t){return t instanceof b}function m(t,n,e){e>n&&t.push({from:n,to:e})}function g(t,n,e,o){if(t[n]!==e)return null;let i=0;for(let r=n;r<t.length;r+=1){const s=t[r-1]==="\\"&&t[r-2]!=="\\";if(!s&&t[r]===e&&(i+=1),!s&&t[r]===o&&(i-=1,i===0))return{from:n,to:r+1,end:r+1}}return null}function u(t,n){let e=n;for(;e<t.length&&/[ \t\r\n]/.test(t[e]);)e+=1;return e}function O(t,n){if(t[n]!=="%")return!1;let e=0;for(let o=n-1;o>=0&&t[o]==="\\";o-=1)e+=1;return e%2===0}function j(t){return/[=,!/]/.test(t)||/\b(?:colorbar|legend|width|height|draw|fill|style|domain|samples|anchor|at|axis)\b/.test(t)}function P(t){return E.has(t)||/^cite[A-Za-z]*/.test(t)}function I(t,n){for(let e=t.indexOf("=");e>=0;e=t.indexOf("=",e+1)){const i=Math.max(...[`
|
|
2
|
+
`,"[","{","]","}",",",";"].map(a=>t.lastIndexOf(a,e-1)+1)),s=t.slice(i,e).match(R);s?.index!==void 0&&m(n,i+s.index,e);let l=e+1;for(;l<t.length&&/\s/.test(t[l]);)l+=1;let f=l;if(t[l]==="{")f=g(t,l,"{","}")?.end??l;else for(;f<t.length&&!/[,\]\}\n]/.test(t[f]);)f+=1;m(n,l,f)}}function B(t,n,e){const o=/\\(begin|end)\s*\{\s*([^{}]+?)\s*\}/g;o.lastIndex=n;let i=1;for(let r=o.exec(t);r;r=o.exec(t))if(r[2].trim()===e){if(r[1]==="begin")i+=1;else if(--i===0)return o.lastIndex}return null}function H(t,n){for(const e of t.matchAll(/\\\((?:\\.|[^])*?\\\)|\\\[(?:\\.|[^])*?\\\]/g))e.index!==void 0&&m(n,e.index,e.index+e[0].length);for(let e=0;e<t.length;e+=1){if(t[e]!=="$"||t[e-1]==="\\")continue;const o=t[e+1]==="$"?"$$":"$",i=t.indexOf(o,e+o.length);i>=0&&(m(n,e,i+o.length),e=i+o.length-1)}}function M(t){const n=[],e=/[A-Za-z@]/;for(let i=0;i<t.length;i+=1){if(O(t,i)){const a=t.indexOf(`
|
|
3
|
+
`,i);m(n,i,a<0?t.length:a),i=a<0?t.length:a;continue}if(t[i]!=="\\")continue;const r=i;let s=i+1;if(e.test(t[s]??""))for(;s<t.length&&/[A-Za-z@0-9:_]/.test(t[s]);)s+=1;else s<t.length&&(s+=1);const l=t.slice(i+1,s);m(n,r,s);let f=u(t,s);if(l==="begin"||l==="end"){const a=g(t,f,"{","}");if(a){m(n,a.from,a.to);const d=t.slice(a.from+1,a.to-1).trim();if(f=u(t,a.end),l==="begin"){const h=g(t,f,"[","]");if(h&&(m(n,h.from,h.to),f=u(t,h.end)),C.has(d)){const c=g(t,f,"{","}");c&&m(n,c.from,c.to)}if(q.has(d)){const c=B(t,a.end,d);if(c!==null){m(n,r,c),i=c-1;continue}}}}i=s-1;continue}if(P(l))for(t[f]==="*"&&(f=u(t,f+1));;){const a=g(t,f,"[","]")??g(t,f,"{","}");if(!a)break;m(n,a.from,a.to),f=u(t,a.end)}else{const a=g(t,f,"[","]");if(a&&(w.has(l)||j(t.slice(a.from+1,a.to-1)))&&(m(n,a.from,a.to),f=u(t,a.end)),w.has(l)){const d=l==="definecolor"||l==="colorlet"?3:1;for(let h=0;h<d;h+=1){const c=g(t,f,"{","}");if(!c)break;m(n,c.from,c.to),f=u(t,c.end)}}}i=s-1}H(t,n),I(t,n);for(const i of t.matchAll(/(?:https?|ftp):\/\/[^\s]+/gi))i.index!==void 0&&m(n,i.index,i.index+i[0].length);n.sort((i,r)=>i.from-r.from||i.to-r.to);const o=[];for(const i of n){const r=o.at(-1);r&&i.from<=r.to?r.to=Math.max(r.to,i.to):o.push({...i})}return o}function k(t){const n=M(t),e=[];let o=0,i=0;for(const r of t){for(;i<n.length&&n[i].to<=o;)i+=1;const s=n[i];e.push(s&&s.from<=o&&o<s.to&&r!==`
|
|
4
|
+
`&&r!=="\r"?" ":r),o+=r.length}return e.join("")}function T(t){const n=[0];let e=0;for(const o of t)e+=o.length,n.push(e);return n}function L(t){return[...new Set(t.map(n=>n.trim()).filter(Boolean))].sort((n,e)=>n.localeCompare(e)).join("\0")}async function V(t,n,e){return(await z(`/api/projects/${t}/spellcheck`,{method:"POST",body:JSON.stringify({path:n,source:e})})).lints}function K(t,n,e,o){const i={from:e.start,to:e.end},r={from:o[e.start]??-1,to:o[e.end]??-1},s=[i,r].filter((l,f,a)=>l.from>=0&&l.to>l.from&&l.to<=t.length&&a.findIndex(d=>d.from===l.from&&d.to===l.to)===f);return s.length===0?null:s.find(l=>n.slice(l.from,l.to)===e.problem)??s.find(l=>/[A-Za-z]/.test(n.slice(l.from,l.to)))??s[0]??null}function N(t,n,e,o){const i=K(t,n,e,o);if(!i)return null;const{from:r,to:s}=i;if(!/[A-Za-z]/.test(n.slice(r,s)))return null;const l=t.slice(r,s);if(!l.trim()||/[\\%$]/.test(l))return null;const f=e.kind==="Spelling"||e.kind==="Typo"?"spelling":"grammar",a=e.suggestions.filter((d,h,c)=>h<$&&c.indexOf(d)===h);return{from:r,to:s,word:l,kind:f,message:e.message,suggestions:a}}function S(t){let n=2166136261;for(let e=0;e<t.length;e+=1)n^=t.charCodeAt(e),n=Math.imul(n,16777619);return`${t.length}:${n>>>0}`}function v(t,n){const e=S(t),o=p.get(e);return!o||o.source!==t||o.dictionary!==n?null:(p.delete(e),p.set(e,o),o.issues)}function _(t,n,e){const o=S(t);for(p.set(o,{source:t,dictionary:n,issues:e});p.size>Z;){const i=p.keys().next().value;if(i===void 0)break;p.delete(i)}}async function G(t,n,e){const o=L(n),i=v(t,o);if(i)return i;const r=k(t),s=T(t),l=new Set(n.map(a=>a.trim().toLocaleLowerCase("en-US")).filter(Boolean)),f=e.map(a=>N(t,r,a,s)).filter(a=>!!a).filter(a=>a.kind!=="spelling"||!l.has(a.word.trim().toLocaleLowerCase("en-US"))).sort((a,d)=>a.from-d.from||a.to-d.to);return _(t,o,f),f}async function U(t,n,e,o){const i=L(o),r=v(e,i);if(r)return r;const s=k(e),l=await V(t,n,s);return G(e,o,l)}async function A(){if(y||!x)return;const t=x;x=null,y=!0;try{t.resolve(await U(t.projectId,t.path,t.source,t.customWords))}catch(n){t.reject(n)}finally{y=!1,A()}}function F(t,n,e,o=[]){return new Promise((i,r)=>{x?.reject(new b),x={projectId:t,path:n,source:e,customWords:[...o],resolve:i,reject:r},A()})}export{b as HarperLintSupersededError,M as ignoredRanges,D as isHarperLintSupersededError,F as lintLatex,G as mapLatexLints,k as maskLatexSource};
|
|
Binary file
|
package/dist/client/index.html
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.2.5/400.css" />
|
|
11
11
|
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
|
|
12
12
|
<title>TexLite</title>
|
|
13
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/react-
|
|
15
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/assets/index-DRShM2ob.js"></script>
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/react-BoEjKzFZ.js">
|
|
15
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DzcH7hBu.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
18
18
|
<div id="root"></div>
|
package/dist/server/anchors.js
CHANGED
|
@@ -21,7 +21,16 @@ export function reanchorFileComments(db, projectId, filePath, oldSource, newSour
|
|
|
21
21
|
let start = clamp(dmp.diff_xIndex(diffs, oldStart), 0, newSource.length);
|
|
22
22
|
let end = clamp(dmp.diff_xIndex(diffs, oldEnd), start, newSource.length);
|
|
23
23
|
let orphaned = false;
|
|
24
|
-
|
|
24
|
+
// A diff-mapped range is only trustworthy when it still contains the
|
|
25
|
+
// exact text that the author selected. A replacement can preserve a
|
|
26
|
+
// non-empty range while changing every character, which otherwise makes
|
|
27
|
+
// a comment silently point at an unrelated piece of source.
|
|
28
|
+
const hasSelectedRange = oldEnd > oldStart || comment.selected_text.length > 0;
|
|
29
|
+
const originalTextMatches = !hasSelectedRange || oldSource.slice(oldStart, oldEnd) === comment.selected_text;
|
|
30
|
+
if (hasSelectedRange && !originalTextMatches) {
|
|
31
|
+
orphaned = true;
|
|
32
|
+
}
|
|
33
|
+
else if (hasSelectedRange && newSource.slice(start, end) !== comment.selected_text) {
|
|
25
34
|
const relocated = nearestContextualMatch(newSource, comment.selected_text, start, comment.context_before, comment.context_after);
|
|
26
35
|
if (relocated === null) {
|
|
27
36
|
orphaned = true;
|
|
@@ -31,6 +40,8 @@ export function reanchorFileComments(db, projectId, filePath, oldSource, newSour
|
|
|
31
40
|
end = relocated + comment.selected_text.length;
|
|
32
41
|
}
|
|
33
42
|
}
|
|
43
|
+
if (hasSelectedRange && !comment.selected_text)
|
|
44
|
+
orphaned = true;
|
|
34
45
|
const anchor = anchorAt(newSource, start, end, orphaned);
|
|
35
46
|
update.run(orphaned ? comment.selected_text : anchor.selectedText, anchor.startOffset, anchor.endOffset, anchor.contextBefore, anchor.contextAfter, Number(anchor.orphaned), new Date().toISOString(), comment.id);
|
|
36
47
|
}
|
|
@@ -67,6 +78,16 @@ function nearestContextualMatch(source, selected, expected, contextBefore, conte
|
|
|
67
78
|
const before = source.slice(Math.max(0, found - contextBefore.length), found);
|
|
68
79
|
const after = source.slice(found + selected.length, found + selected.length + contextAfter.length);
|
|
69
80
|
const contextScore = commonSuffixLength(before, contextBefore) + commonPrefixLength(after, contextAfter);
|
|
81
|
+
// Do not relocate based solely on proximity. A repeated word with no
|
|
82
|
+
// matching context is ambiguous and must be surfaced as orphaned.
|
|
83
|
+
const availableContext = contextBefore.length + contextAfter.length;
|
|
84
|
+
if (availableContext === 0)
|
|
85
|
+
return null;
|
|
86
|
+
const minimumContext = Math.min(4, availableContext);
|
|
87
|
+
if (contextScore < minimumContext) {
|
|
88
|
+
cursor = found + Math.max(1, selected.length);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
70
91
|
const rank = contextScore * 1000 - distance;
|
|
71
92
|
if (rank > bestRank) {
|
|
72
93
|
best = found;
|