@docx-editor.dev/core 2.29.0 → 2.30.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.
Files changed (99) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.ts +18 -13
  3. package/dist/automation.js +1 -1
  4. package/dist/binding.cjs +1 -1
  5. package/dist/binding.d.ts +46 -38
  6. package/dist/binding.js +1 -1
  7. package/dist/{chrome-print-CAs51cpq.d.ts → chrome-print-BM3Js-6X.d.ts} +276 -227
  8. package/dist/{chunk-BCXH4BXB.js → chunk-2PV5L5NJ.js} +3 -3
  9. package/dist/chunk-5OTS2EJ7.js +7 -0
  10. package/dist/chunk-5P4223J4.cjs +27 -0
  11. package/dist/{chunk-MM5QBMTE.cjs → chunk-5RRAZMBU.cjs} +1 -1
  12. package/dist/chunk-5SPITS5F.js +18 -0
  13. package/dist/{chunk-236O4YQW.js → chunk-7ATNKARV.js} +1 -1
  14. package/dist/{chunk-6JPL6ZAS.cjs → chunk-BGCUTKWE.cjs} +5 -5
  15. package/dist/chunk-EBCXSH2W.js +3 -0
  16. package/dist/{chunk-JLVBDYVQ.cjs → chunk-ERECKTIR.cjs} +1 -1
  17. package/dist/{chunk-BY2ACZZ6.cjs → chunk-FLBEJC6X.cjs} +1 -1
  18. package/dist/{chunk-W35WTWAO.cjs → chunk-HYASLE2G.cjs} +1 -1
  19. package/dist/chunk-JC47NRJC.cjs +3 -0
  20. package/dist/{chunk-7WQ7AAHW.cjs → chunk-KJRTNY2Q.cjs} +1 -1
  21. package/dist/chunk-NKPUH3QJ.js +1 -0
  22. package/dist/chunk-PF5NJWS3.js +2 -0
  23. package/dist/chunk-PWTRJSES.cjs +18 -0
  24. package/dist/chunk-QFKGI242.cjs +30 -0
  25. package/dist/{chunk-G4HOFIKJ.js → chunk-RJCQGJR7.js} +1 -1
  26. package/dist/chunk-RPPV4S6T.cjs +4 -0
  27. package/dist/{chunk-LSZ6KPKK.js → chunk-T32MGBJS.js} +1 -1
  28. package/dist/chunk-UM26GH5B.js +30 -0
  29. package/dist/chunk-VRCZBFLH.js +27 -0
  30. package/dist/{chunk-UHHYFIDT.cjs → chunk-WF7JZ755.cjs} +1 -1
  31. package/dist/chunk-WK5X2MMA.cjs +7 -0
  32. package/dist/{chunk-RCLZXP3B.js → chunk-WPDD2Y32.js} +1 -1
  33. package/dist/chunk-YBMWBXST.cjs +2 -0
  34. package/dist/{chunk-OMCG63ZF.js → chunk-YZGUBCHP.js} +1 -1
  35. package/dist/chunk-ZOS2PM4A.js +4 -0
  36. package/dist/collaboration/replication.cjs +1 -1
  37. package/dist/collaboration/replication.d.ts +4 -4
  38. package/dist/collaboration/replication.js +1 -1
  39. package/dist/collaboration.d.ts +3 -3
  40. package/dist/contracts/document.d.ts +2 -2
  41. package/dist/contracts/editor.d.ts +8 -8
  42. package/dist/contracts/modules.d.ts +11 -11
  43. package/dist/contracts/types.d.ts +1 -1
  44. package/dist/{custom-node-writes-Bn6uciLb.d.ts → custom-node-writes-0v0Kgw1T.d.ts} +2 -2
  45. package/dist/{diagnostic-context-B8M79cfK.d.ts → diagnostic-context-CcAO4q1s.d.ts} +1 -1
  46. package/dist/{diagnostic-hints-BeVjfNOv.d.ts → diagnostic-hints-2Bke6H_w.d.ts} +11 -4
  47. package/dist/{document-protection-CUb55pl_.d.ts → document-protection-8eyMWIJ0.d.ts} +1 -1
  48. package/dist/{editor-CZQZmTIU.d.ts → editor-DaEJd2so.d.ts} +84 -10
  49. package/dist/editor.cjs +1 -1
  50. package/dist/editor.d.ts +31 -30
  51. package/dist/editor.js +1 -1
  52. package/dist/export.cjs +2 -2
  53. package/dist/export.d.ts +16 -13
  54. package/dist/export.js +2 -2
  55. package/dist/{font-resolver-lSBLirLR.d.ts → font-resolver-CL9BVKZo.d.ts} +1 -1
  56. package/dist/font-shaping-policy-BvpkrfxM.d.ts +7 -0
  57. package/dist/{headless-document-view-pp3q7wIh.d.ts → headless-document-view-DZQN8Bnx.d.ts} +2 -2
  58. package/dist/{image-resources-tXLQShoC.d.ts → image-resources-Bipz8toD.d.ts} +1 -1
  59. package/dist/index.cjs +1 -1
  60. package/dist/index.d.ts +24 -23
  61. package/dist/index.js +1 -1
  62. package/dist/{layout-shaping-BD-dF_rn.d.ts → layout-shaping-cEnVrhWg.d.ts} +3 -2
  63. package/dist/layout.cjs +1 -1
  64. package/dist/layout.d.ts +41 -38
  65. package/dist/layout.js +1 -1
  66. package/dist/{note-properties-qQUjO1GQ.d.ts → note-properties-9FH8zAeG.d.ts} +1 -1
  67. package/dist/{omml-equation-BUbU0utM.d.ts → omml-equation-DP2WpUbK.d.ts} +13 -1
  68. package/dist/output.cjs +1 -1
  69. package/dist/output.d.ts +7 -7
  70. package/dist/output.js +1 -1
  71. package/dist/{protocol-DYzzz2ej.d.ts → protocol-CZ1uUlPO.d.ts} +2 -2
  72. package/dist/{review-paragraph-order-CN_0l2Cb.d.ts → review-paragraph-order-CqVelc5A.d.ts} +1 -1
  73. package/dist/{semantic-cell-selection-eYag3P47.d.ts → semantic-cell-selection-Dr9yxFZt.d.ts} +2 -2
  74. package/dist/{semantic-interaction-kR_QB845.d.ts → semantic-interaction-Dc3pf3hr.d.ts} +1 -1
  75. package/dist/{semantic-paint-ZayFF3tD.d.ts → semantic-paint-Bz3FBAoH.d.ts} +3 -3
  76. package/dist/{semantic-record-queries-Bsgth6lv.d.ts → semantic-record-queries-Bx0pl6kL.d.ts} +1 -1
  77. package/dist/{semantic-records-DQmumPgL.d.ts → semantic-records-CjcF26ZL.d.ts} +86 -61
  78. package/dist/store.cjs +1 -1
  79. package/dist/store.d.ts +17 -130
  80. package/dist/store.js +1 -1
  81. package/dist/{tree-package-store-CovjNARF.d.ts → tree-package-store-DKhdEVym.d.ts} +158 -4
  82. package/dist/{tree-session-contract-CZVAGl51.d.ts → tree-session-contract-CwnTEVLF.d.ts} +7 -5
  83. package/dist/{types-barrel-DuC5QBNC.d.ts → types-barrel-CA0xB8kH.d.ts} +2 -2
  84. package/package.json +2 -2
  85. package/dist/chunk-6ZQP4HQ7.js +0 -3
  86. package/dist/chunk-CAJEXXVG.cjs +0 -4
  87. package/dist/chunk-CPWLFPWC.js +0 -30
  88. package/dist/chunk-D7ZMDMPX.cjs +0 -3
  89. package/dist/chunk-DOHF6FA7.cjs +0 -30
  90. package/dist/chunk-DVX32P2P.js +0 -27
  91. package/dist/chunk-E4LOMDNL.js +0 -1
  92. package/dist/chunk-EKLM7NWB.cjs +0 -7
  93. package/dist/chunk-G3K63G7P.cjs +0 -27
  94. package/dist/chunk-LQX36Z5P.js +0 -7
  95. package/dist/chunk-OSFOJTHU.cjs +0 -18
  96. package/dist/chunk-T6K2QYNZ.cjs +0 -2
  97. package/dist/chunk-TRGAVV2Y.js +0 -4
  98. package/dist/chunk-U4JZVSOE.js +0 -2
  99. package/dist/chunk-YQ5G6LC7.js +0 -18
