@aiquants/markdown-explorer 0.23.0 → 0.24.1
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/CHANGELOG.md +127 -0
- package/README.md +66 -21
- package/dist/{EditSurface-Dhvw9IDD.js → EditSurface-CFXG8Qok.js} +333 -336
- package/dist/{EditSurface-Bk4tdJ99.cjs → EditSurface-CiKQiYSD.cjs} +5 -5
- package/dist/{ExplorerSplit-BAFiXU-V.cjs → ExplorerSplit-BWMVatnB.cjs} +1 -1
- package/dist/{ExplorerSplit-Q5VqUBDE.js → ExplorerSplit-DIkC3R7O.js} +81 -81
- package/dist/{MultiLayout-DlATT7km.js → MultiLayout-DXnuRzb4.js} +22 -22
- package/dist/{MultiLayout-Bq_TS3ez.cjs → MultiLayout-q_Pvwykp.cjs} +1 -1
- package/dist/{NativeScrollBar-A6-qEpz7.cjs → NativeScrollBar-UYBG64v1.cjs} +1 -1
- package/dist/{NativeScrollBar-TsIcS3JZ.js → NativeScrollBar-s_uSPPEd.js} +1 -1
- package/dist/{TreeLayout-zrSo4MNZ.js → TreeLayout-BQ1lWVf3.js} +3 -3
- package/dist/{TreeLayout-l-r2pPao.cjs → TreeLayout-Di0yv1E-.cjs} +1 -1
- package/dist/core/config.d.cts +13 -0
- package/dist/core/config.d.ts +13 -0
- package/dist/core/contracts.d.cts +22 -4
- package/dist/core/contracts.d.ts +22 -4
- package/dist/core/labels.d.cts +12 -0
- package/dist/core/labels.d.ts +12 -0
- package/dist/core/textEncoding.d.cts +4 -0
- package/dist/core/textEncoding.d.ts +4 -0
- package/dist/{dataRoute-Diu_7gle.js → dataRoute-BEvesOvN.js} +105 -97
- package/dist/dataRoute-Cv7fgCW7.cjs +1 -0
- package/dist/index-BhxsL0Sm.js +4097 -0
- package/dist/index-ZdsIXJap.cjs +13 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +24 -23
- package/dist/location-CasigkBk.cjs +1 -0
- package/dist/location-gXXmC7CQ.js +643 -0
- package/dist/{merge-BzMpSaxx.js → merge-CQAXBfvi.js} +1 -1
- package/dist/{merge-DlPkU2Jc.cjs → merge-DkmrVEIc.cjs} +1 -1
- package/dist/{sanitizePolicy-Du3lFZd-.cjs → sanitizePolicy-CZwOaJ92.cjs} +1 -1
- package/dist/{sanitizePolicy-BvhYIqVO.js → sanitizePolicy-gVKBhabq.js} +1 -1
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +1 -1
- package/dist/server/fileSystemSource.d.cts +1 -0
- package/dist/server/fileSystemSource.d.ts +1 -0
- package/dist/server/ports.d.cts +8 -1
- package/dist/server/ports.d.ts +8 -1
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +783 -768
- package/dist/styles/markdown-explorer.css +1 -1
- package/dist/{useSplitPersistence-HfAb8Kzh.js → useSplitPersistence-BPNjvuJi.js} +1 -1
- package/dist/{useSplitPersistence-CR4Oxtaa.cjs → useSplitPersistence-Bmpb2prR.cjs} +1 -1
- package/docs/behavior/dom-hooks.md +13 -6
- package/docs/behavior/layout.md +22 -10
- package/docs/behavior/localization.md +10 -4
- package/docs/behavior/security.md +7 -4
- package/docs/behavior/url-contract.md +2 -2
- package/package.json +5 -5
- package/dist/dataRoute-vXGZMVB-.cjs +0 -1
- package/dist/index-BNFl3BsO.cjs +0 -13
- package/dist/index-Jz6zeO4O.js +0 -3703
- package/dist/location-8Ho8ZNv_.js +0 -499
- package/dist/location-DN0AI4ir.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),a=require("react"),j=require("./location-DN0AI4ir.cjs"),R=require("./index-BNFl3BsO.cjs"),oe=require("./ExplorerSplit-BAFiXU-V.cjs"),_=require("@aiquants/drag-drop-panels"),me=require("react-router"),ee=require("./storage-DM0EvkVf.cjs"),be=require("./dataRoute-vXGZMVB-.cjs"),Be=require("react-dom"),je=require("@aiquants/markdown"),Fe=require("./scrollBarGeometry-C46jBtmM.cjs"),Ve=()=>{const e=new Map;return{hold:(n,t)=>{e.set(n,t),queueMicrotask(()=>{e.get(n)===t&&e.delete(n)})},take:n=>{const t=e.get(n);return e.delete(n),t===void 0?null:t}}},Ce=a.createContext(null),le=()=>{const e=a.use(Ce);if(e===null)throw new Error("[markdown-explorer] multi-view panels must be rendered inside the multi-view stage");return e},Ue=(e,n)=>{const t=e.pendingHashes.get(n);return t===void 0?null:t},$e=0xcbf29ce484222325n,Ge=0x100000001b3n,Ye=(1n<<64n)-1n,We=(1n<<53n)-1n,Ke=new TextEncoder,Je=e=>{let n=$e;for(const t of Ke.encode(e))n=(n^BigInt(t))*Ge&Ye;return Number(n&We)},Z=256,Xe=e=>`aqmx-p-${Je(e).toString(36)}`,Pe=(e,n)=>{const t=Xe(e);let o=t;for(let r=2;n.has(o);r+=1)o=`${t}-${String(r)}`;return o},Ze=new Map,Qe=(e,n=Ze)=>{const t=new Set(e.flatMap(r=>n.get(r)??[])),o=new Map;for(const r of e){const s=n.get(r)??Pe(r,t);t.add(s),o.set(r,s)}return o},Te=(e,n,t)=>{const o=e.columnOf.get(n);return o===void 0?void 0:Math.min(t-1,Math.max(0,o))},Me=(e,n)=>{const[t,...o]=j.columnGroups(n.logical,n.visible);if(t===void 0)throw new RangeError("[markdown-explorer] there must be at least one visible column");const r=([u,f])=>e.slice(u,f).reduce((l,y)=>l+y.length,0);let s=t;for(const u of o)r(u)<r(s)&&(s=u);let c=s[0];for(let u=s[0];u<s[1];u+=1)(e[u]?.length??0)<(e[c]?.length??0)&&(c=u);return c},Q=(e,n)=>{const t=Array.from({length:n.logical},()=>[]),o=[];for(const r of e.docs){const s=Te(e,r,n.logical);s===void 0?o.push(r):t[s]?.push(r)}for(const r of o)t[Me(t,n)]?.push(r);return t},en=(e,n)=>j.columnGroups(e.length,n).map(([t,o])=>e.slice(t,o).flat()),nn=(e,n,t)=>{const[o,r]=n,s=r-o,c=e.length,u=Array.from({length:s},(E,m)=>{const v=[0];for(const p of e)v.push((v.at(-1)??0)+(t(p)===o+m?1:0));return v}),f=(E,m,v)=>(u[E]?.[v]??0)-(u[E]?.[m]??0),l=Array.from({length:s+1},()=>Array.from({length:c+1},()=>Number.NEGATIVE_INFINITY)),y=Array.from({length:s+1},()=>Array.from({length:c+1},()=>0)),x=l[0];x&&(x[0]=0);for(let E=0;E<s;E+=1)for(let m=0;m<=c;m+=1)for(let v=0;v<=m;v+=1){const p=(l[E]?.[v]??Number.NEGATIVE_INFINITY)+f(E,v,m),P=l[E+1],M=y[E+1];P&&M&&p>(P[m]??Number.NEGATIVE_INFINITY)&&(P[m]=p,M[m]=v)}const b=Array.from({length:s},()=>[]);let k=c;for(let E=s;E>0;E-=1){const m=y[E]?.[k]??0;b[E-1]=e.slice(m,k),k=m}return b},Le=(e,n)=>{const t=n.flat(),o=new Map(e.columnOf);for(const[r,s]of n.entries())for(const c of s)o.delete(c),o.set(c,r);for(const r of o.keys()){if(o.size<=Z)break;o.delete(r)}return{docs:t,columnOf:o}},tn=(e,n,t,o)=>{if(e.docs.includes(n))return{state:e,outcome:"existing"};if(e.docs.length>=o)return{state:e,outcome:"rejected"};const r=Q(e,t),s=Te(e,n,t.logical)??Me(r,t);r[s]?.push(n);const c=new Map(e.panelIds);return c.set(n,Pe(n,new Set(c.values()))),{state:{...e,...Le(e,r),panelIds:c},outcome:"opened"}},ke=(e,n)=>{if(!e.docs.includes(n))return e;const t=new Set(e.hidden);t.delete(n);const o=new Set(e.markup);o.delete(n);const r=new Map(e.panelIds);return r.delete(n),{...e,docs:e.docs.filter(s=>s!==n),hidden:t,markup:o,panelIds:r,maximized:e.maximized===n?null:e.maximized}},on=(e,n,t,o)=>{if(e.hidden.has(n))return{state:Re(e,n,!1),outcome:"shown"};if(e.docs.includes(n))return{state:ke(e,n),outcome:"closed"};const r=tn(e,n,t,o);return{state:r.state,outcome:r.outcome==="rejected"?"rejected":"opened"}},rn=(e,n,t)=>{if(n===t||!e.docs.includes(n))return{state:e,outcome:"ignored"};if(e.docs.includes(t))return{state:e,outcome:"existing"};const o=new Map(e.columnOf),r=o.get(n);r!==void 0&&(o.delete(t),o.set(t,r));const s=new Set(e.hidden);s.delete(n);const c=new Map(e.panelIds),u=c.get(n);if(u===void 0)throw new Error(`[markdown-explorer] the open document ${JSON.stringify(n)} has no panel id`);c.delete(n),c.set(t,u);const f=new Set(e.markup);return f.delete(n),{state:{docs:e.docs.map(l=>l===n?t:l),maximized:e.maximized===n?t:e.maximized,columnOf:o,hidden:s,markup:f,panelIds:c},outcome:"navigated"}},Re=(e,n,t)=>{if(!e.docs.includes(n)||e.hidden.has(n)===t)return e;const o=new Set(e.hidden);return t?o.add(n):o.delete(n),{...e,hidden:o,maximized:t&&e.maximized===n?null:e.maximized}},sn=(e,n,t)=>{if(!e.docs.includes(n)||e.markup.has(n)===t)return e;const o=new Set(e.markup);return t?o.add(n):o.delete(n),{...e,markup:o}},ln=(e,n)=>{if(e.maximized===n||n!==null&&!e.docs.includes(n))return e;if(n===null||!e.hidden.has(n))return{...e,maximized:n};const t=new Set(e.hidden);return t.delete(n),{...e,maximized:n,hidden:t}},cn=(e,n,t)=>{const o=Q(e,t),r=new Map;for(const[l,y]of o.entries())for(const x of y)r.set(x,l);const s=new Set(e.docs),c=new Set,u=j.columnGroups(t.logical,t.visible),f=Array.from({length:t.logical},()=>[]);for(const[l,y]of u.entries()){const x=(n[l]??[]).filter(b=>s.has(b)&&!c.has(b));for(const b of x)c.add(b);for(const[b,k]of nn(x,y,E=>r.get(E)).entries())f[y[0]+b]?.push(...k)}for(const l of e.docs)c.has(l)||f[r.get(l)??0]?.push(l);return f.every((l,y)=>l.length===o[y]?.length&&l.every((x,b)=>o[y]?.[b]===x))?e:{...e,...Le(e,f)}},ne=(e,n)=>{const t=[...new Set(e.docs)].slice(0,n),o=new Set(t),r=e.maximized!==null&&o.has(e.maximized)?e.maximized:null;return{docs:t,maximized:r,columnOf:e.stored.columnOf,hidden:new Set([...e.stored.hidden].filter(s=>o.has(s)&&s!==r)),markup:new Set(e.markup.filter(s=>o.has(s))),panelIds:Qe(t,e.panelIds)}},fe=(e,n)=>{if(e.docs.every(o=>e.columnOf.has(o)))return e;const t=new Map(e.columnOf);for(const[o,r]of Q(e,n).entries())for(const s of r)t.delete(s),t.set(s,o);for(const o of t.keys()){if(t.size<=Z)break;t.delete(o)}return{...e,columnOf:t}},Ne=1,U=Object.freeze({columnOf:new Map,hidden:new Set}),an=(e,n)=>{if(e===null||e==="")return U;let t;try{t=JSON.parse(e)}catch{return U}if(t===null||typeof t!="object"||Array.isArray(t))return U;const o=t;if(o.v!==Ne)return U;const r=new Map;if(Array.isArray(o.columnOf))for(const c of o.columnOf.slice(-Z))Array.isArray(c)&&c.length===2&&typeof c[0]=="string"&&c[0]!==""&&Number.isInteger(c[1])&&c[1]>=0&&c[1]<n&&(r.delete(c[0]),r.set(c[0],c[1]));const s=new Set(Array.isArray(o.hidden)?o.hidden.filter(c=>typeof c=="string"&&c!==""):[]);return{columnOf:r,hidden:s}},un=e=>JSON.stringify({v:Ne,columnOf:[...e.columnOf.entries()].slice(-Z),hidden:e.docs.filter(n=>e.hidden.has(n))}),ie=(e,n)=>{const t=e.get(n);return t===void 0?be.lastPathSegment(n):t},Y=e=>{const n=new Map;for(const[t,o]of e.panelIds)n.set(o,t);return n},pe=e=>{if(!be.isAcceptableDocumentPath(e))throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(e.slice(0,80))}`)},dn=({config:e,location:n,writeUrl:t,persist:o})=>{const{maxPanels:r,columns:s}=e.multiView,c=R.createEmitter(),u=new Map,f=new Map;let l={layout:ne({docs:n.docs,maximized:n.maximized,markup:n.markup,stored:U},r),source:n.source,visibleColumns:s,ready:!1,splitDragging:!1,titles:new Map,pendingHashes:new Map},y=!1;const x=i=>y?fe(i,{logical:s,visible:l.visibleColumns}):i,b=(i,g)=>j.explorerHref(e,{view:"multi",source:i,docs:g.docs,maximized:g.maximized,markup:g.markup}),k=i=>({docs:i.docs,maximized:i.maximized,markup:[...i.markup]});let E=b(n.source,n),m=n.source,v=E;const p=[],P=[];let M=null;const A=()=>{if(!(p.length>0))for(const i of P.splice(0))i()},d=i=>{l={...l,...i},c.emit()},S=()=>{if(!l.ready)return;const i=un(l.layout);i!==M&&(M=i,o(i))},h=(i,g,T)=>{const D=b(i,k(g));D!==E&&(E=D,m=i,p.push(D),t(D,T))},w=i=>{const g=new Set(i.panelIds.values());for(const C of[...u.keys()])g.has(C)||u.delete(C);for(const C of[...f.keys()])g.has(C)||f.delete(C);const T=new Set(i.docs),D=[...l.titles.keys()].every(C=>T.has(C))?l.titles:new Map([...l.titles].filter(([C])=>T.has(C))),O=[...l.pendingHashes.keys()].every(C=>g.has(C))?l.pendingHashes:new Map([...l.pendingHashes].filter(([C])=>g.has(C)));return{titles:D,pendingHashes:O}},N=i=>i===l.layout?!1:(d({layout:i,...w(i)}),h(m,i,"replace"),S(),!0),I=()=>({logical:s,visible:l.visibleColumns});return{getSnapshot:()=>l,subscribe:c.subscribe,toggle:i=>{pe(i);const{state:g,outcome:T}=on(l.layout,i,I(),r);return N(g),T},close:i=>N(ke(l.layout,i)),navigate:(i,g)=>{pe(g);const{state:T,outcome:D}=rn(l.layout,i,g);if(D!=="navigated")return D;const O=T.panelIds.get(g);return O!==void 0&&(u.delete(O),f.delete(O)),N(T),D},setHidden:(i,g)=>N(Re(l.layout,i,g)),maximize:i=>N(ln(l.layout,i)),setMarkup:(i,g)=>N(sn(l.layout,i,g)),arrange:i=>N(cn(l.layout,i,{logical:s,visible:i.length})),changeSource:i=>{h(i,l.layout,"push")},revealSource:i=>{h(i,l.layout,"replace")},observeLocation:i=>{const g=b(i.source,i);if(g===E)return p.length=0,v=g,i.source!==l.source&&d({source:i.source}),A(),!1;if(g===v)return!1;v=g;const T=p.indexOf(g);if(T>=0)return p.splice(0,T+1),i.source!==l.source&&d({source:i.source}),A(),!1;p.length=0,E=g,m=i.source;const D=x(ne({docs:i.docs,maximized:i.maximized,markup:i.markup,stored:{columnOf:l.layout.columnOf,hidden:l.layout.hidden},panelIds:l.layout.panelIds},r));return d({layout:D,source:i.source,...w(D)}),S(),A(),!0},whenUrlRendered:i=>{P.push(i),A()},loadStored:i=>{d({layout:x(ne({docs:l.layout.docs,maximized:l.layout.maximized,markup:[...l.layout.markup],stored:i,panelIds:l.layout.panelIds},r)),ready:!0}),S()},setVisibleColumns:i=>{if(!Number.isInteger(i)||i<1||i>s)throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(s)}; got ${String(i)}`);y=!0;const g=fe(l.layout,{logical:s,visible:i});i===l.visibleColumns&&g===l.layout||(d({visibleColumns:i,layout:g}),g!==l.layout&&S())},setSplitDragging:i=>{i!==l.splitDragging&&d({splitDragging:i})},setTitle:(i,g)=>{!l.layout.docs.includes(i)||l.titles.get(i)===g||d({titles:new Map(l.titles).set(i,g)})},titleOf:i=>ie(l.titles,i),setPendingHash:(i,g)=>{const T=l.pendingHashes.get(i);if(g===null||g===""){if(T===void 0)return;const D=new Map(l.pendingHashes);D.delete(i),d({pendingHashes:D});return}T!==g&&d({pendingHashes:new Map(l.pendingHashes).set(i,g)})},saveReadingPosition:(i,g,T)=>{l.layout.panelIds.get(g)===i&&u.set(i,{doc:g,position:T})},readingPositionOf:(i,g)=>{const T=u.get(i);return T===void 0||T.doc!==g?null:T.position},saveImageView:(i,g,T)=>{f.set(i,{url:g,state:T})},imageViewOf:(i,g)=>{const T=f.get(i);return T===void 0||T.url!==g?null:T.state}}},z=(e,n)=>{const t=()=>n(e.getSnapshot());return a.useSyncExternalStore(e.subscribe,t,t)},mn=e=>{const{config:n,storageNamespace:t}=R.useExplorer(),o=me.useNavigate(),r=a.useRef(o),s=ee.storageKeys(t).multiLayout,[c]=a.useState(()=>dn({config:n,location:e,writeUrl:(l,y)=>{r.current(l,R.explorerNavigationOptions(y==="replace"?"browse":"switch-source"))},persist:l=>ee.writeStorage(s,l)}));a.useLayoutEffect(()=>{r.current=o},[o]);const u=me.useLocation(),f=a.useMemo(()=>({location:e,navigated:u}),[e,u]);return a.useLayoutEffect(()=>{c.observeLocation(f.location)},[c,f]),a.useLayoutEffect(()=>{c.loadStored(an(ee.readStorage(s),n.multiView.columns))},[c,s,n]),c},fn=e=>{const n=e.closest(_.SCROLL_AREA_SELECTOR);if(n===null)throw new Error("[markdown-explorer] a panel's document region is not inside the panel's scroll area");return n},pn=({docPath:e,panelId:n,maximized:t,title:o,onContentShown:r})=>{const{store:s,followLink:c,revealInPanel:u}=le(),{announcer:f}=R.useExplorer(),l=z(s,d=>Ue(d,n)),y=z(s,d=>d.layout.markup.has(e)),x=a.useCallback((d,S)=>c(n,e,d,S),[c,n,e]),b=a.useCallback(()=>s.setPendingHash(n,null),[s,n]),k=a.useMemo(()=>({read:d=>s.imageViewOf(n,d),save:(d,S)=>s.saveImageView(n,d,S)}),[s,n]),E=a.useCallback((d,S)=>{S.kind!=="failure"&&s.setTitle(d,S.name),r(d)},[s,r]),m=a.useCallback(d=>{s.whenUrlRendered(()=>f.announce(d))},[s,f]),v=a.useMemo(()=>({scrollerOf:fn,reveal:d=>u(n,d)}),[u,n]),p=a.useMemo(()=>({kind:"panel",maximized:t,onDocumentLink:x,pendingHash:l,onHashConsumed:b,announceFailure:m,paneScroll:v}),[t,x,l,b,m,v]),P=a.useMemo(()=>({kind:"panel",documentName:o,maximized:t}),[o,t]),M=a.useCallback(()=>s.setMarkup(e,!s.getSnapshot().layout.markup.has(e)),[s,e]),A=a.useMemo(()=>({shown:y,toggle:M}),[y,M]);return L.jsxs(R.ImageViewMemoryContext,{value:k,children:[L.jsx(R.DocumentRefreshBar,{path:e,placement:P,markup:A}),L.jsx(R.DocumentPane,{path:e,absence:R.NO_DOCUMENT,markup:y,variant:p,onDocumentShown:E})]})},ge=()=>typeof HTMLElement<"u"&&typeof HTMLElement.prototype.showPopover=="function"&&typeof HTMLElement.prototype.hidePopover=="function",ce="data-aqmx-column-probe",K="data-panel-id",re="--aqmx-multi-panel-chrome",gn=e=>e==="normal"?0:R.cssPixels(e),hn=(e,n)=>{const t=e.querySelector(_.SCROLL_ROOT_SELECTOR)?.firstElementChild,o=e.querySelector(`[${ce}]`),r=o instanceof HTMLElement?o.getBoundingClientRect().width:Number.NaN;if(!(t instanceof HTMLElement))return{plan:{trackInlineSize:Number.NaN,gap:Number.NaN,minColumnInlineSize:r,logicalColumns:n},stageBlockSize:Number.NaN};const s=getComputedStyle(t),c=t.clientWidth-R.cssPixels(s.paddingLeft)-R.cssPixels(s.paddingRight),u=t.clientHeight-R.cssPixels(s.paddingTop)-R.cssPixels(s.paddingBottom);return{plan:{trackInlineSize:c,gap:gn(s.columnGap),minColumnInlineSize:r,logicalColumns:n},stageBlockSize:u}},vn=(e,n)=>{if(e.getClientRects().length===0)return Number.NaN;const t=getComputedStyle(e);return n.getBoundingClientRect().top-e.getBoundingClientRect().top+R.cssPixels(t.paddingBottom)+R.cssPixels(t.borderBottomWidth)},J="data-aqmx-panel-frame",he="--aqmx-multi-panel-pinned-block-size",yn=e=>{const{docPath:n,panelId:t}=e;if(typeof n!="string"||typeof t!="string")throw new TypeError("[markdown-explorer] a multi-view panel needs string docPath and panelId props");return{docPath:n,panelId:t}},Sn=e=>{const n=getComputedStyle(e),t=Number.parseFloat(n.lineHeight);return Number.isFinite(t)?t:Number.parseFloat(n.fontSize)},wn=(e,n,t)=>e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*n.clientHeight:e.deltaMode!==WheelEvent.DOM_DELTA_LINE?e.deltaY:e.deltaY*t(n),$=e=>{const n=e.closest(_.SCROLL_AREA_SELECTOR);return n instanceof HTMLElement?n:null},Ae=e=>{const n=e.firstElementChild;return n instanceof HTMLElement&&getComputedStyle(n).position==="sticky"?n:null},Ie=(e,n)=>{const t=n.getBoundingClientRect().top,o=Ae(e);return o===null?t:Math.max(t,o.getBoundingClientRect().bottom)},ve=(e,n)=>{let t=0,o=e.length;for(;t<o;){const r=t+o>>>1;(e[r]?.getBoundingClientRect().bottom??Number.NEGATIVE_INFINITY)>n?o=r:t=r+1}return t<e.length?t:-1},xn=(e,n)=>{const t=Ie(e,n),o=[];let r=e;for(let c=ve([...r.children],t);c>=0;c=ve([...r.children],t)){const u=r.children[c];if(u===void 0)break;o.push(c),r=u}const s=r.getBoundingClientRect();return{scrollTop:n.scrollTop,anchor:o.length===0?null:{path:o,offset:s.top-t,height:s.height}}},ye=(e,n,t)=>{if(n.scrollTop=t.scrollTop,t.anchor===null)return;let o=e;for(const f of t.anchor.path)o=o?.children[f];if(o===void 0)return;const r=o.getBoundingClientRect(),{offset:s,height:c}=t.anchor,u=s<0&&c>0?s/c*r.height:s;n.scrollTop+=r.top-Ie(e,n)-u},En=Object.freeze(["data-testid","aria-label","title","href","id","name"]),De=e=>{const n=e.getAttribute(_.PANEL_ACTION_ATTRIBUTE);return JSON.stringify(n===null?[e.tagName,...En.map(t=>e.getAttribute(t))]:[e.tagName,_.PANEL_ACTION_ATTRIBUTE,n])},On=(e,n)=>{if(n===null||!e.contains(n))return null;const t=[];for(let o=n;o!==e;){const r=o.parentElement;if(r===null)return null;t.unshift([...r.children].indexOf(o)),o=r}return{path:t,signature:De(n)}},bn=(e,n,t)=>{let o=e;for(const r of t.path)o=o?.children[r];o instanceof HTMLElement&&De(o)===t.signature&&R.focusWithoutScroll(o)||n.focus({preventScroll:!0})},Cn=(e,n,t)=>{if(e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))return;const o=e.ctrlKey||e.metaKey,r=o?$(n):n.closest(_.SCROLL_ROOT_SELECTOR);if(!(r instanceof HTMLElement))return;const s=wn(e,r,t);(o||Pn(r,s))&&(e.preventDefault(),r.scrollTop+=s)},Pn=(e,n)=>n<0?e.scrollTop>0:n>0?Math.ceil(e.scrollTop+e.clientHeight)<e.scrollHeight:!1,Tn=e=>e.scrollHeight>e.clientHeight,Mn=(e,n,t)=>{let o=Number.NaN,r=Number.NaN;const s=Ae(t),c=()=>{const l=vn(e,n);if(!Number.isFinite(l))return;const y=s===null?0:s.getBoundingClientRect().height;y!==r&&(r=y,t.style.setProperty(he,`${String(y)}px`));const x=l+y;x!==o&&(o=x,e.style.setProperty(re,`${String(x)}px`))};c();let u=null;const f=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{u===null&&(u=requestAnimationFrame(()=>{u=null,c()}))});return f?.observe(e),f?.observe(n),s!==null&&f?.observe(s),()=>{f?.disconnect(),u!==null&&cancelAnimationFrame(u),e.style.removeProperty(re),t.style.removeProperty(he)}},Ln=e=>{const{docPath:n,panelId:t}=yn(e),{store:o,Body:r,maximize:s,focusCarry:c}=le(),u=z(o,m=>m.layout.maximized===n),f=z(o,m=>ie(m.titles,n)),l=a.useRef(null),y=a.useRef(null),x=a.useRef(null),b=a.useRef(null);a.useEffect(()=>{const m=l.current,v=m===null?null:$(m);if(m===null||v===null||u)return;const p=new Map,P=h=>{const w=p.get(h);if(w!==void 0)return w;const N=Sn(h);return p.set(h,N),N},M=h=>Cn(h,m,P);let A=!1;const d=()=>{const h=Tn(v);h!==A&&(A=h,h?m.addEventListener("wheel",M,{capture:!0,passive:!1}):m.removeEventListener("wheel",M,{capture:!0}))};d();const S=typeof ResizeObserver>"u"?null:new ResizeObserver(d);return S?.observe(v),S?.observe(m),()=>{S?.disconnect(),m.removeEventListener("wheel",M,{capture:!0})}},[u]),a.useLayoutEffect(()=>{const m=l.current,v=m===null?null:$(m),p=m===null?null:m.closest(`[${K}]`);if(!(m===null||v===null||!(p instanceof HTMLElement)))return Mn(p,v,m)},[]),a.useLayoutEffect(()=>{const m=l.current,v=m===null?null:$(m);if(m===null||v===null)return;const p=h=>{ye(m,v,h),b.current=v.scrollTop},P=o.readingPositionOf(t,n);y.current=P===null?null:{doc:n,position:P},P!==null&&p(P);let M=null,A=m.getBoundingClientRect().width;const d=()=>{M===null&&(M=requestAnimationFrame(()=>{M=null;const h=b.current;if(b.current=null,h!==null&&v.scrollTop===h||m.getBoundingClientRect().width!==A)return;const w=x.current;w!==null&&o.saveReadingPosition(t,w,xn(m,v))}))};v.addEventListener("scroll",d,{passive:!0});const S=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{const h=m.getBoundingClientRect().width;if(h===A)return;A=h;const w=o.readingPositionOf(t,n);w!==null&&p(w)});return S?.observe(m),()=>{v.removeEventListener("scroll",d),S?.disconnect(),M!==null&&cancelAnimationFrame(M)}},[o,t,n]),a.useLayoutEffect(()=>{const m=l.current,v=m===null?null:m.closest(`[${K}]`);if(m===null||v===null)return;const p=c.take(t);return p!==null&&bn(v,m,p),()=>{const P=On(v,v.ownerDocument.activeElement);P!==null&&c.hold(t,P)}},[c,t]);const k=a.useCallback(m=>{const v=l.current,p=v===null?null:$(v);if(v===null||p===null)return;const P=x.current;x.current=m;const M=y.current;y.current=null,M!==null&&M.doc===m?(ye(v,p,M.position),b.current=p.scrollTop):P!==null&&P!==m&&(p.scrollTop=0)},[]),E=a.useCallback(()=>s(n),[s,n]);return L.jsx("div",{ref:l,role:"group","aria-label":f,className:"aqmx-multi-panel-frame",tabIndex:-1,"data-aqmx-panel-frame":t,"data-aqmx-maximized":u?"true":"false","data-testid":"markdown-explorer-panel-frame",...u?R.CONTENT_PANE:{},onDoubleClick:u?void 0:E,children:L.jsx(r,{docPath:n,panelId:t,maximized:u,title:f,onContentShown:k})})},kn=a.memo(Ln),W=(e,n)=>{const t=e.panelIds.get(n);if(t===void 0)throw new Error(`[markdown-explorer] the open document ${JSON.stringify(n)} has no panel id`);return t},Se=e=>Object.fromEntries(_.generateColumnIds(e).map(n=>[n,[]])),Rn=(e,n)=>{const t=en(Q(e,n),n.visible);return Object.fromEntries(t.map((o,r)=>[_.generateColumnId(r),o.map(s=>W(e,s))]))},Nn=(e,n)=>{const t=Y(e);return _.sortColumnIds(Object.keys(n)).map(o=>(n[o]??[]).flatMap(r=>{const s=t.get(r);return s===void 0?[]:[s]}))},An=e=>({switchToCustomDragMode:e.panelSwitchToCustomDrag,switchToNormalDragMode:e.panelSwitchToNormalDrag,hidePanel:e.panelHide,maximizePanel:e.panelMaximize,restorePanel:e.panelRestore,closePanel:e.panelClose,movePanel:e.panelMove,movePanelToPreviousColumn:e.panelMovePreviousColumn,movePanelToNextColumn:e.panelMoveNextColumn,movePanelUp:e.panelMoveUp,movePanelDown:e.panelMoveDown,customDragModeBadge:e.panelCustomDragBadge,panelMoved:e.panelMoved,panelMoveUnavailable:e.panelMoveUnavailable,panelDragStarted:e.panelDragStarted,panelDragCancelled:e.panelDragCancelled,hiddenPanels:e.hiddenPanelsTitle,hiddenPanelBadge:e.hiddenPanelBadge,hiddenPanelNotice:e.hiddenPanelNotice,emptyColumn:e.multiColumnEmpty,dropZone:e.multiColumnRegion,dropHere:e.panelDropHere}),In="--aqmx-multi-stage-bar-gutter",Dn=Object.freeze({[In]:`${String(Fe.NATIVE_SCROLL_BAR_WIDTH)}px`}),_n=Object.freeze({blockSize:"100%"}),zn=Object.freeze({[_.NO_PANEL_DRAG_ATTRIBUTE]:"",style:Object.freeze({display:"flex"})}),Hn=e=>L.jsx("div",{...zn,children:L.jsx(R.LazyNativeScrollBar,{scroller:e,withCircle:!0})}),qn=({props:e,children:n})=>L.jsx(je.HostedScrollArea,{scrollerProps:{...e,style:_n},renderScrollBar:Hn,children:n}),Bn=e=>L.jsx(R.LazyNativeScrollBar,{scroller:e,withCircle:!1}),ae="--aqmx-stage-block",jn="--aqmx-multi-panel-body-floor",Fn=`calc(var(${ae}) * ${String(j.PANEL_MIN_BLOCK_RATIO)})`,Vn=`max(calc(var(${ae}) * ${String(j.PANEL_MAX_BLOCK_RATIO)}), calc(var(${re}) + var(${jn})))`,Un=(e,n)=>{const t=Object.entries(e);return t.length!==Object.keys(n).length?!1:t.every(([o,r])=>{const s=n[o];return s!==void 0&&s.length===r.length&&s.every((c,u)=>r[u]===c)})},we=["keydown","pointerdown","wheel","touchstart"],G=new WeakMap,xe=(e,n,t)=>{for(let o=n;o!==null&&o!==t;o=o.parentElement){e.observe(o);for(let r=o.previousElementSibling;r!==null;r=r.previousElementSibling)e.observe(r)}},$n=e=>{const n=new Map;for(let t=e.parentElement;t!==null;t=t.parentElement)n.set(t,{top:t.scrollTop,left:t.scrollLeft});return n},X=(e,n,t)=>{G.get(e)?.();const o=e.querySelector(`[${K}="${n}"]`);if(!(o instanceof HTMLElement))return;const r=t!==null&&o.contains(t)?t:null;let s=new Map;const c=()=>{if(!o.isConnected)return;o.scrollIntoView({block:"nearest",inline:"nearest",behavior:"instant"});const x=r?.isConnected===!0?r:o;x!==o&&x.scrollIntoView({block:"nearest",inline:"nearest",behavior:"instant"}),s=$n(x)};if(c(),typeof ResizeObserver>"u")return;const u=new ResizeObserver(c);xe(u,o,o.closest(_.SCROLL_ROOT_SELECTOR)),r!==null&&xe(u,r,o);const{ownerDocument:f}=e,l=x=>{const b=x.target===f?f.scrollingElement:x.target;if(!(b instanceof Element))return;const k=s.get(b);k!==void 0&&(b.scrollTop!==k.top||b.scrollLeft!==k.left)&&y()},y=()=>{u.disconnect();for(const x of we)f.removeEventListener(x,y,!0);f.removeEventListener("scroll",l,!0),G.get(e)===y&&G.delete(e)};for(const x of we)f.addEventListener(x,y,{capture:!0,passive:!0});f.addEventListener("scroll",l,{capture:!0,passive:!0}),G.set(e,y)},_e=(e,n)=>{const t=e.querySelector(`[${J}="${n}"]`);return t instanceof HTMLElement?(X(e,n,null),t.focus({preventScroll:!0}),!0):!1},ue=(e,n)=>{const t=e.querySelector(`[${K}="${n}"]`);return t instanceof HTMLElement&&t.contains(e.ownerDocument.activeElement)},Ee=(e,n)=>{if(!ue(e,n))return null;const t=[...e.querySelectorAll(`[${J}]`)].map(c=>c.getAttribute(J)),o=t.indexOf(n),r=t[o+1];if(o>=0&&typeof r=="string")return{kind:"panel",panelId:r};const s=t[o-1];return o>0&&typeof s=="string"?{kind:"panel",panelId:s}:{kind:"stage"}},Oe=(e,n)=>{requestAnimationFrame(()=>{const t=e.current;t!==null&&(n.kind==="panel"&&_e(t,n.panelId)||t.focus({preventScroll:!0}))})},ze=(e,n)=>{requestAnimationFrame(()=>{const t=e.current;t!==null&&_e(t,n)})},Gn=(e,n,t)=>{requestAnimationFrame(()=>{const o=e.current;if(o===null)return;const{activeElement:r,body:s}=o.ownerDocument;if(X(o,n,t&&ue(o,n)?r:null),!t||r!==null&&r!==s&&r.isConnected)return;const c=o.querySelector(`[${J}="${n}"]`);c instanceof HTMLElement&&c.focus({preventScroll:!0})})},Yn=({store:e,stageRef:n})=>{const{config:t,labels:o,announcer:r,edits:s}=R.useExplorer(),{maximize:c}=le(),u=t.multiView.columns,f=z(e,O=>O.layout),l=z(e,O=>O.visibleColumns),y=z(e,O=>O.titles),x=z(e,O=>O.layout.maximized!==null||O.splitDragging),[b,k]=a.useState(!1),[E]=a.useState(()=>Se(l)),m=a.useMemo(()=>An(o),[o]),v=a.useCallback(O=>{e.arrange(Nn(e.getSnapshot().layout,O))},[e]),p=_.useDragDropColumns({initialColumnPanels:E,initialPanelVisibility:{},debugConfig:_.DEFAULT_DEBUG_CONFIG,onColumnPanelsChange:v}),{columnPanels:P,setColumnPanels:M}=p,A=a.useRef(x),d=a.useRef(P);a.useLayoutEffect(()=>{A.current=x,d.current=P},[x,P]);const S=a.useCallback(O=>{const C=n.current;if(C===null)return;const{plan:B,stageBlockSize:H}=hn(C,u);if(Number.isFinite(H)&&H>0&&C.style.setProperty(ae,`${String(H)}px`),A.current&&!O)return;const q=j.replanVisibleColumns(e.getSnapshot().visibleColumns,B);q!==null&&e.setVisibleColumns(q)},[e,n,u]);a.useLayoutEffect(()=>{S(!0),k(!0)},[S]),a.useEffect(()=>{const O=n.current;if(O===null||typeof ResizeObserver>"u")return;let C=null;const B=new ResizeObserver(()=>{C===null&&(C=requestAnimationFrame(()=>{C=null,S(!1)}))}),H=O.querySelector(_.SCROLL_ROOT_SELECTOR)?.firstElementChild,q=O.querySelector(`[${ce}]`);return H instanceof Element&&B.observe(H),q instanceof Element&&B.observe(q),()=>{B.disconnect(),C!==null&&cancelAnimationFrame(C)}},[n,S]),a.useEffect(()=>{x||S(!1)},[x,S]);const h=a.useMemo(()=>b?Rn(f,{logical:u,visible:l}):Se(l),[b,f,u,l]);a.useLayoutEffect(()=>{Un(d.current,h)||M(h)},[h,M]);const w=a.useMemo(()=>_.sortColumnIds(Object.keys(P)).map(O=>({id:O,key:O,className:"aqmx-multi-column"})),[P]),N=a.useMemo(()=>f.docs.map(O=>{const C=W(f,O);return{id:C,component:kn,title:ie(y,O),props:{docPath:O,panelId:C},minHeight:Fn,maxHeight:Vn}}),[f,y]),I=a.useMemo(()=>Object.fromEntries(f.docs.map(O=>[W(f,O),!f.hidden.has(O)])),[f]),i=f.maximized===null?null:W(f,f.maximized),g=a.useCallback(O=>{const{layout:C}=e.getSnapshot();for(const[B,H]of Y(C)){const q=O[B];if(q===void 0||q!==C.hidden.has(H))continue;const F=e.titleOf(H);if(q){if(!e.setHidden(H,!1))continue;r.announce(o.panelShown(F)),ze(n,B);continue}const V=n.current,de=V===null?null:Ee(V,B);e.setHidden(H,!0)&&(r.announce(o.panelHidden(F)),de!==null&&Oe(n,de))}},[e,n,r,o]),T=a.useCallback(O=>{const C=Y(e.getSnapshot().layout).get(O);if(C===void 0)return;const B=()=>{const q=e.titleOf(C),F=n.current,V=F===null?null:Ee(F,O);e.close(C)&&(r.announce(o.panelClosed(q)),V!==null&&Oe(n,V))},H=s.unsavedAmong([C]);H.length===0?B():s.askToDiscard(H).then(q=>{q&&B()})},[e,n,r,o,s]),D=a.useCallback(O=>{if(O===null){c(null);return}const C=Y(e.getSnapshot().layout).get(O);C!==void 0&&c(C)},[e,c]);return L.jsx("div",{className:"aqmx-multi-layout","aria-busy":!b,children:L.jsx(_.DragDropLayout,{columns:w,panels:N,columnPanels:P,onColumnPanelsChange:v,panelVisibility:I,onPanelVisibilityChange:g,dragState:p.dragState,dragOverPosition:p.dragOverPosition,originalPanelPosition:p.originalPanelPosition,dragModes:p.dragModes,debugConfig:_.DEFAULT_DEBUG_CONFIG,panelSizes:p.panelSizes,customDrag:p.customDrag,setPanelRef:p.setPanelRef,onDragStart:p.handleDragStart,onDragEnd:p.handleDragEnd,onPlaceholderDragEnter:p.handlePlaceholderDragEnter,onPlaceholderDragLeave:p.handlePlaceholderDragLeave,onDragOverWithInsert:p.handleDragOverWithInsert,onDropWithInsert:p.handleDropWithInsert,onColumnDragLeave:p.handleColumnDragLeave,onPanelMouseDown:p.handleMouseDown,onPanelSizeInfoClick:p.handlePanelSizeInfoClick,onToggleDragMode:p.toggleDragMode,onPanelClose:T,onPanelMaximizeChange:D,maximizedPanel:i,dragHandle:"header",labels:m,panelClassName:"aqmx-multi-panel",renderPanelScrollArea:qn,renderStageScrollBar:Bn})})},te={blockStart:"--aqmx-multi-toast-block-start",inlineEnd:"--aqmx-multi-toast-inline-end",room:"--aqmx-multi-toast-room"},Wn=(e,n)=>{const t=n.getBoundingClientRect(),o=[t.left+1,t.left+t.width/2,t.right-1],r=[t.top+1,t.top+t.height/2,t.bottom-1];return o.some(s=>r.some(c=>{const u=n.ownerDocument.elementsFromPoint(s,c),f=u.findIndex(y=>n.contains(y)),l=u.findIndex(y=>e.contains(y));return f!==-1&&l!==-1&&l<f}))},Kn=(e,n)=>{const t=n.getBoundingClientRect(),o=n.ownerDocument.documentElement.clientWidth,r=getComputedStyle(n).direction==="rtl";return e.style.setProperty(te.blockStart,`${String(t.top)}px`),e.style.setProperty(te.inlineEnd,`${String(r?t.left:o-t.right)}px`),e.style.setProperty(te.room,`${String(t.width)}px`),e.showPopover(),()=>{e.isConnected&&e.hidePopover()}},Jn=({store:e,body:n,limitNotice:t,onLimitNoticeCovered:o,ref:r})=>{const{config:s,labels:c,announcer:u,edits:f}=R.useExplorer(),l=a.useRef(null),y=a.useRef(null),x=z(e,d=>d.ready),b=z(e,d=>d.layout.docs.length>0),k=z(e,d=>d.visibleColumns),E=a.use(oe.SheetNoticeSlotContext),m=a.useCallback(d=>{const{layout:S}=e.getSnapshot(),h=S.maximized,w=d===null&&h!==null?S.panelIds.get(h):void 0,N=l.current,I=w!==void 0&&N!==null&&ue(N,w);e.maximize(d)&&(d!==null?u.announce(c.panelMaximized(e.titleOf(d))):h!==null&&u.announce(c.panelRestored(e.titleOf(h))),w!==void 0&&Gn(l,w,I))},[e,u,c]),v=a.useCallback((d,S,h,w)=>{if(h===S){e.setPendingHash(d,w);return}const N=f.unsavedAmong([S]);if(N.length>0){f.askToDiscard(N).then(T=>{T&&v(d,S,h,w)});return}const I=e.navigate(S,h);if(I==="navigated"){e.setPendingHash(d,w);return}if(I!=="existing")return;const{layout:i}=e.getSnapshot(),g=i.panelIds.get(h);g!==void 0&&(u.announce(c.panelAlreadyOpen(e.titleOf(h))),i.maximized===null?e.setHidden(h,!1):m(h),e.setPendingHash(g,w),ze(l,g))},[e,u,c,m,f]);a.useLayoutEffect(()=>{if(t===null||E!==null||!ge())return;const d=y.current,S=l.current;if(d===null||S===null)throw new Error("[markdown-explorer] the panel-limit notice and the stage must be mounted together");return Kn(d,S)},[t,E]),a.useEffect(()=>{const d=y.current;if(t===null||d===null)return;const{ownerDocument:S}=d;let h=null;const w=N=>{const I=N.target;I instanceof Element&&(h!==null&&cancelAnimationFrame(h),h=requestAnimationFrame(()=>{h=null,S.activeElement===I&&d.isConnected&&Wn(d,I)&&o()}))};return S.addEventListener("focusin",w,!0),()=>{S.removeEventListener("focusin",w,!0),h!==null&&cancelAnimationFrame(h)}},[t,E,o]),a.useImperativeHandle(r,()=>({bringIntoView:d=>{requestAnimationFrame(()=>{const S=l.current,h=e.getSnapshot().layout.panelIds.get(d);S!==null&&h!==void 0&&X(S,h,null)})}}),[e]),a.useEffect(()=>{const d=l.current;return()=>{d!==null&&G.get(d)?.()}},[]);const p=a.useCallback((d,S)=>{const h=l.current;h!==null&&X(h,d,S)},[]),[P]=a.useState(Ve),M=a.useMemo(()=>({store:e,Body:n,followLink:v,maximize:m,revealInPanel:p,focusCarry:P}),[e,n,v,m,p,P]),A=a.useMemo(()=>Array.from({length:s.multiView.columns},(d,S)=>_.generateColumnId(S)),[s]);return L.jsxs("section",{ref:l,className:"aqmx-multi-stage",style:Dn,tabIndex:-1,"aria-label":c.multiRegion,"aria-busy":b&&!x,"data-testid":"markdown-explorer-stage","data-aqmx-visible-columns":k,...R.CONTENT_PANE,children:[L.jsx("span",{className:"aqmx-multi-probe","aria-hidden":"true",[ce]:""}),b?x?L.jsx(Ce,{value:M,children:L.jsx(Yn,{store:e,stageRef:l})}):L.jsx("div",{className:"aqmx-multi-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-stage-skeleton",children:A.map(d=>L.jsxs("div",{className:"aqmx-skeleton aqmx-multi-skeleton-column",children:[L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{})]},d))}):L.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-multi-empty",children:L.jsx("p",{className:"aqmx-empty-title",children:c.multiEmpty})}),t===null?null:E!==null?Be.createPortal(L.jsx("div",{ref:y,className:"aqmx-toast aqmx-multi-toast","data-testid":"markdown-explorer-panel-limit",children:t}),E):L.jsx("div",{ref:y,popover:ge()?"manual":void 0,className:"aqmx-toast aqmx-multi-toast","data-testid":"markdown-explorer-panel-limit",children:t})]})},He=3e3,qe=(e,n)=>{if(n!==null)return n;const[t]=e;return t===void 0?null:t},se=(e,n,t)=>{const o=new Set(e),r=n.filter(c=>!o.has(c)),s=r.length>0?r.at(-1):t!==null&&n.includes(t)?t:n.at(-1);return s===void 0?null:s},Xn=(e,n,t)=>{switch(n){case"opened":return e.panelOpened(t);case"shown":return e.panelShown(t);case"closed":return e.panelClosed(t);default:{const o=n;throw new RangeError(`[markdown-explorer] unknown toggle outcome ${JSON.stringify(o)}`)}}},Zn=({location:e})=>{const{config:n,labels:t,announcer:o}=R.useExplorer(),r=mn(e),s=z(r,w=>w.layout.docs),c=z(r,w=>w.layout.maximized),u=z(r,w=>w.layout.markup),f=z(r,w=>w.source),[l,y]=a.useState(()=>({docs:s,latest:se([],s,null)}));l.docs!==s&&y({docs:s,latest:se(l.docs,s,l.latest)});const x=c!==null?c:l.latest,[b,k]=a.useState(!1),E=a.useRef(null),[m,v]=a.useState(0),p=a.useRef(null),P=a.useRef(null);a.useLayoutEffect(()=>{const w=p.current;p.current=null,w!==null&&(r.whenUrlRendered(()=>o.announce(w.announcement)),P.current?.bringIntoView(w.doc))}),a.useEffect(()=>()=>{E.current!==null&&clearTimeout(E.current)},[]);const M=a.useCallback(()=>{E.current!==null&&clearTimeout(E.current),k(!0),E.current=setTimeout(()=>{E.current=null,k(!1)},He)},[]),A=a.useCallback(()=>{E.current!==null&&clearTimeout(E.current),E.current=null,k(!1)},[]),d=a.useCallback(w=>{const N=r.titleOf(w),I=r.toggle(w);I==="rejected"&&M();const i=I==="rejected"?t.panelLimit(n.multiView.maxPanels):Xn(t,I,N);if(I==="shown"){p.current={doc:w,announcement:i},v(g=>g+1);return}r.whenUrlRendered(()=>{o.announce(i),I==="opened"&&P.current?.bringIntoView(w)})},[r,M,o,t,n]),S=a.useMemo(()=>new Set(s),[s]),h=a.useMemo(()=>{const w=qe(s,c);return{href:j.explorerHref(n,{view:"tree",source:f,doc:w,markup:w!==null&&u.has(w)}),target:"tree"}},[n,f,s,c,u]);return L.jsx(oe.ExplorerSplit,{view:"multi",explorer:L.jsx(oe.ExplorerPane,{mode:"multi",sourceId:f,currentPath:x,openPaths:S,onOpenDocument:d,onSourceChange:r.changeSource,onRevealSource:r.revealSource,viewSwitch:h}),content:L.jsx(Jn,{ref:P,store:r,body:pn,limitNotice:b?t.panelLimit(n.multiView.maxPanels):null,onLimitNoticeCovered:A}),contentCoversPage:c!==null,sheetDismissals:m,onDraggingChange:r.setSplitDragging})};exports.MultiLayout=Zn;exports.PANEL_LIMIT_NOTICE_MS=He;exports.latestOpenedDocument=se;exports.treeSwitchDocument=qe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),a=require("react"),j=require("./location-CasigkBk.cjs"),R=require("./index-ZdsIXJap.cjs"),oe=require("./ExplorerSplit-BWMVatnB.cjs"),_=require("@aiquants/drag-drop-panels"),me=require("react-router"),ee=require("./storage-DM0EvkVf.cjs"),be=require("./dataRoute-Cv7fgCW7.cjs"),Be=require("react-dom"),je=require("@aiquants/markdown"),Fe=require("./scrollBarGeometry-C46jBtmM.cjs"),Ve=()=>{const e=new Map;return{hold:(n,t)=>{e.set(n,t),queueMicrotask(()=>{e.get(n)===t&&e.delete(n)})},take:n=>{const t=e.get(n);return e.delete(n),t===void 0?null:t}}},Ce=a.createContext(null),le=()=>{const e=a.use(Ce);if(e===null)throw new Error("[markdown-explorer] multi-view panels must be rendered inside the multi-view stage");return e},Ue=(e,n)=>{const t=e.pendingHashes.get(n);return t===void 0?null:t},$e=0xcbf29ce484222325n,Ge=0x100000001b3n,Ye=(1n<<64n)-1n,We=(1n<<53n)-1n,Ke=new TextEncoder,Je=e=>{let n=$e;for(const t of Ke.encode(e))n=(n^BigInt(t))*Ge&Ye;return Number(n&We)},Z=256,Xe=e=>`aqmx-p-${Je(e).toString(36)}`,Pe=(e,n)=>{const t=Xe(e);let o=t;for(let r=2;n.has(o);r+=1)o=`${t}-${String(r)}`;return o},Ze=new Map,Qe=(e,n=Ze)=>{const t=new Set(e.flatMap(r=>n.get(r)??[])),o=new Map;for(const r of e){const s=n.get(r)??Pe(r,t);t.add(s),o.set(r,s)}return o},Te=(e,n,t)=>{const o=e.columnOf.get(n);return o===void 0?void 0:Math.min(t-1,Math.max(0,o))},Me=(e,n)=>{const[t,...o]=j.columnGroups(n.logical,n.visible);if(t===void 0)throw new RangeError("[markdown-explorer] there must be at least one visible column");const r=([u,f])=>e.slice(u,f).reduce((l,y)=>l+y.length,0);let s=t;for(const u of o)r(u)<r(s)&&(s=u);let c=s[0];for(let u=s[0];u<s[1];u+=1)(e[u]?.length??0)<(e[c]?.length??0)&&(c=u);return c},Q=(e,n)=>{const t=Array.from({length:n.logical},()=>[]),o=[];for(const r of e.docs){const s=Te(e,r,n.logical);s===void 0?o.push(r):t[s]?.push(r)}for(const r of o)t[Me(t,n)]?.push(r);return t},en=(e,n)=>j.columnGroups(e.length,n).map(([t,o])=>e.slice(t,o).flat()),nn=(e,n,t)=>{const[o,r]=n,s=r-o,c=e.length,u=Array.from({length:s},(E,m)=>{const v=[0];for(const p of e)v.push((v.at(-1)??0)+(t(p)===o+m?1:0));return v}),f=(E,m,v)=>(u[E]?.[v]??0)-(u[E]?.[m]??0),l=Array.from({length:s+1},()=>Array.from({length:c+1},()=>Number.NEGATIVE_INFINITY)),y=Array.from({length:s+1},()=>Array.from({length:c+1},()=>0)),x=l[0];x&&(x[0]=0);for(let E=0;E<s;E+=1)for(let m=0;m<=c;m+=1)for(let v=0;v<=m;v+=1){const p=(l[E]?.[v]??Number.NEGATIVE_INFINITY)+f(E,v,m),P=l[E+1],M=y[E+1];P&&M&&p>(P[m]??Number.NEGATIVE_INFINITY)&&(P[m]=p,M[m]=v)}const b=Array.from({length:s},()=>[]);let k=c;for(let E=s;E>0;E-=1){const m=y[E]?.[k]??0;b[E-1]=e.slice(m,k),k=m}return b},Le=(e,n)=>{const t=n.flat(),o=new Map(e.columnOf);for(const[r,s]of n.entries())for(const c of s)o.delete(c),o.set(c,r);for(const r of o.keys()){if(o.size<=Z)break;o.delete(r)}return{docs:t,columnOf:o}},tn=(e,n,t,o)=>{if(e.docs.includes(n))return{state:e,outcome:"existing"};if(e.docs.length>=o)return{state:e,outcome:"rejected"};const r=Q(e,t),s=Te(e,n,t.logical)??Me(r,t);r[s]?.push(n);const c=new Map(e.panelIds);return c.set(n,Pe(n,new Set(c.values()))),{state:{...e,...Le(e,r),panelIds:c},outcome:"opened"}},ke=(e,n)=>{if(!e.docs.includes(n))return e;const t=new Set(e.hidden);t.delete(n);const o=new Set(e.markup);o.delete(n);const r=new Map(e.panelIds);return r.delete(n),{...e,docs:e.docs.filter(s=>s!==n),hidden:t,markup:o,panelIds:r,maximized:e.maximized===n?null:e.maximized}},on=(e,n,t,o)=>{if(e.hidden.has(n))return{state:Re(e,n,!1),outcome:"shown"};if(e.docs.includes(n))return{state:ke(e,n),outcome:"closed"};const r=tn(e,n,t,o);return{state:r.state,outcome:r.outcome==="rejected"?"rejected":"opened"}},rn=(e,n,t)=>{if(n===t||!e.docs.includes(n))return{state:e,outcome:"ignored"};if(e.docs.includes(t))return{state:e,outcome:"existing"};const o=new Map(e.columnOf),r=o.get(n);r!==void 0&&(o.delete(t),o.set(t,r));const s=new Set(e.hidden);s.delete(n);const c=new Map(e.panelIds),u=c.get(n);if(u===void 0)throw new Error(`[markdown-explorer] the open document ${JSON.stringify(n)} has no panel id`);c.delete(n),c.set(t,u);const f=new Set(e.markup);return f.delete(n),{state:{docs:e.docs.map(l=>l===n?t:l),maximized:e.maximized===n?t:e.maximized,columnOf:o,hidden:s,markup:f,panelIds:c},outcome:"navigated"}},Re=(e,n,t)=>{if(!e.docs.includes(n)||e.hidden.has(n)===t)return e;const o=new Set(e.hidden);return t?o.add(n):o.delete(n),{...e,hidden:o,maximized:t&&e.maximized===n?null:e.maximized}},sn=(e,n,t)=>{if(!e.docs.includes(n)||e.markup.has(n)===t)return e;const o=new Set(e.markup);return t?o.add(n):o.delete(n),{...e,markup:o}},ln=(e,n)=>{if(e.maximized===n||n!==null&&!e.docs.includes(n))return e;if(n===null||!e.hidden.has(n))return{...e,maximized:n};const t=new Set(e.hidden);return t.delete(n),{...e,maximized:n,hidden:t}},cn=(e,n,t)=>{const o=Q(e,t),r=new Map;for(const[l,y]of o.entries())for(const x of y)r.set(x,l);const s=new Set(e.docs),c=new Set,u=j.columnGroups(t.logical,t.visible),f=Array.from({length:t.logical},()=>[]);for(const[l,y]of u.entries()){const x=(n[l]??[]).filter(b=>s.has(b)&&!c.has(b));for(const b of x)c.add(b);for(const[b,k]of nn(x,y,E=>r.get(E)).entries())f[y[0]+b]?.push(...k)}for(const l of e.docs)c.has(l)||f[r.get(l)??0]?.push(l);return f.every((l,y)=>l.length===o[y]?.length&&l.every((x,b)=>o[y]?.[b]===x))?e:{...e,...Le(e,f)}},ne=(e,n)=>{const t=[...new Set(e.docs)].slice(0,n),o=new Set(t),r=e.maximized!==null&&o.has(e.maximized)?e.maximized:null;return{docs:t,maximized:r,columnOf:e.stored.columnOf,hidden:new Set([...e.stored.hidden].filter(s=>o.has(s)&&s!==r)),markup:new Set(e.markup.filter(s=>o.has(s))),panelIds:Qe(t,e.panelIds)}},fe=(e,n)=>{if(e.docs.every(o=>e.columnOf.has(o)))return e;const t=new Map(e.columnOf);for(const[o,r]of Q(e,n).entries())for(const s of r)t.delete(s),t.set(s,o);for(const o of t.keys()){if(t.size<=Z)break;t.delete(o)}return{...e,columnOf:t}},Ne=1,U=Object.freeze({columnOf:new Map,hidden:new Set}),an=(e,n)=>{if(e===null||e==="")return U;let t;try{t=JSON.parse(e)}catch{return U}if(t===null||typeof t!="object"||Array.isArray(t))return U;const o=t;if(o.v!==Ne)return U;const r=new Map;if(Array.isArray(o.columnOf))for(const c of o.columnOf.slice(-Z))Array.isArray(c)&&c.length===2&&typeof c[0]=="string"&&c[0]!==""&&Number.isInteger(c[1])&&c[1]>=0&&c[1]<n&&(r.delete(c[0]),r.set(c[0],c[1]));const s=new Set(Array.isArray(o.hidden)?o.hidden.filter(c=>typeof c=="string"&&c!==""):[]);return{columnOf:r,hidden:s}},un=e=>JSON.stringify({v:Ne,columnOf:[...e.columnOf.entries()].slice(-Z),hidden:e.docs.filter(n=>e.hidden.has(n))}),ie=(e,n)=>{const t=e.get(n);return t===void 0?be.lastPathSegment(n):t},Y=e=>{const n=new Map;for(const[t,o]of e.panelIds)n.set(o,t);return n},pe=e=>{if(!be.isAcceptableDocumentPath(e))throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(e.slice(0,80))}`)},dn=({config:e,location:n,writeUrl:t,persist:o})=>{const{maxPanels:r,columns:s}=e.multiView,c=R.createEmitter(),u=new Map,f=new Map;let l={layout:ne({docs:n.docs,maximized:n.maximized,markup:n.markup,stored:U},r),source:n.source,visibleColumns:s,ready:!1,splitDragging:!1,titles:new Map,pendingHashes:new Map},y=!1;const x=i=>y?fe(i,{logical:s,visible:l.visibleColumns}):i,b=(i,g)=>j.explorerHref(e,{view:"multi",source:i,docs:g.docs,maximized:g.maximized,markup:g.markup}),k=i=>({docs:i.docs,maximized:i.maximized,markup:[...i.markup]});let E=b(n.source,n),m=n.source,v=E;const p=[],P=[];let M=null;const A=()=>{if(!(p.length>0))for(const i of P.splice(0))i()},d=i=>{l={...l,...i},c.emit()},S=()=>{if(!l.ready)return;const i=un(l.layout);i!==M&&(M=i,o(i))},h=(i,g,T)=>{const D=b(i,k(g));D!==E&&(E=D,m=i,p.push(D),t(D,T))},w=i=>{const g=new Set(i.panelIds.values());for(const C of[...u.keys()])g.has(C)||u.delete(C);for(const C of[...f.keys()])g.has(C)||f.delete(C);const T=new Set(i.docs),D=[...l.titles.keys()].every(C=>T.has(C))?l.titles:new Map([...l.titles].filter(([C])=>T.has(C))),O=[...l.pendingHashes.keys()].every(C=>g.has(C))?l.pendingHashes:new Map([...l.pendingHashes].filter(([C])=>g.has(C)));return{titles:D,pendingHashes:O}},N=i=>i===l.layout?!1:(d({layout:i,...w(i)}),h(m,i,"replace"),S(),!0),I=()=>({logical:s,visible:l.visibleColumns});return{getSnapshot:()=>l,subscribe:c.subscribe,toggle:i=>{pe(i);const{state:g,outcome:T}=on(l.layout,i,I(),r);return N(g),T},close:i=>N(ke(l.layout,i)),navigate:(i,g)=>{pe(g);const{state:T,outcome:D}=rn(l.layout,i,g);if(D!=="navigated")return D;const O=T.panelIds.get(g);return O!==void 0&&(u.delete(O),f.delete(O)),N(T),D},setHidden:(i,g)=>N(Re(l.layout,i,g)),maximize:i=>N(ln(l.layout,i)),setMarkup:(i,g)=>N(sn(l.layout,i,g)),arrange:i=>N(cn(l.layout,i,{logical:s,visible:i.length})),changeSource:i=>{h(i,l.layout,"push")},revealSource:i=>{h(i,l.layout,"replace")},observeLocation:i=>{const g=b(i.source,i);if(g===E)return p.length=0,v=g,i.source!==l.source&&d({source:i.source}),A(),!1;if(g===v)return!1;v=g;const T=p.indexOf(g);if(T>=0)return p.splice(0,T+1),i.source!==l.source&&d({source:i.source}),A(),!1;p.length=0,E=g,m=i.source;const D=x(ne({docs:i.docs,maximized:i.maximized,markup:i.markup,stored:{columnOf:l.layout.columnOf,hidden:l.layout.hidden},panelIds:l.layout.panelIds},r));return d({layout:D,source:i.source,...w(D)}),S(),A(),!0},whenUrlRendered:i=>{P.push(i),A()},loadStored:i=>{d({layout:x(ne({docs:l.layout.docs,maximized:l.layout.maximized,markup:[...l.layout.markup],stored:i,panelIds:l.layout.panelIds},r)),ready:!0}),S()},setVisibleColumns:i=>{if(!Number.isInteger(i)||i<1||i>s)throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(s)}; got ${String(i)}`);y=!0;const g=fe(l.layout,{logical:s,visible:i});i===l.visibleColumns&&g===l.layout||(d({visibleColumns:i,layout:g}),g!==l.layout&&S())},setSplitDragging:i=>{i!==l.splitDragging&&d({splitDragging:i})},setTitle:(i,g)=>{!l.layout.docs.includes(i)||l.titles.get(i)===g||d({titles:new Map(l.titles).set(i,g)})},titleOf:i=>ie(l.titles,i),setPendingHash:(i,g)=>{const T=l.pendingHashes.get(i);if(g===null||g===""){if(T===void 0)return;const D=new Map(l.pendingHashes);D.delete(i),d({pendingHashes:D});return}T!==g&&d({pendingHashes:new Map(l.pendingHashes).set(i,g)})},saveReadingPosition:(i,g,T)=>{l.layout.panelIds.get(g)===i&&u.set(i,{doc:g,position:T})},readingPositionOf:(i,g)=>{const T=u.get(i);return T===void 0||T.doc!==g?null:T.position},saveImageView:(i,g,T)=>{f.set(i,{url:g,state:T})},imageViewOf:(i,g)=>{const T=f.get(i);return T===void 0||T.url!==g?null:T.state}}},z=(e,n)=>{const t=()=>n(e.getSnapshot());return a.useSyncExternalStore(e.subscribe,t,t)},mn=e=>{const{config:n,storageNamespace:t}=R.useExplorer(),o=me.useNavigate(),r=a.useRef(o),s=ee.storageKeys(t).multiLayout,[c]=a.useState(()=>dn({config:n,location:e,writeUrl:(l,y)=>{r.current(l,R.explorerNavigationOptions(y==="replace"?"browse":"switch-source"))},persist:l=>ee.writeStorage(s,l)}));a.useLayoutEffect(()=>{r.current=o},[o]);const u=me.useLocation(),f=a.useMemo(()=>({location:e,navigated:u}),[e,u]);return a.useLayoutEffect(()=>{c.observeLocation(f.location)},[c,f]),a.useLayoutEffect(()=>{c.loadStored(an(ee.readStorage(s),n.multiView.columns))},[c,s,n]),c},fn=e=>{const n=e.closest(_.SCROLL_AREA_SELECTOR);if(n===null)throw new Error("[markdown-explorer] a panel's document region is not inside the panel's scroll area");return n},pn=({docPath:e,panelId:n,maximized:t,title:o,onContentShown:r})=>{const{store:s,followLink:c,revealInPanel:u}=le(),{announcer:f}=R.useExplorer(),l=z(s,d=>Ue(d,n)),y=z(s,d=>d.layout.markup.has(e)),x=a.useCallback((d,S)=>c(n,e,d,S),[c,n,e]),b=a.useCallback(()=>s.setPendingHash(n,null),[s,n]),k=a.useMemo(()=>({read:d=>s.imageViewOf(n,d),save:(d,S)=>s.saveImageView(n,d,S)}),[s,n]),E=a.useCallback((d,S)=>{S.kind!=="failure"&&s.setTitle(d,S.name),r(d)},[s,r]),m=a.useCallback(d=>{s.whenUrlRendered(()=>f.announce(d))},[s,f]),v=a.useMemo(()=>({scrollerOf:fn,reveal:d=>u(n,d)}),[u,n]),p=a.useMemo(()=>({kind:"panel",maximized:t,onDocumentLink:x,pendingHash:l,onHashConsumed:b,announceFailure:m,paneScroll:v}),[t,x,l,b,m,v]),P=a.useMemo(()=>({kind:"panel",documentName:o,maximized:t}),[o,t]),M=a.useCallback(()=>s.setMarkup(e,!s.getSnapshot().layout.markup.has(e)),[s,e]),A=a.useMemo(()=>({shown:y,toggle:M}),[y,M]);return L.jsxs(R.ImageViewMemoryContext,{value:k,children:[L.jsx(R.DocumentRefreshBar,{path:e,placement:P,markup:A}),L.jsx(R.DocumentPane,{path:e,absence:R.NO_DOCUMENT,markup:y,variant:p,onDocumentShown:E})]})},ge=()=>typeof HTMLElement<"u"&&typeof HTMLElement.prototype.showPopover=="function"&&typeof HTMLElement.prototype.hidePopover=="function",ce="data-aqmx-column-probe",K="data-panel-id",re="--aqmx-multi-panel-chrome",gn=e=>e==="normal"?0:R.cssPixels(e),hn=(e,n)=>{const t=e.querySelector(_.SCROLL_ROOT_SELECTOR)?.firstElementChild,o=e.querySelector(`[${ce}]`),r=o instanceof HTMLElement?o.getBoundingClientRect().width:Number.NaN;if(!(t instanceof HTMLElement))return{plan:{trackInlineSize:Number.NaN,gap:Number.NaN,minColumnInlineSize:r,logicalColumns:n},stageBlockSize:Number.NaN};const s=getComputedStyle(t),c=t.clientWidth-R.cssPixels(s.paddingLeft)-R.cssPixels(s.paddingRight),u=t.clientHeight-R.cssPixels(s.paddingTop)-R.cssPixels(s.paddingBottom);return{plan:{trackInlineSize:c,gap:gn(s.columnGap),minColumnInlineSize:r,logicalColumns:n},stageBlockSize:u}},vn=(e,n)=>{if(e.getClientRects().length===0)return Number.NaN;const t=getComputedStyle(e);return n.getBoundingClientRect().top-e.getBoundingClientRect().top+R.cssPixels(t.paddingBottom)+R.cssPixels(t.borderBottomWidth)},J="data-aqmx-panel-frame",he="--aqmx-multi-panel-pinned-block-size",yn=e=>{const{docPath:n,panelId:t}=e;if(typeof n!="string"||typeof t!="string")throw new TypeError("[markdown-explorer] a multi-view panel needs string docPath and panelId props");return{docPath:n,panelId:t}},Sn=e=>{const n=getComputedStyle(e),t=Number.parseFloat(n.lineHeight);return Number.isFinite(t)?t:Number.parseFloat(n.fontSize)},wn=(e,n,t)=>e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*n.clientHeight:e.deltaMode!==WheelEvent.DOM_DELTA_LINE?e.deltaY:e.deltaY*t(n),$=e=>{const n=e.closest(_.SCROLL_AREA_SELECTOR);return n instanceof HTMLElement?n:null},Ae=e=>{const n=e.firstElementChild;return n instanceof HTMLElement&&getComputedStyle(n).position==="sticky"?n:null},Ie=(e,n)=>{const t=n.getBoundingClientRect().top,o=Ae(e);return o===null?t:Math.max(t,o.getBoundingClientRect().bottom)},ve=(e,n)=>{let t=0,o=e.length;for(;t<o;){const r=t+o>>>1;(e[r]?.getBoundingClientRect().bottom??Number.NEGATIVE_INFINITY)>n?o=r:t=r+1}return t<e.length?t:-1},xn=(e,n)=>{const t=Ie(e,n),o=[];let r=e;for(let c=ve([...r.children],t);c>=0;c=ve([...r.children],t)){const u=r.children[c];if(u===void 0)break;o.push(c),r=u}const s=r.getBoundingClientRect();return{scrollTop:n.scrollTop,anchor:o.length===0?null:{path:o,offset:s.top-t,height:s.height}}},ye=(e,n,t)=>{if(n.scrollTop=t.scrollTop,t.anchor===null)return;let o=e;for(const f of t.anchor.path)o=o?.children[f];if(o===void 0)return;const r=o.getBoundingClientRect(),{offset:s,height:c}=t.anchor,u=s<0&&c>0?s/c*r.height:s;n.scrollTop+=r.top-Ie(e,n)-u},En=Object.freeze(["data-testid","aria-label","title","href","id","name"]),De=e=>{const n=e.getAttribute(_.PANEL_ACTION_ATTRIBUTE);return JSON.stringify(n===null?[e.tagName,...En.map(t=>e.getAttribute(t))]:[e.tagName,_.PANEL_ACTION_ATTRIBUTE,n])},On=(e,n)=>{if(n===null||!e.contains(n))return null;const t=[];for(let o=n;o!==e;){const r=o.parentElement;if(r===null)return null;t.unshift([...r.children].indexOf(o)),o=r}return{path:t,signature:De(n)}},bn=(e,n,t)=>{let o=e;for(const r of t.path)o=o?.children[r];o instanceof HTMLElement&&De(o)===t.signature&&R.focusWithoutScroll(o)||n.focus({preventScroll:!0})},Cn=(e,n,t)=>{if(e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))return;const o=e.ctrlKey||e.metaKey,r=o?$(n):n.closest(_.SCROLL_ROOT_SELECTOR);if(!(r instanceof HTMLElement))return;const s=wn(e,r,t);(o||Pn(r,s))&&(e.preventDefault(),r.scrollTop+=s)},Pn=(e,n)=>n<0?e.scrollTop>0:n>0?Math.ceil(e.scrollTop+e.clientHeight)<e.scrollHeight:!1,Tn=e=>e.scrollHeight>e.clientHeight,Mn=(e,n,t)=>{let o=Number.NaN,r=Number.NaN;const s=Ae(t),c=()=>{const l=vn(e,n);if(!Number.isFinite(l))return;const y=s===null?0:s.getBoundingClientRect().height;y!==r&&(r=y,t.style.setProperty(he,`${String(y)}px`));const x=l+y;x!==o&&(o=x,e.style.setProperty(re,`${String(x)}px`))};c();let u=null;const f=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{u===null&&(u=requestAnimationFrame(()=>{u=null,c()}))});return f?.observe(e),f?.observe(n),s!==null&&f?.observe(s),()=>{f?.disconnect(),u!==null&&cancelAnimationFrame(u),e.style.removeProperty(re),t.style.removeProperty(he)}},Ln=e=>{const{docPath:n,panelId:t}=yn(e),{store:o,Body:r,maximize:s,focusCarry:c}=le(),u=z(o,m=>m.layout.maximized===n),f=z(o,m=>ie(m.titles,n)),l=a.useRef(null),y=a.useRef(null),x=a.useRef(null),b=a.useRef(null);a.useEffect(()=>{const m=l.current,v=m===null?null:$(m);if(m===null||v===null||u)return;const p=new Map,P=h=>{const w=p.get(h);if(w!==void 0)return w;const N=Sn(h);return p.set(h,N),N},M=h=>Cn(h,m,P);let A=!1;const d=()=>{const h=Tn(v);h!==A&&(A=h,h?m.addEventListener("wheel",M,{capture:!0,passive:!1}):m.removeEventListener("wheel",M,{capture:!0}))};d();const S=typeof ResizeObserver>"u"?null:new ResizeObserver(d);return S?.observe(v),S?.observe(m),()=>{S?.disconnect(),m.removeEventListener("wheel",M,{capture:!0})}},[u]),a.useLayoutEffect(()=>{const m=l.current,v=m===null?null:$(m),p=m===null?null:m.closest(`[${K}]`);if(!(m===null||v===null||!(p instanceof HTMLElement)))return Mn(p,v,m)},[]),a.useLayoutEffect(()=>{const m=l.current,v=m===null?null:$(m);if(m===null||v===null)return;const p=h=>{ye(m,v,h),b.current=v.scrollTop},P=o.readingPositionOf(t,n);y.current=P===null?null:{doc:n,position:P},P!==null&&p(P);let M=null,A=m.getBoundingClientRect().width;const d=()=>{M===null&&(M=requestAnimationFrame(()=>{M=null;const h=b.current;if(b.current=null,h!==null&&v.scrollTop===h||m.getBoundingClientRect().width!==A)return;const w=x.current;w!==null&&o.saveReadingPosition(t,w,xn(m,v))}))};v.addEventListener("scroll",d,{passive:!0});const S=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{const h=m.getBoundingClientRect().width;if(h===A)return;A=h;const w=o.readingPositionOf(t,n);w!==null&&p(w)});return S?.observe(m),()=>{v.removeEventListener("scroll",d),S?.disconnect(),M!==null&&cancelAnimationFrame(M)}},[o,t,n]),a.useLayoutEffect(()=>{const m=l.current,v=m===null?null:m.closest(`[${K}]`);if(m===null||v===null)return;const p=c.take(t);return p!==null&&bn(v,m,p),()=>{const P=On(v,v.ownerDocument.activeElement);P!==null&&c.hold(t,P)}},[c,t]);const k=a.useCallback(m=>{const v=l.current,p=v===null?null:$(v);if(v===null||p===null)return;const P=x.current;x.current=m;const M=y.current;y.current=null,M!==null&&M.doc===m?(ye(v,p,M.position),b.current=p.scrollTop):P!==null&&P!==m&&(p.scrollTop=0)},[]),E=a.useCallback(()=>s(n),[s,n]);return L.jsx("div",{ref:l,role:"group","aria-label":f,className:"aqmx-multi-panel-frame",tabIndex:-1,"data-aqmx-panel-frame":t,"data-aqmx-maximized":u?"true":"false","data-testid":"markdown-explorer-panel-frame",...u?R.CONTENT_PANE:{},onDoubleClick:u?void 0:E,children:L.jsx(r,{docPath:n,panelId:t,maximized:u,title:f,onContentShown:k})})},kn=a.memo(Ln),W=(e,n)=>{const t=e.panelIds.get(n);if(t===void 0)throw new Error(`[markdown-explorer] the open document ${JSON.stringify(n)} has no panel id`);return t},Se=e=>Object.fromEntries(_.generateColumnIds(e).map(n=>[n,[]])),Rn=(e,n)=>{const t=en(Q(e,n),n.visible);return Object.fromEntries(t.map((o,r)=>[_.generateColumnId(r),o.map(s=>W(e,s))]))},Nn=(e,n)=>{const t=Y(e);return _.sortColumnIds(Object.keys(n)).map(o=>(n[o]??[]).flatMap(r=>{const s=t.get(r);return s===void 0?[]:[s]}))},An=e=>({switchToCustomDragMode:e.panelSwitchToCustomDrag,switchToNormalDragMode:e.panelSwitchToNormalDrag,hidePanel:e.panelHide,maximizePanel:e.panelMaximize,restorePanel:e.panelRestore,closePanel:e.panelClose,movePanel:e.panelMove,movePanelToPreviousColumn:e.panelMovePreviousColumn,movePanelToNextColumn:e.panelMoveNextColumn,movePanelUp:e.panelMoveUp,movePanelDown:e.panelMoveDown,customDragModeBadge:e.panelCustomDragBadge,panelMoved:e.panelMoved,panelMoveUnavailable:e.panelMoveUnavailable,panelDragStarted:e.panelDragStarted,panelDragCancelled:e.panelDragCancelled,hiddenPanels:e.hiddenPanelsTitle,hiddenPanelBadge:e.hiddenPanelBadge,hiddenPanelNotice:e.hiddenPanelNotice,emptyColumn:e.multiColumnEmpty,dropZone:e.multiColumnRegion,dropHere:e.panelDropHere}),In="--aqmx-multi-stage-bar-gutter",Dn=Object.freeze({[In]:`${String(Fe.NATIVE_SCROLL_BAR_WIDTH)}px`}),_n=Object.freeze({blockSize:"100%"}),zn=Object.freeze({[_.NO_PANEL_DRAG_ATTRIBUTE]:"",style:Object.freeze({display:"flex"})}),Hn=e=>L.jsx("div",{...zn,children:L.jsx(R.LazyNativeScrollBar,{scroller:e,withCircle:!0})}),qn=({props:e,children:n})=>L.jsx(je.HostedScrollArea,{scrollerProps:{...e,style:_n},renderScrollBar:Hn,children:n}),Bn=e=>L.jsx(R.LazyNativeScrollBar,{scroller:e,withCircle:!1}),ae="--aqmx-stage-block",jn="--aqmx-multi-panel-body-floor",Fn=`calc(var(${ae}) * ${String(j.PANEL_MIN_BLOCK_RATIO)})`,Vn=`max(calc(var(${ae}) * ${String(j.PANEL_MAX_BLOCK_RATIO)}), calc(var(${re}) + var(${jn})))`,Un=(e,n)=>{const t=Object.entries(e);return t.length!==Object.keys(n).length?!1:t.every(([o,r])=>{const s=n[o];return s!==void 0&&s.length===r.length&&s.every((c,u)=>r[u]===c)})},we=["keydown","pointerdown","wheel","touchstart"],G=new WeakMap,xe=(e,n,t)=>{for(let o=n;o!==null&&o!==t;o=o.parentElement){e.observe(o);for(let r=o.previousElementSibling;r!==null;r=r.previousElementSibling)e.observe(r)}},$n=e=>{const n=new Map;for(let t=e.parentElement;t!==null;t=t.parentElement)n.set(t,{top:t.scrollTop,left:t.scrollLeft});return n},X=(e,n,t)=>{G.get(e)?.();const o=e.querySelector(`[${K}="${n}"]`);if(!(o instanceof HTMLElement))return;const r=t!==null&&o.contains(t)?t:null;let s=new Map;const c=()=>{if(!o.isConnected)return;o.scrollIntoView({block:"nearest",inline:"nearest",behavior:"instant"});const x=r?.isConnected===!0?r:o;x!==o&&x.scrollIntoView({block:"nearest",inline:"nearest",behavior:"instant"}),s=$n(x)};if(c(),typeof ResizeObserver>"u")return;const u=new ResizeObserver(c);xe(u,o,o.closest(_.SCROLL_ROOT_SELECTOR)),r!==null&&xe(u,r,o);const{ownerDocument:f}=e,l=x=>{const b=x.target===f?f.scrollingElement:x.target;if(!(b instanceof Element))return;const k=s.get(b);k!==void 0&&(b.scrollTop!==k.top||b.scrollLeft!==k.left)&&y()},y=()=>{u.disconnect();for(const x of we)f.removeEventListener(x,y,!0);f.removeEventListener("scroll",l,!0),G.get(e)===y&&G.delete(e)};for(const x of we)f.addEventListener(x,y,{capture:!0,passive:!0});f.addEventListener("scroll",l,{capture:!0,passive:!0}),G.set(e,y)},_e=(e,n)=>{const t=e.querySelector(`[${J}="${n}"]`);return t instanceof HTMLElement?(X(e,n,null),t.focus({preventScroll:!0}),!0):!1},ue=(e,n)=>{const t=e.querySelector(`[${K}="${n}"]`);return t instanceof HTMLElement&&t.contains(e.ownerDocument.activeElement)},Ee=(e,n)=>{if(!ue(e,n))return null;const t=[...e.querySelectorAll(`[${J}]`)].map(c=>c.getAttribute(J)),o=t.indexOf(n),r=t[o+1];if(o>=0&&typeof r=="string")return{kind:"panel",panelId:r};const s=t[o-1];return o>0&&typeof s=="string"?{kind:"panel",panelId:s}:{kind:"stage"}},Oe=(e,n)=>{requestAnimationFrame(()=>{const t=e.current;t!==null&&(n.kind==="panel"&&_e(t,n.panelId)||t.focus({preventScroll:!0}))})},ze=(e,n)=>{requestAnimationFrame(()=>{const t=e.current;t!==null&&_e(t,n)})},Gn=(e,n,t)=>{requestAnimationFrame(()=>{const o=e.current;if(o===null)return;const{activeElement:r,body:s}=o.ownerDocument;if(X(o,n,t&&ue(o,n)?r:null),!t||r!==null&&r!==s&&r.isConnected)return;const c=o.querySelector(`[${J}="${n}"]`);c instanceof HTMLElement&&c.focus({preventScroll:!0})})},Yn=({store:e,stageRef:n})=>{const{config:t,labels:o,announcer:r,edits:s}=R.useExplorer(),{maximize:c}=le(),u=t.multiView.columns,f=z(e,O=>O.layout),l=z(e,O=>O.visibleColumns),y=z(e,O=>O.titles),x=z(e,O=>O.layout.maximized!==null||O.splitDragging),[b,k]=a.useState(!1),[E]=a.useState(()=>Se(l)),m=a.useMemo(()=>An(o),[o]),v=a.useCallback(O=>{e.arrange(Nn(e.getSnapshot().layout,O))},[e]),p=_.useDragDropColumns({initialColumnPanels:E,initialPanelVisibility:{},debugConfig:_.DEFAULT_DEBUG_CONFIG,onColumnPanelsChange:v}),{columnPanels:P,setColumnPanels:M}=p,A=a.useRef(x),d=a.useRef(P);a.useLayoutEffect(()=>{A.current=x,d.current=P},[x,P]);const S=a.useCallback(O=>{const C=n.current;if(C===null)return;const{plan:B,stageBlockSize:H}=hn(C,u);if(Number.isFinite(H)&&H>0&&C.style.setProperty(ae,`${String(H)}px`),A.current&&!O)return;const q=j.replanVisibleColumns(e.getSnapshot().visibleColumns,B);q!==null&&e.setVisibleColumns(q)},[e,n,u]);a.useLayoutEffect(()=>{S(!0),k(!0)},[S]),a.useEffect(()=>{const O=n.current;if(O===null||typeof ResizeObserver>"u")return;let C=null;const B=new ResizeObserver(()=>{C===null&&(C=requestAnimationFrame(()=>{C=null,S(!1)}))}),H=O.querySelector(_.SCROLL_ROOT_SELECTOR)?.firstElementChild,q=O.querySelector(`[${ce}]`);return H instanceof Element&&B.observe(H),q instanceof Element&&B.observe(q),()=>{B.disconnect(),C!==null&&cancelAnimationFrame(C)}},[n,S]),a.useEffect(()=>{x||S(!1)},[x,S]);const h=a.useMemo(()=>b?Rn(f,{logical:u,visible:l}):Se(l),[b,f,u,l]);a.useLayoutEffect(()=>{Un(d.current,h)||M(h)},[h,M]);const w=a.useMemo(()=>_.sortColumnIds(Object.keys(P)).map(O=>({id:O,key:O,className:"aqmx-multi-column"})),[P]),N=a.useMemo(()=>f.docs.map(O=>{const C=W(f,O);return{id:C,component:kn,title:ie(y,O),props:{docPath:O,panelId:C},minHeight:Fn,maxHeight:Vn}}),[f,y]),I=a.useMemo(()=>Object.fromEntries(f.docs.map(O=>[W(f,O),!f.hidden.has(O)])),[f]),i=f.maximized===null?null:W(f,f.maximized),g=a.useCallback(O=>{const{layout:C}=e.getSnapshot();for(const[B,H]of Y(C)){const q=O[B];if(q===void 0||q!==C.hidden.has(H))continue;const F=e.titleOf(H);if(q){if(!e.setHidden(H,!1))continue;r.announce(o.panelShown(F)),ze(n,B);continue}const V=n.current,de=V===null?null:Ee(V,B);e.setHidden(H,!0)&&(r.announce(o.panelHidden(F)),de!==null&&Oe(n,de))}},[e,n,r,o]),T=a.useCallback(O=>{const C=Y(e.getSnapshot().layout).get(O);if(C===void 0)return;const B=()=>{const q=e.titleOf(C),F=n.current,V=F===null?null:Ee(F,O);e.close(C)&&(r.announce(o.panelClosed(q)),V!==null&&Oe(n,V))},H=s.unsavedAmong([C]);H.length===0?B():s.askToDiscard(H).then(q=>{q&&B()})},[e,n,r,o,s]),D=a.useCallback(O=>{if(O===null){c(null);return}const C=Y(e.getSnapshot().layout).get(O);C!==void 0&&c(C)},[e,c]);return L.jsx("div",{className:"aqmx-multi-layout","aria-busy":!b,children:L.jsx(_.DragDropLayout,{columns:w,panels:N,columnPanels:P,onColumnPanelsChange:v,panelVisibility:I,onPanelVisibilityChange:g,dragState:p.dragState,dragOverPosition:p.dragOverPosition,originalPanelPosition:p.originalPanelPosition,dragModes:p.dragModes,debugConfig:_.DEFAULT_DEBUG_CONFIG,panelSizes:p.panelSizes,customDrag:p.customDrag,setPanelRef:p.setPanelRef,onDragStart:p.handleDragStart,onDragEnd:p.handleDragEnd,onPlaceholderDragEnter:p.handlePlaceholderDragEnter,onPlaceholderDragLeave:p.handlePlaceholderDragLeave,onDragOverWithInsert:p.handleDragOverWithInsert,onDropWithInsert:p.handleDropWithInsert,onColumnDragLeave:p.handleColumnDragLeave,onPanelMouseDown:p.handleMouseDown,onPanelSizeInfoClick:p.handlePanelSizeInfoClick,onToggleDragMode:p.toggleDragMode,onPanelClose:T,onPanelMaximizeChange:D,maximizedPanel:i,dragHandle:"header",labels:m,panelClassName:"aqmx-multi-panel",renderPanelScrollArea:qn,renderStageScrollBar:Bn})})},te={blockStart:"--aqmx-multi-toast-block-start",inlineEnd:"--aqmx-multi-toast-inline-end",room:"--aqmx-multi-toast-room"},Wn=(e,n)=>{const t=n.getBoundingClientRect(),o=[t.left+1,t.left+t.width/2,t.right-1],r=[t.top+1,t.top+t.height/2,t.bottom-1];return o.some(s=>r.some(c=>{const u=n.ownerDocument.elementsFromPoint(s,c),f=u.findIndex(y=>n.contains(y)),l=u.findIndex(y=>e.contains(y));return f!==-1&&l!==-1&&l<f}))},Kn=(e,n)=>{const t=n.getBoundingClientRect(),o=n.ownerDocument.documentElement.clientWidth,r=getComputedStyle(n).direction==="rtl";return e.style.setProperty(te.blockStart,`${String(t.top)}px`),e.style.setProperty(te.inlineEnd,`${String(r?t.left:o-t.right)}px`),e.style.setProperty(te.room,`${String(t.width)}px`),e.showPopover(),()=>{e.isConnected&&e.hidePopover()}},Jn=({store:e,body:n,limitNotice:t,onLimitNoticeCovered:o,ref:r})=>{const{config:s,labels:c,announcer:u,edits:f}=R.useExplorer(),l=a.useRef(null),y=a.useRef(null),x=z(e,d=>d.ready),b=z(e,d=>d.layout.docs.length>0),k=z(e,d=>d.visibleColumns),E=a.use(oe.SheetNoticeSlotContext),m=a.useCallback(d=>{const{layout:S}=e.getSnapshot(),h=S.maximized,w=d===null&&h!==null?S.panelIds.get(h):void 0,N=l.current,I=w!==void 0&&N!==null&&ue(N,w);e.maximize(d)&&(d!==null?u.announce(c.panelMaximized(e.titleOf(d))):h!==null&&u.announce(c.panelRestored(e.titleOf(h))),w!==void 0&&Gn(l,w,I))},[e,u,c]),v=a.useCallback((d,S,h,w)=>{if(h===S){e.setPendingHash(d,w);return}const N=f.unsavedAmong([S]);if(N.length>0){f.askToDiscard(N).then(T=>{T&&v(d,S,h,w)});return}const I=e.navigate(S,h);if(I==="navigated"){e.setPendingHash(d,w);return}if(I!=="existing")return;const{layout:i}=e.getSnapshot(),g=i.panelIds.get(h);g!==void 0&&(u.announce(c.panelAlreadyOpen(e.titleOf(h))),i.maximized===null?e.setHidden(h,!1):m(h),e.setPendingHash(g,w),ze(l,g))},[e,u,c,m,f]);a.useLayoutEffect(()=>{if(t===null||E!==null||!ge())return;const d=y.current,S=l.current;if(d===null||S===null)throw new Error("[markdown-explorer] the panel-limit notice and the stage must be mounted together");return Kn(d,S)},[t,E]),a.useEffect(()=>{const d=y.current;if(t===null||d===null)return;const{ownerDocument:S}=d;let h=null;const w=N=>{const I=N.target;I instanceof Element&&(h!==null&&cancelAnimationFrame(h),h=requestAnimationFrame(()=>{h=null,S.activeElement===I&&d.isConnected&&Wn(d,I)&&o()}))};return S.addEventListener("focusin",w,!0),()=>{S.removeEventListener("focusin",w,!0),h!==null&&cancelAnimationFrame(h)}},[t,E,o]),a.useImperativeHandle(r,()=>({bringIntoView:d=>{requestAnimationFrame(()=>{const S=l.current,h=e.getSnapshot().layout.panelIds.get(d);S!==null&&h!==void 0&&X(S,h,null)})}}),[e]),a.useEffect(()=>{const d=l.current;return()=>{d!==null&&G.get(d)?.()}},[]);const p=a.useCallback((d,S)=>{const h=l.current;h!==null&&X(h,d,S)},[]),[P]=a.useState(Ve),M=a.useMemo(()=>({store:e,Body:n,followLink:v,maximize:m,revealInPanel:p,focusCarry:P}),[e,n,v,m,p,P]),A=a.useMemo(()=>Array.from({length:s.multiView.columns},(d,S)=>_.generateColumnId(S)),[s]);return L.jsxs("section",{ref:l,className:"aqmx-multi-stage",style:Dn,tabIndex:-1,"aria-label":c.multiRegion,"aria-busy":b&&!x,"data-testid":"markdown-explorer-stage","data-aqmx-visible-columns":k,...R.CONTENT_PANE,children:[L.jsx("span",{className:"aqmx-multi-probe","aria-hidden":"true",[ce]:""}),b?x?L.jsx(Ce,{value:M,children:L.jsx(Yn,{store:e,stageRef:l})}):L.jsx("div",{className:"aqmx-multi-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-stage-skeleton",children:A.map(d=>L.jsxs("div",{className:"aqmx-skeleton aqmx-multi-skeleton-column",children:[L.jsx("span",{}),L.jsx("span",{}),L.jsx("span",{})]},d))}):L.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-multi-empty",children:L.jsx("p",{className:"aqmx-empty-title",children:c.multiEmpty})}),t===null?null:E!==null?Be.createPortal(L.jsx("div",{ref:y,className:"aqmx-toast aqmx-multi-toast","data-testid":"markdown-explorer-panel-limit",children:t}),E):L.jsx("div",{ref:y,popover:ge()?"manual":void 0,className:"aqmx-toast aqmx-multi-toast","data-testid":"markdown-explorer-panel-limit",children:t})]})},He=3e3,qe=(e,n)=>{if(n!==null)return n;const[t]=e;return t===void 0?null:t},se=(e,n,t)=>{const o=new Set(e),r=n.filter(c=>!o.has(c)),s=r.length>0?r.at(-1):t!==null&&n.includes(t)?t:n.at(-1);return s===void 0?null:s},Xn=(e,n,t)=>{switch(n){case"opened":return e.panelOpened(t);case"shown":return e.panelShown(t);case"closed":return e.panelClosed(t);default:{const o=n;throw new RangeError(`[markdown-explorer] unknown toggle outcome ${JSON.stringify(o)}`)}}},Zn=({location:e})=>{const{config:n,labels:t,announcer:o}=R.useExplorer(),r=mn(e),s=z(r,w=>w.layout.docs),c=z(r,w=>w.layout.maximized),u=z(r,w=>w.layout.markup),f=z(r,w=>w.source),[l,y]=a.useState(()=>({docs:s,latest:se([],s,null)}));l.docs!==s&&y({docs:s,latest:se(l.docs,s,l.latest)});const x=c!==null?c:l.latest,[b,k]=a.useState(!1),E=a.useRef(null),[m,v]=a.useState(0),p=a.useRef(null),P=a.useRef(null);a.useLayoutEffect(()=>{const w=p.current;p.current=null,w!==null&&(r.whenUrlRendered(()=>o.announce(w.announcement)),P.current?.bringIntoView(w.doc))}),a.useEffect(()=>()=>{E.current!==null&&clearTimeout(E.current)},[]);const M=a.useCallback(()=>{E.current!==null&&clearTimeout(E.current),k(!0),E.current=setTimeout(()=>{E.current=null,k(!1)},He)},[]),A=a.useCallback(()=>{E.current!==null&&clearTimeout(E.current),E.current=null,k(!1)},[]),d=a.useCallback(w=>{const N=r.titleOf(w),I=r.toggle(w);I==="rejected"&&M();const i=I==="rejected"?t.panelLimit(n.multiView.maxPanels):Xn(t,I,N);if(I==="shown"){p.current={doc:w,announcement:i},v(g=>g+1);return}r.whenUrlRendered(()=>{o.announce(i),I==="opened"&&P.current?.bringIntoView(w)})},[r,M,o,t,n]),S=a.useMemo(()=>new Set(s),[s]),h=a.useMemo(()=>{const w=qe(s,c);return{href:j.explorerHref(n,{view:"tree",source:f,doc:w,markup:w!==null&&u.has(w)}),target:"tree"}},[n,f,s,c,u]);return L.jsx(oe.ExplorerSplit,{view:"multi",explorer:L.jsx(oe.ExplorerPane,{mode:"multi",sourceId:f,currentPath:x,openPaths:S,onOpenDocument:d,onSourceChange:r.changeSource,onRevealSource:r.revealSource,viewSwitch:h}),content:L.jsx(Jn,{ref:P,store:r,body:pn,limitNotice:b?t.panelLimit(n.multiView.maxPanels):null,onLimitNoticeCovered:A}),contentCoversPage:c!==null,sheetDismissals:m,onDraggingChange:r.setSplitDragging})};exports.MultiLayout=Zn;exports.PANEL_LIMIT_NOTICE_MS=He;exports.latestOpenedDocument=se;exports.treeSwitchDocument=qe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react/jsx-runtime"),h=require("@aiquants/virtualscroll"),a=require("react"),v=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react/jsx-runtime"),h=require("@aiquants/virtualscroll"),a=require("react"),v=require("./index-ZdsIXJap.cjs"),g=require("./scrollBarGeometry-C46jBtmM.cjs"),S=require("./tapScrollCircle-C5DGI-0H.cjs"),p=e=>({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight}),m=(e,t)=>e.scrollTop===t.scrollTop&&e.scrollHeight===t.scrollHeight&&e.clientHeight===t.clientHeight,f=e=>{let t=p(e);return{getSnapshot:()=>t,subscribe:s=>{const o=()=>{const i=p(e);m(t,i)||(t=i,s())};let n=0;const c=()=>{n===0&&(n=requestAnimationFrame(()=>{n=0,o()}))},r=typeof ResizeObserver>"u"?null:new ResizeObserver(c),l=()=>{if(r!==null){r.disconnect(),r.observe(e);for(const i of e.children)r.observe(i)}};l();const u=typeof MutationObserver>"u"?null:new MutationObserver(()=>{l(),c()});return u?.observe(e,{childList:!0}),e.addEventListener("scroll",o,{passive:!0}),o(),()=>{e.removeEventListener("scroll",o),u?.disconnect(),r?.disconnect(),cancelAnimationFrame(n)}}}},b=e=>{const t=a.useMemo(()=>f(e),[e]);return a.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)},d=(e,t)=>{const s=typeof t=="function"?t(e.scrollTop):t;return e.scrollTo({top:s,behavior:"instant"}),e.scrollTop},C=({scroller:e,withCircle:t})=>{const{locale:s}=v.useExplorer(),{scrollTop:o,scrollHeight:n,clientHeight:c}=b(e),r=a.useCallback(l=>d(e,l),[e]);return T.jsx(h.ScrollBar,{contentSize:n,viewportSize:c,scrollPosition:o,onScroll:r,scrollBarWidth:g.NATIVE_SCROLL_BAR_WIDTH,enableThumbDrag:!0,enableTrackClick:!0,enableArrowButtons:!0,enableArrowButtonTabStops:!1,tapScrollCircleOptions:t?S.TAP_SCROLL_CIRCLE:S.NO_TAP_SCROLL_CIRCLE,locale:s})};exports.NativeScrollBar=C;exports.scrollScrollerTo=d;exports.useScrollerMetrics=b;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as p } from "react/jsx-runtime";
|
|
2
2
|
import { ScrollBar as m } from "@aiquants/virtualscroll";
|
|
3
3
|
import { useCallback as b, useMemo as S, useSyncExternalStore as h } from "react";
|
|
4
|
-
import { u as T } from "./index-
|
|
4
|
+
import { u as T } from "./index-BhxsL0Sm.js";
|
|
5
5
|
import { N as f } from "./scrollBarGeometry-DOBdGNV-.js";
|
|
6
6
|
import { T as d, N as v } from "./tapScrollCircle-u4EXeLhx.js";
|
|
7
7
|
const u = (e) => ({ scrollTop: e.scrollTop, scrollHeight: e.scrollHeight, clientHeight: e.clientHeight }), g = (e, t) => e.scrollTop === t.scrollTop && e.scrollHeight === t.scrollHeight && e.clientHeight === t.clientHeight, C = (e) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as w, jsxs as _ } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as v, useCallback as m, useSyncExternalStore as C, useEffect as S, useState as M } from "react";
|
|
3
3
|
import { useLocation as A } from "react-router";
|
|
4
|
-
import { e as p, c as L } from "./location-
|
|
5
|
-
import { u as h, r as y, F as G, c as j, N as H, d as q, e as U, D as $, P as z, f as B } from "./index-
|
|
6
|
-
import { E as Y, a as J, b as K } from "./ExplorerSplit-
|
|
4
|
+
import { e as p, c as L } from "./location-gXXmC7CQ.js";
|
|
5
|
+
import { u as h, r as y, F as G, c as j, N as H, d as q, e as U, D as $, P as z, f as B } from "./index-BhxsL0Sm.js";
|
|
6
|
+
import { E as Y, a as J, b as K } from "./ExplorerSplit-DIkC3R7O.js";
|
|
7
7
|
const Q = (t, e) => t.claim !== e.claim || t.readme.status !== e.readme.status ? !1 : t.readme.status === "failed" && e.readme.status === "failed" ? t.readme.failure === e.readme.failure : t.readme.status === "ok" && e.readme.status === "ok" ? t.readme.readme === e.readme.readme : !0, V = (t, e, n) => {
|
|
8
8
|
let r = null;
|
|
9
9
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),u=require("react"),T=require("react-router"),p=require("./location-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),u=require("react"),T=require("react-router"),p=require("./location-CasigkBk.cjs"),d=require("./index-ZdsIXJap.cjs"),x=require("./ExplorerSplit-BWMVatnB.cjs"),P=(t,e)=>t.claim!==e.claim||t.readme.status!==e.readme.status?!1:t.readme.status==="failed"&&e.readme.status==="failed"?t.readme.failure===e.readme.failure:t.readme.status==="ok"&&e.readme.status==="ok"?t.readme.readme===e.readme.readme:!0,F=(t,e,n)=>{let r=null;return()=>{const a=t.version(),c=t.read(e),o=c.status!=="pending";if(r!==null&&r.version===a&&r.tree===c&&r.settled===o)return r.state;const l=d.readFolderReadme(t,e,n),s=r!==null&&P(r.state,l)?r.state:l;return r={version:a,tree:c,settled:o,state:s},s}},_=(t,e,n)=>{let r=!0,a=null;const c=()=>{r&&n()},o=()=>{const s=t.read(e);s===a||s.status!=="pending"||(a=s,s.then(c,c))};o();const l=t.subscribe(()=>{o(),n()});return()=>{r=!1,l()}},j=()=>d.FOLDER_README_LOADING,q=(t,e)=>{const{trees:n}=d.useExplorer(),r=u.useMemo(()=>e===null?null:F(n,t,e),[n,t,e]),a=u.useCallback(f=>r===null?()=>{}:_(n,t,f),[r,n,t]),c=u.useCallback(()=>r===null?null:r(),[r]),o=u.useCallback(()=>r===null?null:j(),[r]),l=u.useSyncExternalStore(a,c,o),s=l?.claim===!0;return u.useEffect(()=>e===null?void 0:n.open(t),[n,t,e]),u.useEffect(()=>e===null||!s?void 0:n.claimChildren(t,new Map([[e,"direct"]])),[n,t,e,s]),l===null?null:l.readme},y=new Set,H=Object.freeze({kind:"loading"}),L=(t,e)=>e.status==="loading"?H:e.status==="failed"?{kind:"failure",folder:t,failure:e.failure,onRetry:e.retry}:{kind:"no-readme",folder:t},A=({location:t})=>{const{config:e}=d.useExplorer(),n=d.useExplorerNavigate(),{hash:r}=T.useLocation(),{source:a,doc:c,folder:o,overrides:l,markup:s}=t,[f,S]=u.useState(x.EMPTY_SELECTION),w=u.useMemo(()=>({gathered:f,onGatheredChange:S}),[f]),v=q(a,o),i=v===null?c:v.status==="ok"?v.readme:null,k=u.useMemo(()=>o===null||v===null?d.NO_DOCUMENT:L(o,v),[o,v]),h=u.useCallback(m=>n(p.explorerHref(e,{view:"tree",source:a,doc:m,overrides:l}),"browse"),[n,e,a,l]),O=u.useCallback(m=>n(p.explorerHref(e,{view:"tree",source:a,folder:m,overrides:l}),"browse"),[n,e,a,l]),g=u.useCallback(m=>n(p.explorerHref(e,{view:"tree",source:m,doc:c,folder:o,overrides:l,markup:s}),"switch-source"),[n,e,c,o,l,s]),C=u.useCallback(m=>n(`${p.explorerHref(e,{view:"tree",source:m,doc:c,folder:o,overrides:l,markup:s})}${r}`,"browse"),[n,e,c,o,l,s,r]),R=u.useCallback(m=>{const E=p.canonicalMultiDocuments(e,m);n(p.explorerHref(e,{view:"multi",source:a,docs:E,markup:s&&i!==null&&E.includes(i)?[i]:[]}),"switch-view")},[n,e,a,i,s]),M=u.useMemo(()=>({href:p.explorerHref(e,i===null?{view:"multi",source:a}:{view:"multi",source:a,docs:[i],markup:s?[i]:[]}),target:"multi"}),[e,a,i,s]),D=u.useMemo(()=>({kind:"page",view:"tree",overrides:l,embed:{}}),[l]),N=d.usePageMarkupToggle(t);return b.jsx(x.ExplorerSplit,{view:"tree",explorer:b.jsx(x.ExplorerPane,{mode:"tree",sourceId:a,currentPath:o===null?c:o,openPaths:y,onOpenDocument:h,onOpenFolder:O,currentFolder:o!==null,onSourceChange:g,onRevealSource:C,viewSwitch:M,tray:w,onOpenSelection:R}),content:b.jsxs("div",{className:"aqmx-document-column aqmx-tree-document",...d.CONTENT_PANE,children:[i===null?null:b.jsx(d.DocumentRefreshBar,{path:i,placement:d.PAGE_DOCUMENT_REFRESH,markup:N}),b.jsx(d.DocumentPane,{path:i,absence:k,markup:s,variant:D})]})})};exports.TreeLayout=A;
|
package/dist/core/config.d.cts
CHANGED
|
@@ -32,6 +32,10 @@ export type ExplorerConfigInput = {
|
|
|
32
32
|
readonly linkCardSize?: LinkCardSize;
|
|
33
33
|
};
|
|
34
34
|
readonly defaultTreeSettings?: Partial<TreeSettings>;
|
|
35
|
+
readonly legacyTextEncoding?: string;
|
|
36
|
+
readonly spreadsheets?: {
|
|
37
|
+
readonly maxBytes?: number;
|
|
38
|
+
};
|
|
35
39
|
};
|
|
36
40
|
export type ExplorerConfig = {
|
|
37
41
|
readonly basePath: string;
|
|
@@ -53,6 +57,10 @@ export type ExplorerConfig = {
|
|
|
53
57
|
readonly iframeHosts: readonly string[];
|
|
54
58
|
readonly embeds: MarkdownEmbeds;
|
|
55
59
|
readonly defaultTreeSettings: TreeSettings;
|
|
60
|
+
readonly legacyTextEncoding: string | null;
|
|
61
|
+
readonly spreadsheets: {
|
|
62
|
+
readonly maxBytes: number;
|
|
63
|
+
};
|
|
56
64
|
};
|
|
57
65
|
export declare const DEFAULT_VIEW_SLUGS: ExplorerViewSlugs;
|
|
58
66
|
export declare const MULTI_VIEW_PANEL_LIMITS: Readonly<{
|
|
@@ -80,6 +88,11 @@ export declare const REVEAL_DOCUMENT_DEPTH_LIMITS: Readonly<{
|
|
|
80
88
|
min: 1;
|
|
81
89
|
max: 64;
|
|
82
90
|
}>;
|
|
91
|
+
export declare const SPREADSHEET_BYTE_LIMITS: Readonly<{
|
|
92
|
+
default: number;
|
|
93
|
+
min: 1;
|
|
94
|
+
max: number;
|
|
95
|
+
}>;
|
|
83
96
|
export declare const defineExplorerConfig: (input: ExplorerConfigInput) => ExplorerConfig;
|
|
84
97
|
export declare const revalidateExplorerConfig: (config: ExplorerConfig) => ExplorerConfig;
|
|
85
98
|
export declare const isExplorerSourceId: (value: unknown) => value is string;
|
package/dist/core/config.d.ts
CHANGED
|
@@ -32,6 +32,10 @@ export type ExplorerConfigInput = {
|
|
|
32
32
|
readonly linkCardSize?: LinkCardSize;
|
|
33
33
|
};
|
|
34
34
|
readonly defaultTreeSettings?: Partial<TreeSettings>;
|
|
35
|
+
readonly legacyTextEncoding?: string;
|
|
36
|
+
readonly spreadsheets?: {
|
|
37
|
+
readonly maxBytes?: number;
|
|
38
|
+
};
|
|
35
39
|
};
|
|
36
40
|
export type ExplorerConfig = {
|
|
37
41
|
readonly basePath: string;
|
|
@@ -53,6 +57,10 @@ export type ExplorerConfig = {
|
|
|
53
57
|
readonly iframeHosts: readonly string[];
|
|
54
58
|
readonly embeds: MarkdownEmbeds;
|
|
55
59
|
readonly defaultTreeSettings: TreeSettings;
|
|
60
|
+
readonly legacyTextEncoding: string | null;
|
|
61
|
+
readonly spreadsheets: {
|
|
62
|
+
readonly maxBytes: number;
|
|
63
|
+
};
|
|
56
64
|
};
|
|
57
65
|
export declare const DEFAULT_VIEW_SLUGS: ExplorerViewSlugs;
|
|
58
66
|
export declare const MULTI_VIEW_PANEL_LIMITS: Readonly<{
|
|
@@ -80,6 +88,11 @@ export declare const REVEAL_DOCUMENT_DEPTH_LIMITS: Readonly<{
|
|
|
80
88
|
min: 1;
|
|
81
89
|
max: 64;
|
|
82
90
|
}>;
|
|
91
|
+
export declare const SPREADSHEET_BYTE_LIMITS: Readonly<{
|
|
92
|
+
default: number;
|
|
93
|
+
min: 1;
|
|
94
|
+
max: number;
|
|
95
|
+
}>;
|
|
83
96
|
export declare const defineExplorerConfig: (input: ExplorerConfigInput) => ExplorerConfig;
|
|
84
97
|
export declare const revalidateExplorerConfig: (config: ExplorerConfig) => ExplorerConfig;
|
|
85
98
|
export declare const isExplorerSourceId: (value: unknown) => value is string;
|
|
@@ -26,6 +26,11 @@ export declare const EXPLORER_IMAGE_TYPES: readonly [
|
|
|
26
26
|
"svg"
|
|
27
27
|
];
|
|
28
28
|
export type ExplorerImageType = (typeof EXPLORER_IMAGE_TYPES)[number];
|
|
29
|
+
export declare const EXPLORER_SPREADSHEET_FORMATS: readonly [
|
|
30
|
+
"csv",
|
|
31
|
+
"tsv"
|
|
32
|
+
];
|
|
33
|
+
export type ExplorerSpreadsheetFormat = (typeof EXPLORER_SPREADSHEET_FORMATS)[number];
|
|
29
34
|
export declare const EXPLORER_NOTICE_TONES: readonly [
|
|
30
35
|
"info",
|
|
31
36
|
"warning",
|
|
@@ -37,6 +42,7 @@ export declare const EXPLORER_DOCUMENT_KINDS: readonly [
|
|
|
37
42
|
"text",
|
|
38
43
|
"image",
|
|
39
44
|
"media",
|
|
45
|
+
"spreadsheet",
|
|
40
46
|
"file",
|
|
41
47
|
"failure"
|
|
42
48
|
];
|
|
@@ -115,13 +121,22 @@ export type ExplorerTextDocument = {
|
|
|
115
121
|
readonly truncated: boolean;
|
|
116
122
|
readonly url: string;
|
|
117
123
|
};
|
|
124
|
+
export type ExplorerExternalEdit = {
|
|
125
|
+
readonly kind: "external";
|
|
126
|
+
readonly href: string;
|
|
127
|
+
};
|
|
118
128
|
export type ExplorerDocumentEdit = {
|
|
119
129
|
readonly kind: "inline";
|
|
120
130
|
} | {
|
|
121
131
|
readonly kind: "draft";
|
|
122
|
-
} |
|
|
123
|
-
|
|
124
|
-
readonly
|
|
132
|
+
} | ExplorerExternalEdit;
|
|
133
|
+
export type ExplorerSpreadsheetDocument = {
|
|
134
|
+
readonly kind: "spreadsheet";
|
|
135
|
+
readonly name: string;
|
|
136
|
+
readonly url: string;
|
|
137
|
+
readonly format: ExplorerSpreadsheetFormat;
|
|
138
|
+
readonly firstSheetOnly: boolean;
|
|
139
|
+
readonly edit: ExplorerExternalEdit | null;
|
|
125
140
|
};
|
|
126
141
|
export type ExplorerDocument = {
|
|
127
142
|
readonly kind: "markdown";
|
|
@@ -139,7 +154,7 @@ export type ExplorerDocument = {
|
|
|
139
154
|
readonly name: string;
|
|
140
155
|
readonly url: string;
|
|
141
156
|
readonly mediaType: ExplorerMediaType;
|
|
142
|
-
} | {
|
|
157
|
+
} | ExplorerSpreadsheetDocument | {
|
|
143
158
|
readonly kind: "file";
|
|
144
159
|
readonly name: string;
|
|
145
160
|
readonly url: string;
|
|
@@ -224,6 +239,7 @@ export declare const isExplorerFailureReason: (value: unknown) => value is Explo
|
|
|
224
239
|
export declare const isExplorerEntryType: (value: unknown) => value is ExplorerEntryType;
|
|
225
240
|
export declare const isExplorerMediaType: (value: unknown) => value is ExplorerMediaType;
|
|
226
241
|
export declare const isExplorerImageType: (value: unknown) => value is ExplorerImageType;
|
|
242
|
+
export declare const isExplorerSpreadsheetFormat: (value: unknown) => value is ExplorerSpreadsheetFormat;
|
|
227
243
|
export declare const isExplorerNoticeTone: (value: unknown) => value is ExplorerNoticeTone;
|
|
228
244
|
export declare const isExplorerDocumentKind: (value: unknown) => value is ExplorerDocumentKind;
|
|
229
245
|
export declare const isExplorerFailureCode: (code: unknown) => code is string;
|
|
@@ -239,6 +255,8 @@ export declare const documentViolation: (value: unknown) => string | null;
|
|
|
239
255
|
export declare const isExplorerDocument: (value: unknown) => value is ExplorerDocument;
|
|
240
256
|
export declare const isExplorerTextAnswer: (value: unknown) => value is ExplorerTextAnswer;
|
|
241
257
|
export declare const editViolation: (value: unknown) => string | null;
|
|
258
|
+
export declare const externalEditViolation: (value: unknown) => string | null;
|
|
259
|
+
export declare const spreadsheetFieldsViolation: (record: Readonly<Record<string, unknown>>) => string | null;
|
|
242
260
|
export declare const isExplorerEditToken: (value: unknown) => value is string;
|
|
243
261
|
export declare const revisionViolation: (value: unknown) => string | null;
|
|
244
262
|
export declare const editAnswerViolation: (value: unknown, kinds: readonly string[]) => string | null;
|
package/dist/core/contracts.d.ts
CHANGED
|
@@ -26,6 +26,11 @@ export declare const EXPLORER_IMAGE_TYPES: readonly [
|
|
|
26
26
|
"svg"
|
|
27
27
|
];
|
|
28
28
|
export type ExplorerImageType = (typeof EXPLORER_IMAGE_TYPES)[number];
|
|
29
|
+
export declare const EXPLORER_SPREADSHEET_FORMATS: readonly [
|
|
30
|
+
"csv",
|
|
31
|
+
"tsv"
|
|
32
|
+
];
|
|
33
|
+
export type ExplorerSpreadsheetFormat = (typeof EXPLORER_SPREADSHEET_FORMATS)[number];
|
|
29
34
|
export declare const EXPLORER_NOTICE_TONES: readonly [
|
|
30
35
|
"info",
|
|
31
36
|
"warning",
|
|
@@ -37,6 +42,7 @@ export declare const EXPLORER_DOCUMENT_KINDS: readonly [
|
|
|
37
42
|
"text",
|
|
38
43
|
"image",
|
|
39
44
|
"media",
|
|
45
|
+
"spreadsheet",
|
|
40
46
|
"file",
|
|
41
47
|
"failure"
|
|
42
48
|
];
|
|
@@ -115,13 +121,22 @@ export type ExplorerTextDocument = {
|
|
|
115
121
|
readonly truncated: boolean;
|
|
116
122
|
readonly url: string;
|
|
117
123
|
};
|
|
124
|
+
export type ExplorerExternalEdit = {
|
|
125
|
+
readonly kind: "external";
|
|
126
|
+
readonly href: string;
|
|
127
|
+
};
|
|
118
128
|
export type ExplorerDocumentEdit = {
|
|
119
129
|
readonly kind: "inline";
|
|
120
130
|
} | {
|
|
121
131
|
readonly kind: "draft";
|
|
122
|
-
} |
|
|
123
|
-
|
|
124
|
-
readonly
|
|
132
|
+
} | ExplorerExternalEdit;
|
|
133
|
+
export type ExplorerSpreadsheetDocument = {
|
|
134
|
+
readonly kind: "spreadsheet";
|
|
135
|
+
readonly name: string;
|
|
136
|
+
readonly url: string;
|
|
137
|
+
readonly format: ExplorerSpreadsheetFormat;
|
|
138
|
+
readonly firstSheetOnly: boolean;
|
|
139
|
+
readonly edit: ExplorerExternalEdit | null;
|
|
125
140
|
};
|
|
126
141
|
export type ExplorerDocument = {
|
|
127
142
|
readonly kind: "markdown";
|
|
@@ -139,7 +154,7 @@ export type ExplorerDocument = {
|
|
|
139
154
|
readonly name: string;
|
|
140
155
|
readonly url: string;
|
|
141
156
|
readonly mediaType: ExplorerMediaType;
|
|
142
|
-
} | {
|
|
157
|
+
} | ExplorerSpreadsheetDocument | {
|
|
143
158
|
readonly kind: "file";
|
|
144
159
|
readonly name: string;
|
|
145
160
|
readonly url: string;
|
|
@@ -224,6 +239,7 @@ export declare const isExplorerFailureReason: (value: unknown) => value is Explo
|
|
|
224
239
|
export declare const isExplorerEntryType: (value: unknown) => value is ExplorerEntryType;
|
|
225
240
|
export declare const isExplorerMediaType: (value: unknown) => value is ExplorerMediaType;
|
|
226
241
|
export declare const isExplorerImageType: (value: unknown) => value is ExplorerImageType;
|
|
242
|
+
export declare const isExplorerSpreadsheetFormat: (value: unknown) => value is ExplorerSpreadsheetFormat;
|
|
227
243
|
export declare const isExplorerNoticeTone: (value: unknown) => value is ExplorerNoticeTone;
|
|
228
244
|
export declare const isExplorerDocumentKind: (value: unknown) => value is ExplorerDocumentKind;
|
|
229
245
|
export declare const isExplorerFailureCode: (code: unknown) => code is string;
|
|
@@ -239,6 +255,8 @@ export declare const documentViolation: (value: unknown) => string | null;
|
|
|
239
255
|
export declare const isExplorerDocument: (value: unknown) => value is ExplorerDocument;
|
|
240
256
|
export declare const isExplorerTextAnswer: (value: unknown) => value is ExplorerTextAnswer;
|
|
241
257
|
export declare const editViolation: (value: unknown) => string | null;
|
|
258
|
+
export declare const externalEditViolation: (value: unknown) => string | null;
|
|
259
|
+
export declare const spreadsheetFieldsViolation: (record: Readonly<Record<string, unknown>>) => string | null;
|
|
242
260
|
export declare const isExplorerEditToken: (value: unknown) => value is string;
|
|
243
261
|
export declare const revisionViolation: (value: unknown) => string | null;
|
|
244
262
|
export declare const editAnswerViolation: (value: unknown, kinds: readonly string[]) => string | null;
|
package/dist/core/labels.d.cts
CHANGED
|
@@ -25,6 +25,7 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
|
|
|
25
25
|
readonly showMarkupLabel: string;
|
|
26
26
|
readonly showMarkup: string;
|
|
27
27
|
readonly showSvgMarkup: string;
|
|
28
|
+
readonly showSpreadsheetMarkup: (format: string) => string;
|
|
28
29
|
readonly showMarkupNamed: (name: string) => string;
|
|
29
30
|
readonly editDocumentLabel: string;
|
|
30
31
|
readonly editDocument: string;
|
|
@@ -159,6 +160,7 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
|
|
|
159
160
|
readonly folderReadmeMissing: (name: string) => string;
|
|
160
161
|
readonly documentLoading: string;
|
|
161
162
|
readonly markupLoading: string;
|
|
163
|
+
readonly spreadsheetLoading: string;
|
|
162
164
|
readonly documentShown: (name: string) => string;
|
|
163
165
|
readonly documentFailed: (name: string, title: string) => string;
|
|
164
166
|
readonly announcementSequence: (messages: readonly string[]) => string;
|
|
@@ -195,6 +197,13 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
|
|
|
195
197
|
readonly mediaUnsupported: string;
|
|
196
198
|
readonly fileNotShown: string;
|
|
197
199
|
readonly pdfNotShown: string;
|
|
200
|
+
readonly spreadsheetFirstSheetOnly: string;
|
|
201
|
+
readonly spreadsheetTruncated: string;
|
|
202
|
+
readonly spreadsheetUnreadableEncoding: (encodings: readonly string[]) => string;
|
|
203
|
+
readonly spreadsheetEmpty: string;
|
|
204
|
+
readonly spreadsheetNotText: string;
|
|
205
|
+
readonly spreadsheetLongRow: string;
|
|
206
|
+
readonly spreadsheetFullscreen: (name: string) => string;
|
|
198
207
|
readonly viewerLoading: string;
|
|
199
208
|
readonly viewerErrorPrefix: string;
|
|
200
209
|
readonly viewerStyleTitle: string;
|
|
@@ -249,6 +258,9 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
|
|
|
249
258
|
readonly viewerSvgImageCopy: string;
|
|
250
259
|
readonly viewerSvgImageCopied: string;
|
|
251
260
|
readonly viewerSvgImageCopyFailed: string;
|
|
261
|
+
readonly viewerSvgImageCopyImage: string;
|
|
262
|
+
readonly viewerSvgImageCopiedImage: string;
|
|
263
|
+
readonly viewerSvgImageCopyImageFailed: string;
|
|
252
264
|
readonly multiRegion: string;
|
|
253
265
|
readonly multiEmpty: string;
|
|
254
266
|
readonly panelLimit: (max: number) => string;
|
package/dist/core/labels.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
|
|
|
25
25
|
readonly showMarkupLabel: string;
|
|
26
26
|
readonly showMarkup: string;
|
|
27
27
|
readonly showSvgMarkup: string;
|
|
28
|
+
readonly showSpreadsheetMarkup: (format: string) => string;
|
|
28
29
|
readonly showMarkupNamed: (name: string) => string;
|
|
29
30
|
readonly editDocumentLabel: string;
|
|
30
31
|
readonly editDocument: string;
|
|
@@ -159,6 +160,7 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
|
|
|
159
160
|
readonly folderReadmeMissing: (name: string) => string;
|
|
160
161
|
readonly documentLoading: string;
|
|
161
162
|
readonly markupLoading: string;
|
|
163
|
+
readonly spreadsheetLoading: string;
|
|
162
164
|
readonly documentShown: (name: string) => string;
|
|
163
165
|
readonly documentFailed: (name: string, title: string) => string;
|
|
164
166
|
readonly announcementSequence: (messages: readonly string[]) => string;
|
|
@@ -195,6 +197,13 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
|
|
|
195
197
|
readonly mediaUnsupported: string;
|
|
196
198
|
readonly fileNotShown: string;
|
|
197
199
|
readonly pdfNotShown: string;
|
|
200
|
+
readonly spreadsheetFirstSheetOnly: string;
|
|
201
|
+
readonly spreadsheetTruncated: string;
|
|
202
|
+
readonly spreadsheetUnreadableEncoding: (encodings: readonly string[]) => string;
|
|
203
|
+
readonly spreadsheetEmpty: string;
|
|
204
|
+
readonly spreadsheetNotText: string;
|
|
205
|
+
readonly spreadsheetLongRow: string;
|
|
206
|
+
readonly spreadsheetFullscreen: (name: string) => string;
|
|
198
207
|
readonly viewerLoading: string;
|
|
199
208
|
readonly viewerErrorPrefix: string;
|
|
200
209
|
readonly viewerStyleTitle: string;
|
|
@@ -249,6 +258,9 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
|
|
|
249
258
|
readonly viewerSvgImageCopy: string;
|
|
250
259
|
readonly viewerSvgImageCopied: string;
|
|
251
260
|
readonly viewerSvgImageCopyFailed: string;
|
|
261
|
+
readonly viewerSvgImageCopyImage: string;
|
|
262
|
+
readonly viewerSvgImageCopiedImage: string;
|
|
263
|
+
readonly viewerSvgImageCopyImageFailed: string;
|
|
252
264
|
readonly multiRegion: string;
|
|
253
265
|
readonly multiEmpty: string;
|
|
254
266
|
readonly panelLimit: (max: number) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const legacyTextEncodingOf: (label: string) => string;
|
|
2
|
+
export declare const textEncodingsOf: (bytes: Uint8Array, complete: boolean, legacyEncoding: string | null) => readonly string[];
|
|
3
|
+
export declare const decodeText: (bytes: Uint8Array, complete: boolean, legacyEncoding: string | null) => string | null;
|
|
4
|
+
export declare const decodeTextLeniently: (bytes: Uint8Array, complete: boolean, legacyEncoding: string | null) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const legacyTextEncodingOf: (label: string) => string;
|
|
2
|
+
export declare const textEncodingsOf: (bytes: Uint8Array, complete: boolean, legacyEncoding: string | null) => readonly string[];
|
|
3
|
+
export declare const decodeText: (bytes: Uint8Array, complete: boolean, legacyEncoding: string | null) => string | null;
|
|
4
|
+
export declare const decodeTextLeniently: (bytes: Uint8Array, complete: boolean, legacyEncoding: string | null) => string;
|