@docx-editor.dev/telemetry 2.35.1-canary.20261107032606.sha-f311676 → 2.36.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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # EigenPal Pro Evaluation License 1.0
2
2
 
3
- Copyright (c) 2026 EigenPal, Inc. All rights reserved.
3
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
4
4
 
5
5
  By copying, modifying, or using the Software, you agree to these terms.
6
6
 
@@ -8,12 +8,13 @@ By copying, modifying, or using the Software, you agree to these terms.
8
8
 
9
9
  “Software” means all source code, object code, documentation, assets, and other
10
10
  materials contained in the “packages/telemetry/” directory of the EigenPal DOCX
11
- Editor repository, except for any material that expressly states that it is
11
+ Editor repository, and in every copy of the `@docx-editor.dev/telemetry` npm package
12
+ published from it, except for any material that expressly states that it is
12
13
  subject to a different license.
13
14
 
14
15
  ## 2. Evaluation Permission; Modifications
15
16
 
16
- Subject to these terms, EigenPal, Inc. grants you a limited, non-exclusive,
17
+ Subject to these terms, Eigenpal, Inc. grants you a limited, non-exclusive,
17
18
  non-transferable, non-sublicensable, royalty-free license to:
18
19
 
19
20
  1. view, clone, and copy the Software;
@@ -24,11 +25,11 @@ non-transferable, non-sublicensable, royalty-free license to:
24
25
 
25
26
  For any such modification, the following applies:
26
27
 
27
- You may keep any modification to yourself. If you do not disclose it to EigenPal, Inc. or to anyone else, it remains yours
28
- If you disclose a modification to EigenPal, Inc. or to any third party, in any form, you assign all right, title, and interest in it to EigenPal, Inc. at the moment of disclosure. The same applies to any feedback you give EigenPal, Inc. You will promptly send EigenPal, Inc. the source code of any modification you disclose, and will sign any document needed to record the assignment.
28
+ You may keep any modification to yourself. If you do not disclose it to Eigenpal, Inc. or to anyone else, it remains yours.
29
+ If you disclose a modification to Eigenpal, Inc. or to any third party, in any form, you assign all right, title, and interest in it to Eigenpal, Inc. at the moment of disclosure. The same applies to any feedback you give Eigenpal, Inc. You will promptly send Eigenpal, Inc. the source code of any modification you disclose, and will sign any document needed to record the assignment.
29
30
  Disclosing a modification to a third party grants that third party no rights in it or in the Software. You will not license or purport to license any modification to anyone.
30
- You may continue using an assigned modification for the internal, non-production evaluation permitted by Section 2 for as long as this license is in effect. EigenPal, Inc. is not obliged to use or support any modification or feedback, and owes you nothing for it.
31
- You confirm that any modification or feedback you disclose is yours to assign and is not subject to any license that would impose obligations on EigenPal, Inc. or grant rights to any third party.
31
+ You may continue using an assigned modification for the internal, non-production evaluation permitted by Section 2 for as long as this license is in effect. Eigenpal, Inc. is not obliged to use or support any modification or feedback, and owes you nothing for it.
32
+ You confirm that any modification or feedback you disclose is yours to assign and is not subject to any license that would impose obligations on Eigenpal, Inc. or grant rights to any third party.
32
33
 
33
34
 
34
35
  No other rights are granted.
@@ -62,17 +63,17 @@ as these terms. You are responsible for their compliance.
62
63
  ## 5. Commercial Rights
63
64
 
64
65
  Production Use and any rights not expressly granted by this license require a
65
- separate written commercial agreement signed by EigenPal, Inc.
66
+ separate written commercial agreement signed by Eigenpal, Inc.
66
67
 
67
68
  Commercial licenses are available by contacting licensing@eigenpal.com.
68
69
 
69
- Access to the Software, correspondence with EigenPal, Inc., or payment of an
70
+ Access to the Software, correspondence with Eigenpal, Inc., or payment of an
70
71
  invoice does not by itself grant production or commercial rights unless those
71
- rights are set out in a written agreement signed by EigenPal, Inc.
72
+ rights are set out in a written agreement signed by Eigenpal, Inc.
72
73
 
73
74
  ## 6. Ownership
74
75
 
75
- EigenPal, Inc. and its licensors retain all rights, title, and interest in the
76
+ Eigenpal, Inc. and its licensors retain all rights, title, and interest in the
76
77
  Software. This license does not transfer ownership or grant any rights by
77
78
  implication.
78
79
 
@@ -86,7 +87,7 @@ terms or if EigenPal terminates this license.
86
87
 
87
88
  Following termination, you must stop using the Software and delete your copies
88
89
  and modifications, except for copies that you are legally required to retain.
89
- EigenPal, Inc. may reinstate your rights in writing.
90
+ Eigenpal, Inc. may reinstate your rights in writing.
90
91
 
91
92
  ## 8. No Warranty
92
93
 
@@ -102,7 +103,7 @@ TO THE MAXIMUM EXTENT PERMITTED BY LAW, EIGENPAL, INC. AND ITS LICENSORS WILL NO
102
103
  ## 10. Trademarks
103
104
 
104
105
  This license does not grant permission to use the names, trademarks, service
105
- marks, or logos of EigenPal, Inc., except to identify the origin of an
106
+ marks, or logos of Eigenpal, Inc., except to identify the origin of an
106
107
  unmodified copy of the Software.
107
108
 
108
109
  ## 11. Governing Law and Jurisdiction
@@ -116,6 +117,6 @@ and you consent to their jurisdiction.
116
117
 
117
118
  ## 12. Separate Commercial Agreements
118
119
 
119
- If EigenPal, Inc. and you enter into a separate written commercial agreement,
120
+ If Eigenpal, Inc. and you enter into a separate written commercial agreement,
120
121
  that agreement controls to the extent it grants additional rights or conflicts
121
122
  with this license.
@@ -1,2 +1,7 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  'use strict';function l(e,o){return {name:"callback",event:e,...o?{metric:o}:{}}}function n(e){let o=e,r=["operation","changeKind","formattingKind","cause","errorName","stage","part"].map(t=>o[t]).filter(t=>typeof t=="string");return r.length?` [${r.join(", ")}]`:""}function c(e){let o=e.repeated?` (and ${e.repeated} more)`:"";switch(e.kind){case "document.open":return e.outcome==="rejected"?`document refused: ${e.code}${n(e)}`:e.pagesBucket===void 0?`document opened: ${e.sizeBucket}, ${e.durationMs} ms`:`document opened: ${e.pagesBucket} pages, ${e.sizeBucket}, ${e.durationMs} ms`;case "edit.rejected":{let r=e.command?`${e.origin} ${e.command}`:e.origin;return `edit refused: ${e.code}${n(e)} (${r}, ${e.tracked?"tracked":"untracked"})${o}`}case "review.skipped":return `tracked changes skipped: ${e.code}${n(e)} x${e.count}`;case "font.failed":return `font substituted: ${e.code}${o}`;case "history":return `undo history: ${e.code}${o}`;case "custom-node":return `custom node payload unreadable: ${e.code}${o}`;case "collab.participants":return `collaboration: ${e.count} ${e.count===1?"person":"people"} in the room`;case "collab.status":{let r=e.code?`: ${e.code}`:"",t=e.connectMs!==void 0?` after ${e.connectMs} ms`:"";return `collaboration ${e.status}${r}${e.recovering?" (recovering)":""}${t}`}case "performance":{let r=[i("key presses and clicks",e.interaction),i("layout",e.layout),i("paint",e.paint)].filter(Boolean),t=e.pagesBucket===void 0?"":`, ${e.pagesBucket} pages`;return `performance over ${Math.round(e.windowMs/1e3)} s${t}: ${r.join("; ")}`}case "document.save":return e.outcome==="saved"?`document saved: ${e.sizeBucket}, ${e.durationMs} ms`:`save failed: ${e.code}${n(e)} after ${e.durationMs} ms`;case "session":{if(e.phase==="start")return "editor session started";let r=e.inputEdits+e.commandEdits+e.automationEdits,t=`${Math.round(e.activeMs/1e3)} s active, ${r} ${r===1?"edit":"edits"}`;return e.phase==="end"?`editor session ended after ${Math.round(e.durationMs/1e3)} s: ${t}`:`editor activity over ${Math.round(e.durationMs/1e3)} s: ${t}`}}}function i(e,o){return o?`${e} p50 ${o.p50Ms} ms, p95 ${o.p95Ms} ms, max ${o.maxMs} ms (x${o.count})`:""}function a(e){return e.repeated===void 0&&s(e)}function p(e){return s(e)?e.repeated??1:0}function s(e){switch(e.kind){case "document.open":return e.outcome==="rejected";case "document.save":return e.outcome==="rejected";case "collab.participants":case "history":case "performance":case "session":return false;case "collab.status":return e.status==="error"&&e.code!=="collab.authentication-failed"&&e.code!=="collab.room-generation-changed";case "edit.rejected":return !d.has(e.code);case "font.failed":return e.code!=="font.missing";case "review.skipped":return e.code!=="review.stale-revision";default:return true}}var d=new Set(["edit.stale-target","edit.read-only","edit.protected-content","edit.refresh-in-progress","edit.preview-active","edit.preview-composing","edit.collaboration-not-ready"]);function m(e={}){let o=e.console??console;return {name:"console",event(r){let t=[`[docx-editor] ${c(r)}`];r.hint&&t.push(` ${r.hint}`),r.docs&&t.push(` ${r.docs}`),(a(r)||r.kind==="performance"&&r.code!==void 0?o.warn:o.info).call(o,t.join(`
2
7
  `));},...e.metrics?{metric(r){o.info(`[docx-editor] ${r.definition.name} ${r.value}`,r.attributes);}}:{}}}function $(){let e=[],o=[];return {name:"memory",events:e,metrics:o,event:r=>{e.push(r);},metric:r=>{o.push(r);},clear(){e.length=0,o.length=0;}}}exports.a=l;exports.b=c;exports.c=a;exports.d=p;exports.e=m;exports.f=$;