@@ -1 +1 @@
1
- 'use strict';var chunkOSFOJTHU_cjs=require('./chunk-OSFOJTHU.cjs');var W=new Set(["document","hdr","ftr","footnotes","endnotes"]),$=24,J=512,U=chunkOSFOJTHU_cjs.ub($);function V(r){let n=r.root;return n.namespaceUri===chunkOSFOJTHU_cjs.la&&W.has(n.localName)}function Y(r){let n=[],e=t=>{if(t.kind!=="textValue"){t.namespaceUri===chunkOSFOJTHU_cjs.la&&t.localName==="p"&&n.push(t);for(let a of t.children)e(a);}};return e(r.root),n}function H(r){let n=chunkOSFOJTHU_cjs.Eb(r);let e=[],t=new Set;for(let a of Y(n)){let i=chunkOSFOJTHU_cjs.wb(a);if(!i||!chunkOSFOJTHU_cjs.vb(i))continue;let o=i.toUpperCase();if(t.has(o))continue;t.add(o);let s=chunkOSFOJTHU_cjs.Vi(n,a.id);s!==null&&e.push(Object.freeze({paragraphId:o,nodeId:a.id,text:s}));}return Object.freeze(e)}function q(r){let n=U.get(r.root);if(n)return n;let e=chunkOSFOJTHU_cjs.Eb(r);let t=new Map,a=new Set,i=o=>{if(o.kind!=="textValue"){if(o.namespaceUri===chunkOSFOJTHU_cjs.la&&o.localName==="p"){let s=chunkOSFOJTHU_cjs.wb(o);if(s&&chunkOSFOJTHU_cjs.vb(s)){let p=s.toUpperCase();a.has(p)||(a.add(p),o.kind==="paragraph"&&t.set(p,o.id));}}for(let s of o.children)i(s);}};return i(e.root),U.set(r.root,t),t}function _(r,n){if(r.length!==n.length)return false;for(let e=0;e<r.length;e+=1)if(r[e].root!==n[e])return false;return true}function B(r){let n=new Map,e=null,t=(i,o,s)=>{for(n.delete(i),n.set(i,{partName:o.name,root:o.root,nodeId:s});n.size>J;){let p=n.keys().next();if(p.done)break;n.delete(p.value);}},a=(i,o)=>{let s=n.get(i);if(!s)return null;let p=o.find(d=>d.name===s.partName);if(!p)return null;if(p.root===s.root)return {part:p,nodeId:s.nodeId};let l=chunkOSFOJTHU_cjs.Ta(p,s.nodeId);if(!l||l.kind!=="paragraph")return null;let c=chunkOSFOJTHU_cjs.wb(l);return !c||c.toUpperCase()!==i?null:(t(i,p,s.nodeId),{part:p,nodeId:s.nodeId})};return i=>{let o=r(),s=a(i,o);if(s)return s;if(e&&e.ids.has(i)&&_(o,e.roots))return null;for(let p of o){let l=q(p).get(i);if(l!==void 0)return t(i,p,l),{part:p,nodeId:l}}return (!e||!_(o,e.roots))&&(e={roots:o.map(p=>p.root),ids:new Set}),e.ids.size<J&&e.ids.add(i),null}}function L(r,n){return chunkOSFOJTHU_cjs.Ma(r,n)}var F=Object.freeze({kind:"body"}),Q=1e6;function O(r,n){if(n<=0||n>=r.length)return false;let e=r.charCodeAt(n-1),t=r.charCodeAt(n);return e>=55296&&e<=56319&&t>=56320&&t<=57343}function K(r,n,e){if(n===e)return [];let t=0,a=Math.min(n.length,e.length);for(;t<a&&n.charCodeAt(t)===e.charCodeAt(t);)t+=1;for(;t>0&&(O(n,t)||O(e,t));)t-=1;let i=0;for(;i<n.length-t&&i<e.length-t&&n.charCodeAt(n.length-i-1)===e.charCodeAt(e.length-i-1);)i+=1;for(;i>0&&(O(n,n.length-i)||O(e,e.length-i));)i-=1;let o=n.length-t-i,s=e.slice(t,e.length-i),p=[];return o>0&&p.push({op:"deleteText",paragraphId:r,start:t,end:t+o}),s.length>0&&p.push({op:"insertText",paragraphId:r,offset:t,text:s}),Object.freeze(p)}function tt(r){let n=t=>!!t&&t.kind!=="textValue"&&t.namespaceUri===chunkOSFOJTHU_cjs.la&&t.localName==="t"&&t.attributes.every(a=>a.namespaceUri===chunkOSFOJTHU_cjs.ma&&a.localName==="space")&&t.children.every(a=>a.kind==="textValue"),e=[];for(let t of r){let a=e.at(-1);if(!n(a)||!n(t)){e.push(t);continue}let i=a.children.map(o=>o.kind==="textValue"?o.value:"").join("")+t.children.map(o=>o.kind==="textValue"?o.value:"").join("");e[e.length-1]={...a,attributes:/^\s|\s$/.test(i)?[{kind:"xmlSpace",namespaceUri:chunkOSFOJTHU_cjs.ma,localName:"space",prefix:"xml",value:"preserve"}]:[],children:[{id:a.children[0]?.id??`${a.id}/text`,kind:"textValue",value:i}]};}return e}function G(r){if(r.kind==="textValue")return r;let n=false,e=r.children.map(t=>{let a=G(t);return a!==t&&(n=true),a});if(r.namespaceUri===chunkOSFOJTHU_cjs.la&&r.localName==="r"){let t=tt(e);(t.length!==e.length||t.some((a,i)=>a!==e[i]))&&(e=[...t],n=true);}return n?{...r,children:e}:r}function et(r,n,e){let t=r.parts.get(n);if(!t)return r;let a=false,i=new Set;for(let o of e)(o.op==="insertText"||o.op==="deleteText")&&!o.revision&&i.add(o.paragraphId);for(let o of i){let s=chunkOSFOJTHU_cjs.Ta(t,o);if(!s||s.kind==="textValue")continue;let p=G(s);if(p===s)continue;let l=chunkOSFOJTHU_cjs.Za(t,o,p,{deferValidation:true});l.ok&&(t=l.part,a=true);}return a?chunkOSFOJTHU_cjs.Fe(r,t):r}function rt(r,n){let e=n.documentId.trim();if(e.length===0||e.length>256)throw new TypeError("documentId must contain 1 to 256 characters");let t=()=>H(r.bodyStore().part),a,i=()=>{let l=r.bodyStore().part,c=r.currentPackage();if(a?.pkg===c&&a.body===l)return a.parts;let d=[l];for(let g of c.parts.values())g===l||!V(g)||d.push(g);return a={pkg:c,body:l,parts:Object.freeze(d)},a.parts},o=B(i),s=(l,c)=>{if(l.length===0)return {ok:true,changed:false};let d=t(),g=new Set,P=[];for(let u of l){if(typeof u.text!="string"||u.text.length>Q)return {ok:false,reason:"collaboration-text-limit"};if(typeof u.paragraphId!="string"||u.paragraphId.length===0||u.paragraphId.length>256)return {ok:false,reason:"unknown-paragraph-id"};let m=u.paragraphId.toUpperCase();if(g.has(m))return {ok:false,reason:"duplicate-paragraph-id"};g.add(m);let N=d.filter(X=>X.paragraphId===m);if(N.length!==1)return {ok:false,reason:"unknown-paragraph-id"};let M=N[0];P.push(...K(M.nodeId,M.text,u.text));}if(P.length===0)return {ok:true,changed:false};let x=r.transact(F,u=>{for(let m of P)u.apply(m);u.applyPackage(m=>et(m,m.mainDocumentPart,P));},{origin:c.origin,actorId:c.actorId,operationId:c.operationId,recordsHistory:false});return x.ok?{ok:true,changed:x.change!==null}:{ok:false,reason:x.detail??x.reason}};return Object.freeze({documentId:e,paragraphs:t,paragraphByNodeId(l){return t().find(c=>c.nodeId===l)??null},paragraphTextOf(l){for(let c of i()){let d=chunkOSFOJTHU_cjs.Vi(c,l);if(d!==null)return d}return null},paragraphByStableId(l){let c=l.toUpperCase(),d=o(c);if(!d)return null;let g=chunkOSFOJTHU_cjs.Vi(d.part,d.nodeId);return g===null?null:Object.freeze({paragraphId:c,nodeId:d.nodeId,text:g})},applyParagraphText(l,c,d){return s([{paragraphId:l,text:c}],d)},applyParagraphTexts:s,applyRemotePackage(l,c){let d=r.publishRemotePackage(l,c);return d.ok?{ok:true,changed:d.change!==null}:{ok:false,reason:d.detail??d.reason}},revision:()=>r.packageRevision,subscribe:l=>r.subscribe(l),observePrimitiveJournal:l=>L(r,l),hasPendingJournals:()=>chunkOSFOJTHU_cjs.Ka(r),flushPendingJournals:()=>{chunkOSFOJTHU_cjs.La(r);},save:()=>chunkOSFOJTHU_cjs.Ee(r.currentPackage()),binaryPart(l){let c=r.currentPackage();return c.partBytes.get(l)??c.partBytes.get(l.startsWith("/")?l.slice(1):`/${l}`)??null}})}function nt(r,n,e){if(n===e||r>n.length)return Math.min(r,e.length);let t=0;for(;t<n.length&&t<e.length&&n[t]===e[t];)t+=1;let a=0;for(;a<n.length-t&&a<e.length-t&&n[n.length-1-a]===e[e.length-1-a];)a+=1;if(r<=t)return Math.min(r,e.length);if(r>n.length-a)return Math.min(e.length,r+e.length-n.length);let i=at(n,e,t,a),o=i.offsets.get(r);return o===void 0&&(o=(i.table?st(i.table,r,n,e,t):null)??ct(r,n,e,t,a)??t,i.offsets.set(r,o)),o}var f=[],ot=16;function at(r,n,e,t){let a=f.findIndex(o=>o.before===r&&o.after===n);if(a>=0){let[o]=f.splice(a,1);return f.push(o),o}let i={before:r,after:n,table:lt(r,n,e,t),offsets:new Map};return f.length>=ot&&f.shift(),f.push(i),i}var it=1<<18;function lt(r,n,e,t){let a=r.length-t-e,i=n.length-t-e;if(a*i>it)return null;let o=i+1,s=new Uint32Array((a+1)*o);for(let p=a-1;p>=0;p-=1)for(let l=i-1;l>=0;l-=1)s[p*o+l]=r[e+p]===n[e+l]?s[(p+1)*o+l+1]+1:Math.max(s[(p+1)*o+l],s[p*o+l+1]);return {lengths:s,width:o,columns:i}}function st(r,n,e,t,a){let{lengths:i,width:o,columns:s}=r,p=n-a,l=0,c=0;for(;l<p;)c<s&&e[a+l]===t[a+c]?(l+=1,c+=1):c>=s||i[(l+1)*o+c]>=i[l*o+c+1]?l+=1:c+=1;return a+c}var pt=[32,16,8,4];function ct(r,n,e,t,a){let i=e.slice(t,e.length-a),o=s=>{let p=i.indexOf(s);return p>=0&&i.indexOf(s,p+1)<0?p:null};for(let s of pt){let p=n.slice(Math.max(t,r-s),r);if(p.length===s){let c=o(p);if(c!==null)return t+c+p.length}let l=n.slice(r,Math.min(n.length-a,r+s));if(l.length===s){let c=o(l);if(c!==null)return t+c}}return null}exports.a=et;exports.b=rt;exports.c=nt;
1
+ 'use strict';var chunkPWTRJSES_cjs=require('./chunk-PWTRJSES.cjs');var W=new Set(["document","hdr","ftr","footnotes","endnotes"]),$=24,J=512,U=chunkPWTRJSES_cjs.ub($);function V(r){let n=r.root;return n.namespaceUri===chunkPWTRJSES_cjs.la&&W.has(n.localName)}function Y(r){let n=[],e=t=>{if(t.kind!=="textValue"){t.namespaceUri===chunkPWTRJSES_cjs.la&&t.localName==="p"&&n.push(t);for(let a of t.children)e(a);}};return e(r.root),n}function H(r){let n=chunkPWTRJSES_cjs.Eb(r);let e=[],t=new Set;for(let a of Y(n)){let i=chunkPWTRJSES_cjs.wb(a);if(!i||!chunkPWTRJSES_cjs.vb(i))continue;let o=i.toUpperCase();if(t.has(o))continue;t.add(o);let s=chunkPWTRJSES_cjs.Vi(n,a.id);s!==null&&e.push(Object.freeze({paragraphId:o,nodeId:a.id,text:s}));}return Object.freeze(e)}function q(r){let n=U.get(r.root);if(n)return n;let e=chunkPWTRJSES_cjs.Eb(r);let t=new Map,a=new Set,i=o=>{if(o.kind!=="textValue"){if(o.namespaceUri===chunkPWTRJSES_cjs.la&&o.localName==="p"){let s=chunkPWTRJSES_cjs.wb(o);if(s&&chunkPWTRJSES_cjs.vb(s)){let p=s.toUpperCase();a.has(p)||(a.add(p),o.kind==="paragraph"&&t.set(p,o.id));}}for(let s of o.children)i(s);}};return i(e.root),U.set(r.root,t),t}function _(r,n){if(r.length!==n.length)return false;for(let e=0;e<r.length;e+=1)if(r[e].root!==n[e])return false;return true}function B(r){let n=new Map,e=null,t=(i,o,s)=>{for(n.delete(i),n.set(i,{partName:o.name,root:o.root,nodeId:s});n.size>J;){let p=n.keys().next();if(p.done)break;n.delete(p.value);}},a=(i,o)=>{let s=n.get(i);if(!s)return null;let p=o.find(d=>d.name===s.partName);if(!p)return null;if(p.root===s.root)return {part:p,nodeId:s.nodeId};let l=chunkPWTRJSES_cjs.Ta(p,s.nodeId);if(!l||l.kind!=="paragraph")return null;let c=chunkPWTRJSES_cjs.wb(l);return !c||c.toUpperCase()!==i?null:(t(i,p,s.nodeId),{part:p,nodeId:s.nodeId})};return i=>{let o=r(),s=a(i,o);if(s)return s;if(e&&e.ids.has(i)&&_(o,e.roots))return null;for(let p of o){let l=q(p).get(i);if(l!==void 0)return t(i,p,l),{part:p,nodeId:l}}return (!e||!_(o,e.roots))&&(e={roots:o.map(p=>p.root),ids:new Set}),e.ids.size<J&&e.ids.add(i),null}}function L(r,n){return chunkPWTRJSES_cjs.Ma(r,n)}var F=Object.freeze({kind:"body"}),Q=1e6;function O(r,n){if(n<=0||n>=r.length)return false;let e=r.charCodeAt(n-1),t=r.charCodeAt(n);return e>=55296&&e<=56319&&t>=56320&&t<=57343}function K(r,n,e){if(n===e)return [];let t=0,a=Math.min(n.length,e.length);for(;t<a&&n.charCodeAt(t)===e.charCodeAt(t);)t+=1;for(;t>0&&(O(n,t)||O(e,t));)t-=1;let i=0;for(;i<n.length-t&&i<e.length-t&&n.charCodeAt(n.length-i-1)===e.charCodeAt(e.length-i-1);)i+=1;for(;i>0&&(O(n,n.length-i)||O(e,e.length-i));)i-=1;let o=n.length-t-i,s=e.slice(t,e.length-i),p=[];return o>0&&p.push({op:"deleteText",paragraphId:r,start:t,end:t+o}),s.length>0&&p.push({op:"insertText",paragraphId:r,offset:t,text:s}),Object.freeze(p)}function tt(r){let n=t=>!!t&&t.kind!=="textValue"&&t.namespaceUri===chunkPWTRJSES_cjs.la&&t.localName==="t"&&t.attributes.every(a=>a.namespaceUri===chunkPWTRJSES_cjs.ma&&a.localName==="space")&&t.children.every(a=>a.kind==="textValue"),e=[];for(let t of r){let a=e.at(-1);if(!n(a)||!n(t)){e.push(t);continue}let i=a.children.map(o=>o.kind==="textValue"?o.value:"").join("")+t.children.map(o=>o.kind==="textValue"?o.value:"").join("");e[e.length-1]={...a,attributes:/^\s|\s$/.test(i)?[{kind:"xmlSpace",namespaceUri:chunkPWTRJSES_cjs.ma,localName:"space",prefix:"xml",value:"preserve"}]:[],children:[{id:a.children[0]?.id??`${a.id}/text`,kind:"textValue",value:i}]};}return e}function G(r){if(r.kind==="textValue")return r;let n=false,e=r.children.map(t=>{let a=G(t);return a!==t&&(n=true),a});if(r.namespaceUri===chunkPWTRJSES_cjs.la&&r.localName==="r"){let t=tt(e);(t.length!==e.length||t.some((a,i)=>a!==e[i]))&&(e=[...t],n=true);}return n?{...r,children:e}:r}function et(r,n,e){let t=r.parts.get(n);if(!t)return r;let a=false,i=new Set;for(let o of e)(o.op==="insertText"||o.op==="deleteText")&&!o.revision&&i.add(o.paragraphId);for(let o of i){let s=chunkPWTRJSES_cjs.Ta(t,o);if(!s||s.kind==="textValue")continue;let p=G(s);if(p===s)continue;let l=chunkPWTRJSES_cjs.Za(t,o,p,{deferValidation:true});l.ok&&(t=l.part,a=true);}return a?chunkPWTRJSES_cjs.Fe(r,t):r}function rt(r,n){let e=n.documentId.trim();if(e.length===0||e.length>256)throw new TypeError("documentId must contain 1 to 256 characters");let t=()=>H(r.bodyStore().part),a,i=()=>{let l=r.bodyStore().part,c=r.currentPackage();if(a?.pkg===c&&a.body===l)return a.parts;let d=[l];for(let g of c.parts.values())g===l||!V(g)||d.push(g);return a={pkg:c,body:l,parts:Object.freeze(d)},a.parts},o=B(i),s=(l,c)=>{if(l.length===0)return {ok:true,changed:false};let d=t(),g=new Set,P=[];for(let u of l){if(typeof u.text!="string"||u.text.length>Q)return {ok:false,reason:"collaboration-text-limit"};if(typeof u.paragraphId!="string"||u.paragraphId.length===0||u.paragraphId.length>256)return {ok:false,reason:"unknown-paragraph-id"};let m=u.paragraphId.toUpperCase();if(g.has(m))return {ok:false,reason:"duplicate-paragraph-id"};g.add(m);let N=d.filter(X=>X.paragraphId===m);if(N.length!==1)return {ok:false,reason:"unknown-paragraph-id"};let M=N[0];P.push(...K(M.nodeId,M.text,u.text));}if(P.length===0)return {ok:true,changed:false};let x=r.transact(F,u=>{for(let m of P)u.apply(m);u.applyPackage(m=>et(m,m.mainDocumentPart,P));},{origin:c.origin,actorId:c.actorId,operationId:c.operationId,recordsHistory:false});return x.ok?{ok:true,changed:x.change!==null}:{ok:false,reason:x.detail??x.reason}};return Object.freeze({documentId:e,paragraphs:t,paragraphByNodeId(l){return t().find(c=>c.nodeId===l)??null},paragraphTextOf(l){for(let c of i()){let d=chunkPWTRJSES_cjs.Vi(c,l);if(d!==null)return d}return null},paragraphByStableId(l){let c=l.toUpperCase(),d=o(c);if(!d)return null;let g=chunkPWTRJSES_cjs.Vi(d.part,d.nodeId);return g===null?null:Object.freeze({paragraphId:c,nodeId:d.nodeId,text:g})},applyParagraphText(l,c,d){return s([{paragraphId:l,text:c}],d)},applyParagraphTexts:s,applyRemotePackage(l,c){let d=r.publishRemotePackage(l,c);return d.ok?{ok:true,changed:d.change!==null}:{ok:false,reason:d.detail??d.reason}},revision:()=>r.packageRevision,subscribe:l=>r.subscribe(l),observePrimitiveJournal:l=>L(r,l),hasPendingJournals:()=>chunkPWTRJSES_cjs.Ka(r),flushPendingJournals:()=>{chunkPWTRJSES_cjs.La(r);},save:()=>chunkPWTRJSES_cjs.Ee(r.currentPackage()),binaryPart(l){let c=r.currentPackage();return c.partBytes.get(l)??c.partBytes.get(l.startsWith("/")?l.slice(1):`/${l}`)??null}})}function nt(r,n,e){if(n===e||r>n.length)return Math.min(r,e.length);let t=0;for(;t<n.length&&t<e.length&&n[t]===e[t];)t+=1;let a=0;for(;a<n.length-t&&a<e.length-t&&n[n.length-1-a]===e[e.length-1-a];)a+=1;if(r<=t)return Math.min(r,e.length);if(r>n.length-a)return Math.min(e.length,r+e.length-n.length);let i=at(n,e,t,a),o=i.offsets.get(r);return o===void 0&&(o=(i.table?st(i.table,r,n,e,t):null)??ct(r,n,e,t,a)??t,i.offsets.set(r,o)),o}var f=[],ot=16;function at(r,n,e,t){let a=f.findIndex(o=>o.before===r&&o.after===n);if(a>=0){let[o]=f.splice(a,1);return f.push(o),o}let i={before:r,after:n,table:lt(r,n,e,t),offsets:new Map};return f.length>=ot&&f.shift(),f.push(i),i}var it=1<<18;function lt(r,n,e,t){let a=r.length-t-e,i=n.length-t-e;if(a*i>it)return null;let o=i+1,s=new Uint32Array((a+1)*o);for(let p=a-1;p>=0;p-=1)for(let l=i-1;l>=0;l-=1)s[p*o+l]=r[e+p]===n[e+l]?s[(p+1)*o+l+1]+1:Math.max(s[(p+1)*o+l],s[p*o+l+1]);return {lengths:s,width:o,columns:i}}function st(r,n,e,t,a){let{lengths:i,width:o,columns:s}=r,p=n-a,l=0,c=0;for(;l<p;)c<s&&e[a+l]===t[a+c]?(l+=1,c+=1):c>=s||i[(l+1)*o+c]>=i[l*o+c+1]?l+=1:c+=1;return a+c}var pt=[32,16,8,4];function ct(r,n,e,t,a){let i=e.slice(t,e.length-a),o=s=>{let p=i.indexOf(s);return p>=0&&i.indexOf(s,p+1)<0?p:null};for(let s of pt){let p=n.slice(Math.max(t,r-s),r);if(p.length===s){let c=o(p);if(c!==null)return t+c+p.length}let l=n.slice(r,Math.min(n.length-a,r+s));if(l.length===s){let c=o(l);if(c!==null)return t+c}}return null}exports.a=et;exports.b=rt;exports.c=nt;