@reviseio/engine 0.0.0-stage → 3.0.0
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 +12 -0
- package/FONT-LICENSE-HAN-EXT-B.txt +91 -0
- package/FONT-LICENSE-KATEX.txt +95 -0
- package/FONT-LICENSE-LIBERATION.txt +102 -0
- package/FONT-LICENSE-NOTO-MULTILINGUAL.txt +93 -0
- package/FONT-LICENSE-NOTO-SANS-SC.txt +93 -0
- package/FONT-LICENSE-NOTO.txt +94 -0
- package/FONT-LICENSE-SOURCE-CODE-PRO.txt +94 -0
- package/FONT-LICENSE-SOURCE-SERIF-4.txt +93 -0
- package/LICENSE +141 -0
- package/README.md +11 -2
- package/THIRD-PARTY-NOTICES.md +3376 -0
- package/assets/historyMaterializeWorker-Kl0syEbc.js +618 -0
- package/chunks/AgentHtmlConverter-BnK7NaYA.js +379 -0
- package/chunks/AgentPageRenderViews-BTLjPZJQ.js +2 -0
- package/chunks/AgentPageRenderer-DLwq6nAa.js +180 -0
- package/chunks/BidiText-Bkp4Y90s.js +160 -0
- package/chunks/BlockDiff-BdlcKY-t.js +42 -0
- package/chunks/CanvasRenderer-Bqsj1S0p.js +110 -0
- package/chunks/ColorParserFull-BKH72fK8.js +446 -0
- package/chunks/DocumentCompare-BqyiP87r.js +6 -0
- package/chunks/DocumentLayout-CsU5MR-3.js +12 -0
- package/chunks/DocumentLayoutEngine-7iOYvyVb.js +218 -0
- package/chunks/DocumentMutator-DIrZBuLr.js +13 -0
- package/chunks/DocumentScrubber-Cz8Q05hF.js +21 -0
- package/chunks/DocumentSession-lXSXqua5.js +1 -0
- package/chunks/DocumentStylesheet-CEEt18sr.js +7 -0
- package/chunks/DocxConverter-BfDw7777.js +1236 -0
- package/chunks/DocxGraft-D0uCnGCo.js +8 -0
- package/chunks/HorizontalRuleOrnaments-gmUZ3R7Q.js +3 -0
- package/chunks/HtmlConverter-7Xj_g9Jr.js +267 -0
- package/chunks/ListNumbering-Qlu6AuRZ.js +23 -0
- package/chunks/MarkdownConverter-cnW_oePY.js +57 -0
- package/chunks/MathRenderer-Bz9WEVvF.js +68 -0
- package/chunks/OdtConverter-GwRDMnwS.js +125 -0
- package/chunks/OfficeImportShared-nlMtIUni.js +30 -0
- package/chunks/PageNumeralFonts-BWzI061X.js +5 -0
- package/chunks/ParagraphDiffAnalysis-DrmStvmz.js +36 -0
- package/chunks/PdfConverter-yOlWiVIj.js +457 -0
- package/chunks/RtfConverter--wLd0qrw.js +186 -0
- package/chunks/TableBorders-C5pNsuxP.js +32 -0
- package/chunks/TableGrid-DbroRucl.js +12 -0
- package/chunks/TextFileDecoder--rsVs3NR.js +9 -0
- package/chunks/TxtConverter-BoRVCDZw.js +14 -0
- package/chunks/Typography-DAGM5kfI.js +28 -0
- package/chunks/UnicodeUtils-CXtusU4g.js +10 -0
- package/chunks/XmlConverter-CO8Z28dX.js +55 -0
- package/chunks/_commonjsHelpers-DaMA6jEr.js +2 -0
- package/chunks/_revise-sdk-lazy-harfbuzz-CDWdjF9f.js +1 -0
- package/chunks/base64-Di1bxoXD.js +1 -0
- package/chunks/browser-module-CFmqfGkE.js +1791 -0
- package/chunks/bundle.min-DRpfgV69.js +782 -0
- package/chunks/capture-Dtinb4bY.js +11 -0
- package/chunks/carrier-RNy67HN4.js +6 -0
- package/chunks/chromeImageLayout-bgHYmqTp.js +18 -0
- package/chunks/engine-TnK8N-gT.js +520 -0
- package/chunks/footnoteFlatten-BcKaWzVs.js +6 -0
- package/chunks/graftExport-DxAALMHp.js +104 -0
- package/chunks/html2canvas.esm-CntiHiYW.js +997 -0
- package/chunks/index-BWdRWxoH.js +1807 -0
- package/chunks/index-CTti7wRd.js +1002 -0
- package/chunks/index.es-CI0QPo8w.js +780 -0
- package/chunks/jspdf.es.min-DU74zN8b.js +1792 -0
- package/chunks/jszip.min-CPW0h1Kx.js +476 -0
- package/chunks/katex-DWj8TvwO.js +1462 -0
- package/chunks/pdf-BLWDCiFF.js +1828 -0
- package/chunks/purify.es-BwLardii.js +107 -0
- package/chunks/serverDocumentSession-BmYdjC6e.js +1011 -0
- package/chunks/signatures-CU2LMLBp.js +21 -0
- package/chunks/suggestionAuthorship-B-IuLQlE.js +1 -0
- package/chunks/web-tree-sitter-BXGZGnNj.js +2 -0
- package/chunks/xmlScan-DXjt2cTS.js +8 -0
- package/engine.d.ts +179 -0
- package/engine.js +3 -0
- package/package.json +64 -4
- package/serverToolContract.d.ts +420 -0
- package/serverToolInputs.generated.d.ts +264 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{a as S,s as p,o as l,d as h,e as y,c as m,h as b,g as w,f as A,n as $,p as C,C as k}from"./signatures-CU2LMLBp.js";async function x(e){const t=globalThis.crypto?.subtle;if(t)try{const a=await t.
|
|
2
|
+
digest("SHA-256",e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));return Array.from(new Uint8Array(a),i=>i.toString(16).padStart(2,"0")).join("")}catch{}let s=3421674724,n=2216829733;for(let a=0;a<
|
|
3
|
+
e.length;a++){n^=e[a];const i=n*435+s*435%65536*65536>>>0;s=(s*435+Math.floor(n*435/4294967296)+n&4294967295)>>>0,n=i}return`fnv1a-${s.toString(16).padStart(8,"0")}${n.toString(16).padStart(8,"0")}`}function L(e,t,s){
|
|
4
|
+
const n=e.get(t);if(!n){e.set(t,{start:s,end:s});return}s<n.start&&(n.start=s),s>n.end&&(n.end=s)}function M(e){const t=e.docxSource;if(!t)return;const s={};for(const n of[...e.children,...e.chrome??[],
|
|
5
|
+
...e.notes??[]])n.id&&(s[n.id]=p(S(n)));t.signatures=s,t.signatureVersion=k,t.pageLayoutSignature=C(e),t.notesSignature=$(e),t.chromeSignature=A(e),t.commentsSignature=w(e),t.corePropertiesSignature=b(
|
|
6
|
+
e),t.bodySidecarsSignature=m(e),t.stylesSignature=y(e),t.settingsSignature=h(e),t.parts=l(e)}function P(e,t,s){const n={},a=new Map;for(const o of[...e.children,...e.chrome??[],...e.notes??[]]){if(!o.
|
|
7
|
+
id)continue;const r=S(o);a.set(o.id,r),n[o.id]=p(r)}const i=new Map,u=[];for(const o of e.children){if(o.type==="footnote"||o.type==="header-footer"||!o.id)continue;const r=t.get(o);if(!r)continue;const g=a.
|
|
8
|
+
get(o.id)?.includes('"footnoteRef"')??!1,f=`${r.start}-${r.end}`,d=i.get(f);if(d){d.blockIds.push(o.id),g&&(d.notesCoupled=!0);continue}u.some(c=>r.start<=c.end&&r.end>=c.start&&!(r.start===c.start&&r.
|
|
9
|
+
end===c.end))||(u.push({start:r.start,end:r.end}),i.set(f,{start:r.start,end:r.end,blockIds:[o.id],...g?{notesCoupled:!0}:{}}))}e.docxSource={signatureVersion:k,spans:Array.from(i.values()).sort((o,r)=>o.
|
|
10
|
+
start-r.start),signatures:n,pageLayoutSignature:C(e),notesSignature:$(e),chromeSignature:A(e),commentsSignature:w(e),corePropertiesSignature:b(e),bodySidecarsSignature:m(e),stylesSignature:y(e),settingsSignature:h(
|
|
11
|
+
e),parts:l(e),...s?{sourceHash:s}:{}}}export{P as c,x as h,L as m,M as r};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{h as b}from"./capture-Dtinb4bY.js";const o="docx-carrier",i=25*1024*1024,u=512*1024,g=1;async function l(n,t,e){const c=e?.byteCap??i;if(t.byteLength>c)return{stored:!1,reason:"oversize"};const a=e?.
|
|
2
|
+
hash??await b(t),r=n.getMap(o),s=Math.ceil(t.byteLength/u);return n.transact(()=>{r.clear();const y={version:g,hash:a,byteLength:t.byteLength,chunkCount:s,chunkSize:u};r.set("meta",y);for(let h=0;h<s;h++)
|
|
3
|
+
r.set(`c${h}`,new Uint8Array(t.subarray(h*u,Math.min((h+1)*u,t.byteLength))))}),{stored:!0,hash:a}}function f(n){const t=n.getMap(o).get("meta");return!t||t.version!==g||typeof t.hash!="string"||typeof t.
|
|
4
|
+
byteLength!="number"||typeof t.chunkCount!="number"?null:{hash:t.hash,byteLength:t.byteLength}}function L(n){const t=n.getMap(o),e=t.get("meta");if(!e||e.version!==g)return null;const c=new Uint8Array(
|
|
5
|
+
e.byteLength);let a=0;for(let r=0;r<e.chunkCount;r++){const s=t.get(`c${r}`);if(!(s instanceof Uint8Array)||a+s.byteLength>e.byteLength)return null;c.set(s,a),a+=s.byteLength}return a!==e.byteLength?null:
|
|
6
|
+
{bytes:c,hash:e.hash}}function p(n){const t=n.getMap(o);n.transact(()=>{t.clear()})}export{o as C,i as D,p as c,f as g,L as l,l as s};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{R as y,at as B,e as v,ad as T,h as z}from"./engine-TnK8N-gT.js";const F=8,H=4,W=10,C=8,$=8;function I(t,r,e){const o=(t??[]).filter(s=>s.side===r);if(o.length===0)return[];const a=s=>o.some(c=>c.
|
|
2
|
+
slot===s),h=e.textSlot??(e.isFirstPage&&a("first")?"first":e.pageNumber%2===0&&a("even")?"even":"default");return o.filter(s=>s.slot===h)}function L(t){const r=t.unit??1,e=F*r,o=Math.max(10*r,0);let a,
|
|
3
|
+
h;t.side==="header"?(a=e,h=t.marginTop-e,t.hasText&&(h=Math.max(o,t.marginTop/2)-(W+H)*r)):(a=t.pageHeight-t.marginBottom+e,h=t.pageHeight-e,t.hasText&&(a=t.pageHeight-Math.max(o,t.marginBottom/2)+(W+
|
|
4
|
+
H)*r));const s=h-a,c=t.pageWidth-t.marginLeft-t.marginRight;return s<C*r||c<=0?null:{bandTop:a,bandHeight:s,contentWidth:c}}function N(t,r){const e=t.unit??1,{bandHeight:o,contentWidth:a}=r,h=t.records.
|
|
5
|
+
filter(n=>Number.isFinite(n.width)&&Number.isFinite(n.height)&&n.width>0&&n.height>0&&typeof n.src=="string"&&n.src.length>0),s=$*e,c=[];for(const n of["left","center","right"]){const g=h.filter(i=>(i.
|
|
6
|
+
align??"left")===n);if(g.length===0)continue;const m=(a-s*(g.length-1))/g.length;if(m<=0)continue;const f=g.map(i=>{const d=i.width*e,u=i.height*e,p=Math.min(1,m/d,o/u);return{record:i,width:d*p,height:u*
|
|
7
|
+
p}}).filter(i=>i.height>=1*e&&i.width>=1*e);f.length>0&&c.push({align:n,sized:f})}return c}function P(t){const r=L(t);if(!r)return[];const e=t.unit??1,o=$*e,{bandTop:a,bandHeight:h,contentWidth:s}=r,c=[];
|
|
8
|
+
for(const{align:n,sized:g}of N(t,r)){const m=g.reduce((i,d)=>i+d.width,0)+o*(g.length-1);let f=n==="left"?t.marginLeft:n==="center"?t.marginLeft+(s-m)/2:t.pageWidth-t.marginRight-m;for(const i of g)c.
|
|
9
|
+
push({src:i.record.src,...i.record.alt?{alt:i.record.alt}:{},x:f,y:a+(h-i.height)/2,width:i.width,height:i.height}),f+=i.width+o}return c}function E(t,r){return t.map(e=>{const o=r?.(e)??e;return`${e.
|
|
10
|
+
side} ${e.slot} image (${e.align??"left"}): ${e.alt?`${JSON.stringify(e.alt)}, `:""}${Math.round(o.width)}x${Math.round(o.height)}px`})}function k(t){if(!t.records||t.records.length===0)return[];const r=[];
|
|
11
|
+
for(const e of["header","footer"]){const o=z(t.chrome,e,t.pageNumber,t.sectionIndex),a=I(t.records,e,{pageNumber:t.pageNumber,isFirstPage:t.isFirstPage,textSlot:o?.slot});a.length!==0&&r.push(...P({side:e,
|
|
12
|
+
records:a,pageWidth:t.pageWidth,pageHeight:t.pageHeight,marginTop:t.marginTop,marginRight:t.marginRight,marginBottom:t.marginBottom,marginLeft:t.marginLeft,hasText:!!(o&&T(o)),unit:t.unit}))}return r}
|
|
13
|
+
function J(t){const r=new Map,e=new Map,o=t.chromeImages??[],a=[...t.children.flatMap(n=>n.type==="section-break"?[n.layout]:[]),void 0].map(n=>y(t.pageLayout,n)),h=a.length;if(!o.some(n=>n.fit==="ban\
|
|
14
|
+
d"))return{sizes:r,sectionsShowing:e,sectionCount:h};const s=new Map;for(const n of o){const g=`${n.side}:${n.slot}`;s.set(g,[...s.get(g)??[],n])}const c=h-1;for(const n of s.values()){const{side:g,slot:m}=n[0],
|
|
15
|
+
f=new Map;a.forEach((i,d)=>{const u=B(t.chrome??[],g,m,d===c?void 0:d),{pageWidth:p,pageHeight:R}=v(i),w={side:g,records:n,pageWidth:p,pageHeight:R,marginTop:i.marginTopPx,marginRight:i.marginRightPx,
|
|
16
|
+
marginBottom:i.marginBottomPx,marginLeft:i.marginLeftPx,hasText:!!(u&&T(u))},x=L(w);if(x)for(const{sized:S}of N(w,x))for(const l of S){const M=e.get(l.record)??new Set;M.add(d),e.set(l.record,M);const b=f.
|
|
17
|
+
get(l.record);(!b||l.width<b.width)&&f.set(l.record,{width:l.width,height:l.height})}});for(const i of n){if(i.fit!=="band")continue;const d=f.get(i);r.set(i,d?{width:Math.max(1,Math.floor(d.width)),height:Math.
|
|
18
|
+
max(1,Math.floor(d.height))}:null),e.has(i)||e.set(i,new Set)}}return{sizes:r,sectionsShowing:e,sectionCount:h}}export{k as a,J as c,E as d,P as p};
|