@@ -1 +1,6 @@
1
- import {c}from'./chunk-BPVPJKIM.js';import {a}from'./chunk-RSWAOCAT.js';import {createHmac}from'crypto';import {readCollaborationResourceUsage}from'@docx-editor.dev/pro/collaboration';import {diagnosticCodes}from'@docx-editor.dev/core';import {isCollaborationFailureCode}from'@docx-editor.dev/core/collaboration';import*as M from'yjs';function X(r){if(typeof r!="string"||r.length===0)throw new TypeError("hmacRoomLabel needs a non-empty secret, such as an environment variable.");let o=c=>`room-${createHmac("sha256",r).update(c).digest("hex").slice(0,16)}`;return C.add(o),o}var C=new WeakSet;function z(r,o){if(!r)return "permission-denied";let c=r,u=typeof r=="string"?r:typeof r=="object"?c.reason??c.code??(typeof c.message=="string"&&o.has(c.message.toLowerCase())?c.message:void 0):void 0;if(u===void 0)return "other";if(typeof u=="number")return Y[u]??"other";if(typeof u!="string")return "other";if(isCollaborationFailureCode(u))return u;let b=u.toLowerCase();return o.has(b)?b:"other"}var Y={4401:"unauthorized",4403:"forbidden"},F=diagnosticCodes().map(r=>r.replace(/^collab\./,"")).filter(isCollaborationFailureCode),$=["unauthorized","forbidden","permission-denied","unknown-room","rate-limited"];function Z(r){let o=c(r),c$1=new Set([...$,...r.reasons??[]].map(e=>e.toLowerCase())),u=r.measureState??true;for(let e of new Set([...c$1,...F,"other"]))o.declare(a.admissionRejections,{reason:e}),o.declare(a.messageRefusals,{reason:e});for(let e of ["success","failure"])o.declare(a.roomLoadDuration,{outcome:e}),o.declare(a.roomStoreDuration,{outcome:e});for(let e of ["migrated","unchanged","failed"])o.declare(a.migrations,{outcome:e});o.declare(a.updates),o.declare(a.updateBytes);let b=e=>{try{return z(r.reasonOf?.(e)??e,c$1)}catch{return "other"}},B=r.perRoomSeries===true;if(B&&r.roomLabel&&!C.has(r.roomLabel))throw new TypeError("perRoomSeries puts the room label into every series, so it accepts only the default label or hmacRoomLabel(secret). A custom roomLabel could put a room name in a metric.");for(let e of r.exporters)e.metric||console.warn(`[docx-editor telemetry] exporter "${e.name}" records no metrics, and room telemetry sends only metrics. Use otelExporter or prometheusRegistry on a server.`);let m=new Set,E=0,_=r.roomLabel??(()=>`room-${E+=1}`),f=()=>Date.now();function g(){let e=0,n=0,t=0;for(let a of m){let l=w(a);e+=a.connections,n+=l,t=Math.max(t,l);}o.metric(a.roomsActive,m.size),o.metric(a.connectionsActive,e),o.metric(a.participantsActive,n),o.metric(a.roomParticipantsMax,t);}function S(e,n){let t=e==="load"?a.roomLoadDuration:a.roomStoreDuration,a$1=globalThis.performance?.now()??f(),l=n?.pendingBytes??0,y=false;return i=>{y||(y=true,o.metric(t,G(a$1),{outcome:i}),i==="success"&&e==="store"&&n&&(n.pendingBytes=Math.max(0,n.pendingBytes-l)));}}async function x(e,n,t){let a=S(e,t);try{let l=await n();return a("success"),l}catch(l){throw a("failure"),l}}function O(e,n){try{j(e,n);}catch{e.changed=true;}}function j(e,n){if(e.changed||!e.sampled){e.changed=false,e.sampled=true,u&&(e.stateBytes=M.encodeStateAsUpdate(e.doc).byteLength);try{let t=readCollaborationResourceUsage(e.doc);e.blobBytes=t.blobBytes,e.nodes=t.nodes;let a={nodes:t.nodes/t.maxNodes,relationships:t.relationships/t.maxRelationships,parts:t.parts/t.maxParts,blobBytes:t.blobBytes/t.maxBlobBytes};e.limitRatio=Math.max(...Object.values(a)),e.ratios=a,e.nodeStates={live:t.nodes-t.tombstonedNodes,tombstoned:t.tombstonedNodes};}catch{}}for(let[t,a$1]of Object.entries(e.ratios??{}))o.metric(a.roomResourceUsage,a$1,{resource:t});for(let[t,a$1]of Object.entries(e.nodeStates??{}))o.metric(a.roomNodes,a$1,{state:t});if(o.metric(a.roomParticipants,w(e)),e.stateBytes!==null&&o.metric(a.roomMemory,e.stateBytes,{kind:"state"}),e.blobBytes!==null&&o.metric(a.roomMemory,e.blobBytes,{kind:"blobs"}),o.metric(a.roomMemory,e.pendingBytes,{kind:"pending_updates"}),o.metric(a.roomAge,(n-e.openedAt)/1e3),o.metric(a.roomIdle,(n-e.lastChange)/1e3),B){let t=e.handle.label;o.metric(a.roomParticipantsByRoom,w(e),{room:t});for(let[a$1,l]of A(e))o.metric(a.roomMemoryByRoom,l,{room:t,kind:a$1});}}function h(){let e={state:0,blobs:0,pending_updates:0};for(let n of m)e.state+=n.stateBytes??0,e.blobs+=n.blobBytes??0,e.pending_updates+=n.pendingBytes;for(let[n,t]of Object.entries(e))o.metric(a.roomsMemory,t,{kind:n});g();}function D(){let e=f();for(let n of m)O(n,e);h();}let v=false;async function H(){if(!v){v=true;try{let e=f();for(let n of [...m])m.has(n)&&O(n,e),await new Promise(t=>setTimeout(t,0));h();}finally{v=false;}}}h();let T=r.sampleInterval??6e4,k=T===false?null:setInterval(()=>{H();},T);return k?.unref?.(),{open(e,n={}){let t=f(),a$1=(d,p)=>{if(i.changed=true,i.loading>0)return;i.lastChange=f();let R=p?.source;R==="redis"||R==="local"&&p.skipStoreHooks===true||(i.pendingBytes+=d.byteLength,o.metric(a.updates,1),o.metric(a.updateBytes,d.byteLength));},l=d=>{let{added:p,removed:R}=d??{};(p?.length??0)+(R?.length??0)>0&&g();};e.on("update",a$1),n.awareness?.on("change",l);let y={label:_(n.name??""),async time(d,p){d==="load"&&(i.loading+=1);try{return await x(d,p,i)}finally{d==="load"&&(i.loading-=1);}},begin:d=>S(d,i),connected(){i.connections+=1,g();},disconnected(){i.connections=Math.max(0,i.connections-1),g();},close(){if(m.delete(i)){if(i.dispose(),B){let d=y.label;o.forget(a.roomParticipantsByRoom,{room:d});for(let[p]of A(i))o.forget(a.roomMemoryByRoom,{room:d,kind:p});}h();}}},i={handle:y,doc:e,awareness:n.awareness,openedAt:t,lastChange:t,connections:0,pendingBytes:0,changed:true,loading:0,sampled:false,stateBytes:null,blobBytes:null,nodes:null,limitRatio:null,dispose(){e.off("update",a$1),n.awareness?.off("change",l);}};return m.add(i),g(),y},rejected(e){o.metric(a.admissionRejections,1,{reason:b(e)});},refused(e){o.metric(a.messageRefusals,1,{reason:b(e)});},migrated(e){o.metric(a.migrations,1,{outcome:e});},time:(e,n)=>x(e,n),begin:e=>S(e),list(){let e=f();return [...m].map(n=>({room:n.handle.label,participants:w(n),connections:n.connections,stateBytes:n.stateBytes,blobBytes:n.blobBytes,pendingBytes:n.pendingBytes,nodes:n.nodes,limitRatio:n.limitRatio,ageSeconds:Math.round((e-n.openedAt)/1e3),idleSeconds:Math.round((e-n.lastChange)/1e3)}))},sample:D,flush:()=>o.flush(),async shutdown(){k&&clearInterval(k);for(let e of [...m])e.handle.close();await o.shutdown();}}}function A(r){return [["state",r.stateBytes??0],["blobs",r.blobBytes??0],["pending_updates",r.pendingBytes]]}function w(r){if(!r.awareness)return r.connections;try{return r.awareness.getStates().size}catch{return r.connections}}function G(r){return Math.max(0,((globalThis.performance?.now()??Date.now())-r)/1e3)}export{X as a,Z as b};
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ import {c}from'./chunk-OMBPGHSR.js';import {a}from'./chunk-RSWAOCAT.js';import {createHmac}from'crypto';import {readCollaborationResourceUsage}from'@docx-editor.dev/pro/collaboration';import {diagnosticCodes}from'@docx-editor.dev/core';import {isCollaborationFailureCode}from'@docx-editor.dev/core/collaboration';import*as M from'yjs';function X(r){if(typeof r!="string"||r.length===0)throw new TypeError("hmacRoomLabel needs a non-empty secret, such as an environment variable.");let o=c=>`room-${createHmac("sha256",r).update(c).digest("hex").slice(0,16)}`;return C.add(o),o}var C=new WeakSet;function z(r,o){if(!r)return "permission-denied";let c=r,u=typeof r=="string"?r:typeof r=="object"?c.reason??c.code??(typeof c.message=="string"&&o.has(c.message.toLowerCase())?c.message:void 0):void 0;if(u===void 0)return "other";if(typeof u=="number")return Y[u]??"other";if(typeof u!="string")return "other";if(isCollaborationFailureCode(u))return u;let b=u.toLowerCase();return o.has(b)?b:"other"}var Y={4401:"unauthorized",4403:"forbidden"},F=diagnosticCodes().map(r=>r.replace(/^collab\./,"")).filter(isCollaborationFailureCode),$=["unauthorized","forbidden","permission-denied","unknown-room","rate-limited"];function Z(r){let o=c(r),c$1=new Set([...$,...r.reasons??[]].map(e=>e.toLowerCase())),u=r.measureState??true;for(let e of new Set([...c$1,...F,"other"]))o.declare(a.admissionRejections,{reason:e}),o.declare(a.messageRefusals,{reason:e});for(let e of ["success","failure"])o.declare(a.roomLoadDuration,{outcome:e}),o.declare(a.roomStoreDuration,{outcome:e});for(let e of ["migrated","unchanged","failed"])o.declare(a.migrations,{outcome:e});o.declare(a.updates),o.declare(a.updateBytes);let b=e=>{try{return z(r.reasonOf?.(e)??e,c$1)}catch{return "other"}},B=r.perRoomSeries===true;if(B&&r.roomLabel&&!C.has(r.roomLabel))throw new TypeError("perRoomSeries puts the room label into every series, so it accepts only the default label or hmacRoomLabel(secret). A custom roomLabel could put a room name in a metric.");for(let e of r.exporters)e.metric||console.warn(`[docx-editor telemetry] exporter "${e.name}" records no metrics, and room telemetry sends only metrics. Use otelExporter or prometheusRegistry on a server.`);let m=new Set,E=0,_=r.roomLabel??(()=>`room-${E+=1}`),f=()=>Date.now();function g(){let e=0,n=0,t=0;for(let a of m){let l=w(a);e+=a.connections,n+=l,t=Math.max(t,l);}o.metric(a.roomsActive,m.size),o.metric(a.connectionsActive,e),o.metric(a.participantsActive,n),o.metric(a.roomParticipantsMax,t);}function S(e,n){let t=e==="load"?a.roomLoadDuration:a.roomStoreDuration,a$1=globalThis.performance?.now()??f(),l=n?.pendingBytes??0,y=false;return i=>{y||(y=true,o.metric(t,G(a$1),{outcome:i}),i==="success"&&e==="store"&&n&&(n.pendingBytes=Math.max(0,n.pendingBytes-l)));}}async function x(e,n,t){let a=S(e,t);try{let l=await n();return a("success"),l}catch(l){throw a("failure"),l}}function O(e,n){try{j(e,n);}catch{e.changed=true;}}function j(e,n){if(e.changed||!e.sampled){e.changed=false,e.sampled=true,u&&(e.stateBytes=M.encodeStateAsUpdate(e.doc).byteLength);try{let t=readCollaborationResourceUsage(e.doc);e.blobBytes=t.blobBytes,e.nodes=t.nodes;let a={nodes:t.nodes/t.maxNodes,relationships:t.relationships/t.maxRelationships,parts:t.parts/t.maxParts,blobBytes:t.blobBytes/t.maxBlobBytes};e.limitRatio=Math.max(...Object.values(a)),e.ratios=a,e.nodeStates={live:t.nodes-t.tombstonedNodes,tombstoned:t.tombstonedNodes};}catch{}}for(let[t,a$1]of Object.entries(e.ratios??{}))o.metric(a.roomResourceUsage,a$1,{resource:t});for(let[t,a$1]of Object.entries(e.nodeStates??{}))o.metric(a.roomNodes,a$1,{state:t});if(o.metric(a.roomParticipants,w(e)),e.stateBytes!==null&&o.metric(a.roomMemory,e.stateBytes,{kind:"state"}),e.blobBytes!==null&&o.metric(a.roomMemory,e.blobBytes,{kind:"blobs"}),o.metric(a.roomMemory,e.pendingBytes,{kind:"pending_updates"}),o.metric(a.roomAge,(n-e.openedAt)/1e3),o.metric(a.roomIdle,(n-e.lastChange)/1e3),B){let t=e.handle.label;o.metric(a.roomParticipantsByRoom,w(e),{room:t});for(let[a$1,l]of A(e))o.metric(a.roomMemoryByRoom,l,{room:t,kind:a$1});}}function h(){let e={state:0,blobs:0,pending_updates:0};for(let n of m)e.state+=n.stateBytes??0,e.blobs+=n.blobBytes??0,e.pending_updates+=n.pendingBytes;for(let[n,t]of Object.entries(e))o.metric(a.roomsMemory,t,{kind:n});g();}function D(){let e=f();for(let n of m)O(n,e);h();}let v=false;async function H(){if(!v){v=true;try{let e=f();for(let n of [...m])m.has(n)&&O(n,e),await new Promise(t=>setTimeout(t,0));h();}finally{v=false;}}}h();let T=r.sampleInterval??6e4,k=T===false?null:setInterval(()=>{H();},T);return k?.unref?.(),{open(e,n={}){let t=f(),a$1=(d,p)=>{if(i.changed=true,i.loading>0)return;i.lastChange=f();let R=p?.source;R==="redis"||R==="local"&&p.skipStoreHooks===true||(i.pendingBytes+=d.byteLength,o.metric(a.updates,1),o.metric(a.updateBytes,d.byteLength));},l=d=>{let{added:p,removed:R}=d??{};(p?.length??0)+(R?.length??0)>0&&g();};e.on("update",a$1),n.awareness?.on("change",l);let y={label:_(n.name??""),async time(d,p){d==="load"&&(i.loading+=1);try{return await x(d,p,i)}finally{d==="load"&&(i.loading-=1);}},begin:d=>S(d,i),connected(){i.connections+=1,g();},disconnected(){i.connections=Math.max(0,i.connections-1),g();},close(){if(m.delete(i)){if(i.dispose(),B){let d=y.label;o.forget(a.roomParticipantsByRoom,{room:d});for(let[p]of A(i))o.forget(a.roomMemoryByRoom,{room:d,kind:p});}h();}}},i={handle:y,doc:e,awareness:n.awareness,openedAt:t,lastChange:t,connections:0,pendingBytes:0,changed:true,loading:0,sampled:false,stateBytes:null,blobBytes:null,nodes:null,limitRatio:null,dispose(){e.off("update",a$1),n.awareness?.off("change",l);}};return m.add(i),g(),y},rejected(e){o.metric(a.admissionRejections,1,{reason:b(e)});},refused(e){o.metric(a.messageRefusals,1,{reason:b(e)});},migrated(e){o.metric(a.migrations,1,{outcome:e});},time:(e,n)=>x(e,n),begin:e=>S(e),list(){let e=f();return [...m].map(n=>({room:n.handle.label,participants:w(n),connections:n.connections,stateBytes:n.stateBytes,blobBytes:n.blobBytes,pendingBytes:n.pendingBytes,nodes:n.nodes,limitRatio:n.limitRatio,ageSeconds:Math.round((e-n.openedAt)/1e3),idleSeconds:Math.round((e-n.lastChange)/1e3)}))},sample:D,flush:()=>o.flush(),async shutdown(){k&&clearInterval(k);for(let e of [...m])e.handle.close();await o.shutdown();}}}function A(r){return [["state",r.stateBytes??0],["blobs",r.blobBytes??0],["pending_updates",r.pendingBytes]]}function w(r){if(!r.awareness)return r.connections;try{return r.awareness.getStates().size}catch{return r.connections}}function G(r){return Math.max(0,((globalThis.performance?.now()??Date.now())-r)/1e3)}export{X as a,Z as b};
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  'use strict';var chunkWGWKNKUT_cjs=require('./chunk-WGWKNKUT.cjs'),core=require('@docx-editor.dev/core');var O=new Set(core.diagnosticCodes());function f(e){return new Set(Object.keys(e))}var B=f({package:true,"content-types":true,relationships:true,"main-document":true,glossary:true,styles:true,numbering:true,settings:true,"web-settings":true,"font-table":true,theme:true,header:true,footer:true,footnotes:true,endnotes:true,comments:true,people:true,"custom-xml":true,"document-properties":true,media:true,embedding:true,other:true}),z=f({Error:true,TypeError:true,RangeError:true,ReferenceError:true,SyntaxError:true,other:true}),P=f({accept:true,reject:true,reassign:true}),F=f({"open-mount":true,"open-layout":true,command:true,"review-item":true,automation:true,save:true}),U=f({insert:true,delete:true,replace:true,moveFrom:true,moveTo:true,format:true,paragraphMark:true,structural:true}),G=f({rPrChange:true,pPrChange:true,sectPrChange:true,tblPrChange:true,tblPrExChange:true,tblGridChange:true,trPrChange:true,tcPrChange:true,numberingChange:true,other:true}),g=e=>e.phase==="active"||e.phase==="end",N={"document.open":{codes:"open",numbers:{durationMs:e=>e.outcome==="opened"}},"edit.rejected":{codes:"edit",numbers:{repeated:true}},"review.skipped":{codes:"review",numbers:{count:true}},"font.failed":{codes:"font",numbers:{repeated:true}},history:{codes:"history",numbers:{repeated:true}},"custom-node":{codes:"custom-node",numbers:{repeated:true}},"collab.status":{codes:"collab",numbers:{repeated:true,connectMs:e=>e.status==="ready"&&e.repeated===void 0}},"collab.participants":{numbers:{count:true}},performance:{codes:"performance",numbers:{windowMs:true}},"document.save":{codes:"save",numbers:{durationMs:true}},session:{numbers:{durationMs:g,activeMs:g,inputEdits:g,commandEdits:g,automationEdits:g}}},x=N,w={kind:new Set(Object.keys(N)),code:O,outcome:new Set(["opened","saved","rejected"]),phase:new Set(["start","active","end"]),origin:new Set(["command","input","automation"]),command:new Set(core.diagnosticCommands()),sizeBucket:/^(?:\d+(?:KiB|MiB)?-\d+(?:KiB|MiB)|512MiB\+)$/,pagesBucket:new Set(["0","1","2-9","10-99","100-999","1000+"]),editorSessionId:/^e_(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,64}|[0-9a-z]{6,12}_[0-9a-z]{1,8})$/,engineVersion:/^(?:development|\d{1,4}\.\d{1,4}\.\d{1,4}(?:-[0-9A-Za-z.]{1,20})?)$/,status:new Set(["initializing","ready","disconnected","error","destroyed"]),previous:new Set(["none","initializing","ready","disconnected","error","destroyed"]),cause:new Set(core.diagnosticCauses()),part:B,errorName:z,stage:F,operation:P,changeKind:U,formattingKind:G},C=1e6,V=720*60*60*1e3,m={min:0,max:C,integer:true},h={min:0,max:V,integer:false},b={...h,removeAboveMax:true};function c(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>=t.min&&e<=t.max&&(!t.integer||Number.isInteger(e))}var S={schemaVersion:{min:1,max:1e3,integer:true},time:{min:0,max:864e13,integer:false},durationMs:b,count:m,repeated:{min:1,max:C,integer:true},connectMs:b,windowMs:b,activeMs:b,inputEdits:m,commandEdits:m,automationEdits:m},L=new Set(["schemaVersion","time"]);function Z(e,t){if(L.has(e))return true;let o=x[t.kind]?.numbers,r=o&&Object.hasOwn(o,e)?o[e]:void 0;return r===true||typeof r=="function"&&r(t)}var v=new Set(["tracked","recovering"]),E=new Set;function u(e,t=e){E.has(t)||chunkWGWKNKUT_cjs.a()==="production"||(E.add(t),console.warn(`[docx-editor telemetry] ${e}`));}function R(e,t){let o=Object.hasOwn(w,e)?w[e]:void 0;return o?o instanceof RegExp?o.test(t):o.has(t):false}function Q(e){let t=e;if(typeof t.kind!="string"||!R("kind",t.kind))return u("dropped an event of an unknown kind; core and telemetry versions may differ","kind"),{dropped:"unknown-kind"};let o=t.kind,r=typeof t.code=="string"?t.code:void 0,s=x[o]?.codes;if(r!==void 0&&(!O.has(r)||!s||!r.startsWith(`${s}.`)))return u("dropped an event with an unknown code; core and telemetry versions may differ","code"),{dropped:"unknown-code"};let a=r?core.explainDiagnostic(r):void 0,d={};for(let[n,i]of Object.entries(t)){if(n==="resource"||n==="attributes")continue;if(n==="shape"){let l=Y(i);if(!l)return u('dropped an event whose "shape" is not a valid document shape',"shape"),{dropped:"invalid-field"};d.shape=l;continue}if(A.has(n)){if(o!=="performance"){u(`removed "${n}", which only performance events carry`,`on:${n}`);continue}let l=X(i);if(!l)return u(`dropped an event whose "${n}" is not a valid timing summary`,`timing:${n}`),{dropped:"invalid-field"};d[n]=l;continue}if(n==="hint"||n==="docs"){a&&i===a[n]&&(d[n]=i);continue}let p=Object.hasOwn(S,n);if(p&&!Z(n,t)){u(`removed "${n}", which a ${o} event does not carry`,`on:${o}:${n}`);continue}let D=Object.hasOwn(w,n)||p||v.has(n),y=p?S[n]:void 0;if(y&&c(i,y))d[n]=i;else if(y?.removeAboveMax&&typeof i=="number"&&i>y.max){u(`removed "${n}", which is longer than the guard accepts`,`long:${n}`);continue}else if(typeof i=="boolean"&&v.has(n))d[n]=i;else if(typeof i=="string"&&R(n,i))d[n]=i;else {if(D)return u(`dropped an event whose "${n}" is not a valid value`,`field:${n}`),{dropped:"invalid-field"};u(`dropped the field "${n}", which is not an anonymous diagnostic field`,`extra:${n}`);}}return o==="performance"&&![...A].some(n=>d[n]!==void 0)?(u("dropped a performance summary without timings","performance:empty"),{dropped:"invalid-field"}):(d.resource=e.resource,d.attributes=e.attributes??{},{event:Object.freeze(d)})}var A=new Set(["interaction","layout","paint"]),H=["count","p50Ms","p95Ms","maxMs"],W=8;function X(e){if(!e||typeof e!="object")return null;let t=e,o=[...H,"bands"];if(Object.keys(t).some(i=>!o.includes(i)))return null;let{count:r,p50Ms:s,p95Ms:a,maxMs:d,bands:n}=t;return !c(r,m)||r<1||!c(s,h)||!c(a,h)||!c(d,h)||s>a||a>d||!Array.isArray(n)||n.length!==W||!n.every(i=>c(i,m))||n.reduce((i,p)=>i+p,0)!==r?null:Object.freeze({count:r,p50Ms:s,p95Ms:a,maxMs:d,bands:Object.freeze([...n])})}var M=["parts","paragraphs","reviewItems","embeddedFonts"];function Y(e){if(!e||typeof e!="object")return null;let t=e;if(Object.keys(t).some(r=>!M.includes(r)))return null;let o={};for(let r of M){let s=t[r];if(typeof s!="string"||!R("pagesBucket",s))return null;o[r]=s;}return Object.freeze(o)}var $=/^[A-Za-z_][A-Za-z0-9_.-]{0,63}$/,j=/^[A-Za-z0-9_.:+-]{0,64}$/;function ee(e,t,o){let r={};for(let[s,a]of Object.entries(e)){if(!$.test(s)||o&&!o.includes(s)){u(`dropped the attribute "${s.slice(0,40)}" on ${t}`,`attribute:${t}:${s}`);continue}typeof a=="number"||typeof a=="boolean"?r[s]=a:typeof a=="string"&&(r[s]=o&&!j.test(a)?"other":a.slice(0,256));}return r}function ne(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t={};for(let[o,r]of Object.entries(e))$.test(o)&&(typeof r=="boolean"||typeof r=="number"&&Number.isFinite(r)||typeof r=="string"&&r&&j.test(r))&&(t[o]=r);return Object.keys(t).length?t:void 0}exports.a=C;exports.b=Q;exports.c=ee;exports.d=ne;
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  'use strict';var o="docx_editor.version",s=[.005,.01,.025,.05,.1,.25,.5,1,2.5,5,10,30,60],l=[1024,16*1024,64*1024,256*1024,1024*1024,4*1024*1024,16*1024*1024,64*1024*1024,256*1024*1024,1024*1024*1024],a=[.016,.033,.05,.1,.2,.5,1],d=[1,2,3,5,10,20,50,100,250],p=[1e3,1e4,5e4,1e5,25e4,5e5,1e6],g=[.1,.25,.5,.75,.9,.95,1],c=[60,300,900,3600,4*3600,24*3600,168*3600],h=[10,30,60,300,900,1800,3600,2*3600,4*3600,8*3600,24*3600];function e(t,r,n,m,u=[],i){return Object.freeze({name:t,kind:r,unit:n,description:m,labels:u,...i?{buckets:i}:{}})}var b=Object.freeze({documentOpens:e("docx_editor.document.opens","counter","{open}","Documents opened or refused, by outcome, refusal code, engine reason, and part role.",["outcome","code","cause","part",o]),documentOpenDuration:e("docx_editor.document.open.duration","histogram","s","Time from the start of an open to the laid-out document.",[o],s),documentSaves:e("docx_editor.document.saves","counter","{save}","Calls to save() that returned the document or failed, by outcome and failure code.",["outcome","code",o]),documentSaveDuration:e("docx_editor.document.save.duration","histogram","s","Time from a save() call to the saved bytes, pending edits included. Successful saves only.",[o],s),edits:e("docx_editor.edits","counter","{edit}","Edits that changed the document, by origin: input, command, or automation. Refused edits are in docx_editor.edit.rejections, and edits by collaborators are not counted. Counted when a session summary is sent, up to a minute after the edit.",["origin",o]),editRejections:e("docx_editor.edit.rejections","counter","{edit}","Edits, commands, and tracked changes refused, by public code and engine reason.",["code","cause","origin","tracked",o]),reviewSkipped:e("docx_editor.review.skipped","counter","{change}","Tracked changes skipped by accept, reject, or reassign requests, by engine reason, operation, and change kind.",["code","cause","operation","change_kind",o]),fontFailures:e("docx_editor.font.failures","counter","{failure}","Font faces that failed to load and were substituted.",["code",o]),historyDiagnostics:e("docx_editor.history.diagnostics","counter","{event}","Undo steps that did not group as the gesture intended, by code.",["code",o]),customNodeDiagnostics:e("docx_editor.custom_node.diagnostics","counter","{node}","Custom node payloads that could not be read, by code.",["code",o]),collabClientStatusTransitions:e("docx_editor.collab.client.status_transitions","counter","{transition}","Collaboration status changes on clients, by new status and failure code.",["status","code",o]),collabClientConnectDuration:e("docx_editor.collab.client.connect.duration","histogram","s","Time from an editor attaching a room to its first ready status, when the editor attached before the room was ready.",[o],s),collabClientParticipants:e("docx_editor.collab.client.participants","histogram","{participant}","People in the room, as each client sees it when the count changes.",[o],d),editorSessions:e("docx_editor.editor.sessions","counter","{session}","Editor sessions started and ended, by phase. An editor ends when it is destroyed or its page closes.",["phase",o]),editorSessionDuration:e("docx_editor.editor.session.duration","histogram","s","Time from the creation of an editor to its end, idle time included. Recorded when the session ends.",[o],h),editorActiveTime:e("docx_editor.editor.active_time","counter","s","Seconds of use: time between key presses, pointer presses, and edits that are at most 30 seconds apart. Counted when a session summary is sent.",[o]),editorInteractionDuration:e("docx_editor.editor.interaction.duration","histogram","s","Key presses and pointer presses on the pages, to the next frame on screen, by page count bucket. Bucket counts are exact; the sum is estimated from the bands.",["pages",o],a),editorLayoutDuration:e("docx_editor.editor.layout.duration","histogram","s","Engine layout passes after edits and view changes, background work included, by page count bucket. Bucket counts are exact; the sum is estimated from the bands.",["pages",o],a),editorPaintDuration:e("docx_editor.editor.paint.duration","histogram","s","Engine paints of the pages, by page count bucket. Bucket counts are exact; the sum is estimated from the bands.",["pages",o],a),droppedEvents:e("docx_editor.telemetry.dropped_events","counter","{event}","Events the anonymity guard dropped, by reason. Usually a version mismatch.",["reason",o]),roomsActive:e("docx_editor.collab.rooms.active","gauge","{room}","Rooms loaded."),connectionsActive:e("docx_editor.collab.connections.active","gauge","{connection}","Open client connections. One person with two tabs is two connections."),participantsActive:e("docx_editor.collab.participants.active","gauge","{participant}","People present in all rooms, from awareness states."),roomParticipants:e("docx_editor.collab.room.participants","histogram","{participant}","People present in each room, sampled once per room per interval.",[],d),roomParticipantsMax:e("docx_editor.collab.room.participants.max","gauge","{participant}","People in the fullest room now."),roomMemory:e("docx_editor.collab.room.memory","histogram","By","Bytes each room holds, sampled per room: encoded state, blobs, and updates not yet stored.",["kind"],l),roomsMemory:e("docx_editor.collab.rooms.memory","gauge","By","Bytes all rooms hold together at the last sample.",["kind"]),roomNodes:e("docx_editor.collab.room.nodes","histogram","{node}","Shared document nodes per room, live and tombstoned.",["state"],p),roomResourceUsage:e("docx_editor.collab.room.resource_usage","histogram","1","Share of each room resource limit in use, from 0 to 1.",["resource"],g),roomAge:e("docx_editor.collab.room.age","histogram","s","How long each room has been loaded.",[],c),roomIdle:e("docx_editor.collab.room.idle","histogram","s","Time since each room last changed.",[],c),roomLoadDuration:e("docx_editor.collab.room.load.duration","histogram","s","Time to load a room, by outcome.",["outcome"],s),roomStoreDuration:e("docx_editor.collab.room.store.duration","histogram","s","Time to store a room, by outcome.",["outcome"],s),admissionRejections:e("docx_editor.collab.admission.rejections","counter","{connection}","Connections refused at admission, by reason.",["reason"]),messageRefusals:e("docx_editor.collab.message.refusals","counter","{message}","Messages refused before they applied, by reason, such as room-generation-changed.",["reason"]),updates:e("docx_editor.collab.updates","counter","{update}","Document updates applied to rooms."),updateBytes:e("docx_editor.collab.update.bytes","counter","By","Bytes of document updates applied to rooms."),roomParticipantsByRoom:e("docx_editor.collab.room.participants.current","gauge","{participant}","People in each room, labeled by room. Recorded only with perRoomSeries.",["room"]),roomMemoryByRoom:e("docx_editor.collab.room.memory.current","gauge","By","Bytes each room holds, labeled by room and kind. Recorded only with perRoomSeries.",["room","kind"]),migrations:e("docx_editor.collab.migrations","counter","{room}","Room migrations, by outcome.",["outcome"])}),y={s:"seconds",By:"bytes"};function _(t){let r=t.name.replace(/[^a-zA-Z0-9_]/g,"_"),n=t.unit==="1"?t.kind==="gauge"?"ratio":void 0:y[t.unit];return n&&!r.endsWith(`_${n}`)&&(r+=`_${n}`),t.kind==="counter"&&(r+="_total"),r}exports.a=b;exports.b=_;
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  function n(){try{return process.env.NODE_ENV}catch{return}}export{n as a};
@@ -1,3 +1,8 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  import {b as b$1}from'./chunk-RSWAOCAT.js';var f="text/plain; version=0.0.4; charset=utf-8";function b(r){return r.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')}function u(r,i){let t=Object.keys(r).sort().map(e=>`${e.replace(/[^a-zA-Z0-9_]/g,"_")}="${b(String(r[e]))}"`);return i&&t.push(i),t.length?`{${t.join(",")}}`:""}function p(r){return Object.keys(r).sort().map(i=>`${i}\0${String(r[i])}`).join("")}function l(r){return r===1/0?"+Inf":r===-1/0?"-Inf":Number.isNaN(r)?"NaN":String(r)}function y(){let r=new Map,i=(t,e)=>{let s=r.get(t.name);s||(s={definition:t,series:new Map},r.set(t.name,s));let o=p(e),n=s.series.get(o);return n||(n={labels:e,value:0},t.kind==="histogram"&&(n.buckets=new Array((t.buckets??[]).length).fill(0),n.sum=0),s.series.set(o,n)),n};return {name:"prometheus",metric(t){let{definition:e,value:s,attributes:o}=t,n=i(e,o);e.kind==="counter"?n.value+=Math.max(0,s):e.kind==="gauge"?n.value=s:(n.value+=1,n.sum+=s,(e.buckets??[]).forEach((a,c)=>{s<=a&&(n.buckets[c]+=1);}));},declare(t,e){i(t,e);},forget(t,e){r.get(t.name)?.series.delete(p(e));},metrics(){let t=[];for(let{definition:e,series:s}of r.values()){let o=b$1(e);t.push(`# HELP ${o} ${e.description.replace(/\n/g," ")}`),t.push(`# TYPE ${o} ${e.kind}`);for(let n of s.values()){if(e.kind!=="histogram"){t.push(`${o}${u(n.labels)} ${l(n.value)}`);continue}(e.buckets??[]).forEach((a,c)=>{let d=`le="${l(a)}"`;t.push(`${o}_bucket${u(n.labels,d)} ${n.buckets[c]}`);}),t.push(`${o}_bucket${u(n.labels,'le="+Inf"')} ${n.value}`),t.push(`${o}_sum${u(n.labels)} ${l(n.sum)}`),t.push(`${o}_count${u(n.labels)} ${n.value}`);}}return t.length?`${t.join(`
2
7
  `)}
3
8
  `:""},reset(){r.clear();}}}async function g(r,i){return (await Promise.all([r,...i.merge??[]].map(e=>e.metrics()))).filter(Boolean).join(`
@@ -1 +1,6 @@
1
- 'use strict';var chunkUSA7TSUJ_cjs=require('./chunk-USA7TSUJ.cjs'),chunkAL2YERWY_cjs=require('./chunk-AL2YERWY.cjs'),crypto=require('crypto'),collaboration$1=require('@docx-editor.dev/pro/collaboration'),core=require('@docx-editor.dev/core'),collaboration=require('@docx-editor.dev/core/collaboration'),M=require('yjs');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var M__namespace=/*#__PURE__*/_interopNamespace(M);function X(r){if(typeof r!="string"||r.length===0)throw new TypeError("hmacRoomLabel needs a non-empty secret, such as an environment variable.");let o=c=>`room-${crypto.createHmac("sha256",r).update(c).digest("hex").slice(0,16)}`;return C.add(o),o}var C=new WeakSet;function z(r,o){if(!r)return "permission-denied";let c=r,u=typeof r=="string"?r:typeof r=="object"?c.reason??c.code??(typeof c.message=="string"&&o.has(c.message.toLowerCase())?c.message:void 0):void 0;if(u===void 0)return "other";if(typeof u=="number")return Y[u]??"other";if(typeof u!="string")return "other";if(collaboration.isCollaborationFailureCode(u))return u;let b=u.toLowerCase();return o.has(b)?b:"other"}var Y={4401:"unauthorized",4403:"forbidden"},F=core.diagnosticCodes().map(r=>r.replace(/^collab\./,"")).filter(collaboration.isCollaborationFailureCode),$=["unauthorized","forbidden","permission-denied","unknown-room","rate-limited"];function Z(r){let o=chunkUSA7TSUJ_cjs.c(r),c=new Set([...$,...r.reasons??[]].map(e=>e.toLowerCase())),u=r.measureState??true;for(let e of new Set([...c,...F,"other"]))o.declare(chunkAL2YERWY_cjs.a.admissionRejections,{reason:e}),o.declare(chunkAL2YERWY_cjs.a.messageRefusals,{reason:e});for(let e of ["success","failure"])o.declare(chunkAL2YERWY_cjs.a.roomLoadDuration,{outcome:e}),o.declare(chunkAL2YERWY_cjs.a.roomStoreDuration,{outcome:e});for(let e of ["migrated","unchanged","failed"])o.declare(chunkAL2YERWY_cjs.a.migrations,{outcome:e});o.declare(chunkAL2YERWY_cjs.a.updates),o.declare(chunkAL2YERWY_cjs.a.updateBytes);let b=e=>{try{return z(r.reasonOf?.(e)??e,c)}catch{return "other"}},B=r.perRoomSeries===true;if(B&&r.roomLabel&&!C.has(r.roomLabel))throw new TypeError("perRoomSeries puts the room label into every series, so it accepts only the default label or hmacRoomLabel(secret). A custom roomLabel could put a room name in a metric.");for(let e of r.exporters)e.metric||console.warn(`[docx-editor telemetry] exporter "${e.name}" records no metrics, and room telemetry sends only metrics. Use otelExporter or prometheusRegistry on a server.`);let m=new Set,E=0,_=r.roomLabel??(()=>`room-${E+=1}`),f=()=>Date.now();function g(){let e=0,n=0,t=0;for(let a of m){let l=w(a);e+=a.connections,n+=l,t=Math.max(t,l);}o.metric(chunkAL2YERWY_cjs.a.roomsActive,m.size),o.metric(chunkAL2YERWY_cjs.a.connectionsActive,e),o.metric(chunkAL2YERWY_cjs.a.participantsActive,n),o.metric(chunkAL2YERWY_cjs.a.roomParticipantsMax,t);}function S(e,n){let t=e==="load"?chunkAL2YERWY_cjs.a.roomLoadDuration:chunkAL2YERWY_cjs.a.roomStoreDuration,a=globalThis.performance?.now()??f(),l=n?.pendingBytes??0,y=false;return i=>{y||(y=true,o.metric(t,G(a),{outcome:i}),i==="success"&&e==="store"&&n&&(n.pendingBytes=Math.max(0,n.pendingBytes-l)));}}async function x(e,n,t){let a=S(e,t);try{let l=await n();return a("success"),l}catch(l){throw a("failure"),l}}function O(e,n){try{j(e,n);}catch{e.changed=true;}}function j(e,n){if(e.changed||!e.sampled){e.changed=false,e.sampled=true,u&&(e.stateBytes=M__namespace.encodeStateAsUpdate(e.doc).byteLength);try{let t=collaboration$1.readCollaborationResourceUsage(e.doc);e.blobBytes=t.blobBytes,e.nodes=t.nodes;let a={nodes:t.nodes/t.maxNodes,relationships:t.relationships/t.maxRelationships,parts:t.parts/t.maxParts,blobBytes:t.blobBytes/t.maxBlobBytes};e.limitRatio=Math.max(...Object.values(a)),e.ratios=a,e.nodeStates={live:t.nodes-t.tombstonedNodes,tombstoned:t.tombstonedNodes};}catch{}}for(let[t,a]of Object.entries(e.ratios??{}))o.metric(chunkAL2YERWY_cjs.a.roomResourceUsage,a,{resource:t});for(let[t,a]of Object.entries(e.nodeStates??{}))o.metric(chunkAL2YERWY_cjs.a.roomNodes,a,{state:t});if(o.metric(chunkAL2YERWY_cjs.a.roomParticipants,w(e)),e.stateBytes!==null&&o.metric(chunkAL2YERWY_cjs.a.roomMemory,e.stateBytes,{kind:"state"}),e.blobBytes!==null&&o.metric(chunkAL2YERWY_cjs.a.roomMemory,e.blobBytes,{kind:"blobs"}),o.metric(chunkAL2YERWY_cjs.a.roomMemory,e.pendingBytes,{kind:"pending_updates"}),o.metric(chunkAL2YERWY_cjs.a.roomAge,(n-e.openedAt)/1e3),o.metric(chunkAL2YERWY_cjs.a.roomIdle,(n-e.lastChange)/1e3),B){let t=e.handle.label;o.metric(chunkAL2YERWY_cjs.a.roomParticipantsByRoom,w(e),{room:t});for(let[a,l]of A(e))o.metric(chunkAL2YERWY_cjs.a.roomMemoryByRoom,l,{room:t,kind:a});}}function h(){let e={state:0,blobs:0,pending_updates:0};for(let n of m)e.state+=n.stateBytes??0,e.blobs+=n.blobBytes??0,e.pending_updates+=n.pendingBytes;for(let[n,t]of Object.entries(e))o.metric(chunkAL2YERWY_cjs.a.roomsMemory,t,{kind:n});g();}function D(){let e=f();for(let n of m)O(n,e);h();}let v=false;async function H(){if(!v){v=true;try{let e=f();for(let n of [...m])m.has(n)&&O(n,e),await new Promise(t=>setTimeout(t,0));h();}finally{v=false;}}}h();let T=r.sampleInterval??6e4,k=T===false?null:setInterval(()=>{H();},T);return k?.unref?.(),{open(e,n={}){let t=f(),a=(d,p)=>{if(i.changed=true,i.loading>0)return;i.lastChange=f();let R=p?.source;R==="redis"||R==="local"&&p.skipStoreHooks===true||(i.pendingBytes+=d.byteLength,o.metric(chunkAL2YERWY_cjs.a.updates,1),o.metric(chunkAL2YERWY_cjs.a.updateBytes,d.byteLength));},l=d=>{let{added:p,removed:R}=d??{};(p?.length??0)+(R?.length??0)>0&&g();};e.on("update",a),n.awareness?.on("change",l);let y={label:_(n.name??""),async time(d,p){d==="load"&&(i.loading+=1);try{return await x(d,p,i)}finally{d==="load"&&(i.loading-=1);}},begin:d=>S(d,i),connected(){i.connections+=1,g();},disconnected(){i.connections=Math.max(0,i.connections-1),g();},close(){if(m.delete(i)){if(i.dispose(),B){let d=y.label;o.forget(chunkAL2YERWY_cjs.a.roomParticipantsByRoom,{room:d});for(let[p]of A(i))o.forget(chunkAL2YERWY_cjs.a.roomMemoryByRoom,{room:d,kind:p});}h();}}},i={handle:y,doc:e,awareness:n.awareness,openedAt:t,lastChange:t,connections:0,pendingBytes:0,changed:true,loading:0,sampled:false,stateBytes:null,blobBytes:null,nodes:null,limitRatio:null,dispose(){e.off("update",a),n.awareness?.off("change",l);}};return m.add(i),g(),y},rejected(e){o.metric(chunkAL2YERWY_cjs.a.admissionRejections,1,{reason:b(e)});},refused(e){o.metric(chunkAL2YERWY_cjs.a.messageRefusals,1,{reason:b(e)});},migrated(e){o.metric(chunkAL2YERWY_cjs.a.migrations,1,{outcome:e});},time:(e,n)=>x(e,n),begin:e=>S(e),list(){let e=f();return [...m].map(n=>({room:n.handle.label,participants:w(n),connections:n.connections,stateBytes:n.stateBytes,blobBytes:n.blobBytes,pendingBytes:n.pendingBytes,nodes:n.nodes,limitRatio:n.limitRatio,ageSeconds:Math.round((e-n.openedAt)/1e3),idleSeconds:Math.round((e-n.lastChange)/1e3)}))},sample:D,flush:()=>o.flush(),async shutdown(){k&&clearInterval(k);for(let e of [...m])e.handle.close();await o.shutdown();}}}function A(r){return [["state",r.stateBytes??0],["blobs",r.blobBytes??0],["pending_updates",r.pendingBytes]]}function w(r){if(!r.awareness)return r.connections;try{return r.awareness.getStates().size}catch{return r.connections}}function G(r){return Math.max(0,((globalThis.performance?.now()??Date.now())-r)/1e3)}exports.a=X;exports.b=Z;
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ 'use strict';var chunkZ7RURMDH_cjs=require('./chunk-Z7RURMDH.cjs'),chunkAL2YERWY_cjs=require('./chunk-AL2YERWY.cjs'),crypto=require('crypto'),collaboration$1=require('@docx-editor.dev/pro/collaboration'),core=require('@docx-editor.dev/core'),collaboration=require('@docx-editor.dev/core/collaboration'),M=require('yjs');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var M__namespace=/*#__PURE__*/_interopNamespace(M);function X(r){if(typeof r!="string"||r.length===0)throw new TypeError("hmacRoomLabel needs a non-empty secret, such as an environment variable.");let o=c=>`room-${crypto.createHmac("sha256",r).update(c).digest("hex").slice(0,16)}`;return C.add(o),o}var C=new WeakSet;function z(r,o){if(!r)return "permission-denied";let c=r,u=typeof r=="string"?r:typeof r=="object"?c.reason??c.code??(typeof c.message=="string"&&o.has(c.message.toLowerCase())?c.message:void 0):void 0;if(u===void 0)return "other";if(typeof u=="number")return Y[u]??"other";if(typeof u!="string")return "other";if(collaboration.isCollaborationFailureCode(u))return u;let b=u.toLowerCase();return o.has(b)?b:"other"}var Y={4401:"unauthorized",4403:"forbidden"},F=core.diagnosticCodes().map(r=>r.replace(/^collab\./,"")).filter(collaboration.isCollaborationFailureCode),$=["unauthorized","forbidden","permission-denied","unknown-room","rate-limited"];function Z(r){let o=chunkZ7RURMDH_cjs.c(r),c=new Set([...$,...r.reasons??[]].map(e=>e.toLowerCase())),u=r.measureState??true;for(let e of new Set([...c,...F,"other"]))o.declare(chunkAL2YERWY_cjs.a.admissionRejections,{reason:e}),o.declare(chunkAL2YERWY_cjs.a.messageRefusals,{reason:e});for(let e of ["success","failure"])o.declare(chunkAL2YERWY_cjs.a.roomLoadDuration,{outcome:e}),o.declare(chunkAL2YERWY_cjs.a.roomStoreDuration,{outcome:e});for(let e of ["migrated","unchanged","failed"])o.declare(chunkAL2YERWY_cjs.a.migrations,{outcome:e});o.declare(chunkAL2YERWY_cjs.a.updates),o.declare(chunkAL2YERWY_cjs.a.updateBytes);let b=e=>{try{return z(r.reasonOf?.(e)??e,c)}catch{return "other"}},B=r.perRoomSeries===true;if(B&&r.roomLabel&&!C.has(r.roomLabel))throw new TypeError("perRoomSeries puts the room label into every series, so it accepts only the default label or hmacRoomLabel(secret). A custom roomLabel could put a room name in a metric.");for(let e of r.exporters)e.metric||console.warn(`[docx-editor telemetry] exporter "${e.name}" records no metrics, and room telemetry sends only metrics. Use otelExporter or prometheusRegistry on a server.`);let m=new Set,E=0,_=r.roomLabel??(()=>`room-${E+=1}`),f=()=>Date.now();function g(){let e=0,n=0,t=0;for(let a of m){let l=w(a);e+=a.connections,n+=l,t=Math.max(t,l);}o.metric(chunkAL2YERWY_cjs.a.roomsActive,m.size),o.metric(chunkAL2YERWY_cjs.a.connectionsActive,e),o.metric(chunkAL2YERWY_cjs.a.participantsActive,n),o.metric(chunkAL2YERWY_cjs.a.roomParticipantsMax,t);}function S(e,n){let t=e==="load"?chunkAL2YERWY_cjs.a.roomLoadDuration:chunkAL2YERWY_cjs.a.roomStoreDuration,a=globalThis.performance?.now()??f(),l=n?.pendingBytes??0,y=false;return i=>{y||(y=true,o.metric(t,G(a),{outcome:i}),i==="success"&&e==="store"&&n&&(n.pendingBytes=Math.max(0,n.pendingBytes-l)));}}async function x(e,n,t){let a=S(e,t);try{let l=await n();return a("success"),l}catch(l){throw a("failure"),l}}function O(e,n){try{j(e,n);}catch{e.changed=true;}}function j(e,n){if(e.changed||!e.sampled){e.changed=false,e.sampled=true,u&&(e.stateBytes=M__namespace.encodeStateAsUpdate(e.doc).byteLength);try{let t=collaboration$1.readCollaborationResourceUsage(e.doc);e.blobBytes=t.blobBytes,e.nodes=t.nodes;let a={nodes:t.nodes/t.maxNodes,relationships:t.relationships/t.maxRelationships,parts:t.parts/t.maxParts,blobBytes:t.blobBytes/t.maxBlobBytes};e.limitRatio=Math.max(...Object.values(a)),e.ratios=a,e.nodeStates={live:t.nodes-t.tombstonedNodes,tombstoned:t.tombstonedNodes};}catch{}}for(let[t,a]of Object.entries(e.ratios??{}))o.metric(chunkAL2YERWY_cjs.a.roomResourceUsage,a,{resource:t});for(let[t,a]of Object.entries(e.nodeStates??{}))o.metric(chunkAL2YERWY_cjs.a.roomNodes,a,{state:t});if(o.metric(chunkAL2YERWY_cjs.a.roomParticipants,w(e)),e.stateBytes!==null&&o.metric(chunkAL2YERWY_cjs.a.roomMemory,e.stateBytes,{kind:"state"}),e.blobBytes!==null&&o.metric(chunkAL2YERWY_cjs.a.roomMemory,e.blobBytes,{kind:"blobs"}),o.metric(chunkAL2YERWY_cjs.a.roomMemory,e.pendingBytes,{kind:"pending_updates"}),o.metric(chunkAL2YERWY_cjs.a.roomAge,(n-e.openedAt)/1e3),o.metric(chunkAL2YERWY_cjs.a.roomIdle,(n-e.lastChange)/1e3),B){let t=e.handle.label;o.metric(chunkAL2YERWY_cjs.a.roomParticipantsByRoom,w(e),{room:t});for(let[a,l]of A(e))o.metric(chunkAL2YERWY_cjs.a.roomMemoryByRoom,l,{room:t,kind:a});}}function h(){let e={state:0,blobs:0,pending_updates:0};for(let n of m)e.state+=n.stateBytes??0,e.blobs+=n.blobBytes??0,e.pending_updates+=n.pendingBytes;for(let[n,t]of Object.entries(e))o.metric(chunkAL2YERWY_cjs.a.roomsMemory,t,{kind:n});g();}function D(){let e=f();for(let n of m)O(n,e);h();}let v=false;async function H(){if(!v){v=true;try{let e=f();for(let n of [...m])m.has(n)&&O(n,e),await new Promise(t=>setTimeout(t,0));h();}finally{v=false;}}}h();let T=r.sampleInterval??6e4,k=T===false?null:setInterval(()=>{H();},T);return k?.unref?.(),{open(e,n={}){let t=f(),a=(d,p)=>{if(i.changed=true,i.loading>0)return;i.lastChange=f();let R=p?.source;R==="redis"||R==="local"&&p.skipStoreHooks===true||(i.pendingBytes+=d.byteLength,o.metric(chunkAL2YERWY_cjs.a.updates,1),o.metric(chunkAL2YERWY_cjs.a.updateBytes,d.byteLength));},l=d=>{let{added:p,removed:R}=d??{};(p?.length??0)+(R?.length??0)>0&&g();};e.on("update",a),n.awareness?.on("change",l);let y={label:_(n.name??""),async time(d,p){d==="load"&&(i.loading+=1);try{return await x(d,p,i)}finally{d==="load"&&(i.loading-=1);}},begin:d=>S(d,i),connected(){i.connections+=1,g();},disconnected(){i.connections=Math.max(0,i.connections-1),g();},close(){if(m.delete(i)){if(i.dispose(),B){let d=y.label;o.forget(chunkAL2YERWY_cjs.a.roomParticipantsByRoom,{room:d});for(let[p]of A(i))o.forget(chunkAL2YERWY_cjs.a.roomMemoryByRoom,{room:d,kind:p});}h();}}},i={handle:y,doc:e,awareness:n.awareness,openedAt:t,lastChange:t,connections:0,pendingBytes:0,changed:true,loading:0,sampled:false,stateBytes:null,blobBytes:null,nodes:null,limitRatio:null,dispose(){e.off("update",a),n.awareness?.off("change",l);}};return m.add(i),g(),y},rejected(e){o.metric(chunkAL2YERWY_cjs.a.admissionRejections,1,{reason:b(e)});},refused(e){o.metric(chunkAL2YERWY_cjs.a.messageRefusals,1,{reason:b(e)});},migrated(e){o.metric(chunkAL2YERWY_cjs.a.migrations,1,{outcome:e});},time:(e,n)=>x(e,n),begin:e=>S(e),list(){let e=f();return [...m].map(n=>({room:n.handle.label,participants:w(n),connections:n.connections,stateBytes:n.stateBytes,blobBytes:n.blobBytes,pendingBytes:n.pendingBytes,nodes:n.nodes,limitRatio:n.limitRatio,ageSeconds:Math.round((e-n.openedAt)/1e3),idleSeconds:Math.round((e-n.lastChange)/1e3)}))},sample:D,flush:()=>o.flush(),async shutdown(){k&&clearInterval(k);for(let e of [...m])e.handle.close();await o.shutdown();}}}function A(r){return [["state",r.stateBytes??0],["blobs",r.blobBytes??0],["pending_updates",r.pendingBytes]]}function w(r){if(!r.awareness)return r.connections;try{return r.awareness.getStates().size}catch{return r.connections}}function G(r){return Math.max(0,((globalThis.performance?.now()??Date.now())-r)/1e3)}exports.a=X;exports.b=Z;
@@ -1,2 +1,7 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  function l(e,o){return {name:"callback",event:e,...o?{metric:o}:{}}}function n(e){let o=e,r=["operation","changeKind","formattingKind","cause","errorName","stage","part"].map(t=>o[t]).filter(t=>typeof t=="string");return r.length?` [${r.join(", ")}]`:""}function c(e){let o=e.repeated?` (and ${e.repeated} more)`:"";switch(e.kind){case "document.open":return e.outcome==="rejected"?`document refused: ${e.code}${n(e)}`:e.pagesBucket===void 0?`document opened: ${e.sizeBucket}, ${e.durationMs} ms`:`document opened: ${e.pagesBucket} pages, ${e.sizeBucket}, ${e.durationMs} ms`;case "edit.rejected":{let r=e.command?`${e.origin} ${e.command}`:e.origin;return `edit refused: ${e.code}${n(e)} (${r}, ${e.tracked?"tracked":"untracked"})${o}`}case "review.skipped":return `tracked changes skipped: ${e.code}${n(e)} x${e.count}`;case "font.failed":return `font substituted: ${e.code}${o}`;case "history":return `undo history: ${e.code}${o}`;case "custom-node":return `custom node payload unreadable: ${e.code}${o}`;case "collab.participants":return `collaboration: ${e.count} ${e.count===1?"person":"people"} in the room`;case "collab.status":{let r=e.code?`: ${e.code}`:"",t=e.connectMs!==void 0?` after ${e.connectMs} ms`:"";return `collaboration ${e.status}${r}${e.recovering?" (recovering)":""}${t}`}case "performance":{let r=[i("key presses and clicks",e.interaction),i("layout",e.layout),i("paint",e.paint)].filter(Boolean),t=e.pagesBucket===void 0?"":`, ${e.pagesBucket} pages`;return `performance over ${Math.round(e.windowMs/1e3)} s${t}: ${r.join("; ")}`}case "document.save":return e.outcome==="saved"?`document saved: ${e.sizeBucket}, ${e.durationMs} ms`:`save failed: ${e.code}${n(e)} after ${e.durationMs} ms`;case "session":{if(e.phase==="start")return "editor session started";let r=e.inputEdits+e.commandEdits+e.automationEdits,t=`${Math.round(e.activeMs/1e3)} s active, ${r} ${r===1?"edit":"edits"}`;return e.phase==="end"?`editor session ended after ${Math.round(e.durationMs/1e3)} s: ${t}`:`editor activity over ${Math.round(e.durationMs/1e3)} s: ${t}`}}}function i(e,o){return o?`${e} p50 ${o.p50Ms} ms, p95 ${o.p95Ms} ms, max ${o.maxMs} ms (x${o.count})`:""}function a(e){return e.repeated===void 0&&s(e)}function p(e){return s(e)?e.repeated??1:0}function s(e){switch(e.kind){case "document.open":return e.outcome==="rejected";case "document.save":return e.outcome==="rejected";case "collab.participants":case "history":case "performance":case "session":return false;case "collab.status":return e.status==="error"&&e.code!=="collab.authentication-failed"&&e.code!=="collab.room-generation-changed";case "edit.rejected":return !d.has(e.code);case "font.failed":return e.code!=="font.missing";case "review.skipped":return e.code!=="review.stale-revision";default:return true}}var d=new Set(["edit.stale-target","edit.read-only","edit.protected-content","edit.refresh-in-progress","edit.preview-active","edit.preview-composing","edit.collaboration-not-ready"]);function m(e={}){let o=e.console??console;return {name:"console",event(r){let t=[`[docx-editor] ${c(r)}`];r.hint&&t.push(` ${r.hint}`),r.docs&&t.push(` ${r.docs}`),(a(r)||r.kind==="performance"&&r.code!==void 0?o.warn:o.info).call(o,t.join(`
2
7
  `));},...e.metrics?{metric(r){o.info(`[docx-editor] ${r.definition.name} ${r.value}`,r.attributes);}}:{}}}function $(){let e=[],o=[];return {name:"memory",events:e,metrics:o,event:r=>{e.push(r);},metric:r=>{o.push(r);},clear(){e.length=0,o.length=0;}}}export{l as a,c as b,a as c,p as d,m as e,$ as f};
@@ -0,0 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ import {a}from'./chunk-RSWAOCAT.js';import {c,b}from'./chunk-W5HFB5EV.js';var A=50,R="2.36.0";function M(o){let i=[...o.exporters],T=Object.freeze({...c(o.resource??{},"resource")}),d=[...o.metricLabels??[]],m=new Map,b$1=new Set;function y(e){if(d.length===0)return e;let r={...e};for(let t of d){let n=r[t];if(n===void 0)continue;let s=String(n),a=m.get(t);if(a||m.set(t,a=new Set),!a.has(s)){if(a.size>=A){r[t]="other";continue}a.add(s);}}return r}let f=false;function p(e,r){if(!b$1.has(r)){b$1.add(r);try{if(o.onExporterError){let t=o.onExporterError(e,r);t&&typeof t.then=="function"&&Promise.resolve(t).catch(()=>{});}else console.warn(`[docx-editor telemetry] exporter "${r}" failed`,e);}catch{}}}function c$1(e,r){try{let t=r();if(!t||typeof t.then!="function")return;Promise.resolve(t).then(void 0,n=>p(n,e.name));}catch(t){p(t,e.name);}}function v(){let e=o.consent??true;if(typeof e=="boolean")return e;try{return e()===!0}catch{return false}}function u(){return !f&&v()}let E=false,_=()=>E||globalThis.document?.visibilityState==="hidden";for(let e of i)c$1(e,()=>e.attach?.({consented:v,pageClosing:_}));async function g(e){await Promise.all(i.map(async r=>{try{await e(r);}catch(t){p(t,r.name);}}));}return {resource:T,consented:u,event(e){if(!u())return;let r=b(e);if("dropped"in r){this.metric(a.droppedEvents,1,{reason:r.dropped});return}for(let t of i)t.event&&c$1(t,()=>t.event(r.event));},metric(e,r,t={}){if(!u()||!Number.isFinite(r))return;let n={definition:e,value:r,attributes:y(c(t,e.name,[...e.labels,...d]))};for(let s of i)s.metric&&c$1(s,()=>s.metric(n));},forget(e,r){let t=c(r,e.name,e.labels);for(let n of i)n.forget&&c$1(n,()=>n.forget(e,t));},declare(e,r={}){if(!u())return;let t=y(c(r,e.name,[...e.labels,...d]));for(let n of i)n.declare&&c$1(n,()=>n.declare(e,t));},flush:()=>g(e=>e.flush?.()),setPageClosing(e){E=e;},async shutdown(){f||(f=true,await g(e=>e.shutdown?e.shutdown():e.flush?.()));}}}export{A as a,R as b,M as c};
@@ -1,3 +1,8 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  'use strict';var chunkAL2YERWY_cjs=require('./chunk-AL2YERWY.cjs');var f="text/plain; version=0.0.4; charset=utf-8";function b(r){return r.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')}function u(r,i){let t=Object.keys(r).sort().map(e=>`${e.replace(/[^a-zA-Z0-9_]/g,"_")}="${b(String(r[e]))}"`);return i&&t.push(i),t.length?`{${t.join(",")}}`:""}function p(r){return Object.keys(r).sort().map(i=>`${i}\0${String(r[i])}`).join("")}function l(r){return r===1/0?"+Inf":r===-1/0?"-Inf":Number.isNaN(r)?"NaN":String(r)}function y(){let r=new Map,i=(t,e)=>{let s=r.get(t.name);s||(s={definition:t,series:new Map},r.set(t.name,s));let o=p(e),n=s.series.get(o);return n||(n={labels:e,value:0},t.kind==="histogram"&&(n.buckets=new Array((t.buckets??[]).length).fill(0),n.sum=0),s.series.set(o,n)),n};return {name:"prometheus",metric(t){let{definition:e,value:s,attributes:o}=t,n=i(e,o);e.kind==="counter"?n.value+=Math.max(0,s):e.kind==="gauge"?n.value=s:(n.value+=1,n.sum+=s,(e.buckets??[]).forEach((a,c)=>{s<=a&&(n.buckets[c]+=1);}));},declare(t,e){i(t,e);},forget(t,e){r.get(t.name)?.series.delete(p(e));},metrics(){let t=[];for(let{definition:e,series:s}of r.values()){let o=chunkAL2YERWY_cjs.b(e);t.push(`# HELP ${o} ${e.description.replace(/\n/g," ")}`),t.push(`# TYPE ${o} ${e.kind}`);for(let n of s.values()){if(e.kind!=="histogram"){t.push(`${o}${u(n.labels)} ${l(n.value)}`);continue}(e.buckets??[]).forEach((a,c)=>{let d=`le="${l(a)}"`;t.push(`${o}_bucket${u(n.labels,d)} ${n.buckets[c]}`);}),t.push(`${o}_bucket${u(n.labels,'le="+Inf"')} ${n.value}`),t.push(`${o}_sum${u(n.labels)} ${l(n.sum)}`),t.push(`${o}_count${u(n.labels)} ${n.value}`);}}return t.length?`${t.join(`
2
7
  `)}
3
8
  `:""},reset(){r.clear();}}}async function g(r,i){return (await Promise.all([r,...i.merge??[]].map(e=>e.metrics()))).filter(Boolean).join(`
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  var o="docx_editor.version",s=[.005,.01,.025,.05,.1,.25,.5,1,2.5,5,10,30,60],l=[1024,16*1024,64*1024,256*1024,1024*1024,4*1024*1024,16*1024*1024,64*1024*1024,256*1024*1024,1024*1024*1024],a=[.016,.033,.05,.1,.2,.5,1],d=[1,2,3,5,10,20,50,100,250],p=[1e3,1e4,5e4,1e5,25e4,5e5,1e6],g=[.1,.25,.5,.75,.9,.95,1],c=[60,300,900,3600,4*3600,24*3600,168*3600],h=[10,30,60,300,900,1800,3600,2*3600,4*3600,8*3600,24*3600];function e(t,r,n,m,u=[],i){return Object.freeze({name:t,kind:r,unit:n,description:m,labels:u,...i?{buckets:i}:{}})}var b=Object.freeze({documentOpens:e("docx_editor.document.opens","counter","{open}","Documents opened or refused, by outcome, refusal code, engine reason, and part role.",["outcome","code","cause","part",o]),documentOpenDuration:e("docx_editor.document.open.duration","histogram","s","Time from the start of an open to the laid-out document.",[o],s),documentSaves:e("docx_editor.document.saves","counter","{save}","Calls to save() that returned the document or failed, by outcome and failure code.",["outcome","code",o]),documentSaveDuration:e("docx_editor.document.save.duration","histogram","s","Time from a save() call to the saved bytes, pending edits included. Successful saves only.",[o],s),edits:e("docx_editor.edits","counter","{edit}","Edits that changed the document, by origin: input, command, or automation. Refused edits are in docx_editor.edit.rejections, and edits by collaborators are not counted. Counted when a session summary is sent, up to a minute after the edit.",["origin",o]),editRejections:e("docx_editor.edit.rejections","counter","{edit}","Edits, commands, and tracked changes refused, by public code and engine reason.",["code","cause","origin","tracked",o]),reviewSkipped:e("docx_editor.review.skipped","counter","{change}","Tracked changes skipped by accept, reject, or reassign requests, by engine reason, operation, and change kind.",["code","cause","operation","change_kind",o]),fontFailures:e("docx_editor.font.failures","counter","{failure}","Font faces that failed to load and were substituted.",["code",o]),historyDiagnostics:e("docx_editor.history.diagnostics","counter","{event}","Undo steps that did not group as the gesture intended, by code.",["code",o]),customNodeDiagnostics:e("docx_editor.custom_node.diagnostics","counter","{node}","Custom node payloads that could not be read, by code.",["code",o]),collabClientStatusTransitions:e("docx_editor.collab.client.status_transitions","counter","{transition}","Collaboration status changes on clients, by new status and failure code.",["status","code",o]),collabClientConnectDuration:e("docx_editor.collab.client.connect.duration","histogram","s","Time from an editor attaching a room to its first ready status, when the editor attached before the room was ready.",[o],s),collabClientParticipants:e("docx_editor.collab.client.participants","histogram","{participant}","People in the room, as each client sees it when the count changes.",[o],d),editorSessions:e("docx_editor.editor.sessions","counter","{session}","Editor sessions started and ended, by phase. An editor ends when it is destroyed or its page closes.",["phase",o]),editorSessionDuration:e("docx_editor.editor.session.duration","histogram","s","Time from the creation of an editor to its end, idle time included. Recorded when the session ends.",[o],h),editorActiveTime:e("docx_editor.editor.active_time","counter","s","Seconds of use: time between key presses, pointer presses, and edits that are at most 30 seconds apart. Counted when a session summary is sent.",[o]),editorInteractionDuration:e("docx_editor.editor.interaction.duration","histogram","s","Key presses and pointer presses on the pages, to the next frame on screen, by page count bucket. Bucket counts are exact; the sum is estimated from the bands.",["pages",o],a),editorLayoutDuration:e("docx_editor.editor.layout.duration","histogram","s","Engine layout passes after edits and view changes, background work included, by page count bucket. Bucket counts are exact; the sum is estimated from the bands.",["pages",o],a),editorPaintDuration:e("docx_editor.editor.paint.duration","histogram","s","Engine paints of the pages, by page count bucket. Bucket counts are exact; the sum is estimated from the bands.",["pages",o],a),droppedEvents:e("docx_editor.telemetry.dropped_events","counter","{event}","Events the anonymity guard dropped, by reason. Usually a version mismatch.",["reason",o]),roomsActive:e("docx_editor.collab.rooms.active","gauge","{room}","Rooms loaded."),connectionsActive:e("docx_editor.collab.connections.active","gauge","{connection}","Open client connections. One person with two tabs is two connections."),participantsActive:e("docx_editor.collab.participants.active","gauge","{participant}","People present in all rooms, from awareness states."),roomParticipants:e("docx_editor.collab.room.participants","histogram","{participant}","People present in each room, sampled once per room per interval.",[],d),roomParticipantsMax:e("docx_editor.collab.room.participants.max","gauge","{participant}","People in the fullest room now."),roomMemory:e("docx_editor.collab.room.memory","histogram","By","Bytes each room holds, sampled per room: encoded state, blobs, and updates not yet stored.",["kind"],l),roomsMemory:e("docx_editor.collab.rooms.memory","gauge","By","Bytes all rooms hold together at the last sample.",["kind"]),roomNodes:e("docx_editor.collab.room.nodes","histogram","{node}","Shared document nodes per room, live and tombstoned.",["state"],p),roomResourceUsage:e("docx_editor.collab.room.resource_usage","histogram","1","Share of each room resource limit in use, from 0 to 1.",["resource"],g),roomAge:e("docx_editor.collab.room.age","histogram","s","How long each room has been loaded.",[],c),roomIdle:e("docx_editor.collab.room.idle","histogram","s","Time since each room last changed.",[],c),roomLoadDuration:e("docx_editor.collab.room.load.duration","histogram","s","Time to load a room, by outcome.",["outcome"],s),roomStoreDuration:e("docx_editor.collab.room.store.duration","histogram","s","Time to store a room, by outcome.",["outcome"],s),admissionRejections:e("docx_editor.collab.admission.rejections","counter","{connection}","Connections refused at admission, by reason.",["reason"]),messageRefusals:e("docx_editor.collab.message.refusals","counter","{message}","Messages refused before they applied, by reason, such as room-generation-changed.",["reason"]),updates:e("docx_editor.collab.updates","counter","{update}","Document updates applied to rooms."),updateBytes:e("docx_editor.collab.update.bytes","counter","By","Bytes of document updates applied to rooms."),roomParticipantsByRoom:e("docx_editor.collab.room.participants.current","gauge","{participant}","People in each room, labeled by room. Recorded only with perRoomSeries.",["room"]),roomMemoryByRoom:e("docx_editor.collab.room.memory.current","gauge","By","Bytes each room holds, labeled by room and kind. Recorded only with perRoomSeries.",["room","kind"]),migrations:e("docx_editor.collab.migrations","counter","{room}","Room migrations, by outcome.",["outcome"])}),y={s:"seconds",By:"bytes"};function _(t){let r=t.name.replace(/[^a-zA-Z0-9_]/g,"_"),n=t.unit==="1"?t.kind==="gauge"?"ratio":void 0:y[t.unit];return n&&!r.endsWith(`_${n}`)&&(r+=`_${n}`),t.kind==="counter"&&(r+="_total"),r}export{b as a,_ as b};
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  import {a}from'./chunk-DT2KMPUJ.js';import {diagnosticCodes,diagnosticCauses,diagnosticCommands,explainDiagnostic}from'@docx-editor.dev/core';var O=new Set(diagnosticCodes());function f(e){return new Set(Object.keys(e))}var B=f({package:true,"content-types":true,relationships:true,"main-document":true,glossary:true,styles:true,numbering:true,settings:true,"web-settings":true,"font-table":true,theme:true,header:true,footer:true,footnotes:true,endnotes:true,comments:true,people:true,"custom-xml":true,"document-properties":true,media:true,embedding:true,other:true}),z=f({Error:true,TypeError:true,RangeError:true,ReferenceError:true,SyntaxError:true,other:true}),P=f({accept:true,reject:true,reassign:true}),F=f({"open-mount":true,"open-layout":true,command:true,"review-item":true,automation:true,save:true}),U=f({insert:true,delete:true,replace:true,moveFrom:true,moveTo:true,format:true,paragraphMark:true,structural:true}),G=f({rPrChange:true,pPrChange:true,sectPrChange:true,tblPrChange:true,tblPrExChange:true,tblGridChange:true,trPrChange:true,tcPrChange:true,numberingChange:true,other:true}),g=e=>e.phase==="active"||e.phase==="end",N={"document.open":{codes:"open",numbers:{durationMs:e=>e.outcome==="opened"}},"edit.rejected":{codes:"edit",numbers:{repeated:true}},"review.skipped":{codes:"review",numbers:{count:true}},"font.failed":{codes:"font",numbers:{repeated:true}},history:{codes:"history",numbers:{repeated:true}},"custom-node":{codes:"custom-node",numbers:{repeated:true}},"collab.status":{codes:"collab",numbers:{repeated:true,connectMs:e=>e.status==="ready"&&e.repeated===void 0}},"collab.participants":{numbers:{count:true}},performance:{codes:"performance",numbers:{windowMs:true}},"document.save":{codes:"save",numbers:{durationMs:true}},session:{numbers:{durationMs:g,activeMs:g,inputEdits:g,commandEdits:g,automationEdits:g}}},x=N,w={kind:new Set(Object.keys(N)),code:O,outcome:new Set(["opened","saved","rejected"]),phase:new Set(["start","active","end"]),origin:new Set(["command","input","automation"]),command:new Set(diagnosticCommands()),sizeBucket:/^(?:\d+(?:KiB|MiB)?-\d+(?:KiB|MiB)|512MiB\+)$/,pagesBucket:new Set(["0","1","2-9","10-99","100-999","1000+"]),editorSessionId:/^e_(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,64}|[0-9a-z]{6,12}_[0-9a-z]{1,8})$/,engineVersion:/^(?:development|\d{1,4}\.\d{1,4}\.\d{1,4}(?:-[0-9A-Za-z.]{1,20})?)$/,status:new Set(["initializing","ready","disconnected","error","destroyed"]),previous:new Set(["none","initializing","ready","disconnected","error","destroyed"]),cause:new Set(diagnosticCauses()),part:B,errorName:z,stage:F,operation:P,changeKind:U,formattingKind:G},C=1e6,V=720*60*60*1e3,m={min:0,max:C,integer:true},h={min:0,max:V,integer:false},b={...h,removeAboveMax:true};function c(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>=t.min&&e<=t.max&&(!t.integer||Number.isInteger(e))}var S={schemaVersion:{min:1,max:1e3,integer:true},time:{min:0,max:864e13,integer:false},durationMs:b,count:m,repeated:{min:1,max:C,integer:true},connectMs:b,windowMs:b,activeMs:b,inputEdits:m,commandEdits:m,automationEdits:m},L=new Set(["schemaVersion","time"]);function Z(e,t){if(L.has(e))return true;let o=x[t.kind]?.numbers,r=o&&Object.hasOwn(o,e)?o[e]:void 0;return r===true||typeof r=="function"&&r(t)}var v=new Set(["tracked","recovering"]),E=new Set;function u(e,t=e){E.has(t)||a()==="production"||(E.add(t),console.warn(`[docx-editor telemetry] ${e}`));}function R(e,t){let o=Object.hasOwn(w,e)?w[e]:void 0;return o?o instanceof RegExp?o.test(t):o.has(t):false}function Q(e){let t=e;if(typeof t.kind!="string"||!R("kind",t.kind))return u("dropped an event of an unknown kind; core and telemetry versions may differ","kind"),{dropped:"unknown-kind"};let o=t.kind,r=typeof t.code=="string"?t.code:void 0,s=x[o]?.codes;if(r!==void 0&&(!O.has(r)||!s||!r.startsWith(`${s}.`)))return u("dropped an event with an unknown code; core and telemetry versions may differ","code"),{dropped:"unknown-code"};let a=r?explainDiagnostic(r):void 0,d={};for(let[n,i]of Object.entries(t)){if(n==="resource"||n==="attributes")continue;if(n==="shape"){let l=Y(i);if(!l)return u('dropped an event whose "shape" is not a valid document shape',"shape"),{dropped:"invalid-field"};d.shape=l;continue}if(A.has(n)){if(o!=="performance"){u(`removed "${n}", which only performance events carry`,`on:${n}`);continue}let l=X(i);if(!l)return u(`dropped an event whose "${n}" is not a valid timing summary`,`timing:${n}`),{dropped:"invalid-field"};d[n]=l;continue}if(n==="hint"||n==="docs"){a&&i===a[n]&&(d[n]=i);continue}let p=Object.hasOwn(S,n);if(p&&!Z(n,t)){u(`removed "${n}", which a ${o} event does not carry`,`on:${o}:${n}`);continue}let D=Object.hasOwn(w,n)||p||v.has(n),y=p?S[n]:void 0;if(y&&c(i,y))d[n]=i;else if(y?.removeAboveMax&&typeof i=="number"&&i>y.max){u(`removed "${n}", which is longer than the guard accepts`,`long:${n}`);continue}else if(typeof i=="boolean"&&v.has(n))d[n]=i;else if(typeof i=="string"&&R(n,i))d[n]=i;else {if(D)return u(`dropped an event whose "${n}" is not a valid value`,`field:${n}`),{dropped:"invalid-field"};u(`dropped the field "${n}", which is not an anonymous diagnostic field`,`extra:${n}`);}}return o==="performance"&&![...A].some(n=>d[n]!==void 0)?(u("dropped a performance summary without timings","performance:empty"),{dropped:"invalid-field"}):(d.resource=e.resource,d.attributes=e.attributes??{},{event:Object.freeze(d)})}var A=new Set(["interaction","layout","paint"]),H=["count","p50Ms","p95Ms","maxMs"],W=8;function X(e){if(!e||typeof e!="object")return null;let t=e,o=[...H,"bands"];if(Object.keys(t).some(i=>!o.includes(i)))return null;let{count:r,p50Ms:s,p95Ms:a,maxMs:d,bands:n}=t;return !c(r,m)||r<1||!c(s,h)||!c(a,h)||!c(d,h)||s>a||a>d||!Array.isArray(n)||n.length!==W||!n.every(i=>c(i,m))||n.reduce((i,p)=>i+p,0)!==r?null:Object.freeze({count:r,p50Ms:s,p95Ms:a,maxMs:d,bands:Object.freeze([...n])})}var M=["parts","paragraphs","reviewItems","embeddedFonts"];function Y(e){if(!e||typeof e!="object")return null;let t=e;if(Object.keys(t).some(r=>!M.includes(r)))return null;let o={};for(let r of M){let s=t[r];if(typeof s!="string"||!R("pagesBucket",s))return null;o[r]=s;}return Object.freeze(o)}var $=/^[A-Za-z_][A-Za-z0-9_.-]{0,63}$/,j=/^[A-Za-z0-9_.:+-]{0,64}$/;function ee(e,t,o){let r={};for(let[s,a]of Object.entries(e)){if(!$.test(s)||o&&!o.includes(s)){u(`dropped the attribute "${s.slice(0,40)}" on ${t}`,`attribute:${t}:${s}`);continue}typeof a=="number"||typeof a=="boolean"?r[s]=a:typeof a=="string"&&(r[s]=o&&!j.test(a)?"other":a.slice(0,256));}return r}function ne(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t={};for(let[o,r]of Object.entries(e))$.test(o)&&(typeof r=="boolean"||typeof r=="number"&&Number.isFinite(r)||typeof r=="string"&&r&&j.test(r))&&(t[o]=r);return Object.keys(t).length?t:void 0}export{C as a,Q as b,ee as c,ne as d};
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  'use strict';function n(){try{return process.env.NODE_ENV}catch{return}}exports.a=n;
@@ -0,0 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ 'use strict';var chunkAL2YERWY_cjs=require('./chunk-AL2YERWY.cjs'),chunk7SYLCJFQ_cjs=require('./chunk-7SYLCJFQ.cjs');var A=50,R="2.36.0";function M(o){let i=[...o.exporters],T=Object.freeze({...chunk7SYLCJFQ_cjs.c(o.resource??{},"resource")}),d=[...o.metricLabels??[]],m=new Map,b=new Set;function y(e){if(d.length===0)return e;let r={...e};for(let t of d){let n=r[t];if(n===void 0)continue;let s=String(n),a=m.get(t);if(a||m.set(t,a=new Set),!a.has(s)){if(a.size>=A){r[t]="other";continue}a.add(s);}}return r}let f=false;function p(e,r){if(!b.has(r)){b.add(r);try{if(o.onExporterError){let t=o.onExporterError(e,r);t&&typeof t.then=="function"&&Promise.resolve(t).catch(()=>{});}else console.warn(`[docx-editor telemetry] exporter "${r}" failed`,e);}catch{}}}function c(e,r){try{let t=r();if(!t||typeof t.then!="function")return;Promise.resolve(t).then(void 0,n=>p(n,e.name));}catch(t){p(t,e.name);}}function v(){let e=o.consent??true;if(typeof e=="boolean")return e;try{return e()===!0}catch{return false}}function u(){return !f&&v()}let E=false,_=()=>E||globalThis.document?.visibilityState==="hidden";for(let e of i)c(e,()=>e.attach?.({consented:v,pageClosing:_}));async function g(e){await Promise.all(i.map(async r=>{try{await e(r);}catch(t){p(t,r.name);}}));}return {resource:T,consented:u,event(e){if(!u())return;let r=chunk7SYLCJFQ_cjs.b(e);if("dropped"in r){this.metric(chunkAL2YERWY_cjs.a.droppedEvents,1,{reason:r.dropped});return}for(let t of i)t.event&&c(t,()=>t.event(r.event));},metric(e,r,t={}){if(!u()||!Number.isFinite(r))return;let n={definition:e,value:r,attributes:y(chunk7SYLCJFQ_cjs.c(t,e.name,[...e.labels,...d]))};for(let s of i)s.metric&&c(s,()=>s.metric(n));},forget(e,r){let t=chunk7SYLCJFQ_cjs.c(r,e.name,e.labels);for(let n of i)n.forget&&c(n,()=>n.forget(e,t));},declare(e,r={}){if(!u())return;let t=y(chunk7SYLCJFQ_cjs.c(r,e.name,[...e.labels,...d]));for(let n of i)n.declare&&c(n,()=>n.declare(e,t));},flush:()=>g(e=>e.flush?.()),setPageClosing(e){E=e;},async shutdown(){f||(f=true,await g(e=>e.shutdown?e.shutdown():e.flush?.()));}}}exports.a=A;exports.b=R;exports.c=M;
@@ -1 +1,6 @@
1
- 'use strict';var chunkQDOUVRQA_cjs=require('../chunk-QDOUVRQA.cjs'),chunkE4QNP535_cjs=require('../chunk-E4QNP535.cjs');require('../chunk-USA7TSUJ.cjs'),require('../chunk-AL2YERWY.cjs'),require('../chunk-7SYLCJFQ.cjs'),require('../chunk-WGWKNKUT.cjs');var crypto=require('crypto');function U(a){if(typeof a!="string"||a.length===0)throw new TypeError("requireBearerToken needs a non-empty secret, such as METRICS_TOKEN.");let n=Buffer.from(`Bearer ${a}`);return c=>{let l=c.headers?.authorization,i=Buffer.from(typeof l=="string"?l:"");return i.length===n.length&&crypto.timingSafeEqual(i,n)}}function $(a,n={}){if(n.rooms&&!n.authorize)throw new TypeError("serveMetrics needs authorize when it serves rooms: the list is private.");let c=n.path??"/metrics",l=chunkQDOUVRQA_cjs.c(a,n.merge?{merge:n.merge}:{}),i=0;return async({request:u,response:f})=>{let g=(u.url??"").split("?")[0],w=n.rooms?.path;if(g!==c&&g!==w){await n.next?.({request:u,response:f});return}throw n.authorize&&!A(n.authorize,u)?(f.writeHead(403),f.end()):g===c?(n.sampleBeforeScrape&&Date.now()-i>=5e3&&(i=Date.now(),n.sampleBeforeScrape.sample()),await l(u,f)):(f.writeHead(200,{"Content-Type":"application/json"}),f.end(JSON.stringify(n.rooms.telemetry.list()))),null}}function I(a,n){let c=chunkE4QNP535_cjs.b(n),l=new Map,i=new Map,u=new Map,f=e=>typeof e.afterLoadDocument=="function",g=1+(a.extensions??[]).filter(e=>f(e)).length+(f(a)?1:0),w=e=>{let r=(u.get(e)??0)+1;u.set(e,r),!(r<g)&&(u.delete(e),y(i,e,"success"));},p=new Map,R=e=>typeof e.afterStoreDocument=="function",M=1+(a.extensions??[]).filter(e=>R(e)).length+(R(a)?1:0),D=e=>{let r=(p.get(e)??0)+1;p.set(e,r),!(r<M)&&(p.delete(e),y(m,e,"success"));},v=e=>{u.delete(e),y(i,e,"failure"),l.get(e)?.close(),l.delete(e);},m=new Map,h=new Map,P=(e,r)=>`${e}\0${r}`,y=(e,r,s)=>{e.get(r)?.(s),e.delete(r);},q={extensionName:"docx-editor-telemetry",priority:Number.MAX_SAFE_INTEGER,async onLoadDocument({documentName:e}){y(i,e,"failure"),i.set(e,c.begin("load"));},async afterLoadDocument({documentName:e,document:r}){l.get(e)?.close(),l.set(e,c.open(r,{name:e,awareness:r.awareness})),u.set(e,0),w(e);},async onStoreDocument({documentName:e}){m.delete(e),p.delete(e);let r=l.get(e);m.set(e,r?r.begin("store"):c.begin("store"));},async afterStoreDocument({documentName:e}){p.set(e,0),D(e);},async connected({documentName:e,socketId:r}){let s=l.get(e),o=P(r,e);if(!s)return;let t=h.get(o);t?t.count+=1:h.set(o,{room:s,count:1}),s.connected();},async onDisconnect({documentName:e,socketId:r}){let s=P(r,e),o=h.get(s);o&&(o.room.disconnected(),o.count-=1,o.count===0&&h.delete(s));},async afterUnloadDocument({documentName:e}){u.delete(e),p.delete(e),y(i,e,"failure"),m.delete(e),l.get(e)?.close(),l.delete(e);},async onDestroy(){await c.shutdown();}},T=e=>{let r=e,s={},o=(t,d,j)=>{let b=r[t];typeof b=="function"&&(s[t]=async S=>{let k;try{k=await b.call(e,S);}catch(O){throw d(O,S),O}return j?.(S),k});};return o("onConnect",t=>c.rejected(t)),o("onAuthenticate",t=>c.rejected(t)),o("onTokenSync",t=>c.rejected(t)),o("beforeHandleMessage",t=>c.refused(t)),o("onLoadDocument",(t,{documentName:d})=>y(i,d??"","failure")),o("afterLoadDocument",(t,{documentName:d})=>v(d??""),({documentName:t})=>w(t??"")),o("afterStoreDocument",(t,{documentName:d})=>{p.delete(d??""),y(m,d??"",L(t)?"success":"failure");},({documentName:t})=>D(t??"")),o("onStoreDocument",(t,{documentName:d})=>{L(t)?m.delete(d??""):y(m,d??"","failure");}),s},C=T(a),E=(a.extensions??[]).map(e=>{let r=T(e);return new Proxy(Object.create(Object.getPrototypeOf(e)),{get(s,o){if(Object.hasOwn(r,o))return r[o];let t=Reflect.get(e,o,e);return typeof t=="function"&&o!=="constructor"?t.bind(e):t},set(s,o,t){return Reflect.set(e,o,t,e)},has:(s,o)=>Reflect.has(e,o),ownKeys:()=>Reflect.ownKeys(e),getOwnPropertyDescriptor(s,o){let t=Reflect.getOwnPropertyDescriptor(e,o);return t?{...t,configurable:true}:void 0}})});return {config:{...a,...C,extensions:[q,...E]},rooms:c}}function A(a,n){try{return a(n)===!0}catch{return false}}function L(a){return a?.name==="SkipFurtherHooksError"}Object.defineProperty(exports,"hmacRoomLabel",{enumerable:true,get:function(){return chunkE4QNP535_cjs.a}});exports.requireBearerToken=U;exports.serveMetrics=$;exports.withCollaborationTelemetry=I;
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ 'use strict';var chunkQDOUVRQA_cjs=require('../chunk-QDOUVRQA.cjs'),chunkKWUY6LI3_cjs=require('../chunk-KWUY6LI3.cjs');require('../chunk-Z7RURMDH.cjs'),require('../chunk-AL2YERWY.cjs'),require('../chunk-7SYLCJFQ.cjs'),require('../chunk-WGWKNKUT.cjs');var crypto=require('crypto');function U(a){if(typeof a!="string"||a.length===0)throw new TypeError("requireBearerToken needs a non-empty secret, such as METRICS_TOKEN.");let n=Buffer.from(`Bearer ${a}`);return c=>{let l=c.headers?.authorization,i=Buffer.from(typeof l=="string"?l:"");return i.length===n.length&&crypto.timingSafeEqual(i,n)}}function $(a,n={}){if(n.rooms&&!n.authorize)throw new TypeError("serveMetrics needs authorize when it serves rooms: the list is private.");let c=n.path??"/metrics",l=chunkQDOUVRQA_cjs.c(a,n.merge?{merge:n.merge}:{}),i=0;return async({request:u,response:f})=>{let g=(u.url??"").split("?")[0],w=n.rooms?.path;if(g!==c&&g!==w){await n.next?.({request:u,response:f});return}throw n.authorize&&!A(n.authorize,u)?(f.writeHead(403),f.end()):g===c?(n.sampleBeforeScrape&&Date.now()-i>=5e3&&(i=Date.now(),n.sampleBeforeScrape.sample()),await l(u,f)):(f.writeHead(200,{"Content-Type":"application/json"}),f.end(JSON.stringify(n.rooms.telemetry.list()))),null}}function I(a,n){let c=chunkKWUY6LI3_cjs.b(n),l=new Map,i=new Map,u=new Map,f=e=>typeof e.afterLoadDocument=="function",g=1+(a.extensions??[]).filter(e=>f(e)).length+(f(a)?1:0),w=e=>{let r=(u.get(e)??0)+1;u.set(e,r),!(r<g)&&(u.delete(e),y(i,e,"success"));},p=new Map,R=e=>typeof e.afterStoreDocument=="function",M=1+(a.extensions??[]).filter(e=>R(e)).length+(R(a)?1:0),D=e=>{let r=(p.get(e)??0)+1;p.set(e,r),!(r<M)&&(p.delete(e),y(m,e,"success"));},v=e=>{u.delete(e),y(i,e,"failure"),l.get(e)?.close(),l.delete(e);},m=new Map,h=new Map,P=(e,r)=>`${e}\0${r}`,y=(e,r,s)=>{e.get(r)?.(s),e.delete(r);},q={extensionName:"docx-editor-telemetry",priority:Number.MAX_SAFE_INTEGER,async onLoadDocument({documentName:e}){y(i,e,"failure"),i.set(e,c.begin("load"));},async afterLoadDocument({documentName:e,document:r}){l.get(e)?.close(),l.set(e,c.open(r,{name:e,awareness:r.awareness})),u.set(e,0),w(e);},async onStoreDocument({documentName:e}){m.delete(e),p.delete(e);let r=l.get(e);m.set(e,r?r.begin("store"):c.begin("store"));},async afterStoreDocument({documentName:e}){p.set(e,0),D(e);},async connected({documentName:e,socketId:r}){let s=l.get(e),o=P(r,e);if(!s)return;let t=h.get(o);t?t.count+=1:h.set(o,{room:s,count:1}),s.connected();},async onDisconnect({documentName:e,socketId:r}){let s=P(r,e),o=h.get(s);o&&(o.room.disconnected(),o.count-=1,o.count===0&&h.delete(s));},async afterUnloadDocument({documentName:e}){u.delete(e),p.delete(e),y(i,e,"failure"),m.delete(e),l.get(e)?.close(),l.delete(e);},async onDestroy(){await c.shutdown();}},T=e=>{let r=e,s={},o=(t,d,j)=>{let b=r[t];typeof b=="function"&&(s[t]=async S=>{let k;try{k=await b.call(e,S);}catch(O){throw d(O,S),O}return j?.(S),k});};return o("onConnect",t=>c.rejected(t)),o("onAuthenticate",t=>c.rejected(t)),o("onTokenSync",t=>c.rejected(t)),o("beforeHandleMessage",t=>c.refused(t)),o("onLoadDocument",(t,{documentName:d})=>y(i,d??"","failure")),o("afterLoadDocument",(t,{documentName:d})=>v(d??""),({documentName:t})=>w(t??"")),o("afterStoreDocument",(t,{documentName:d})=>{p.delete(d??""),y(m,d??"",L(t)?"success":"failure");},({documentName:t})=>D(t??"")),o("onStoreDocument",(t,{documentName:d})=>{L(t)?m.delete(d??""):y(m,d??"","failure");}),s},C=T(a),E=(a.extensions??[]).map(e=>{let r=T(e);return new Proxy(Object.create(Object.getPrototypeOf(e)),{get(s,o){if(Object.hasOwn(r,o))return r[o];let t=Reflect.get(e,o,e);return typeof t=="function"&&o!=="constructor"?t.bind(e):t},set(s,o,t){return Reflect.set(e,o,t,e)},has:(s,o)=>Reflect.has(e,o),ownKeys:()=>Reflect.ownKeys(e),getOwnPropertyDescriptor(s,o){let t=Reflect.getOwnPropertyDescriptor(e,o);return t?{...t,configurable:true}:void 0}})});return {config:{...a,...C,extensions:[q,...E]},rooms:c}}function A(a,n){try{return a(n)===!0}catch{return false}}function L(a){return a?.name==="SkipFurtherHooksError"}Object.defineProperty(exports,"hmacRoomLabel",{enumerable:true,get:function(){return chunkKWUY6LI3_cjs.a}});exports.requireBearerToken=U;exports.serveMetrics=$;exports.withCollaborationTelemetry=I;
@@ -1 +1,6 @@
1
- import {c}from'../chunk-JM4KJB6O.js';import {b}from'../chunk-2HQP6UUK.js';export{a as hmacRoomLabel}from'../chunk-2HQP6UUK.js';import'../chunk-BPVPJKIM.js';import'../chunk-RSWAOCAT.js';import'../chunk-W5HFB5EV.js';import'../chunk-DT2KMPUJ.js';import {timingSafeEqual}from'crypto';function U(a){if(typeof a!="string"||a.length===0)throw new TypeError("requireBearerToken needs a non-empty secret, such as METRICS_TOKEN.");let n=Buffer.from(`Bearer ${a}`);return c=>{let l=c.headers?.authorization,i=Buffer.from(typeof l=="string"?l:"");return i.length===n.length&&timingSafeEqual(i,n)}}function $(a,n={}){if(n.rooms&&!n.authorize)throw new TypeError("serveMetrics needs authorize when it serves rooms: the list is private.");let c$1=n.path??"/metrics",l=c(a,n.merge?{merge:n.merge}:{}),i=0;return async({request:u,response:f})=>{let g=(u.url??"").split("?")[0],w=n.rooms?.path;if(g!==c$1&&g!==w){await n.next?.({request:u,response:f});return}throw n.authorize&&!A(n.authorize,u)?(f.writeHead(403),f.end()):g===c$1?(n.sampleBeforeScrape&&Date.now()-i>=5e3&&(i=Date.now(),n.sampleBeforeScrape.sample()),await l(u,f)):(f.writeHead(200,{"Content-Type":"application/json"}),f.end(JSON.stringify(n.rooms.telemetry.list()))),null}}function I(a,n){let c=b(n),l=new Map,i=new Map,u=new Map,f=e=>typeof e.afterLoadDocument=="function",g=1+(a.extensions??[]).filter(e=>f(e)).length+(f(a)?1:0),w=e=>{let r=(u.get(e)??0)+1;u.set(e,r),!(r<g)&&(u.delete(e),y(i,e,"success"));},p=new Map,R=e=>typeof e.afterStoreDocument=="function",M=1+(a.extensions??[]).filter(e=>R(e)).length+(R(a)?1:0),D=e=>{let r=(p.get(e)??0)+1;p.set(e,r),!(r<M)&&(p.delete(e),y(m,e,"success"));},v=e=>{u.delete(e),y(i,e,"failure"),l.get(e)?.close(),l.delete(e);},m=new Map,h=new Map,P=(e,r)=>`${e}\0${r}`,y=(e,r,s)=>{e.get(r)?.(s),e.delete(r);},q={extensionName:"docx-editor-telemetry",priority:Number.MAX_SAFE_INTEGER,async onLoadDocument({documentName:e}){y(i,e,"failure"),i.set(e,c.begin("load"));},async afterLoadDocument({documentName:e,document:r}){l.get(e)?.close(),l.set(e,c.open(r,{name:e,awareness:r.awareness})),u.set(e,0),w(e);},async onStoreDocument({documentName:e}){m.delete(e),p.delete(e);let r=l.get(e);m.set(e,r?r.begin("store"):c.begin("store"));},async afterStoreDocument({documentName:e}){p.set(e,0),D(e);},async connected({documentName:e,socketId:r}){let s=l.get(e),o=P(r,e);if(!s)return;let t=h.get(o);t?t.count+=1:h.set(o,{room:s,count:1}),s.connected();},async onDisconnect({documentName:e,socketId:r}){let s=P(r,e),o=h.get(s);o&&(o.room.disconnected(),o.count-=1,o.count===0&&h.delete(s));},async afterUnloadDocument({documentName:e}){u.delete(e),p.delete(e),y(i,e,"failure"),m.delete(e),l.get(e)?.close(),l.delete(e);},async onDestroy(){await c.shutdown();}},T=e=>{let r=e,s={},o=(t,d,j)=>{let b=r[t];typeof b=="function"&&(s[t]=async S=>{let k;try{k=await b.call(e,S);}catch(O){throw d(O,S),O}return j?.(S),k});};return o("onConnect",t=>c.rejected(t)),o("onAuthenticate",t=>c.rejected(t)),o("onTokenSync",t=>c.rejected(t)),o("beforeHandleMessage",t=>c.refused(t)),o("onLoadDocument",(t,{documentName:d})=>y(i,d??"","failure")),o("afterLoadDocument",(t,{documentName:d})=>v(d??""),({documentName:t})=>w(t??"")),o("afterStoreDocument",(t,{documentName:d})=>{p.delete(d??""),y(m,d??"",L(t)?"success":"failure");},({documentName:t})=>D(t??"")),o("onStoreDocument",(t,{documentName:d})=>{L(t)?m.delete(d??""):y(m,d??"","failure");}),s},C=T(a),E=(a.extensions??[]).map(e=>{let r=T(e);return new Proxy(Object.create(Object.getPrototypeOf(e)),{get(s,o){if(Object.hasOwn(r,o))return r[o];let t=Reflect.get(e,o,e);return typeof t=="function"&&o!=="constructor"?t.bind(e):t},set(s,o,t){return Reflect.set(e,o,t,e)},has:(s,o)=>Reflect.has(e,o),ownKeys:()=>Reflect.ownKeys(e),getOwnPropertyDescriptor(s,o){let t=Reflect.getOwnPropertyDescriptor(e,o);return t?{...t,configurable:true}:void 0}})});return {config:{...a,...C,extensions:[q,...E]},rooms:c}}function A(a,n){try{return a(n)===!0}catch{return false}}function L(a){return a?.name==="SkipFurtherHooksError"}export{U as requireBearerToken,$ as serveMetrics,I as withCollaborationTelemetry};
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ import {c}from'../chunk-JM4KJB6O.js';import {b}from'../chunk-57ARMVFM.js';export{a as hmacRoomLabel}from'../chunk-57ARMVFM.js';import'../chunk-OMBPGHSR.js';import'../chunk-RSWAOCAT.js';import'../chunk-W5HFB5EV.js';import'../chunk-DT2KMPUJ.js';import {timingSafeEqual}from'crypto';function U(a){if(typeof a!="string"||a.length===0)throw new TypeError("requireBearerToken needs a non-empty secret, such as METRICS_TOKEN.");let n=Buffer.from(`Bearer ${a}`);return c=>{let l=c.headers?.authorization,i=Buffer.from(typeof l=="string"?l:"");return i.length===n.length&&timingSafeEqual(i,n)}}function $(a,n={}){if(n.rooms&&!n.authorize)throw new TypeError("serveMetrics needs authorize when it serves rooms: the list is private.");let c$1=n.path??"/metrics",l=c(a,n.merge?{merge:n.merge}:{}),i=0;return async({request:u,response:f})=>{let g=(u.url??"").split("?")[0],w=n.rooms?.path;if(g!==c$1&&g!==w){await n.next?.({request:u,response:f});return}throw n.authorize&&!A(n.authorize,u)?(f.writeHead(403),f.end()):g===c$1?(n.sampleBeforeScrape&&Date.now()-i>=5e3&&(i=Date.now(),n.sampleBeforeScrape.sample()),await l(u,f)):(f.writeHead(200,{"Content-Type":"application/json"}),f.end(JSON.stringify(n.rooms.telemetry.list()))),null}}function I(a,n){let c=b(n),l=new Map,i=new Map,u=new Map,f=e=>typeof e.afterLoadDocument=="function",g=1+(a.extensions??[]).filter(e=>f(e)).length+(f(a)?1:0),w=e=>{let r=(u.get(e)??0)+1;u.set(e,r),!(r<g)&&(u.delete(e),y(i,e,"success"));},p=new Map,R=e=>typeof e.afterStoreDocument=="function",M=1+(a.extensions??[]).filter(e=>R(e)).length+(R(a)?1:0),D=e=>{let r=(p.get(e)??0)+1;p.set(e,r),!(r<M)&&(p.delete(e),y(m,e,"success"));},v=e=>{u.delete(e),y(i,e,"failure"),l.get(e)?.close(),l.delete(e);},m=new Map,h=new Map,P=(e,r)=>`${e}\0${r}`,y=(e,r,s)=>{e.get(r)?.(s),e.delete(r);},q={extensionName:"docx-editor-telemetry",priority:Number.MAX_SAFE_INTEGER,async onLoadDocument({documentName:e}){y(i,e,"failure"),i.set(e,c.begin("load"));},async afterLoadDocument({documentName:e,document:r}){l.get(e)?.close(),l.set(e,c.open(r,{name:e,awareness:r.awareness})),u.set(e,0),w(e);},async onStoreDocument({documentName:e}){m.delete(e),p.delete(e);let r=l.get(e);m.set(e,r?r.begin("store"):c.begin("store"));},async afterStoreDocument({documentName:e}){p.set(e,0),D(e);},async connected({documentName:e,socketId:r}){let s=l.get(e),o=P(r,e);if(!s)return;let t=h.get(o);t?t.count+=1:h.set(o,{room:s,count:1}),s.connected();},async onDisconnect({documentName:e,socketId:r}){let s=P(r,e),o=h.get(s);o&&(o.room.disconnected(),o.count-=1,o.count===0&&h.delete(s));},async afterUnloadDocument({documentName:e}){u.delete(e),p.delete(e),y(i,e,"failure"),m.delete(e),l.get(e)?.close(),l.delete(e);},async onDestroy(){await c.shutdown();}},T=e=>{let r=e,s={},o=(t,d,j)=>{let b=r[t];typeof b=="function"&&(s[t]=async S=>{let k;try{k=await b.call(e,S);}catch(O){throw d(O,S),O}return j?.(S),k});};return o("onConnect",t=>c.rejected(t)),o("onAuthenticate",t=>c.rejected(t)),o("onTokenSync",t=>c.rejected(t)),o("beforeHandleMessage",t=>c.refused(t)),o("onLoadDocument",(t,{documentName:d})=>y(i,d??"","failure")),o("afterLoadDocument",(t,{documentName:d})=>v(d??""),({documentName:t})=>w(t??"")),o("afterStoreDocument",(t,{documentName:d})=>{p.delete(d??""),y(m,d??"",L(t)?"success":"failure");},({documentName:t})=>D(t??"")),o("onStoreDocument",(t,{documentName:d})=>{L(t)?m.delete(d??""):y(m,d??"","failure");}),s},C=T(a),E=(a.extensions??[]).map(e=>{let r=T(e);return new Proxy(Object.create(Object.getPrototypeOf(e)),{get(s,o){if(Object.hasOwn(r,o))return r[o];let t=Reflect.get(e,o,e);return typeof t=="function"&&o!=="constructor"?t.bind(e):t},set(s,o,t){return Reflect.set(e,o,t,e)},has:(s,o)=>Reflect.has(e,o),ownKeys:()=>Reflect.ownKeys(e),getOwnPropertyDescriptor(s,o){let t=Reflect.getOwnPropertyDescriptor(e,o);return t?{...t,configurable:true}:void 0}})});return {config:{...a,...C,extensions:[q,...E]},rooms:c}}function A(a,n){try{return a(n)===!0}catch{return false}}function L(a){return a?.name==="SkipFurtherHooksError"}export{U as requireBearerToken,$ as serveMetrics,I as withCollaborationTelemetry};
package/dist/index.cjs CHANGED
@@ -1 +1,6 @@
1
- 'use strict';var chunkUSA7TSUJ_cjs=require('./chunk-USA7TSUJ.cjs'),chunkAL2YERWY_cjs=require('./chunk-AL2YERWY.cjs'),chunk3O6TTDB5_cjs=require('./chunk-3O6TTDB5.cjs'),chunk7SYLCJFQ_cjs=require('./chunk-7SYLCJFQ.cjs');require('./chunk-WGWKNKUT.cjs');var core=require('@docx-editor.dev/core');var X={documentOpen:true,documentSave:true,sessions:true,editing:true,trackedChanges:true,fonts:true,history:true,customNodes:true,collaborationClient:true,performance:true},Y=new Set(["edit.tracking-required","edit.suggesting-needs-author","edit.tracking-mode-unsupported","edit.tracking-author-required","edit.tracking-unsupported-host"]);function Z(e){switch(e.kind){case "document.open":return "documentOpen";case "document.save":return "documentSave";case "session":return "sessions";case "edit.rejected":return e.tracked||Y.has(e.code)?"trackedChanges":"editing";case "review.skipped":return "trackedChanges";case "font.failed":return "fonts";case "history":return "history";case "custom-node":return "customNodes";case "collab.status":case "collab.participants":return "collaborationClient";case "performance":return "performance";default:return null}}function J(e){return e.kind==="collab.participants"?`${e.editorSessionId}|participants`:e.kind==="edit.rejected"?[e.editorSessionId,e.code,e.cause,e.errorName,e.stage,e.origin,e.tracked,e.command].join("|"):e.kind==="font.failed"?`${e.editorSessionId}|font|${e.code}`:e.kind==="history"||e.kind==="custom-node"?`${e.editorSessionId}|${e.kind}|${e.code}`:e.kind==="collab.status"?`${e.editorSessionId}|status|${e.status}|${e.code??""}|${e.recovering}`:null}function Q(e){let t=chunkUSA7TSUJ_cjs.c(e),m=e.metricLabels??[];function n(o){let r={};try{let a=typeof e.attributes=="function"?e.attributes():e.attributes;r=chunk7SYLCJFQ_cjs.c(a??{},"attributes");}catch{}return Object.freeze({...r,...o})}function c(o){let r={};for(let a of m)o[a]!==void 0&&(r[a]=o[a]);return r}let f=e.include??X,l=e.dedupeWindowMs??1e4,g=o=>{try{if(e.filter&&!e.filter(o))return}catch{return}t.event(o);},E=e.documentShape==="detailed",y=new Map,S=false,k=()=>{},T=false;function D(o){let r=f[o];return r?r===true?1:Math.min(1,Math.max(0,r.sampleRate??1)):null}let h=new Map;function w(o,r,a){if(a>=1)return true;if(r!=="performance"&&r!=="sessions")return Math.random()<a;let p=`${r}|${o.editorSessionId}`,b=h.get(p);return b===void 0&&(h.size>=1e3&&h.clear(),b=Math.random()<a,h.set(p,b)),b}function M(){if(S)return;S=true;let o=globalThis;if(typeof o.addEventListener!="function")return;let r=()=>{t.setPageClosing(true),u();},a=()=>{let p=globalThis.document?.visibilityState==="hidden";t.setPageClosing(p),p&&u();};o.addEventListener("pagehide",r),o.addEventListener("visibilitychange",a),k=()=>{o.removeEventListener?.("pagehide",r),o.removeEventListener?.("visibilitychange",a);};}function v(o){let r=y.get(o);if(r){if(y.delete(o),clearTimeout(r.timer),r.latest){let a=r.event;r.latest.count!==a.count&&g(I(F(r.latest,E),t,r.event.attributes));}else if(r.repeated>0){let{connectMs:a,...p}=r.event;g({...p,repeated:Math.min(r.repeated,chunk7SYLCJFQ_cjs.a)});}}}function i(o,r={}){if(T||!t.consented())return;let a=n(r),p=chunk7SYLCJFQ_cjs.b(I(o,t,a));if("dropped"in p){t.metric(chunkAL2YERWY_cjs.a.droppedEvents,1,{...c(a),reason:p.dropped,"docx_editor.version":chunkUSA7TSUJ_cjs.b});return}let b=Z(o),A=b?D(b):null;if(A===null||b==="performance"&&A===0)return;M(),ee(t,p.event,c(a));let x=l>0?J(o):null,O=x?y.get(x):void 0;if(O){o.kind==="collab.participants"?O.latest=o:O.repeated+=1;return}let _=o.kind==="session"&&o.phase==="end";if(!w(o,b,A)){_&&u();return}let L=I(F(o,E),t,a);if(g(L),_&&u(),x){let R=setTimeout(()=>v(x),l);R.unref?.(),y.set(x,{event:L,repeated:0,timer:R});}}function d(o){return Object.freeze({id:"telemetry",onDiagnostic:r=>i(r,o),wantsDiagnostic:r=>!T&&(r==="session"?D("sessions")!==null:r!=="performance"||(D("performance")??0)>0&&t.consented())})}async function u(){for(let o of [...y.keys()])v(o);await t.flush();}return {module:d({}),moduleFor(o){return d(chunk7SYLCJFQ_cjs.c(o,"moduleFor"))},record:i,flush:u,async shutdown(){for(let o of [...y.keys()])v(o);T=true,k(),await t.shutdown();}}}function F(e,t){if(t||e.kind!=="document.open"||e.outcome!=="opened"||!("shape"in e))return e;let{shape:m,...n}=e;return n}function I(e,t,m){let n="code"in e?e.code:void 0;return {...e,...n?core.explainDiagnostic(n):{},engineVersion:chunkUSA7TSUJ_cjs.b,resource:t.resource,attributes:m}}function ee(e,t,m){let n={metric:(c,f,l={})=>e.metric(c,f,{...l,...m,"docx_editor.version":chunkUSA7TSUJ_cjs.b})};switch(t.kind){case "document.open":t.outcome==="opened"?(n.metric(chunkAL2YERWY_cjs.a.documentOpens,1,{outcome:"opened",code:"none",cause:"none",part:"none"}),n.metric(chunkAL2YERWY_cjs.a.documentOpenDuration,t.durationMs/1e3)):n.metric(chunkAL2YERWY_cjs.a.documentOpens,1,{outcome:"rejected",code:t.code,cause:t.cause??"none",part:t.part??"none"});return;case "edit.rejected":n.metric(chunkAL2YERWY_cjs.a.editRejections,1,{code:t.code,cause:t.cause??"none",origin:t.origin,tracked:t.tracked});return;case "review.skipped":n.metric(chunkAL2YERWY_cjs.a.reviewSkipped,t.count,{code:t.code,cause:t.cause??"none",operation:t.operation??"none",change_kind:t.changeKind??"none"});return;case "font.failed":n.metric(chunkAL2YERWY_cjs.a.fontFailures,1,{code:t.code});return;case "history":n.metric(chunkAL2YERWY_cjs.a.historyDiagnostics,1,{code:t.code});return;case "custom-node":n.metric(chunkAL2YERWY_cjs.a.customNodeDiagnostics,1,{code:t.code});return;case "collab.status":n.metric(chunkAL2YERWY_cjs.a.collabClientStatusTransitions,1,{status:t.status,code:t.code??"none"}),t.connectMs!==void 0&&n.metric(chunkAL2YERWY_cjs.a.collabClientConnectDuration,t.connectMs/1e3);return;case "collab.participants":n.metric(chunkAL2YERWY_cjs.a.collabClientParticipants,t.count);return;case "performance":{let c=t.pagesBucket??"unknown";N(n,chunkAL2YERWY_cjs.a.editorInteractionDuration,c,t.interaction),N(n,chunkAL2YERWY_cjs.a.editorLayoutDuration,c,t.layout),N(n,chunkAL2YERWY_cjs.a.editorPaintDuration,c,t.paint);return}case "document.save":n.metric(chunkAL2YERWY_cjs.a.documentSaves,1,{outcome:t.outcome,code:t.outcome==="rejected"?t.code:"none"}),t.outcome==="saved"&&n.metric(chunkAL2YERWY_cjs.a.documentSaveDuration,t.durationMs/1e3);return;case "session":te(n,t);}}function te(e,t){if(t.phase==="start"){e.metric(chunkAL2YERWY_cjs.a.editorSessions,1,{phase:"start"});return}if(t.phase==="end"){e.metric(chunkAL2YERWY_cjs.a.editorSessions,1,{phase:"end"}),e.metric(chunkAL2YERWY_cjs.a.editorSessionDuration,t.durationMs/1e3);return}t.activeMs>0&&e.metric(chunkAL2YERWY_cjs.a.editorActiveTime,t.activeMs/1e3);for(let[m,n]of [["input",t.inputEdits],["command",t.commandEdits],["automation",t.automationEdits]])n>0&&e.metric(chunkAL2YERWY_cjs.a.edits,n,{origin:m});}function N(e,t,m,n){if(!n)return;let c=t.buckets??[];n.bands.forEach((f,l)=>{let g=c[l],E=l===0?0:c[l-1],y=g===void 0?Math.max(n.maxMs/1e3,E+1e-6):(E+g)/2;for(let S=0;S<f;S+=1)e.metric(t,y,{pages:m});});}var oe=new TextEncoder,ne=e=>oe.encode(e).byteLength;function re(e){let t=Math.min(50,Math.max(1,Math.floor(e.batchSize??20))),m=e.flushIntervalMs??1e4,n=[],c,f,l=new Set,g=i=>{try{e.onError?.(i);}catch{}},E=(i,d)=>{if(typeof fetch!="function")return;let u=fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:i,keepalive:d}).then(o=>{if(!o.ok)throw new Error(`telemetry endpoint answered ${o.status}`)}).catch(g).finally(()=>l.delete(u));l.add(u);},y=i=>{let d=globalThis.navigator;if(!e.headers&&typeof d?.sendBeacon=="function")try{if(d.sendBeacon(e.url,new Blob([i],{type:"application/json"})))return}catch{}E(i,true);},S=i=>{let d=Math.min(t,n.length);for(;d>0;){let u=JSON.stringify(n.slice(0,d)),o=ne(u);if(o<=i)return {body:u,bytes:o,count:d};if(d===1)return null;d=Math.ceil(d/2);}return null},k=0,T=false,D=i=>{if(c!==void 0&&clearTimeout(c),c=void 0,f&&!f.consented()){n=[];return}(!i||!T)&&(k=0),T=i;let d=0;for(;n.length;){let u=S(61440-(i?k:0));if(!u){d+=i?n.length:1,n=i?[]:n.slice(1);continue}n=n.slice(u.count),i?(k+=u.bytes,y(u.body)):E(u.body,false);}d&&g(new Error(`telemetry dropped ${d} events that did not fit`));},h=()=>{let i=f?.pageClosing()??false;return i||(T=false),i},w=globalThis.document,M=()=>{w?.visibilityState==="visible"&&(T=false);},v=()=>w?.removeEventListener?.("visibilitychange",M);return {name:"http",attach(i){f=i,w?.addEventListener?.("visibilitychange",M);},event(i){n.push(i),n.length>=t?D(h()):c===void 0&&(c=setTimeout(()=>D(h()),m),c.unref?.());},async flush(){D(h()),await Promise.all(l);},async shutdown(){v(),D(h()),await Promise.all(l);}}}function ie(e={}){return ()=>{let t=globalThis;if(!t.window||!t.document||!t.navigator||t.navigator.globalPrivacyControl===true||t.navigator.doNotTrack==="1")return false;if(!e.optOutKey)return true;try{return globalThis.localStorage?.getItem(e.optOutKey)!=="off"}catch{return true}}}Object.defineProperty(exports,"ENGINE_VERSION",{enumerable:true,get:function(){return chunkUSA7TSUJ_cjs.b}});Object.defineProperty(exports,"MAX_METRIC_LABEL_VALUES",{enumerable:true,get:function(){return chunkUSA7TSUJ_cjs.a}});Object.defineProperty(exports,"METRICS",{enumerable:true,get:function(){return chunkAL2YERWY_cjs.a}});Object.defineProperty(exports,"prometheusName",{enumerable:true,get:function(){return chunkAL2YERWY_cjs.b}});Object.defineProperty(exports,"callbackExporter",{enumerable:true,get:function(){return chunk3O6TTDB5_cjs.a}});Object.defineProperty(exports,"consoleExporter",{enumerable:true,get:function(){return chunk3O6TTDB5_cjs.e}});Object.defineProperty(exports,"failureCount",{enumerable:true,get:function(){return chunk3O6TTDB5_cjs.d}});Object.defineProperty(exports,"isFailure",{enumerable:true,get:function(){return chunk3O6TTDB5_cjs.c}});Object.defineProperty(exports,"memoryExporter",{enumerable:true,get:function(){return chunk3O6TTDB5_cjs.f}});Object.defineProperty(exports,"explainDiagnostic",{enumerable:true,get:function(){return core.explainDiagnostic}});exports.browserPrivacySignals=ie;exports.createTelemetry=Q;exports.httpExporter=re;
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ 'use strict';var chunkZ7RURMDH_cjs=require('./chunk-Z7RURMDH.cjs'),chunkAL2YERWY_cjs=require('./chunk-AL2YERWY.cjs'),chunk3O6TTDB5_cjs=require('./chunk-3O6TTDB5.cjs'),chunk7SYLCJFQ_cjs=require('./chunk-7SYLCJFQ.cjs');require('./chunk-WGWKNKUT.cjs');var core=require('@docx-editor.dev/core');var X={documentOpen:true,documentSave:true,sessions:true,editing:true,trackedChanges:true,fonts:true,history:true,customNodes:true,collaborationClient:true,performance:true},Y=new Set(["edit.tracking-required","edit.suggesting-needs-author","edit.tracking-mode-unsupported","edit.tracking-author-required","edit.tracking-unsupported-host"]);function Z(e){switch(e.kind){case "document.open":return "documentOpen";case "document.save":return "documentSave";case "session":return "sessions";case "edit.rejected":return e.tracked||Y.has(e.code)?"trackedChanges":"editing";case "review.skipped":return "trackedChanges";case "font.failed":return "fonts";case "history":return "history";case "custom-node":return "customNodes";case "collab.status":case "collab.participants":return "collaborationClient";case "performance":return "performance";default:return null}}function J(e){return e.kind==="collab.participants"?`${e.editorSessionId}|participants`:e.kind==="edit.rejected"?[e.editorSessionId,e.code,e.cause,e.errorName,e.stage,e.origin,e.tracked,e.command].join("|"):e.kind==="font.failed"?`${e.editorSessionId}|font|${e.code}`:e.kind==="history"||e.kind==="custom-node"?`${e.editorSessionId}|${e.kind}|${e.code}`:e.kind==="collab.status"?`${e.editorSessionId}|status|${e.status}|${e.code??""}|${e.recovering}`:null}function Q(e){let t=chunkZ7RURMDH_cjs.c(e),m=e.metricLabels??[];function n(o){let r={};try{let a=typeof e.attributes=="function"?e.attributes():e.attributes;r=chunk7SYLCJFQ_cjs.c(a??{},"attributes");}catch{}return Object.freeze({...r,...o})}function c(o){let r={};for(let a of m)o[a]!==void 0&&(r[a]=o[a]);return r}let f=e.include??X,l=e.dedupeWindowMs??1e4,g=o=>{try{if(e.filter&&!e.filter(o))return}catch{return}t.event(o);},E=e.documentShape==="detailed",y=new Map,S=false,k=()=>{},T=false;function D(o){let r=f[o];return r?r===true?1:Math.min(1,Math.max(0,r.sampleRate??1)):null}let h=new Map;function w(o,r,a){if(a>=1)return true;if(r!=="performance"&&r!=="sessions")return Math.random()<a;let p=`${r}|${o.editorSessionId}`,b=h.get(p);return b===void 0&&(h.size>=1e3&&h.clear(),b=Math.random()<a,h.set(p,b)),b}function M(){if(S)return;S=true;let o=globalThis;if(typeof o.addEventListener!="function")return;let r=()=>{t.setPageClosing(true),u();},a=()=>{let p=globalThis.document?.visibilityState==="hidden";t.setPageClosing(p),p&&u();};o.addEventListener("pagehide",r),o.addEventListener("visibilitychange",a),k=()=>{o.removeEventListener?.("pagehide",r),o.removeEventListener?.("visibilitychange",a);};}function v(o){let r=y.get(o);if(r){if(y.delete(o),clearTimeout(r.timer),r.latest){let a=r.event;r.latest.count!==a.count&&g(I(F(r.latest,E),t,r.event.attributes));}else if(r.repeated>0){let{connectMs:a,...p}=r.event;g({...p,repeated:Math.min(r.repeated,chunk7SYLCJFQ_cjs.a)});}}}function i(o,r={}){if(T||!t.consented())return;let a=n(r),p=chunk7SYLCJFQ_cjs.b(I(o,t,a));if("dropped"in p){t.metric(chunkAL2YERWY_cjs.a.droppedEvents,1,{...c(a),reason:p.dropped,"docx_editor.version":chunkZ7RURMDH_cjs.b});return}let b=Z(o),A=b?D(b):null;if(A===null||b==="performance"&&A===0)return;M(),ee(t,p.event,c(a));let x=l>0?J(o):null,O=x?y.get(x):void 0;if(O){o.kind==="collab.participants"?O.latest=o:O.repeated+=1;return}let _=o.kind==="session"&&o.phase==="end";if(!w(o,b,A)){_&&u();return}let L=I(F(o,E),t,a);if(g(L),_&&u(),x){let R=setTimeout(()=>v(x),l);R.unref?.(),y.set(x,{event:L,repeated:0,timer:R});}}function d(o){return Object.freeze({id:"telemetry",onDiagnostic:r=>i(r,o),wantsDiagnostic:r=>!T&&(r==="session"?D("sessions")!==null:r!=="performance"||(D("performance")??0)>0&&t.consented())})}async function u(){for(let o of [...y.keys()])v(o);await t.flush();}return {module:d({}),moduleFor(o){return d(chunk7SYLCJFQ_cjs.c(o,"moduleFor"))},record:i,flush:u,async shutdown(){for(let o of [...y.keys()])v(o);T=true,k(),await t.shutdown();}}}function F(e,t){if(t||e.kind!=="document.open"||e.outcome!=="opened"||!("shape"in e))return e;let{shape:m,...n}=e;return n}function I(e,t,m){let n="code"in e?e.code:void 0;return {...e,...n?core.explainDiagnostic(n):{},engineVersion:chunkZ7RURMDH_cjs.b,resource:t.resource,attributes:m}}function ee(e,t,m){let n={metric:(c,f,l={})=>e.metric(c,f,{...l,...m,"docx_editor.version":chunkZ7RURMDH_cjs.b})};switch(t.kind){case "document.open":t.outcome==="opened"?(n.metric(chunkAL2YERWY_cjs.a.documentOpens,1,{outcome:"opened",code:"none",cause:"none",part:"none"}),n.metric(chunkAL2YERWY_cjs.a.documentOpenDuration,t.durationMs/1e3)):n.metric(chunkAL2YERWY_cjs.a.documentOpens,1,{outcome:"rejected",code:t.code,cause:t.cause??"none",part:t.part??"none"});return;case "edit.rejected":n.metric(chunkAL2YERWY_cjs.a.editRejections,1,{code:t.code,cause:t.cause??"none",origin:t.origin,tracked:t.tracked});return;case "review.skipped":n.metric(chunkAL2YERWY_cjs.a.reviewSkipped,t.count,{code:t.code,cause:t.cause??"none",operation:t.operation??"none",change_kind:t.changeKind??"none"});return;case "font.failed":n.metric(chunkAL2YERWY_cjs.a.fontFailures,1,{code:t.code});return;case "history":n.metric(chunkAL2YERWY_cjs.a.historyDiagnostics,1,{code:t.code});return;case "custom-node":n.metric(chunkAL2YERWY_cjs.a.customNodeDiagnostics,1,{code:t.code});return;case "collab.status":n.metric(chunkAL2YERWY_cjs.a.collabClientStatusTransitions,1,{status:t.status,code:t.code??"none"}),t.connectMs!==void 0&&n.metric(chunkAL2YERWY_cjs.a.collabClientConnectDuration,t.connectMs/1e3);return;case "collab.participants":n.metric(chunkAL2YERWY_cjs.a.collabClientParticipants,t.count);return;case "performance":{let c=t.pagesBucket??"unknown";N(n,chunkAL2YERWY_cjs.a.editorInteractionDuration,c,t.interaction),N(n,chunkAL2YERWY_cjs.a.editorLayoutDuration,c,t.layout),N(n,chunkAL2YERWY_cjs.a.editorPaintDuration,c,t.paint);return}case "document.save":n.metric(chunkAL2YERWY_cjs.a.documentSaves,1,{outcome:t.outcome,code:t.outcome==="rejected"?t.code:"none"}),t.outcome==="saved"&&n.metric(chunkAL2YERWY_cjs.a.documentSaveDuration,t.durationMs/1e3);return;case "session":te(n,t);}}function te(e,t){if(t.phase==="start"){e.metric(chunkAL2YERWY_cjs.a.editorSessions,1,{phase:"start"});return}if(t.phase==="end"){e.metric(chunkAL2YERWY_cjs.a.editorSessions,1,{phase:"end"}),e.metric(chunkAL2YERWY_cjs.a.editorSessionDuration,t.durationMs/1e3);return}t.activeMs>0&&e.metric(chunkAL2YERWY_cjs.a.editorActiveTime,t.activeMs/1e3);for(let[m,n]of [["input",t.inputEdits],["command",t.commandEdits],["automation",t.automationEdits]])n>0&&e.metric(chunkAL2YERWY_cjs.a.edits,n,{origin:m});}function N(e,t,m,n){if(!n)return;let c=t.buckets??[];n.bands.forEach((f,l)=>{let g=c[l],E=l===0?0:c[l-1],y=g===void 0?Math.max(n.maxMs/1e3,E+1e-6):(E+g)/2;for(let S=0;S<f;S+=1)e.metric(t,y,{pages:m});});}var oe=new TextEncoder,ne=e=>oe.encode(e).byteLength;function re(e){let t=Math.min(50,Math.max(1,Math.floor(e.batchSize??20))),m=e.flushIntervalMs??1e4,n=[],c,f,l=new Set,g=i=>{try{e.onError?.(i);}catch{}},E=(i,d)=>{if(typeof fetch!="function")return;let u=fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:i,keepalive:d}).then(o=>{if(!o.ok)throw new Error(`telemetry endpoint answered ${o.status}`)}).catch(g).finally(()=>l.delete(u));l.add(u);},y=i=>{let d=globalThis.navigator;if(!e.headers&&typeof d?.sendBeacon=="function")try{if(d.sendBeacon(e.url,new Blob([i],{type:"application/json"})))return}catch{}E(i,true);},S=i=>{let d=Math.min(t,n.length);for(;d>0;){let u=JSON.stringify(n.slice(0,d)),o=ne(u);if(o<=i)return {body:u,bytes:o,count:d};if(d===1)return null;d=Math.ceil(d/2);}return null},k=0,T=false,D=i=>{if(c!==void 0&&clearTimeout(c),c=void 0,f&&!f.consented()){n=[];return}(!i||!T)&&(k=0),T=i;let d=0;for(;n.length;){let u=S(61440-(i?k:0));if(!u){d+=i?n.length:1,n=i?[]:n.slice(1);continue}n=n.slice(u.count),i?(k+=u.bytes,y(u.body)):E(u.body,false);}d&&g(new Error(`telemetry dropped ${d} events that did not fit`));},h=()=>{let i=f?.pageClosing()??false;return i||(T=false),i},w=globalThis.document,M=()=>{w?.visibilityState==="visible"&&(T=false);},v=()=>w?.removeEventListener?.("visibilitychange",M);return {name:"http",attach(i){f=i,w?.addEventListener?.("visibilitychange",M);},event(i){n.push(i),n.length>=t?D(h()):c===void 0&&(c=setTimeout(()=>D(h()),m),c.unref?.());},async flush(){D(h()),await Promise.all(l);},async shutdown(){v(),D(h()),await Promise.all(l);}}}function ie(e={}){return ()=>{let t=globalThis;if(!t.window||!t.document||!t.navigator||t.navigator.globalPrivacyControl===true||t.navigator.doNotTrack==="1")return false;if(!e.optOutKey)return true;try{return globalThis.localStorage?.getItem(e.optOutKey)!=="off"}catch{return true}}}Object.defineProperty(exports,"ENGINE_VERSION",{enumerable:true,get:function(){return chunkZ7RURMDH_cjs.b}});Object.defineProperty(exports,"MAX_METRIC_LABEL_VALUES",{enumerable:true,get:function(){return chunkZ7RURMDH_cjs.a}});Object.defineProperty(exports,"METRICS",{enumerable:true,get:function(){return chunkAL2YERWY_cjs.a}});Object.defineProperty(exports,"prometheusName",{enumerable:true,get:function(){return chunkAL2YERWY_cjs.b}});Object.defineProperty(exports,"callbackExporter",{enumerable:true,get:function(){return chunk3O6TTDB5_cjs.a}});Object.defineProperty(exports,"consoleExporter",{enumerable:true,get:function(){return chunk3O6TTDB5_cjs.e}});Object.defineProperty(exports,"failureCount",{enumerable:true,get:function(){return chunk3O6TTDB5_cjs.d}});Object.defineProperty(exports,"isFailure",{enumerable:true,get:function(){return chunk3O6TTDB5_cjs.c}});Object.defineProperty(exports,"memoryExporter",{enumerable:true,get:function(){return chunk3O6TTDB5_cjs.f}});Object.defineProperty(exports,"explainDiagnostic",{enumerable:true,get:function(){return core.explainDiagnostic}});exports.browserPrivacySignals=ie;exports.createTelemetry=Q;exports.httpExporter=re;
package/dist/index.js CHANGED
@@ -1 +1,6 @@
1
- import {c,b as b$1}from'./chunk-BPVPJKIM.js';export{b as ENGINE_VERSION,a as MAX_METRIC_LABEL_VALUES}from'./chunk-BPVPJKIM.js';import {a as a$1}from'./chunk-RSWAOCAT.js';export{a as METRICS,b as prometheusName}from'./chunk-RSWAOCAT.js';export{a as callbackExporter,e as consoleExporter,d as failureCount,c as isFailure,f as memoryExporter}from'./chunk-NJ5XLQLN.js';import {c as c$1,a,b}from'./chunk-W5HFB5EV.js';import'./chunk-DT2KMPUJ.js';import {explainDiagnostic}from'@docx-editor.dev/core';export{explainDiagnostic}from'@docx-editor.dev/core';var X={documentOpen:true,documentSave:true,sessions:true,editing:true,trackedChanges:true,fonts:true,history:true,customNodes:true,collaborationClient:true,performance:true},Y=new Set(["edit.tracking-required","edit.suggesting-needs-author","edit.tracking-mode-unsupported","edit.tracking-author-required","edit.tracking-unsupported-host"]);function Z(e){switch(e.kind){case "document.open":return "documentOpen";case "document.save":return "documentSave";case "session":return "sessions";case "edit.rejected":return e.tracked||Y.has(e.code)?"trackedChanges":"editing";case "review.skipped":return "trackedChanges";case "font.failed":return "fonts";case "history":return "history";case "custom-node":return "customNodes";case "collab.status":case "collab.participants":return "collaborationClient";case "performance":return "performance";default:return null}}function J(e){return e.kind==="collab.participants"?`${e.editorSessionId}|participants`:e.kind==="edit.rejected"?[e.editorSessionId,e.code,e.cause,e.errorName,e.stage,e.origin,e.tracked,e.command].join("|"):e.kind==="font.failed"?`${e.editorSessionId}|font|${e.code}`:e.kind==="history"||e.kind==="custom-node"?`${e.editorSessionId}|${e.kind}|${e.code}`:e.kind==="collab.status"?`${e.editorSessionId}|status|${e.status}|${e.code??""}|${e.recovering}`:null}function Q(e){let t=c(e),m=e.metricLabels??[];function n(o){let r={};try{let a=typeof e.attributes=="function"?e.attributes():e.attributes;r=c$1(a??{},"attributes");}catch{}return Object.freeze({...r,...o})}function c$2(o){let r={};for(let a of m)o[a]!==void 0&&(r[a]=o[a]);return r}let f=e.include??X,l=e.dedupeWindowMs??1e4,g=o=>{try{if(e.filter&&!e.filter(o))return}catch{return}t.event(o);},E=e.documentShape==="detailed",y=new Map,S=false,k=()=>{},T=false;function D(o){let r=f[o];return r?r===true?1:Math.min(1,Math.max(0,r.sampleRate??1)):null}let h=new Map;function w(o,r,a){if(a>=1)return true;if(r!=="performance"&&r!=="sessions")return Math.random()<a;let p=`${r}|${o.editorSessionId}`,b=h.get(p);return b===void 0&&(h.size>=1e3&&h.clear(),b=Math.random()<a,h.set(p,b)),b}function M(){if(S)return;S=true;let o=globalThis;if(typeof o.addEventListener!="function")return;let r=()=>{t.setPageClosing(true),u();},a=()=>{let p=globalThis.document?.visibilityState==="hidden";t.setPageClosing(p),p&&u();};o.addEventListener("pagehide",r),o.addEventListener("visibilitychange",a),k=()=>{o.removeEventListener?.("pagehide",r),o.removeEventListener?.("visibilitychange",a);};}function v(o){let r=y.get(o);if(r){if(y.delete(o),clearTimeout(r.timer),r.latest){let a=r.event;r.latest.count!==a.count&&g(I(F(r.latest,E),t,r.event.attributes));}else if(r.repeated>0){let{connectMs:a$1,...p}=r.event;g({...p,repeated:Math.min(r.repeated,a)});}}}function i(o,r={}){if(T||!t.consented())return;let a=n(r),p=b(I(o,t,a));if("dropped"in p){t.metric(a$1.droppedEvents,1,{...c$2(a),reason:p.dropped,"docx_editor.version":b$1});return}let b$2=Z(o),A=b$2?D(b$2):null;if(A===null||b$2==="performance"&&A===0)return;M(),ee(t,p.event,c$2(a));let x=l>0?J(o):null,O=x?y.get(x):void 0;if(O){o.kind==="collab.participants"?O.latest=o:O.repeated+=1;return}let _=o.kind==="session"&&o.phase==="end";if(!w(o,b$2,A)){_&&u();return}let L=I(F(o,E),t,a);if(g(L),_&&u(),x){let R=setTimeout(()=>v(x),l);R.unref?.(),y.set(x,{event:L,repeated:0,timer:R});}}function d(o){return Object.freeze({id:"telemetry",onDiagnostic:r=>i(r,o),wantsDiagnostic:r=>!T&&(r==="session"?D("sessions")!==null:r!=="performance"||(D("performance")??0)>0&&t.consented())})}async function u(){for(let o of [...y.keys()])v(o);await t.flush();}return {module:d({}),moduleFor(o){return d(c$1(o,"moduleFor"))},record:i,flush:u,async shutdown(){for(let o of [...y.keys()])v(o);T=true,k(),await t.shutdown();}}}function F(e,t){if(t||e.kind!=="document.open"||e.outcome!=="opened"||!("shape"in e))return e;let{shape:m,...n}=e;return n}function I(e,t,m){let n="code"in e?e.code:void 0;return {...e,...n?explainDiagnostic(n):{},engineVersion:b$1,resource:t.resource,attributes:m}}function ee(e,t,m){let n={metric:(c,f,l={})=>e.metric(c,f,{...l,...m,"docx_editor.version":b$1})};switch(t.kind){case "document.open":t.outcome==="opened"?(n.metric(a$1.documentOpens,1,{outcome:"opened",code:"none",cause:"none",part:"none"}),n.metric(a$1.documentOpenDuration,t.durationMs/1e3)):n.metric(a$1.documentOpens,1,{outcome:"rejected",code:t.code,cause:t.cause??"none",part:t.part??"none"});return;case "edit.rejected":n.metric(a$1.editRejections,1,{code:t.code,cause:t.cause??"none",origin:t.origin,tracked:t.tracked});return;case "review.skipped":n.metric(a$1.reviewSkipped,t.count,{code:t.code,cause:t.cause??"none",operation:t.operation??"none",change_kind:t.changeKind??"none"});return;case "font.failed":n.metric(a$1.fontFailures,1,{code:t.code});return;case "history":n.metric(a$1.historyDiagnostics,1,{code:t.code});return;case "custom-node":n.metric(a$1.customNodeDiagnostics,1,{code:t.code});return;case "collab.status":n.metric(a$1.collabClientStatusTransitions,1,{status:t.status,code:t.code??"none"}),t.connectMs!==void 0&&n.metric(a$1.collabClientConnectDuration,t.connectMs/1e3);return;case "collab.participants":n.metric(a$1.collabClientParticipants,t.count);return;case "performance":{let c=t.pagesBucket??"unknown";N(n,a$1.editorInteractionDuration,c,t.interaction),N(n,a$1.editorLayoutDuration,c,t.layout),N(n,a$1.editorPaintDuration,c,t.paint);return}case "document.save":n.metric(a$1.documentSaves,1,{outcome:t.outcome,code:t.outcome==="rejected"?t.code:"none"}),t.outcome==="saved"&&n.metric(a$1.documentSaveDuration,t.durationMs/1e3);return;case "session":te(n,t);}}function te(e,t){if(t.phase==="start"){e.metric(a$1.editorSessions,1,{phase:"start"});return}if(t.phase==="end"){e.metric(a$1.editorSessions,1,{phase:"end"}),e.metric(a$1.editorSessionDuration,t.durationMs/1e3);return}t.activeMs>0&&e.metric(a$1.editorActiveTime,t.activeMs/1e3);for(let[m,n]of [["input",t.inputEdits],["command",t.commandEdits],["automation",t.automationEdits]])n>0&&e.metric(a$1.edits,n,{origin:m});}function N(e,t,m,n){if(!n)return;let c=t.buckets??[];n.bands.forEach((f,l)=>{let g=c[l],E=l===0?0:c[l-1],y=g===void 0?Math.max(n.maxMs/1e3,E+1e-6):(E+g)/2;for(let S=0;S<f;S+=1)e.metric(t,y,{pages:m});});}var oe=new TextEncoder,ne=e=>oe.encode(e).byteLength;function re(e){let t=Math.min(50,Math.max(1,Math.floor(e.batchSize??20))),m=e.flushIntervalMs??1e4,n=[],c,f,l=new Set,g=i=>{try{e.onError?.(i);}catch{}},E=(i,d)=>{if(typeof fetch!="function")return;let u=fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:i,keepalive:d}).then(o=>{if(!o.ok)throw new Error(`telemetry endpoint answered ${o.status}`)}).catch(g).finally(()=>l.delete(u));l.add(u);},y=i=>{let d=globalThis.navigator;if(!e.headers&&typeof d?.sendBeacon=="function")try{if(d.sendBeacon(e.url,new Blob([i],{type:"application/json"})))return}catch{}E(i,true);},S=i=>{let d=Math.min(t,n.length);for(;d>0;){let u=JSON.stringify(n.slice(0,d)),o=ne(u);if(o<=i)return {body:u,bytes:o,count:d};if(d===1)return null;d=Math.ceil(d/2);}return null},k=0,T=false,D=i=>{if(c!==void 0&&clearTimeout(c),c=void 0,f&&!f.consented()){n=[];return}(!i||!T)&&(k=0),T=i;let d=0;for(;n.length;){let u=S(61440-(i?k:0));if(!u){d+=i?n.length:1,n=i?[]:n.slice(1);continue}n=n.slice(u.count),i?(k+=u.bytes,y(u.body)):E(u.body,false);}d&&g(new Error(`telemetry dropped ${d} events that did not fit`));},h=()=>{let i=f?.pageClosing()??false;return i||(T=false),i},w=globalThis.document,M=()=>{w?.visibilityState==="visible"&&(T=false);},v=()=>w?.removeEventListener?.("visibilitychange",M);return {name:"http",attach(i){f=i,w?.addEventListener?.("visibilitychange",M);},event(i){n.push(i),n.length>=t?D(h()):c===void 0&&(c=setTimeout(()=>D(h()),m),c.unref?.());},async flush(){D(h()),await Promise.all(l);},async shutdown(){v(),D(h()),await Promise.all(l);}}}function ie(e={}){return ()=>{let t=globalThis;if(!t.window||!t.document||!t.navigator||t.navigator.globalPrivacyControl===true||t.navigator.doNotTrack==="1")return false;if(!e.optOutKey)return true;try{return globalThis.localStorage?.getItem(e.optOutKey)!=="off"}catch{return true}}}export{ie as browserPrivacySignals,Q as createTelemetry,re as httpExporter};
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ import {c,b as b$1}from'./chunk-OMBPGHSR.js';export{b as ENGINE_VERSION,a as MAX_METRIC_LABEL_VALUES}from'./chunk-OMBPGHSR.js';import {a as a$1}from'./chunk-RSWAOCAT.js';export{a as METRICS,b as prometheusName}from'./chunk-RSWAOCAT.js';export{a as callbackExporter,e as consoleExporter,d as failureCount,c as isFailure,f as memoryExporter}from'./chunk-NJ5XLQLN.js';import {c as c$1,a,b}from'./chunk-W5HFB5EV.js';import'./chunk-DT2KMPUJ.js';import {explainDiagnostic}from'@docx-editor.dev/core';export{explainDiagnostic}from'@docx-editor.dev/core';var X={documentOpen:true,documentSave:true,sessions:true,editing:true,trackedChanges:true,fonts:true,history:true,customNodes:true,collaborationClient:true,performance:true},Y=new Set(["edit.tracking-required","edit.suggesting-needs-author","edit.tracking-mode-unsupported","edit.tracking-author-required","edit.tracking-unsupported-host"]);function Z(e){switch(e.kind){case "document.open":return "documentOpen";case "document.save":return "documentSave";case "session":return "sessions";case "edit.rejected":return e.tracked||Y.has(e.code)?"trackedChanges":"editing";case "review.skipped":return "trackedChanges";case "font.failed":return "fonts";case "history":return "history";case "custom-node":return "customNodes";case "collab.status":case "collab.participants":return "collaborationClient";case "performance":return "performance";default:return null}}function J(e){return e.kind==="collab.participants"?`${e.editorSessionId}|participants`:e.kind==="edit.rejected"?[e.editorSessionId,e.code,e.cause,e.errorName,e.stage,e.origin,e.tracked,e.command].join("|"):e.kind==="font.failed"?`${e.editorSessionId}|font|${e.code}`:e.kind==="history"||e.kind==="custom-node"?`${e.editorSessionId}|${e.kind}|${e.code}`:e.kind==="collab.status"?`${e.editorSessionId}|status|${e.status}|${e.code??""}|${e.recovering}`:null}function Q(e){let t=c(e),m=e.metricLabels??[];function n(o){let r={};try{let a=typeof e.attributes=="function"?e.attributes():e.attributes;r=c$1(a??{},"attributes");}catch{}return Object.freeze({...r,...o})}function c$2(o){let r={};for(let a of m)o[a]!==void 0&&(r[a]=o[a]);return r}let f=e.include??X,l=e.dedupeWindowMs??1e4,g=o=>{try{if(e.filter&&!e.filter(o))return}catch{return}t.event(o);},E=e.documentShape==="detailed",y=new Map,S=false,k=()=>{},T=false;function D(o){let r=f[o];return r?r===true?1:Math.min(1,Math.max(0,r.sampleRate??1)):null}let h=new Map;function w(o,r,a){if(a>=1)return true;if(r!=="performance"&&r!=="sessions")return Math.random()<a;let p=`${r}|${o.editorSessionId}`,b=h.get(p);return b===void 0&&(h.size>=1e3&&h.clear(),b=Math.random()<a,h.set(p,b)),b}function M(){if(S)return;S=true;let o=globalThis;if(typeof o.addEventListener!="function")return;let r=()=>{t.setPageClosing(true),u();},a=()=>{let p=globalThis.document?.visibilityState==="hidden";t.setPageClosing(p),p&&u();};o.addEventListener("pagehide",r),o.addEventListener("visibilitychange",a),k=()=>{o.removeEventListener?.("pagehide",r),o.removeEventListener?.("visibilitychange",a);};}function v(o){let r=y.get(o);if(r){if(y.delete(o),clearTimeout(r.timer),r.latest){let a=r.event;r.latest.count!==a.count&&g(I(F(r.latest,E),t,r.event.attributes));}else if(r.repeated>0){let{connectMs:a$1,...p}=r.event;g({...p,repeated:Math.min(r.repeated,a)});}}}function i(o,r={}){if(T||!t.consented())return;let a=n(r),p=b(I(o,t,a));if("dropped"in p){t.metric(a$1.droppedEvents,1,{...c$2(a),reason:p.dropped,"docx_editor.version":b$1});return}let b$2=Z(o),A=b$2?D(b$2):null;if(A===null||b$2==="performance"&&A===0)return;M(),ee(t,p.event,c$2(a));let x=l>0?J(o):null,O=x?y.get(x):void 0;if(O){o.kind==="collab.participants"?O.latest=o:O.repeated+=1;return}let _=o.kind==="session"&&o.phase==="end";if(!w(o,b$2,A)){_&&u();return}let L=I(F(o,E),t,a);if(g(L),_&&u(),x){let R=setTimeout(()=>v(x),l);R.unref?.(),y.set(x,{event:L,repeated:0,timer:R});}}function d(o){return Object.freeze({id:"telemetry",onDiagnostic:r=>i(r,o),wantsDiagnostic:r=>!T&&(r==="session"?D("sessions")!==null:r!=="performance"||(D("performance")??0)>0&&t.consented())})}async function u(){for(let o of [...y.keys()])v(o);await t.flush();}return {module:d({}),moduleFor(o){return d(c$1(o,"moduleFor"))},record:i,flush:u,async shutdown(){for(let o of [...y.keys()])v(o);T=true,k(),await t.shutdown();}}}function F(e,t){if(t||e.kind!=="document.open"||e.outcome!=="opened"||!("shape"in e))return e;let{shape:m,...n}=e;return n}function I(e,t,m){let n="code"in e?e.code:void 0;return {...e,...n?explainDiagnostic(n):{},engineVersion:b$1,resource:t.resource,attributes:m}}function ee(e,t,m){let n={metric:(c,f,l={})=>e.metric(c,f,{...l,...m,"docx_editor.version":b$1})};switch(t.kind){case "document.open":t.outcome==="opened"?(n.metric(a$1.documentOpens,1,{outcome:"opened",code:"none",cause:"none",part:"none"}),n.metric(a$1.documentOpenDuration,t.durationMs/1e3)):n.metric(a$1.documentOpens,1,{outcome:"rejected",code:t.code,cause:t.cause??"none",part:t.part??"none"});return;case "edit.rejected":n.metric(a$1.editRejections,1,{code:t.code,cause:t.cause??"none",origin:t.origin,tracked:t.tracked});return;case "review.skipped":n.metric(a$1.reviewSkipped,t.count,{code:t.code,cause:t.cause??"none",operation:t.operation??"none",change_kind:t.changeKind??"none"});return;case "font.failed":n.metric(a$1.fontFailures,1,{code:t.code});return;case "history":n.metric(a$1.historyDiagnostics,1,{code:t.code});return;case "custom-node":n.metric(a$1.customNodeDiagnostics,1,{code:t.code});return;case "collab.status":n.metric(a$1.collabClientStatusTransitions,1,{status:t.status,code:t.code??"none"}),t.connectMs!==void 0&&n.metric(a$1.collabClientConnectDuration,t.connectMs/1e3);return;case "collab.participants":n.metric(a$1.collabClientParticipants,t.count);return;case "performance":{let c=t.pagesBucket??"unknown";N(n,a$1.editorInteractionDuration,c,t.interaction),N(n,a$1.editorLayoutDuration,c,t.layout),N(n,a$1.editorPaintDuration,c,t.paint);return}case "document.save":n.metric(a$1.documentSaves,1,{outcome:t.outcome,code:t.outcome==="rejected"?t.code:"none"}),t.outcome==="saved"&&n.metric(a$1.documentSaveDuration,t.durationMs/1e3);return;case "session":te(n,t);}}function te(e,t){if(t.phase==="start"){e.metric(a$1.editorSessions,1,{phase:"start"});return}if(t.phase==="end"){e.metric(a$1.editorSessions,1,{phase:"end"}),e.metric(a$1.editorSessionDuration,t.durationMs/1e3);return}t.activeMs>0&&e.metric(a$1.editorActiveTime,t.activeMs/1e3);for(let[m,n]of [["input",t.inputEdits],["command",t.commandEdits],["automation",t.automationEdits]])n>0&&e.metric(a$1.edits,n,{origin:m});}function N(e,t,m,n){if(!n)return;let c=t.buckets??[];n.bands.forEach((f,l)=>{let g=c[l],E=l===0?0:c[l-1],y=g===void 0?Math.max(n.maxMs/1e3,E+1e-6):(E+g)/2;for(let S=0;S<f;S+=1)e.metric(t,y,{pages:m});});}var oe=new TextEncoder,ne=e=>oe.encode(e).byteLength;function re(e){let t=Math.min(50,Math.max(1,Math.floor(e.batchSize??20))),m=e.flushIntervalMs??1e4,n=[],c,f,l=new Set,g=i=>{try{e.onError?.(i);}catch{}},E=(i,d)=>{if(typeof fetch!="function")return;let u=fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:i,keepalive:d}).then(o=>{if(!o.ok)throw new Error(`telemetry endpoint answered ${o.status}`)}).catch(g).finally(()=>l.delete(u));l.add(u);},y=i=>{let d=globalThis.navigator;if(!e.headers&&typeof d?.sendBeacon=="function")try{if(d.sendBeacon(e.url,new Blob([i],{type:"application/json"})))return}catch{}E(i,true);},S=i=>{let d=Math.min(t,n.length);for(;d>0;){let u=JSON.stringify(n.slice(0,d)),o=ne(u);if(o<=i)return {body:u,bytes:o,count:d};if(d===1)return null;d=Math.ceil(d/2);}return null},k=0,T=false,D=i=>{if(c!==void 0&&clearTimeout(c),c=void 0,f&&!f.consented()){n=[];return}(!i||!T)&&(k=0),T=i;let d=0;for(;n.length;){let u=S(61440-(i?k:0));if(!u){d+=i?n.length:1,n=i?[]:n.slice(1);continue}n=n.slice(u.count),i?(k+=u.bytes,y(u.body)):E(u.body,false);}d&&g(new Error(`telemetry dropped ${d} events that did not fit`));},h=()=>{let i=f?.pageClosing()??false;return i||(T=false),i},w=globalThis.document,M=()=>{w?.visibilityState==="visible"&&(T=false);},v=()=>w?.removeEventListener?.("visibilitychange",M);return {name:"http",attach(i){f=i,w?.addEventListener?.("visibilitychange",M);},event(i){n.push(i),n.length>=t?D(h()):c===void 0&&(c=setTimeout(()=>D(h()),m),c.unref?.());},async flush(){D(h()),await Promise.all(l);},async shutdown(){v(),D(h()),await Promise.all(l);}}}function ie(e={}){return ()=>{let t=globalThis;if(!t.window||!t.document||!t.navigator||t.navigator.globalPrivacyControl===true||t.navigator.doNotTrack==="1")return false;if(!e.optOutKey)return true;try{return globalThis.localStorage?.getItem(e.optOutKey)!=="off"}catch{return true}}}export{ie as browserPrivacySignals,Q as createTelemetry,re as httpExporter};
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  'use strict';var chunk3O6TTDB5_cjs=require('../chunk-3O6TTDB5.cjs'),chunk7SYLCJFQ_cjs=require('../chunk-7SYLCJFQ.cjs');require('../chunk-WGWKNKUT.cjs');var b=50,o=e=>typeof e=="string",u=e=>typeof e=="number"&&Number.isFinite(e),p=e=>typeof e=="boolean",h={"edit.rejected":[["code",o],["origin",o],["tracked",p]],"review.skipped":[["code",o],["count",u]],"font.failed":[["code",o]],history:[["code",o]],"custom-node":[["code",o]],"collab.status":[["status",o],["previous",o],["recovering",p]],"collab.participants":[["count",u]],performance:[["windowMs",u]]},E=["durationMs","activeMs","inputEdits","commandEdits","automationEdits"];function T(e){if(!u(e.schemaVersion)||!u(e.time)||!o(e.editorSessionId)||!o(e.engineVersion))return false;if(e.kind==="document.open")return e.outcome==="opened"?o(e.sizeBucket)&&u(e.durationMs):e.outcome==="rejected"&&o(e.code);if(e.kind==="document.save")return u(e.durationMs)&&(e.outcome==="saved"?o(e.sizeBucket):e.outcome==="rejected"&&o(e.code));if(e.kind==="session")return e.phase==="start"||(e.phase==="active"||e.phase==="end")&&E.every(t=>u(e[t]));let n=h[e.kind];return !!n&&n.every(([t,s])=>s(e[t]))}function w(e,n){if(n.size===0)return {};let t=chunk7SYLCJFQ_cjs.d(e)??{};return Object.fromEntries(Object.entries(t).filter(([s])=>n.has(s)))}function R(e,n={}){let t=n.maxEvents??b,s=new Set(n.attributeKeys??[]);return !Array.isArray(e)||e.length>t?[]:e.flatMap(r=>{if(!r||typeof r!="object"||Array.isArray(r))return [];let a=r,{resource:d,attributes:l,...i}=a,c=chunk7SYLCJFQ_cjs.b(i);if("dropped"in c||!T(c.event))return [];let g=w(a.attributes,s),{attributes:O,...k}=c.event;return [Object.freeze({...k,resource:w(a.resource,s),attributes:g})]})}function _(e){let{hint:n,docs:t,...s}=e,r="code"in e&&e.code?` ${e.code}`:"";return {...s,dt:e.time,message:`${e.kind}${r}`,occurrences:e.repeated??1,failures:chunk3O6TTDB5_cjs.d(e)}}var x=64*1024;async function A(e,n){if(Number(e.headers.get("content-length")??0)>n)return null;let t=e.body;if(!t)return "";let s=t.getReader(),r=[],a=0;for(;;){let{done:i,value:c}=await s.read();if(i)break;if(a+=c.byteLength,a>n)return await s.cancel().catch(()=>{}),null;r.push(c);}let d=new Uint8Array(a),l=0;for(let i of r)d.set(i,l),l+=i.byteLength;return new TextDecoder().decode(d)}function F(e){let n=e.maxBodyBytes??x,t=()=>new Response(null,{status:204}),s=r=>{try{e.onError?.(r);}catch{}};return async r=>{if(r.method!=="POST")return t();if(e.allowedOrigins){let i=r.headers.get("origin");if(!i||!e.allowedOrigins.includes(i))return t()}let a;try{a=await A(r,n);}catch{return t()}if(a===null)return t();let d;try{d=JSON.parse(a);}catch{return t()}let l=R(d,e);if(!l.length)return t();try{let c=await e.forward(l);if(c&&c.ok===!1)throw new Error(`the log service answered ${String(c.status)}`)}catch(i){s(i);}return t()}}exports.telemetryRoute=F;exports.toLogRecord=_;exports.validateTelemetryEvents=R;
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  import {d}from'../chunk-NJ5XLQLN.js';import {b as b$1,d as d$1}from'../chunk-W5HFB5EV.js';import'../chunk-DT2KMPUJ.js';var b=50,o=e=>typeof e=="string",u=e=>typeof e=="number"&&Number.isFinite(e),p=e=>typeof e=="boolean",h={"edit.rejected":[["code",o],["origin",o],["tracked",p]],"review.skipped":[["code",o],["count",u]],"font.failed":[["code",o]],history:[["code",o]],"custom-node":[["code",o]],"collab.status":[["status",o],["previous",o],["recovering",p]],"collab.participants":[["count",u]],performance:[["windowMs",u]]},E=["durationMs","activeMs","inputEdits","commandEdits","automationEdits"];function T(e){if(!u(e.schemaVersion)||!u(e.time)||!o(e.editorSessionId)||!o(e.engineVersion))return false;if(e.kind==="document.open")return e.outcome==="opened"?o(e.sizeBucket)&&u(e.durationMs):e.outcome==="rejected"&&o(e.code);if(e.kind==="document.save")return u(e.durationMs)&&(e.outcome==="saved"?o(e.sizeBucket):e.outcome==="rejected"&&o(e.code));if(e.kind==="session")return e.phase==="start"||(e.phase==="active"||e.phase==="end")&&E.every(t=>u(e[t]));let n=h[e.kind];return !!n&&n.every(([t,s])=>s(e[t]))}function w(e,n){if(n.size===0)return {};let t=d$1(e)??{};return Object.fromEntries(Object.entries(t).filter(([s])=>n.has(s)))}function R(e,n={}){let t=n.maxEvents??b,s=new Set(n.attributeKeys??[]);return !Array.isArray(e)||e.length>t?[]:e.flatMap(r=>{if(!r||typeof r!="object"||Array.isArray(r))return [];let a=r,{resource:d,attributes:l,...i}=a,c=b$1(i);if("dropped"in c||!T(c.event))return [];let g=w(a.attributes,s),{attributes:O,...k}=c.event;return [Object.freeze({...k,resource:w(a.resource,s),attributes:g})]})}function _(e){let{hint:n,docs:t,...s}=e,r="code"in e&&e.code?` ${e.code}`:"";return {...s,dt:e.time,message:`${e.kind}${r}`,occurrences:e.repeated??1,failures:d(e)}}var x=64*1024;async function A(e,n){if(Number(e.headers.get("content-length")??0)>n)return null;let t=e.body;if(!t)return "";let s=t.getReader(),r=[],a=0;for(;;){let{done:i,value:c}=await s.read();if(i)break;if(a+=c.byteLength,a>n)return await s.cancel().catch(()=>{}),null;r.push(c);}let d=new Uint8Array(a),l=0;for(let i of r)d.set(i,l),l+=i.byteLength;return new TextDecoder().decode(d)}function F(e){let n=e.maxBodyBytes??x,t=()=>new Response(null,{status:204}),s=r=>{try{e.onError?.(r);}catch{}};return async r=>{if(r.method!=="POST")return t();if(e.allowedOrigins){let i=r.headers.get("origin");if(!i||!e.allowedOrigins.includes(i))return t()}let a;try{a=await A(r,n);}catch{return t()}if(a===null)return t();let d;try{d=JSON.parse(a);}catch{return t()}let l=R(d,e);if(!l.length)return t();try{let c=await e.forward(l);if(c&&c.ok===!1)throw new Error(`the log service answered ${String(c.status)}`)}catch(i){s(i);}return t()}}export{F as telemetryRoute,_ as toLogRecord,R as validateTelemetryEvents};
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  'use strict';var chunk3O6TTDB5_cjs=require('../chunk-3O6TTDB5.cjs'),chunkWGWKNKUT_cjs=require('../chunk-WGWKNKUT.cjs'),api=require('@opentelemetry/api');var E="@docx-editor.dev/telemetry";function M(o){let n=o.getDelegate?.()??o;return /^Noop/.test(n?.constructor?.name??"")}var k=false;function h(o,n){let s=chunkWGWKNKUT_cjs.a();k||s==="production"||!M(o)||!M(n)||(k=true,console.warn("[docx-editor telemetry] otelExporter found no OpenTelemetry SDK. Register a MeterProvider and a TracerProvider before creating the exporter, or pass them as options. Until then every measurement is dropped."));}function C(o,n,s){return o.createObservableGauge(n.name,{unit:n.unit,description:n.description}).addCallback(t=>{for(let{value:i,attributes:a}of s.values())t.observe(i,a);}),{record(t,i={}){s.set(g(i),{value:t,attributes:i});},forget(t){s.delete(g(t));}}}function g(o){return JSON.stringify(Object.keys(o).sort().map(n=>[n,o[n]]))}function f(o){let n={...o.resource,...o.attributes};for(let[s,t]of Object.entries(o))if(!(s==="resource"||s==="attributes"||s==="hint"||s==="docs")){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")n[`docx_editor.${s}`]=t;else if(s==="shape"&&t&&typeof t=="object")for(let[i,a]of Object.entries(t))typeof a=="string"&&(n[`docx_editor.shape.${i}`]=a);else if(t&&typeof t=="object"&&!Array.isArray(t))for(let[i,a]of Object.entries(t))typeof a=="number"&&(n[`docx_editor.${s}.${i}`]=a);}return n}function j(o={}){let n=o.scope??E,s=()=>o.meterProvider??api.metrics.getMeterProvider(),t=()=>o.tracerProvider??api.trace.getTracerProvider(),i,a,l=new Map,m=new Map,b=false;function P(e){let r=m.get(e);return r||(r=new Map,m.set(e,r)),r}function T(){let e=s();return (e!==i||!a)&&(i=e,a=e.getMeter(n),l.clear()),a}function A(e){let r=T();b||(b=true,setTimeout(()=>h(s(),t()),5e3).unref?.());let c=l.get(e.name);if(c)return c;let u={unit:e.unit,description:e.description},d=e.kind==="counter"?r.createCounter(e.name,u):e.kind==="histogram"?r.createHistogram(e.name,{...u,...e.buckets?{advice:{explicitBucketBoundaries:[...e.buckets]}}:{}}):C(r,e,P(e.name));return l.set(e.name,d),d}return {name:"otel",metric(e){let r=A(e.definition),c=e.attributes;"add"in r?r.add(e.value,c):r.record(e.value,c);},event(e){if(e.kind==="document.open"||e.kind==="document.save"){let u=e.kind==="document.save"||e.outcome==="opened"?e.durationMs:0,d=e.time-u,p=t().getTracer(n).startSpan(`docx_editor.${e.kind}`,{startTime:d,attributes:f(e)},o.parentContext?.());e.outcome==="rejected"&&p.setStatus({code:api.SpanStatusCode.ERROR,message:e.code}),p.end(e.time);return}let r=api.trace.getActiveSpan();if(r){r.addEvent(`docx_editor.${e.kind}`,f(e));return}if(!chunk3O6TTDB5_cjs.c(e))return;let c=t().getTracer(n).startSpan(`docx_editor.${e.kind}`,{startTime:e.time,attributes:f(e)},o.parentContext?.());c.setStatus({code:api.SpanStatusCode.ERROR,message:"code"in e?e.code:e.kind}),c.end(e.time);},forget(e,r){m.get(e.name)?.delete(g(r));},async flush(){let e=r=>(r.getDelegate?.()??r).forceFlush?.();await Promise.all([e(s()),e(t())]);}}}exports.otelExporter=j;
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  import {c}from'../chunk-NJ5XLQLN.js';import {a}from'../chunk-DT2KMPUJ.js';import {SpanStatusCode,trace,metrics}from'@opentelemetry/api';var E="@docx-editor.dev/telemetry";function M(o){let n=o.getDelegate?.()??o;return /^Noop/.test(n?.constructor?.name??"")}var k=false;function h(o,n){let s=a();k||s==="production"||!M(o)||!M(n)||(k=true,console.warn("[docx-editor telemetry] otelExporter found no OpenTelemetry SDK. Register a MeterProvider and a TracerProvider before creating the exporter, or pass them as options. Until then every measurement is dropped."));}function C(o,n,s){return o.createObservableGauge(n.name,{unit:n.unit,description:n.description}).addCallback(t=>{for(let{value:i,attributes:a}of s.values())t.observe(i,a);}),{record(t,i={}){s.set(g(i),{value:t,attributes:i});},forget(t){s.delete(g(t));}}}function g(o){return JSON.stringify(Object.keys(o).sort().map(n=>[n,o[n]]))}function f(o){let n={...o.resource,...o.attributes};for(let[s,t]of Object.entries(o))if(!(s==="resource"||s==="attributes"||s==="hint"||s==="docs")){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")n[`docx_editor.${s}`]=t;else if(s==="shape"&&t&&typeof t=="object")for(let[i,a]of Object.entries(t))typeof a=="string"&&(n[`docx_editor.shape.${i}`]=a);else if(t&&typeof t=="object"&&!Array.isArray(t))for(let[i,a]of Object.entries(t))typeof a=="number"&&(n[`docx_editor.${s}.${i}`]=a);}return n}function j(o={}){let n=o.scope??E,s=()=>o.meterProvider??metrics.getMeterProvider(),t=()=>o.tracerProvider??trace.getTracerProvider(),i,a,l=new Map,m=new Map,b=false;function P(e){let r=m.get(e);return r||(r=new Map,m.set(e,r)),r}function T(){let e=s();return (e!==i||!a)&&(i=e,a=e.getMeter(n),l.clear()),a}function A(e){let r=T();b||(b=true,setTimeout(()=>h(s(),t()),5e3).unref?.());let c=l.get(e.name);if(c)return c;let u={unit:e.unit,description:e.description},d=e.kind==="counter"?r.createCounter(e.name,u):e.kind==="histogram"?r.createHistogram(e.name,{...u,...e.buckets?{advice:{explicitBucketBoundaries:[...e.buckets]}}:{}}):C(r,e,P(e.name));return l.set(e.name,d),d}return {name:"otel",metric(e){let r=A(e.definition),c=e.attributes;"add"in r?r.add(e.value,c):r.record(e.value,c);},event(e){if(e.kind==="document.open"||e.kind==="document.save"){let u=e.kind==="document.save"||e.outcome==="opened"?e.durationMs:0,d=e.time-u,p=t().getTracer(n).startSpan(`docx_editor.${e.kind}`,{startTime:d,attributes:f(e)},o.parentContext?.());e.outcome==="rejected"&&p.setStatus({code:SpanStatusCode.ERROR,message:e.code}),p.end(e.time);return}let r=trace.getActiveSpan();if(r){r.addEvent(`docx_editor.${e.kind}`,f(e));return}if(!c(e))return;let c$1=t().getTracer(n).startSpan(`docx_editor.${e.kind}`,{startTime:e.time,attributes:f(e)},o.parentContext?.());c$1.setStatus({code:SpanStatusCode.ERROR,message:"code"in e?e.code:e.kind}),c$1.end(e.time);},forget(e,r){m.get(e.name)?.delete(g(r));},async flush(){let e=r=>(r.getDelegate?.()??r).forceFlush?.();await Promise.all([e(s()),e(t())]);}}}export{j as otelExporter};
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  'use strict';var chunkQDOUVRQA_cjs=require('../chunk-QDOUVRQA.cjs');require('../chunk-AL2YERWY.cjs');Object.defineProperty(exports,"PROMETHEUS_CONTENT_TYPE",{enumerable:true,get:function(){return chunkQDOUVRQA_cjs.a}});Object.defineProperty(exports,"fetchMetricsHandler",{enumerable:true,get:function(){return chunkQDOUVRQA_cjs.d}});Object.defineProperty(exports,"metricsHandler",{enumerable:true,get:function(){return chunkQDOUVRQA_cjs.c}});Object.defineProperty(exports,"prometheusRegistry",{enumerable:true,get:function(){return chunkQDOUVRQA_cjs.b}});
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  export{a as PROMETHEUS_CONTENT_TYPE,d as fetchMetricsHandler,c as metricsHandler,b as prometheusRegistry}from'../chunk-JM4KJB6O.js';import'../chunk-RSWAOCAT.js';
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  'use strict';var chunk3O6TTDB5_cjs=require('../chunk-3O6TTDB5.cjs');var i=class extends Error{name="DocxEditorDiagnosticError";code;constructor(r,t){super(t?`${r}: ${t}`:r),this.code=r;}},u=new Set(["collab.authentication-failed","collab.room-generation-changed"]),l=new Set(["open.failed","open.unsupported-source","open.invalid-limits"]),f=Object.freeze([".docx-editor",".docx-pages"]);function x(e,r){return e.category?.startsWith("ui.")&&g(r?.event?.target)?null:e}function g(e){try{let r=e;return r&&typeof r.closest!="function"&&(r=r.parentElement),!r||typeof r.closest!="function"?!0:r.closest(f.join(", "))!=null}catch{return true}}function p(e){switch(e.kind){case "document.open":return e.outcome==="rejected"&&l.has(e.code);case "document.save":return e.outcome==="rejected"&&e.code==="save.failed";case "edit.rejected":return e.code==="edit.internal-invariant";case "review.skipped":return e.code==="review.revision-unsupported"||e.code==="review.retained-structure";case "font.failed":return e.code==="font.shaper-unavailable";case "collab.status":return e.status==="error"&&!e.recovering&&!u.has(e.code??"");default:return false}}function m(e){return e.kind==="document.open"?e.outcome==="opened":e.kind==="document.save"?e.outcome==="saved":e.kind==="session"?true:e.kind==="performance"&&e.code===void 0}function c(e){return "code"in e&&e.code?e.code:e.kind}function y(e){let r=e,t={"docx_editor.kind":e.kind,"docx_editor.code":c(e),"docx_editor.version":e.engineVersion,"docx_editor.editor_session":e.editorSessionId};for(let[o,n]of [["origin","origin"],["tracked","tracked"],["status","status"],["outcome","outcome"],["command","command"],["cause","cause"],["part","part"],["errorName","error_name"],["stage","stage"],["operation","operation"],["changeKind","change_kind"],["formattingKind","formatting_kind"]])r[o]!==void 0&&(t[`docx_editor.${n}`]=String(r[o]));for(let[o,n]of Object.entries(e.attributes??{}))t[o]=String(n);return t}function k(e,r){let t=e,o=["cause","errorName","stage","changeKind","formattingKind"].map(n=>t[n]).filter(n=>typeof n=="string");return ["docx-editor",e.kind,r,...o]}function d(e){let{resource:r,...t}=e;return {...t,...Object.keys(r).length?{resource:r}:{}}}function b(e,r={}){let t=r.issue??p,o=r.breadcrumbs??true;return {name:"sentry",event(n){let s=c(n);if(n.repeated===void 0&&t(n)){e.captureException(new i(s,n.hint),{fingerprint:k(n,s),level:n.kind==="font.failed"||n.kind==="review.skipped"?"warning":"error",tags:y(n),contexts:{docx_editor:d(n)}});return}o&&e.addBreadcrumb({category:"docx-editor",message:chunk3O6TTDB5_cjs.b(n),level:m(n)?"info":"warning",data:d(n)});},async flush(){await e.flush?.(2e3);}}}exports.DocxEditorDiagnosticError=i;exports.EDITOR_SELECTORS=f;exports.dropEditorBreadcrumbs=x;exports.isSentryIssue=p;exports.sentryExporter=b;
@@ -1 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
1
6
  import {b as b$1}from'../chunk-NJ5XLQLN.js';var i=class extends Error{name="DocxEditorDiagnosticError";code;constructor(r,t){super(t?`${r}: ${t}`:r),this.code=r;}},u=new Set(["collab.authentication-failed","collab.room-generation-changed"]),l=new Set(["open.failed","open.unsupported-source","open.invalid-limits"]),f=Object.freeze([".docx-editor",".docx-pages"]);function x(e,r){return e.category?.startsWith("ui.")&&g(r?.event?.target)?null:e}function g(e){try{let r=e;return r&&typeof r.closest!="function"&&(r=r.parentElement),!r||typeof r.closest!="function"?!0:r.closest(f.join(", "))!=null}catch{return true}}function p(e){switch(e.kind){case "document.open":return e.outcome==="rejected"&&l.has(e.code);case "document.save":return e.outcome==="rejected"&&e.code==="save.failed";case "edit.rejected":return e.code==="edit.internal-invariant";case "review.skipped":return e.code==="review.revision-unsupported"||e.code==="review.retained-structure";case "font.failed":return e.code==="font.shaper-unavailable";case "collab.status":return e.status==="error"&&!e.recovering&&!u.has(e.code??"");default:return false}}function m(e){return e.kind==="document.open"?e.outcome==="opened":e.kind==="document.save"?e.outcome==="saved":e.kind==="session"?true:e.kind==="performance"&&e.code===void 0}function c(e){return "code"in e&&e.code?e.code:e.kind}function y(e){let r=e,t={"docx_editor.kind":e.kind,"docx_editor.code":c(e),"docx_editor.version":e.engineVersion,"docx_editor.editor_session":e.editorSessionId};for(let[o,n]of [["origin","origin"],["tracked","tracked"],["status","status"],["outcome","outcome"],["command","command"],["cause","cause"],["part","part"],["errorName","error_name"],["stage","stage"],["operation","operation"],["changeKind","change_kind"],["formattingKind","formatting_kind"]])r[o]!==void 0&&(t[`docx_editor.${n}`]=String(r[o]));for(let[o,n]of Object.entries(e.attributes??{}))t[o]=String(n);return t}function k(e,r){let t=e,o=["cause","errorName","stage","changeKind","formattingKind"].map(n=>t[n]).filter(n=>typeof n=="string");return ["docx-editor",e.kind,r,...o]}function d(e){let{resource:r,...t}=e;return {...t,...Object.keys(r).length?{resource:r}:{}}}function b(e,r={}){let t=r.issue??p,o=r.breadcrumbs??true;return {name:"sentry",event(n){let s=c(n);if(n.repeated===void 0&&t(n)){e.captureException(new i(s,n.hint),{fingerprint:k(n,s),level:n.kind==="font.failed"||n.kind==="review.skipped"?"warning":"error",tags:y(n),contexts:{docx_editor:d(n)}});return}o&&e.addBreadcrumb({category:"docx-editor",message:b$1(n),level:m(n)?"info":"warning",data:d(n)});},async flush(){await e.flush?.(2e3);}}}export{i as DocxEditorDiagnosticError,f as EDITOR_SELECTORS,x as dropEditorBreadcrumbs,p as isSentryIssue,b as sentryExporter};
@@ -1 +1,6 @@
1
- 'use strict';var chunkE4QNP535_cjs=require('../chunk-E4QNP535.cjs');require('../chunk-USA7TSUJ.cjs'),require('../chunk-AL2YERWY.cjs'),require('../chunk-7SYLCJFQ.cjs'),require('../chunk-WGWKNKUT.cjs');Object.defineProperty(exports,"hmacRoomLabel",{enumerable:true,get:function(){return chunkE4QNP535_cjs.a}});Object.defineProperty(exports,"roomTelemetry",{enumerable:true,get:function(){return chunkE4QNP535_cjs.b}});
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ 'use strict';var chunkKWUY6LI3_cjs=require('../chunk-KWUY6LI3.cjs');require('../chunk-Z7RURMDH.cjs'),require('../chunk-AL2YERWY.cjs'),require('../chunk-7SYLCJFQ.cjs'),require('../chunk-WGWKNKUT.cjs');Object.defineProperty(exports,"hmacRoomLabel",{enumerable:true,get:function(){return chunkKWUY6LI3_cjs.a}});Object.defineProperty(exports,"roomTelemetry",{enumerable:true,get:function(){return chunkKWUY6LI3_cjs.b}});
@@ -1 +1,6 @@
1
- export{a as hmacRoomLabel,b as roomTelemetry}from'../chunk-2HQP6UUK.js';import'../chunk-BPVPJKIM.js';import'../chunk-RSWAOCAT.js';import'../chunk-W5HFB5EV.js';import'../chunk-DT2KMPUJ.js';
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ export{a as hmacRoomLabel,b as roomTelemetry}from'../chunk-57ARMVFM.js';import'../chunk-OMBPGHSR.js';import'../chunk-RSWAOCAT.js';import'../chunk-W5HFB5EV.js';import'../chunk-DT2KMPUJ.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docx-editor.dev/telemetry",
3
- "version": "2.35.1-canary.20261107032606.sha-f311676",
3
+ "version": "2.36.0",
4
4
  "description": "Anonymous diagnostics, metrics, and error reporting for @docx-editor.dev editors and collaboration servers, with OpenTelemetry, Prometheus, and Sentry exporters.",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -56,8 +56,8 @@
56
56
  "license:add": "license-check-and-add add -f license-check.json"
57
57
  },
58
58
  "peerDependencies": {
59
- "@docx-editor.dev/core": "2.35.1-canary.20261107032606.sha-f311676",
60
- "@docx-editor.dev/pro": "2.35.1-canary.20261107032606.sha-f311676",
59
+ "@docx-editor.dev/core": "~2.36.0",
60
+ "@docx-editor.dev/pro": "~2.36.0",
61
61
  "@opentelemetry/api": "^1.9.0",
62
62
  "yjs": "^13.6.32",
63
63
  "@hocuspocus/server": "^4.6.0"
@@ -99,7 +99,7 @@
99
99
  "collaboration"
100
100
  ],
101
101
  "author": {
102
- "name": "EigenPal, Inc.",
102
+ "name": "Eigenpal, Inc.",
103
103
  "email": "licensing@eigenpal.com",
104
104
  "url": "https://eigenpal.com"
105
105
  },
@@ -1 +0,0 @@
1
- import {a}from'./chunk-RSWAOCAT.js';import {c,b}from'./chunk-W5HFB5EV.js';var A=50,R="2.35.1-canary.20261107032606.sha-f311676";function M(o){let i=[...o.exporters],T=Object.freeze({...c(o.resource??{},"resource")}),d=[...o.metricLabels??[]],m=new Map,b$1=new Set;function y(e){if(d.length===0)return e;let r={...e};for(let t of d){let n=r[t];if(n===void 0)continue;let s=String(n),a=m.get(t);if(a||m.set(t,a=new Set),!a.has(s)){if(a.size>=A){r[t]="other";continue}a.add(s);}}return r}let f=false;function p(e,r){if(!b$1.has(r)){b$1.add(r);try{if(o.onExporterError){let t=o.onExporterError(e,r);t&&typeof t.then=="function"&&Promise.resolve(t).catch(()=>{});}else console.warn(`[docx-editor telemetry] exporter "${r}" failed`,e);}catch{}}}function c$1(e,r){try{let t=r();if(!t||typeof t.then!="function")return;Promise.resolve(t).then(void 0,n=>p(n,e.name));}catch(t){p(t,e.name);}}function v(){let e=o.consent??true;if(typeof e=="boolean")return e;try{return e()===!0}catch{return false}}function u(){return !f&&v()}let E=false,_=()=>E||globalThis.document?.visibilityState==="hidden";for(let e of i)c$1(e,()=>e.attach?.({consented:v,pageClosing:_}));async function g(e){await Promise.all(i.map(async r=>{try{await e(r);}catch(t){p(t,r.name);}}));}return {resource:T,consented:u,event(e){if(!u())return;let r=b(e);if("dropped"in r){this.metric(a.droppedEvents,1,{reason:r.dropped});return}for(let t of i)t.event&&c$1(t,()=>t.event(r.event));},metric(e,r,t={}){if(!u()||!Number.isFinite(r))return;let n={definition:e,value:r,attributes:y(c(t,e.name,[...e.labels,...d]))};for(let s of i)s.metric&&c$1(s,()=>s.metric(n));},forget(e,r){let t=c(r,e.name,e.labels);for(let n of i)n.forget&&c$1(n,()=>n.forget(e,t));},declare(e,r={}){if(!u())return;let t=y(c(r,e.name,[...e.labels,...d]));for(let n of i)n.declare&&c$1(n,()=>n.declare(e,t));},flush:()=>g(e=>e.flush?.()),setPageClosing(e){E=e;},async shutdown(){f||(f=true,await g(e=>e.shutdown?e.shutdown():e.flush?.()));}}}export{A as a,R as b,M as c};
@@ -1 +0,0 @@
1
- 'use strict';var chunkAL2YERWY_cjs=require('./chunk-AL2YERWY.cjs'),chunk7SYLCJFQ_cjs=require('./chunk-7SYLCJFQ.cjs');var A=50,R="2.35.1-canary.20261107032606.sha-f311676";function M(o){let i=[...o.exporters],T=Object.freeze({...chunk7SYLCJFQ_cjs.c(o.resource??{},"resource")}),d=[...o.metricLabels??[]],m=new Map,b=new Set;function y(e){if(d.length===0)return e;let r={...e};for(let t of d){let n=r[t];if(n===void 0)continue;let s=String(n),a=m.get(t);if(a||m.set(t,a=new Set),!a.has(s)){if(a.size>=A){r[t]="other";continue}a.add(s);}}return r}let f=false;function p(e,r){if(!b.has(r)){b.add(r);try{if(o.onExporterError){let t=o.onExporterError(e,r);t&&typeof t.then=="function"&&Promise.resolve(t).catch(()=>{});}else console.warn(`[docx-editor telemetry] exporter "${r}" failed`,e);}catch{}}}function c(e,r){try{let t=r();if(!t||typeof t.then!="function")return;Promise.resolve(t).then(void 0,n=>p(n,e.name));}catch(t){p(t,e.name);}}function v(){let e=o.consent??true;if(typeof e=="boolean")return e;try{return e()===!0}catch{return false}}function u(){return !f&&v()}let E=false,_=()=>E||globalThis.document?.visibilityState==="hidden";for(let e of i)c(e,()=>e.attach?.({consented:v,pageClosing:_}));async function g(e){await Promise.all(i.map(async r=>{try{await e(r);}catch(t){p(t,r.name);}}));}return {resource:T,consented:u,event(e){if(!u())return;let r=chunk7SYLCJFQ_cjs.b(e);if("dropped"in r){this.metric(chunkAL2YERWY_cjs.a.droppedEvents,1,{reason:r.dropped});return}for(let t of i)t.event&&c(t,()=>t.event(r.event));},metric(e,r,t={}){if(!u()||!Number.isFinite(r))return;let n={definition:e,value:r,attributes:y(chunk7SYLCJFQ_cjs.c(t,e.name,[...e.labels,...d]))};for(let s of i)s.metric&&c(s,()=>s.metric(n));},forget(e,r){let t=chunk7SYLCJFQ_cjs.c(r,e.name,e.labels);for(let n of i)n.forget&&c(n,()=>n.forget(e,t));},declare(e,r={}){if(!u())return;let t=y(chunk7SYLCJFQ_cjs.c(r,e.name,[...e.labels,...d]));for(let n of i)n.declare&&c(n,()=>n.declare(e,t));},flush:()=>g(e=>e.flush?.()),setPageClosing(e){E=e;},async shutdown(){f||(f=true,await g(e=>e.shutdown?e.shutdown():e.flush?.()));}}}exports.a=A;exports.b=R;exports.c=M;