@docx-editor.dev/pro 2.38.0 → 2.39.0-canary.20261118032846.sha-764bd09

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.
@@ -3,4 +3,4 @@ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
3
  Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
4
  Production use requires a commercial agreement: licensing@eigenpal.com
5
5
  */
6
- import {e,b,r,a,f,k as k$1,j as j$1,g,l,m as m$1,n}from'./chunk-664SJBNS.js';import*as i from'yjs';var C="roomGeneration",k="docx-room-generation",M=4409,O=2,s=new Set,_=1024;async function D(n,e){let t=n.buffer instanceof ArrayBuffer?n:n.slice(),o=new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",t)),r="";for(let a of o)r+=a.toString(16).padStart(2,"0");return `${e}:${r}`}function I(n){if(s.size>=_){let e=s.values().next().value;e!==void 0&&s.delete(e);}s.add(n);}function G(n){let e$1=n.getMap(e).get(C);return typeof e$1=="string"?e$1:""}async function j(n,e$1={}){let t=e$1.minimumGain??O,o=await D(n,t);if(s.has(o))return null;let r$1=new i.Doc;try{i.applyUpdate(r$1,n);let u=r$1.getMap(e).get("documentId");if(typeof u!="string")throw new b("not-initialized");let l=await N(r(r$1),u,{keepBound:!0});return n.byteLength/Math.max(1,l.byteLength)>=t?l:(I(o),null)}finally{r$1.destroy();}}async function N(n$1,e,t={}){let o=new i.Doc,r=a(o),a$1=new f(o);try{let u=new k$1(o.getMap(j$1)),l$1=await g(a$1,l(n$1,t.maxBytes,{keepBound:t.keepBound===!0}),u);if(!l$1.ok)throw new b(l$1.code);return o.transact(()=>{a$1.schema.meta.set("documentId",e),a$1.schema.meta.set(C,globalThis.crypto.randomUUID()),m$1(o);}),n(o),i.encodeStateAsUpdate(o)}finally{a$1.destroy(),r(),o.destroy();}}function J(n){let e$1=n.getMap(e).get("initialized")===true;return JSON.stringify({type:k,generation:e$1?G(n):null})}function V(n){return n.code===M||n.reason==="room-generation-changed"}var B=new Set([0,1,3,4,6]),U=5,w=Symbol("docx-room-generation-checked");function W(n){let e=Y(n.update);if(!e)throw m();if(e.type===U){let t=T(e.payload);if(t===void 0)return;if(t!==null&&t!==G(n.document))throw m();n.context[w]=true;return}if(B.has(e.type)&&n.context[w]!==true)throw m()}function m(){return Object.assign(new Error("room-generation-changed"),{code:M,reason:"room-generation-changed"})}function T(n){if(n===null||n.length>512)return;let e;try{e=JSON.parse(n);}catch{return}if(typeof e!="object"||e===null)return;let t=e;if(t.type===k)return t.generation===null?null:typeof t.generation=="string"&&t.generation.length<=128?t.generation:void 0}function Y(n){let e={at:0};if(x(n,e)===null)return null;let o=R(n,e);return o===null?null:{type:o,payload:o===U?x(n,e):null}}function R(n,e){let t=0,o=1;for(let r=0;r<8;r+=1){let a=n[e.at];if(a===void 0)return null;if(e.at+=1,t+=(a&127)*o,a<128)return t;o*=128;}return null}function x(n,e){let t=R(n,e);if(t===null||e.at+t>n.length)return null;let o=new TextDecoder().decode(n.subarray(e.at,e.at+t));return e.at+=t,o}export{G as a,j as b,N as c,J as d,V as e,W as f};
6
+ import {e,b,r,a,f,k as k$1,j as j$1,g,l,m as m$1,n}from'./chunk-KQ4A2C2I.js';import*as i from'yjs';var C="roomGeneration",k="docx-room-generation",M=4409,O=2,s=new Set,_=1024;async function D(n,e){let t=n.buffer instanceof ArrayBuffer?n:n.slice(),o=new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",t)),r="";for(let a of o)r+=a.toString(16).padStart(2,"0");return `${e}:${r}`}function I(n){if(s.size>=_){let e=s.values().next().value;e!==void 0&&s.delete(e);}s.add(n);}function G(n){let e$1=n.getMap(e).get(C);return typeof e$1=="string"?e$1:""}async function j(n,e$1={}){let t=e$1.minimumGain??O,o=await D(n,t);if(s.has(o))return null;let r$1=new i.Doc;try{i.applyUpdate(r$1,n);let u=r$1.getMap(e).get("documentId");if(typeof u!="string")throw new b("not-initialized");let l=await N(r(r$1),u,{keepBound:!0});return n.byteLength/Math.max(1,l.byteLength)>=t?l:(I(o),null)}finally{r$1.destroy();}}async function N(n$1,e,t={}){let o=new i.Doc,r=a(o),a$1=new f(o);try{let u=new k$1(o.getMap(j$1)),l$1=await g(a$1,l(n$1,t.maxBytes,{keepBound:t.keepBound===!0}),u);if(!l$1.ok)throw new b(l$1.code);return o.transact(()=>{a$1.schema.meta.set("documentId",e),a$1.schema.meta.set(C,globalThis.crypto.randomUUID()),m$1(o);}),n(o),i.encodeStateAsUpdate(o)}finally{a$1.destroy(),r(),o.destroy();}}function J(n){let e$1=n.getMap(e).get("initialized")===true;return JSON.stringify({type:k,generation:e$1?G(n):null})}function V(n){return n.code===M||n.reason==="room-generation-changed"}var B=new Set([0,1,3,4,6]),U=5,w=Symbol("docx-room-generation-checked");function W(n){let e=Y(n.update);if(!e)throw m();if(e.type===U){let t=T(e.payload);if(t===void 0)return;if(t!==null&&t!==G(n.document))throw m();n.context[w]=true;return}if(B.has(e.type)&&n.context[w]!==true)throw m()}function m(){return Object.assign(new Error("room-generation-changed"),{code:M,reason:"room-generation-changed"})}function T(n){if(n===null||n.length>512)return;let e;try{e=JSON.parse(n);}catch{return}if(typeof e!="object"||e===null)return;let t=e;if(t.type===k)return t.generation===null?null:typeof t.generation=="string"&&t.generation.length<=128?t.generation:void 0}function Y(n){let e={at:0};if(x(n,e)===null)return null;let o=R(n,e);return o===null?null:{type:o,payload:o===U?x(n,e):null}}function R(n,e){let t=0,o=1;for(let r=0;r<8;r+=1){let a=n[e.at];if(a===void 0)return null;if(e.at+=1,t+=(a&127)*o,a<128)return t;o*=128;}return null}function x(n,e){let t=R(n,e);if(t===null||e.at+t>n.length)return null;let o=new TextDecoder().decode(n.subarray(e.at,e.at+t));return e.at+=t,o}export{G as a,j as b,N as c,J as d,V as e,W as f};