writetrack 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/dist/browser/index.js +1 -1
- package/dist/browser/pipes.js +1 -1
- package/dist/browser/viz.js +9 -9
- package/dist/browser/writetrack.wasm +0 -0
- package/dist/esm/index.d.ts +32 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/pipes.js +1 -1
- package/dist/esm/verify.d.ts +1 -1
- package/dist/esm/viz.d.ts +3 -1
- package/dist/esm/viz.js +9 -9
- package/dist/esm/writetrack.wasm +0 -0
- package/dist/index.cjs +1 -1
- package/dist/lexical/index.d.ts +3 -0
- package/dist/pipes.cjs +1 -1
- package/dist/quill/index.d.ts +8 -1
- package/dist/slate/index.d.ts +2 -0
- package/dist/viz.cjs +9 -9
- package/dist/writetrack.wasm +0 -0
- package/package.json +11 -3
package/dist/lexical/index.d.ts
CHANGED
|
@@ -68,6 +68,9 @@ export declare function createWriteTrackLexical(
|
|
|
68
68
|
prevRootElement: HTMLElement | null
|
|
69
69
|
) => void
|
|
70
70
|
): () => void;
|
|
71
|
+
registerUpdateListener(
|
|
72
|
+
listener: (payload: { tags: Set<string> }) => void
|
|
73
|
+
): () => void;
|
|
71
74
|
getEditorState(): {
|
|
72
75
|
read<T>(callback: () => T): T;
|
|
73
76
|
};
|
package/dist/pipes.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var m=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var x=(n,r)=>{for(var o in r)m(n,o,{get:r[o],enumerable:!0})},T=(n,r,o,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of y(r))!b.call(n,e)&&e!==o&&m(n,e,{get:()=>r[e],enumerable:!(t=h(r,e))||t.enumerable});return n};var w=n=>T(m({},"__esModule",{value:!0}),n);var S={};x(S,{datadog:()=>p,opentelemetry:()=>g,segment:()=>d,webhook:()=>f});module.exports=w(S);function f(n){let{url:r,headers:o={},retries:t=0,backoffMs:e=100,maxBackoffMs:a=3e4,keepalive:c=!1}=n;return{async send(v){let u=null;for(let s=0;s<=t;s++){if(s>0){let i=Math.min(e*Math.pow(2,s-1),a);await new Promise(k=>setTimeout(k,i))}try{let i=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",...o},body:JSON.stringify(v),keepalive:c});if(i.ok)return;u=new Error(`Webhook failed: ${i.status} ${i.statusText}`)}catch(i){u=i instanceof Error?i:new Error(String(i))}}throw u}}}function l(n){return n instanceof Error?n.message:String(n)}function p(n){let{client:r,actionName:o="writetrack_session",tags:t={}}=n;return{async send(e){let a={...t,duration:e.metadata.duration,keystrokeCount:e.session.events.length,qualityLevel:e.quality.qualityLevel,targetElement:e.metadata.targetElement,schemaVersion:e.version};e.metadata.userId&&(a.userId=e.metadata.userId),e.metadata.contentId&&(a.contentId=e.metadata.contentId),e.metadata.custom&&(a.custom=e.metadata.custom);try{r.addAction(o,a)}catch(c){throw new Error(`Datadog addAction failed: ${l(c)}`)}}}}function d(n){let{client:r,eventName:o="WriteTrack Session"}=n;return{async send(t){let e={duration:t.metadata.duration,keystrokeCount:t.session.events.length,qualityLevel:t.quality.qualityLevel,targetElement:t.metadata.targetElement,schemaVersion:t.version};t.metadata.userId&&(e.userId=t.metadata.userId),t.metadata.contentId&&(e.contentId=t.metadata.contentId),t.metadata.custom&&(e.custom=t.metadata.custom),r.track(o,e)}}}function g(n){let{tracer:r,spanName:o="writetrack.session"}=n;return{async send(t){let e=r.startSpan(o);try{e.setAttribute("writetrack.duration",t.metadata.duration),e.setAttribute("writetrack.keystroke_count",t.session.events.length),e.setAttribute("writetrack.quality_level",t.quality.qualityLevel),e.setAttribute("writetrack.target_element",t.metadata.targetElement),e.setAttribute("writetrack.schema_version",t.version),t.metadata.userId&&e.setAttribute("writetrack.user_id",t.metadata.userId),t.metadata.contentId&&e.setAttribute("writetrack.content_id",t.metadata.contentId),e.setStatus({code:1})}finally{e.end()}}}}0&&(module.exports={datadog,opentelemetry,segment,webhook});
|
package/dist/quill/index.d.ts
CHANGED
|
@@ -41,6 +41,13 @@ export interface WriteTrackModuleOptions {
|
|
|
41
41
|
export declare class WriteTrackModule {
|
|
42
42
|
get tracker(): WriteTrack | null;
|
|
43
43
|
get isTracking(): boolean;
|
|
44
|
-
constructor(
|
|
44
|
+
constructor(
|
|
45
|
+
quill: {
|
|
46
|
+
root: HTMLElement;
|
|
47
|
+
getSelection(): { index: number; length: number } | null;
|
|
48
|
+
on(event: string, handler: (...args: unknown[]) => void): void;
|
|
49
|
+
},
|
|
50
|
+
options: WriteTrackModuleOptions
|
|
51
|
+
);
|
|
45
52
|
destroy(): void;
|
|
46
53
|
}
|
package/dist/slate/index.d.ts
CHANGED
|
@@ -58,6 +58,8 @@ export interface WriteTrackSlateHandle {
|
|
|
58
58
|
export declare function createWriteTrackSlate(
|
|
59
59
|
editor: {
|
|
60
60
|
selection: { anchor: { offset: number }; focus: { offset: number } } | null;
|
|
61
|
+
insertText: (text: string) => void;
|
|
62
|
+
insertData: (data: DataTransfer) => void;
|
|
61
63
|
},
|
|
62
64
|
element: HTMLElement,
|
|
63
65
|
options: WriteTrackSlateOptions
|
package/dist/viz.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Ft=Object.create;var st=Object.defineProperty;var zt=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var Ht=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty;var jt=(a,t)=>{for(var e in t)st(a,e,{get:t[e],enumerable:!0})},Ct=(a,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Gt(t))!Vt.call(a,r)&&r!==e&&st(a,r,{get:()=>t[r],enumerable:!(n=zt(t,r))||n.enumerable});return a};var P=(a,t,e)=>(e=a!=null?Ft(Ht(a)):{},Ct(t||!a||!a.__esModule?st(e,"default",{value:a,enumerable:!0}):e,a)),qt=a=>Ct(st({},"__esModule",{value:!0}),a);var Be={};jt(Be,{BaseChart:()=>g,CATEGORY_NAMES:()=>B,CompositionTimeline:()=>G,CorrectionsBubble:()=>J,DocumentGrowth:()=>Y,DocumentRibbon:()=>U,EditWaterfall:()=>Q,GLOSSARY:()=>St,IntegrityFooter:()=>_,PauseDistribution:()=>q,RhythmHeatmap:()=>V,SEGMENT_COLORS:()=>ct,Sparkline:()=>lt,SpeedTimeline:()=>F,TIER1_CATEGORIES:()=>pt,TIER2_CATEGORIES:()=>ht,WtScorecard:()=>it,extractCorrectionBubbles:()=>Z,extractGrowthData:()=>K,extractPasteMarkers:()=>bt,extractPauseHistogram:()=>wt,extractRhythmPairs:()=>j,extractRibbonData:()=>vt,extractSegments:()=>H,extractSeries:()=>yt,extractSpeedData:()=>z,extractWaterfallData:()=>X,formatDuration:()=>at,generateCaption:()=>ft,generateSummary:()=>rt,getMetrics:()=>nt,getStatus:()=>W,isPass:()=>Bt,wrapTerms:()=>ot});module.exports=qt(Be);var Tt=`:host {
|
|
2
2
|
--wt-color-primary: #fbbf24;
|
|
3
3
|
--wt-color-secondary: #22d3ee;
|
|
4
4
|
--wt-color-bg: #111113;
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/* Force light text on dark tooltips regardless of chart theme */
|
|
38
|
-
[aria-label="tip"] { color: #fafafa; }`,S={fill:"#1a1a1d",stroke:"#27272a",textPadding:6,fontSize:11,fontFamily:"'JetBrains Mono', ui-monospace, monospace"};var g=class extends HTMLElement{constructor(){super();this._data=null;this._resizeObserver=null;this._resizeRaf=null;this.e=null;this.s=!0;this.a=!1;this.o=!1;this.shadow=this.attachShadow({mode:"open"});let r=document.createElement("style");r.textContent=this.getStylesheet(),this.shadow.appendChild(r),this.container=document.createElement("div"),this.container.className="wt-chart",this.shadow.appendChild(this.container)}static get observedAttributes(){return["data","theme","label"]}getStylesheet(){return St}connectedCallback(){typeof ResizeObserver<"u"&&(this.s=!0,this._resizeObserver=new ResizeObserver(()=>{if(this.s){this.s=!1;return}this._data&&(this._resizeRaf&&cancelAnimationFrame(this._resizeRaf),this._resizeRaf=requestAnimationFrame(()=>{this._resizeRaf=null,this.onResize()}))}),this._resizeObserver.observe(this.container)),this.i(),typeof MutationObserver<"u"&&(this.e=new MutationObserver(()=>{this.i()}),this.e.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),document.body&&this.e.observe(document.body,{attributes:!0,attributeFilter:["data-theme"]}))}disconnectedCallback(){this.destroy()}attributeChangedCallback(r,a,t){if(r==="data"&&t)try{let s=JSON.parse(t);this.setData(s)}catch(s){console.warn("[WriteTrack] BaseChart: invalid JSON in data attribute:",s)}r==="theme"&&this._data&&this.a&&this.render()}setData(r){this._data=r,this.render()}getData(){return this._data}get hasRendered(){return this.a}replaceChart(...r){for(let a of r)if(a instanceof SVGElement){a.setAttribute("role","img");let t=this.getAttribute("label")??this.tagName.toLowerCase().replace("wt-","").replace(/-/g," ")+" chart";a.setAttribute("aria-label",t)}this.container.replaceChildren(...r),this.a=!0,this.dispatchEvent(new CustomEvent("wt-render",{bubbles:!1}))}showEmptyState(r="No data"){let a=document.createElement("div");a.className="wt-empty",a.textContent=r,a.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;font-family:var(--wt-font-ui,system-ui,sans-serif);font-size:11px;color:var(--wt-color-text-muted,#a1a1aa);",this.container.replaceChildren(a),this.a=!1}destroy(){this._resizeRaf&&(cancelAnimationFrame(this._resizeRaf),this._resizeRaf=null),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this.e&&(this.e.disconnect(),this.e=null),this.container.replaceChildren(),this._data=null,this.a=!1}onResize(){this.render()}static register(){customElements.get(this.tagName)||customElements.define(this.tagName,this)}i(){if(this.hasAttribute("theme")&&!this.o)return;let r=this.parentElement;for(;r;){let a=r.getAttribute("data-theme");if(a){this.shadow.host.setAttribute("theme",a),this.o=!0;return}r=r.parentElement}this.o&&(this.shadow.host.removeAttribute("theme"),this.o=!1)}};g.tagName="wt-base-chart";var D=P(require("@observablehq/plot"),1);var jt=5;function ft(n){var s;let e=(((s=n.session)==null?void 0:s.events)??[]).filter(o=>o.type==="keydown"&&o.flightTime!=null&&o.flightTime>0);if(e.length<2)return[[],[]];let r=n.session.sessionStartTime,a=[],t=[];for(let o=0;o<e.length;o++){let i=Math.max(0,o-jt+1),c=0,l=0;for(let u=i;u<=o;u++)c+=e[u].flightTime,l++;let d=c/l,m=Math.round(6e4/d);a.push(Math.round((e[o].timestamp-r)/1e3*100)/100),t.push(m)}return[a,t]}var N=class N extends g{connectedCallback(){super.connectedCallback();let e=getComputedStyle(this);!this.style.display&&e.display==="inline"&&(this.style.display="inline-block"),!this.style.width&&(e.width==="auto"||e.width==="0px")&&(this.style.width="200px"),!this.style.height&&(e.height==="auto"||e.height==="0px")&&(this.style.height="40px")}render(){if(!this._data)return;let[e,r]=ft(this._data);if(e.length===0){this.showEmptyState("No data");return}let a=e.map((i,c)=>({time:i,speed:r[c]})),t=this.getBoundingClientRect(),s=Math.max(t.width||200,50),o=Math.max(t.height||40,20);try{let i=D.plot({width:s,height:o,axis:null,x:{axis:null},y:{axis:null},marks:[D.areaY(a,{x:"time",y:"speed",fill:"var(--wt-color-primary, #fbbf24)",fillOpacity:.1}),D.lineY(a,{x:"time",y:"speed",stroke:"var(--wt-color-primary, #fbbf24)",strokeWidth:1.5})],style:{background:"transparent",overflow:"visible"},margin:0,marginTop:2,marginBottom:2,marginLeft:0,marginRight:0});this.replaceChart(i)}catch(i){console.warn("[WriteTrack] Sparkline render failed:",i)}}static create(e,r){N.register();let a=document.createElement(N.tagName);return e.appendChild(a),a.setData(r),a}};N.tagName="wt-sparkline";var it=N;var C=P(require("@observablehq/plot"),1);function z(n){var t,s,o;let e=(s=(t=n.temporalPatterns)==null?void 0:t.metrics)==null?void 0:s.speedTimeline;if(!((o=e==null?void 0:e.timestamps)!=null&&o.length))return[];let r=Math.min(e.timestamps.length,e.values.length),a=[];for(let i=0;i<r;i++)a.push({time:e.timestamps[i]/1e3,speed:e.values[i]});return a}var I=class extends g{render(){if(!this._data)return;let e=z(this._data);if(e.length===0){this.showEmptyState("No speed data");return}let r=this.clientWidth||640,a=this.clientHeight||200;try{let t=C.plot({width:r,height:a,marginLeft:50,marginBottom:35,x:{label:"Time (s)"},y:{label:"Speed (CPM)",grid:!0},marks:[C.areaY(e,{x:"time",y:"speed",fill:"var(--wt-color-primary, #fbbf24)",fillOpacity:.15,curve:"natural"}),C.lineY(e,{x:"time",y:"speed",stroke:"var(--wt-color-primary, #fbbf24)",strokeWidth:2,curve:"natural"}),C.ruleY([0],{stroke:"var(--wt-color-border, #27272a)"}),C.tip(e,C.pointerX({x:"time",y:"speed",title:s=>`${s.time.toFixed(1)}s \u2014 ${Math.round(s.speed)} CPM`,...S}))],style:{background:"transparent",color:"var(--wt-color-text, #fafafa)",fontFamily:"var(--wt-font-data)",fontSize:"11px"}});this.replaceChart(t)}catch(t){console.warn("[WriteTrack] SpeedTimeline render failed:",t)}}};I.tagName="wt-speed-timeline";var A=P(require("@observablehq/plot"),1);var lt={typing:"var(--wt-color-primary, #fbbf24)",paste:"var(--wt-color-secondary, #22d3ee)",pause:"var(--wt-color-text-muted, #a1a1aa)",tabAway:"#ef4444",autocomplete:"#a78bfa",navigating:"#34d399"};function G(n){let e=n.sessionTimeline;return e!=null&&e.length?e.map(r=>({start:r.startTime/1e3,end:r.endTime/1e3,type:r.type,color:lt[r.type]??"#666"})):[]}function gt(n){var r,a;return(((a=(r=n.contentOrigin)==null?void 0:r.metrics)==null?void 0:a.pasteEvents)??[]).map(t=>({time:t.timestamp/1e3,chars:t.characterCount,source:t.source}))}var F=class extends g{render(){if(!this._data)return;let e=G(this._data);if(e.length===0){this.showEmptyState("No session data");return}let r=gt(this._data),a=[A.barX(e,{x1:"start",x2:"end",fill:"color",y:()=>"Activity",inset:.5}),A.tip(e,A.pointer({x:o=>(o.start+o.end)/2,y:()=>"Activity",title:o=>`${o.type} \u2014 ${(o.end-o.start).toFixed(1)}s`,...S}))];r.length&&a.push(A.dot(r,{x:"time",y:()=>"Activity",r:"chars",fill:lt.paste,fillOpacity:.7,stroke:"var(--wt-color-bg, #111113)",strokeWidth:1}));let t=this.clientWidth||640,s=this.clientHeight||80;try{let o=A.plot({width:t,height:s,marginLeft:50,marginBottom:35,x:{label:"Time (s)"},y:{axis:null,padding:.3},marks:a,style:{background:"transparent",color:"var(--wt-color-text, #fafafa)",fontFamily:"var(--wt-font-data)",fontSize:"11px"}});this.replaceChart(o)}catch(o){console.warn("[WriteTrack] CompositionTimeline render failed:",o)}}};F.tagName="wt-composition-timeline";var ct=P(require("@observablehq/plot"),1);var Yt=10;function V(n){var o,i,c,l,d;let e=(i=(o=n.timingAuthenticity)==null?void 0:o.metrics)==null?void 0:i.timingOverTime;if(!((c=e==null?void 0:e.timestamps)!=null&&c.length))return[];let r=((l=e.series)==null?void 0:l.meanDwell)??[],a=((d=e.series)==null?void 0:d.meanFlight)??[];if(!r.length||!a.length)return[];let t=[],s=Math.min(e.timestamps.length,r.length,a.length);for(let m=0;m<s;m++)r[m]!=null&&a[m]!=null&&t.push({dwell:r[m],flight:a[m]});return t}var H=class extends g{render(){if(!this._data)return;let e=V(this._data);if(e.length<Yt){this.showEmptyState("Insufficient timing data");return}let r=this.clientWidth||400,a=Math.min(r,this.clientHeight||400);try{let t=ct.plot({width:r,height:a,marginLeft:50,marginBottom:35,x:{label:"Dwell (ms)",grid:!0},y:{label:"Flight (ms)",grid:!0},marks:[ct.dot(e,{x:"dwell",y:"flight",fill:"var(--wt-color-primary, #fbbf24)",fillOpacity:.35,r:3,stroke:"var(--wt-color-primary, #fbbf24)",strokeOpacity:.6,strokeWidth:.5})],style:{background:"transparent",color:"var(--wt-color-text, #fafafa)",fontFamily:"var(--wt-font-data)",fontSize:"11px"}});this.replaceChart(t)}catch(t){console.warn("[WriteTrack] RhythmHeatmap render failed:",t)}}};H.tagName="wt-rhythm-heatmap";var O=P(require("@observablehq/plot"),1);function yt(n){var r,a,t;let e=(a=(r=n.temporalPatterns)==null?void 0:r.metrics)==null?void 0:a.pauseDistribution;return(t=e==null?void 0:e.histogram)!=null&&t.length?e.histogram.map(s=>({start:s.binStart,end:s.binEnd,count:s.count})):[]}var j=class extends g{render(){if(!this._data)return;let e=yt(this._data);if(e.length===0){this.showEmptyState("No pause data");return}let r=this.clientWidth||640,a=this.clientHeight||200;try{let t=O.plot({width:r,height:a,marginLeft:50,marginBottom:35,x:{label:"Pause Duration (ms)"},y:{label:"Count",grid:!0},marks:[O.rectY(e,{x1:"start",x2:"end",y:"count",fill:"var(--wt-color-primary, #fbbf24)",fillOpacity:.8,inset:.5}),O.ruleY([0])],style:{background:"transparent",color:"var(--wt-color-text, #fafafa)",fontFamily:"var(--wt-font-data)",fontSize:"11px"}});this.replaceChart(t)}catch(t){console.warn("[WriteTrack] PauseDistribution render failed:",t)}}};j.tagName="wt-pause-distribution";var E=P(require("@observablehq/plot"),1);var dt=/^.$/u;function v(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function q(n){var i,c;let e=(i=n.session)==null?void 0:i.events;if(!(e!=null&&e.length))return[];let r=e.filter(l=>l.type==="keydown");if(r.length===0)return[];let a=r[0].timestamp,t=[];for(let l of r)l.key==="Backspace"||l.key==="Delete"?t.push({timestamp:l.timestamp,type:"key",delta:-1}):dt.test(l.key)&&t.push({timestamp:l.timestamp,type:"key",delta:1});for(let l of((c=n.session)==null?void 0:c.clipboardEvents)??[])l.type==="paste"?t.push({timestamp:l.timestamp,type:"paste",delta:l.length,pasteLength:l.length}):l.type==="cut"&&t.push({timestamp:l.timestamp,type:"cut",delta:-l.length,cutLength:l.length});t.sort((l,d)=>l.timestamp-d.timestamp);let s=[],o=0;for(let l of t){let d=(l.timestamp-a)/1e3;l.type==="paste"?(s.push({time:d,chars:o,isPaste:!1,isCut:!1}),o+=l.delta,s.push({time:d+.001,chars:o,isPaste:!0,isCut:!1,pasteLength:l.pasteLength})):l.type==="cut"?(s.push({time:d,chars:o,isPaste:!1,isCut:!1}),o=Math.max(0,o+l.delta),s.push({time:d+.001,chars:o,isPaste:!1,isCut:!0,cutLength:l.cutLength})):(o=Math.max(0,o+l.delta),s.push({time:d,chars:o,isPaste:!1,isCut:!1}))}return s}var Y=class extends g{render(){if(!this._data)return;let e=q(this._data);if(e.length===0){this.showEmptyState("No keystroke data");return}let r=e.filter(o=>o.isPaste),a=e.filter(o=>o.isCut),t=this.clientWidth||640,s=this.clientHeight||200;try{let o=[E.lineY(e,{x:"time",y:"chars",stroke:"var(--wt-color-primary, #fbbf24)",strokeWidth:2})];r.length>0&&o.push(E.text(r,{x:"time",y:"chars",text:c=>`+${c.pasteLength}`,fill:"var(--wt-color-secondary, #22d3ee)",fontSize:10,dy:-8})),a.length>0&&o.push(E.text(a,{x:"time",y:"chars",text:c=>`\u2212${c.cutLength}`,fill:"#ef4444",fontSize:10,dy:12})),o.push(E.tip(e,E.pointerX({x:"time",y:"chars",title:c=>{let l=`${c.time.toFixed(1)}s \u2014 ${c.chars} chars`;return c.isPaste?`${l}
|
|
39
|
-
+${
|
|
40
|
-
\u2212${
|
|
38
|
+
[aria-label="tip"] { color: #fafafa; }`,k={fill:"#1a1a1d",stroke:"#27272a",textPadding:6,fontSize:11,fontFamily:"'JetBrains Mono', ui-monospace, monospace"};function D(a){console.warn(`[WriteTrack] ${a}`)}function gt(a){return a instanceof Error?a.message:String(a)}var g=class extends HTMLElement{constructor(){super();this._data=null;this._resizeObserver=null;this._resizeRaf=null;this.e=null;this.i=!0;this.o=!1;this.a=!1;this.shadow=this.attachShadow({mode:"open"});let e=document.createElement("style");e.textContent=this.getStylesheet(),this.shadow.appendChild(e),this.container=document.createElement("div"),this.container.className="wt-chart",this.shadow.appendChild(this.container)}static get observedAttributes(){return["data","theme","label"]}getStylesheet(){return Tt}connectedCallback(){typeof ResizeObserver<"u"&&(this.i=!0,this._resizeObserver=new ResizeObserver(()=>{if(this.i){this.i=!1;return}this._data&&(this._resizeRaf&&cancelAnimationFrame(this._resizeRaf),this._resizeRaf=requestAnimationFrame(()=>{this._resizeRaf=null,this.onResize()}))}),this._resizeObserver.observe(this.container)),this.s(),typeof MutationObserver<"u"&&(this.e=new MutationObserver(()=>{this.s()}),this.e.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),document.body&&this.e.observe(document.body,{attributes:!0,attributeFilter:["data-theme"]}))}disconnectedCallback(){this.destroy()}attributeChangedCallback(e,n,r){if(e==="data"&&r)try{let o=JSON.parse(r);this.setData(o)}catch(o){D(`BaseChart: invalid JSON in data attribute: ${gt(o)}`)}e==="theme"&&this._data&&this.o&&this.safeRender()}setData(e){this._data=e,this.safeRender()}getData(){return this._data}get hasRendered(){return this.o}replaceChart(...e){for(let n of e)if(n instanceof SVGElement){n.setAttribute("role","img");let r=this.getAttribute("label")??this.tagName.toLowerCase().replace("wt-","").replace(/-/g," ")+" chart";n.setAttribute("aria-label",r)}this.container.replaceChildren(...e),this.o=!0,this.dispatchEvent(new CustomEvent("wt-render",{bubbles:!1}))}showEmptyState(e="No data"){let n=document.createElement("div");n.className="wt-empty",n.textContent=e,n.style.cssText="display:flex;align-items:center;justify-content:center;height:100%;font-family:var(--wt-font-ui,system-ui,sans-serif);font-size:11px;color:var(--wt-color-text-muted,#a1a1aa);",this.container.replaceChildren(n),this.o=!1}destroy(){this._resizeRaf&&(cancelAnimationFrame(this._resizeRaf),this._resizeRaf=null),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this.e&&(this.e.disconnect(),this.e=null),this.container.replaceChildren(),this._data=null,this.o=!1}onResize(){this.safeRender()}safeRender(){try{this.render()}catch(e){D(`${this.constructor.name} render failed: ${gt(e)}`)}}static register(){customElements.get(this.tagName)||customElements.define(this.tagName,this)}s(){if(this.hasAttribute("theme")&&!this.a)return;let e=this.parentElement;for(;e;){let n=e.getAttribute("data-theme");if(n){this.shadow.host.setAttribute("theme",n),this.a=!0;return}e=e.parentElement}this.a&&(this.shadow.host.removeAttribute("theme"),this.a=!1)}};g.tagName="wt-base-chart";var O=P(require("@observablehq/plot"),1);var Yt=5;function yt(a){var o;let t=(((o=a.session)==null?void 0:o.events)??[]).filter(i=>i.type==="keydown"&&i.flightTime!=null&&i.flightTime>0);if(t.length<2)return[[],[]];let e=a.session.sessionStartTime,n=[],r=[];for(let i=0;i<t.length;i++){let s=Math.max(0,i-Yt+1),l=0,c=0;for(let u=s;u<=i;u++)l+=t[u].flightTime,c++;let d=l/c,m=Math.round(6e4/d);n.push(Math.round((t[i].timestamp-e)/1e3*100)/100),r.push(m)}return[n,r]}var I=class I extends g{connectedCallback(){super.connectedCallback();let t=getComputedStyle(this);!this.style.display&&t.display==="inline"&&(this.style.display="inline-block"),!this.style.width&&(t.width==="auto"||t.width==="0px")&&(this.style.width="200px"),!this.style.height&&(t.height==="auto"||t.height==="0px")&&(this.style.height="40px")}render(){if(!this._data)return;let[t,e]=yt(this._data);if(t.length===0){this.showEmptyState("No data");return}let n=t.map((l,c)=>({time:l,speed:e[c]})),r=this.getBoundingClientRect(),o=Math.max(r.width||200,50),i=Math.max(r.height||40,20),s=O.plot({width:o,height:i,axis:null,x:{axis:null},y:{axis:null},marks:[O.areaY(n,{x:"time",y:"speed",fill:"var(--wt-color-primary, #fbbf24)",fillOpacity:.1}),O.lineY(n,{x:"time",y:"speed",stroke:"var(--wt-color-primary, #fbbf24)",strokeWidth:1.5})],style:{background:"transparent",overflow:"visible"},margin:0,marginTop:2,marginBottom:2,marginLeft:0,marginRight:0});this.replaceChart(s)}static create(t,e){I.register();let n=document.createElement(I.tagName);return t.appendChild(n),n.setData(e),n}};I.tagName="wt-sparkline";var lt=I;var C=P(require("@observablehq/plot"),1);function z(a){var r,o,i;let t=(o=(r=a.temporalPatterns)==null?void 0:r.metrics)==null?void 0:o.speedTimeline;if(!((i=t==null?void 0:t.timestamps)!=null&&i.length))return[];let e=Math.min(t.timestamps.length,t.values.length),n=[];for(let s=0;s<e;s++)n.push({time:t.timestamps[s]/1e3,speed:t.values[s]});return n.sort((s,l)=>s.time-l.time),n}var F=class extends g{render(){if(!this._data)return;let t=z(this._data);if(t.length===0){this.showEmptyState("No speed data");return}let e=this.clientWidth||640,n=this.clientHeight||200,r=C.plot({width:e,height:n,marginLeft:50,marginBottom:35,x:{label:"Time (s)"},y:{label:"Speed (CPM)",grid:!0},marks:[C.areaY(t,{x:"time",y:"speed",fill:"var(--wt-color-primary, #fbbf24)",fillOpacity:.15,curve:"monotone-x"}),C.lineY(t,{x:"time",y:"speed",stroke:"var(--wt-color-primary, #fbbf24)",strokeWidth:2,curve:"monotone-x"}),C.ruleY([0],{stroke:"var(--wt-color-border, #27272a)"}),C.tip(t,C.pointerX({x:"time",y:"speed",title:o=>`${o.time.toFixed(1)}s \u2014 ${Math.round(o.speed)} CPM`,...k}))],style:{background:"transparent",color:"var(--wt-color-text, #fafafa)",fontFamily:"var(--wt-font-data)",fontSize:"11px"}});this.replaceChart(r)}};F.tagName="wt-speed-timeline";var A=P(require("@observablehq/plot"),1);var ct={typing:"var(--wt-color-primary, #fbbf24)",paste:"var(--wt-color-secondary, #22d3ee)",pause:"var(--wt-color-text-muted, #a1a1aa)",tabAway:"#ef4444",autocomplete:"#a78bfa",navigating:"#34d399"};function H(a){let t=a.sessionTimeline;return t!=null&&t.length?t.map(e=>({start:e.startTime/1e3,end:e.endTime/1e3,type:e.type,color:ct[e.type]??"#666"})):[]}function bt(a){var e,n;return(((n=(e=a.contentOrigin)==null?void 0:e.metrics)==null?void 0:n.pasteEvents)??[]).map(r=>({time:r.timestamp/1e3,chars:r.characterCount,source:r.source}))}var G=class extends g{render(){if(!this._data)return;let t=H(this._data);if(t.length===0){this.showEmptyState("No session data");return}let e=bt(this._data),n=[A.barX(t,{x1:"start",x2:"end",fill:"color",y:()=>"Activity",inset:.5}),A.tip(t,A.pointer({x:s=>(s.start+s.end)/2,y:()=>"Activity",title:s=>`${s.type} \u2014 ${(s.end-s.start).toFixed(1)}s`,...k}))];e.length&&n.push(A.dot(e,{x:"time",y:()=>"Activity",r:"chars",fill:ct.paste,fillOpacity:.7,stroke:"var(--wt-color-bg, #111113)",strokeWidth:1}));let r=this.clientWidth||640,o=this.clientHeight||80,i=A.plot({width:r,height:o,marginLeft:50,marginBottom:35,x:{label:"Time (s)"},y:{axis:null,padding:.3},marks:n,style:{background:"transparent",color:"var(--wt-color-text, #fafafa)",fontFamily:"var(--wt-font-data)",fontSize:"11px"}});this.replaceChart(i)}};G.tagName="wt-composition-timeline";var dt=P(require("@observablehq/plot"),1);var Kt=10;function j(a){var i,s,l,c,d;let t=(s=(i=a.timingAuthenticity)==null?void 0:i.metrics)==null?void 0:s.timingOverTime;if(!((l=t==null?void 0:t.timestamps)!=null&&l.length))return[];let e=((c=t.series)==null?void 0:c.meanDwell)??[],n=((d=t.series)==null?void 0:d.meanFlight)??[];if(!e.length||!n.length)return[];let r=[],o=Math.min(t.timestamps.length,e.length,n.length);for(let m=0;m<o;m++)e[m]!=null&&n[m]!=null&&r.push({dwell:e[m],flight:n[m]});return r}var V=class extends g{render(){if(!this._data)return;let t=j(this._data);if(t.length<Kt){this.showEmptyState("Insufficient timing data");return}let e=this.clientWidth||400,n=Math.min(e,this.clientHeight||400),r=dt.plot({width:e,height:n,marginLeft:50,marginBottom:35,x:{label:"Dwell (ms)",grid:!0},y:{label:"Flight (ms)",grid:!0},marks:[dt.dot(t,{x:"dwell",y:"flight",fill:"var(--wt-color-primary, #fbbf24)",fillOpacity:.35,r:3,stroke:"var(--wt-color-primary, #fbbf24)",strokeOpacity:.6,strokeWidth:.5})],style:{background:"transparent",color:"var(--wt-color-text, #fafafa)",fontFamily:"var(--wt-font-data)",fontSize:"11px"}});this.replaceChart(r)}};V.tagName="wt-rhythm-heatmap";var L=P(require("@observablehq/plot"),1);function wt(a){var e,n,r;let t=(n=(e=a.temporalPatterns)==null?void 0:e.metrics)==null?void 0:n.pauseDistribution;return(r=t==null?void 0:t.histogram)!=null&&r.length?t.histogram.map(o=>({start:o.binStart,end:o.binEnd,count:o.count})):[]}var q=class extends g{render(){if(!this._data)return;let t=wt(this._data);if(t.length===0){this.showEmptyState("No pause data");return}let e=this.clientWidth||640,n=this.clientHeight||200,r=L.plot({width:e,height:n,marginLeft:50,marginBottom:35,x:{label:"Pause Duration (ms)"},y:{label:"Count",grid:!0},marks:[L.rectY(t,{x1:"start",x2:"end",y:"count",fill:"var(--wt-color-primary, #fbbf24)",fillOpacity:.8,inset:.5}),L.ruleY([0])],style:{background:"transparent",color:"var(--wt-color-text, #fafafa)",fontFamily:"var(--wt-font-data)",fontSize:"11px"}});this.replaceChart(r)}};q.tagName="wt-pause-distribution";var E=P(require("@observablehq/plot"),1);var mt=/^.$/u;function v(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ut(a){let t=[];for(let e of a)e.key==="Backspace"||e.key==="Delete"?t.push({timestamp:e.timestamp,type:"key",delta:-1}):mt.test(e.key)&&t.push({timestamp:e.timestamp,type:"key",delta:1});return t}function Qt(a){let t=[];for(let e of a??[])e.type==="paste"?t.push({timestamp:e.timestamp,type:"paste",delta:e.length,pasteLength:e.length}):e.type==="cut"&&t.push({timestamp:e.timestamp,type:"cut",delta:-e.length,cutLength:e.length});return t}function Xt(a,t){let e=[],n=0;for(let r of a){let o=(r.timestamp-t)/1e3;r.type==="paste"?(e.push({time:o,chars:n,isPaste:!1,isCut:!1}),n+=r.delta,e.push({time:o+.001,chars:n,isPaste:!0,isCut:!1,pasteLength:r.pasteLength})):r.type==="cut"?(e.push({time:o,chars:n,isPaste:!1,isCut:!1}),n=Math.max(0,n+r.delta),e.push({time:o+.001,chars:n,isPaste:!1,isCut:!0,cutLength:r.cutLength})):(n=Math.max(0,n+r.delta),e.push({time:o,chars:n,isPaste:!1,isCut:!1}))}return e}function K(a){var o,i;let t=(o=a.session)==null?void 0:o.events;if(!(t!=null&&t.length))return[];let e=t.filter(s=>s.type==="keydown");if(e.length===0)return[];let n=e[0].timestamp,r=[...Ut(e),...Qt((i=a.session)==null?void 0:i.clipboardEvents)];return r.sort((s,l)=>s.timestamp-l.timestamp),Xt(r,n)}function Jt(a,t,e){let n=[E.lineY(a,{x:"time",y:"chars",stroke:"var(--wt-color-primary, #fbbf24)",strokeWidth:2})];return t.length>0&&n.push(E.text(t,{x:"time",y:"chars",text:r=>`+${r.pasteLength}`,fill:"var(--wt-color-secondary, #22d3ee)",fontSize:10,dy:-8})),e.length>0&&n.push(E.text(e,{x:"time",y:"chars",text:r=>`\u2212${r.cutLength}`,fill:"#ef4444",fontSize:10,dy:12})),n.push(E.tip(a,E.pointerX({x:"time",y:"chars",title:r=>{let o=`${r.time.toFixed(1)}s \u2014 ${r.chars} chars`;return r.isPaste?`${o}
|
|
39
|
+
+${r.pasteLength} pasted`:r.isCut?`${o}
|
|
40
|
+
\u2212${r.cutLength} cut`:o},...k}))),n}var Y=class extends g{render(){if(!this._data)return;let t=K(this._data);if(t.length===0){this.showEmptyState("No keystroke data");return}let e=t.filter(i=>i.isPaste),n=t.filter(i=>i.isCut),r=this.clientWidth||640,o=this.clientHeight||200;try{let i=Jt(t,e,n),s=E.plot({width:r,height:o,marginLeft:50,marginBottom:35,x:{label:"Time (s)"},y:{label:"Characters",grid:!0},marks:i,style:{background:"transparent",color:"var(--wt-color-text, #fafafa)",fontFamily:"var(--wt-font-data)",fontSize:"11px"}});this.replaceChart(s)}catch(i){D(`DocumentGrowth render failed: ${i}`)}}};Y.tagName="wt-document-growth";var M=P(require("@observablehq/plot"),1);function vt(a){var o;let t=(o=a.session)==null?void 0:o.events;if(!(t!=null&&t.length))return[];let e=t.filter(i=>i.type==="keydown");if(e.length===0)return[];let n=e[0].timestamp,r=[];for(let i=0;i<e.length;i++){let s=e[i],l=(s.timestamp-n)/1e3,c=i<e.length-1?(e[i+1].timestamp-n)/1e3:l+(s.dwellTime??50)/1e3,d=s.flightTime??0;r.push({start:l,end:c,flight:d})}return r}var U=class extends g{render(){if(!this._data)return;let t=vt(this._data);if(t.length===0){this.showEmptyState("No keystroke data");return}let e=this.clientWidth||640,n=this.clientHeight||80,r=M.plot({width:e,height:n,marginLeft:50,marginBottom:35,x:{label:"Time (s)"},y:{axis:null},color:{type:"sequential",scheme:"YlOrRd",domain:[0,Math.max(1,t.reduce((o,i)=>i.flight>o?i.flight:o,0))],label:"Flight time (ms)"},marks:[M.rect(t,{x1:"start",x2:"end",y1:()=>0,y2:()=>1,fill:"flight",inset:.5}),M.tip(t,M.pointer({x:o=>(o.start+o.end)/2,y:()=>.5,title:o=>`${o.start.toFixed(1)}s \u2014 ${Math.round(o.flight)}ms flight time`,...k}))],style:{background:"transparent",color:"var(--wt-color-text, #fafafa)",fontFamily:"var(--wt-font-data)",fontSize:"11px"}});this.replaceChart(r)}};U.tagName="wt-document-ribbon";var T=P(require("@observablehq/plot"),1);var Zt=null;function Et(){return Zt}function Pt(a,t,e,n){let r=a.length;if(r<=t||t<3)return a;let o=Et();if(!o)return a;let i=new Float64Array(r),s=new Float64Array(r);for(let d=0;d<r;d++)i[d]=e(a[d]),s[d]=n(a[d]);let l=o.lttb_downsample(i,s,t);if(l.length===0)return a;let c=new Array(l.length);for(let d=0;d<l.length;d++)c[d]=a[l[d]];return c}var At=2e3;function te(a,t){let e=[],n=[];for(let r of a??[])r.type==="paste"?e.push({time:Math.max(0,(r.timestamp-t)/1e3),position:r.position}):r.type==="cut"&&n.push({time:Math.max(0,(r.timestamp-t)/1e3),position:r.position});return{pastes:e,cuts:n}}function X(a){var s,l;let t=(s=a.session)==null?void 0:s.events;if(!(t!=null&&t.length))return{keystrokes:[],pastes:[],cuts:[]};let e=t.filter(c=>c.type==="keydown"&&c.cursorPosition!=null);if(e.length===0)return{keystrokes:[],pastes:[],cuts:[]};let n=e[0].timestamp,r=e.map(c=>({time:(c.timestamp-n)/1e3,position:c.cursorPosition})),{pastes:o,cuts:i}=te((l=a.session)==null?void 0:l.clipboardEvents,n);return{keystrokes:r,pastes:o,cuts:i}}function ee(a,t,e){let n=[T.line(a,{x:"time",y:"position",stroke:"var(--wt-color-primary, #fbbf24)",strokeWidth:1,strokeOpacity:.5}),T.dot(a,{x:"time",y:"position",fill:"var(--wt-color-primary, #fbbf24)",r:2})];return t.length>0&&n.push(T.dot(t,{x:"time",y:"position",fill:"var(--wt-color-secondary, #22d3ee)",r:6,stroke:"var(--wt-color-bg, #111113)",strokeWidth:1})),e.length>0&&n.push(T.dot(e,{x:"time",y:"position",fill:"#f97316",r:6,stroke:"var(--wt-color-bg, #111113)",strokeWidth:1})),n.push(T.tip(a,T.pointerX({x:"time",y:"position",title:r=>`${r.time.toFixed(1)}s \u2014 position ${r.position}`,...k}))),n}var Q=class extends g{render(){if(!this._data)return;let t=X(this._data);if(t.keystrokes.length===0){this.showEmptyState("No cursor position data");return}let e=Pt(t.keystrokes,At,s=>s.time,s=>s.position),{pastes:n,cuts:r}=t,o=this.clientWidth||640,i=this.clientHeight||200;try{let s=ee(e,n,r),l=T.plot({width:o,height:i,marginLeft:50,marginBottom:35,x:{label:"Time (s)"},y:{label:"Position",reverse:!0,grid:!0},marks:s,style:{background:"transparent",color:"var(--wt-color-text, #fafafa)",fontFamily:"var(--wt-font-data)",fontSize:"11px"}});this.replaceChart(l)}catch(s){D(`EditWaterfall render failed: ${s}`)}}};Q.tagName="wt-edit-waterfall";var R=P(require("@observablehq/plot"),1);var Mt={insert:"#22c55e",delete:"#ef4444",paste:"var(--wt-color-secondary, #22d3ee)",cut:"#f97316"},Rt={insert:.6,delete:-.6,paste:0,cut:0};function Z(a){var c,d;let t=(c=a.session)==null?void 0:c.events;if(!(t!=null&&t.length))return[];let e=t.filter(m=>m.type==="keydown");if(e.length===0)return[];let n=e[0].timestamp,r=[],o=null,i=0,s=0;function l(){o&&i>0&&r.push({time:s,chars:i,type:o,size:Math.max(4,Math.sqrt(i)*3)}),o=null,i=0}for(let m of e){let u=(m.timestamp-n)/1e3,p=null;m.key==="Backspace"||m.key==="Delete"?p="delete":mt.test(m.key)&&(p="insert"),p!==null&&(p!==o&&(l(),o=p,s=u),i++)}l();for(let m of((d=a.session)==null?void 0:d.clipboardEvents)??[])if(m.type==="paste"||m.type==="cut"){let u=Math.max(0,(m.timestamp-n)/1e3),p=m.length;r.push({time:u,chars:p,type:m.type,size:Math.max(4,Math.sqrt(p)*3)})}return r.sort((m,u)=>m.time-u.time),r}var J=class extends g{render(){if(!this._data)return;let t=Z(this._data);if(t.length===0){this.showEmptyState("No edit data");return}let e=this.clientWidth||640,n=this.clientHeight||140,r=R.plot({width:e,height:n,marginLeft:50,marginBottom:35,marginTop:10,x:{label:"Time (s)"},y:{axis:null,domain:[-1.5,1.5]},marks:[R.dot(t,{x:"time",y:i=>Rt[i.type],r:"size",fill:i=>Mt[i.type],fillOpacity:.65,stroke:i=>Mt[i.type],strokeWidth:1}),R.tip(t,R.pointer({x:"time",y:i=>Rt[i.type],title:i=>`${i.time.toFixed(1)}s \u2014 ${i.type}, ${i.chars} chars`,...k}))],style:{background:"transparent",color:"var(--wt-color-text, #fafafa)",fontFamily:"var(--wt-font-data)",fontSize:"11px"}});this.replaceChart(r);let o=document.createElement("div");o.className="wt-legend",o.style.cssText="display:flex;gap:12px;padding:6px 0 0;font-family:var(--wt-font-ui,system-ui,sans-serif);font-size:10px;color:var(--wt-color-text-muted,#a1a1aa);";for(let[i,s]of[["Insert","#22c55e"],["Delete","#ef4444"],["Paste","#22d3ee"],["Cut","#f97316"]]){let l=document.createElement("span");l.style.cssText="display:flex;align-items:center;gap:4px;";let c=document.createElement("span");c.style.cssText=`width:8px;height:8px;border-radius:50%;background:${s};`,l.appendChild(c),l.appendChild(document.createTextNode(i)),o.appendChild(l)}this.container.appendChild(o)}};J.tagName="wt-corrections-bubble";var tt=`:host {
|
|
41
41
|
/* \u2500\u2500 Surface colors (light default) \u2500\u2500 */
|
|
42
42
|
--wt-scorecard-bg: #F7F6F2;
|
|
43
43
|
--wt-scorecard-bg-card: #FFFFFF;
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
.wt-term:hover {
|
|
103
103
|
text-decoration-color: var(--wt-scorecard-text-secondary);
|
|
104
104
|
}
|
|
105
|
-
`,
|
|
105
|
+
`,Er=(()=>{try{let a=new CSSStyleSheet;return a.replaceSync(tt),a}catch{return null}})();var re={"--wt-color-bg":"var(--wt-scorecard-bg-card)","--wt-color-surface":"var(--wt-scorecard-bg-detail)","--wt-color-text":"var(--wt-scorecard-text)","--wt-color-text-muted":"var(--wt-scorecard-text-tertiary)","--wt-color-border":"var(--wt-scorecard-border)","--wt-color-primary":"var(--wt-scorecard-chart-accent)","--wt-color-secondary":"var(--wt-scorecard-chart-flagged)","--wt-font-data":"var(--wt-scorecard-font-data)","--wt-font-ui":"var(--wt-scorecard-font-body)"};function Wt(a){for(let[t,e]of Object.entries(re))a.style.setProperty(t,e)}var et=new Uint8Array(256),xt=new Uint8Array(256);(function(){let a=1;for(let t=0;t<255;t++)et[t]=a,xt[a]=t,a=a<<1^(a>=128?285:0);et[255]=et[0]})();function _t(a,t){return a===0||t===0?0:et[(xt[a]+xt[t])%255]}function ne(a){let t=[1];for(let e=0;e<a;e++){let n=new Array(t.length+1).fill(0);for(let r=0;r<t.length;r++)n[r]^=t[r],n[r+1]^=_t(t[r],et[e]);t=n}return t}function ae(a,t){let e=ne(t),n=new Uint8Array(a.length+t);n.set(a);for(let r=0;r<a.length;r++){let o=n[r];if(o!==0)for(let i=0;i<e.length;i++)n[r+i]^=_t(e[i],o)}return n.slice(a.length)}var oe=[{ver:1,size:21,dc:16,ec:10,blocks:1,cap:14},{ver:2,size:25,dc:28,ec:16,blocks:1,cap:26},{ver:3,size:29,dc:44,ec:26,blocks:1,cap:42},{ver:4,size:33,dc:64,ec:18,blocks:2,cap:62},{ver:5,size:37,dc:86,ec:24,blocks:2,cap:84},{ver:6,size:41,dc:108,ec:16,blocks:4,cap:106}],ie=[[],[6,18],[6,22],[6,26],[6,30],[6,34]];function se(a){for(let t of oe)if(a<=t.cap)return t;return null}function le(a,t){let e=[];function n(h,w){for(let b=w-1;b>=0;b--)e.push(h>>b&1)}n(4,4),n(a.length,8);for(let h of a)n(h,8);let r=t.dc*8;for(n(0,Math.min(4,r-e.length));e.length%8!==0;)e.push(0);let o=[236,17],i=0;for(;e.length<r;)n(o[i%2],8),i++;let s=[];for(let h=0;h<e.length;h+=8){let w=0;for(let b=0;b<8;b++)w=w<<1|e[h+b];s.push(w)}let l=Math.floor(t.dc/t.blocks),c=t.dc-l*t.blocks,d=[],m=[],u=0;for(let h=0;h<t.blocks;h++){let w=l+(h>=t.blocks-c?1:0),b=new Uint8Array(s.slice(u,u+w));d.push(b),m.push(ae(b,t.ec)),u+=w}let p=[],y=0;for(let h of d)y=Math.max(y,h.length);for(let h=0;h<y;h++)for(let w of d)h<w.length&&p.push(w[h]);for(let h=0;h<t.ec;h++)for(let w of m)p.push(w[h]);return p}function ce(a){let t=a.size,e=[],n=[];for(let s=0;s<t;s++)e.push(new Int8Array(t)),n.push(new Uint8Array(t));function r(s,l,c){e[l][s]=c?1:-1,n[l][s]=1}function o(s,l){for(let d=-3;d<=3;d++)for(let m=-3;m<=3;m++){let u=s+m,p=l+d;u<0||u>=t||p<0||p>=t||r(u,p,Math.max(Math.abs(m),Math.abs(d))!==2)}let c=[[-4,0],[4,0],[0,-4],[0,4]];for(let d=-4;d<=4;d++)for(let m of c){let u=s+(m[0]!==0?m[0]:d),p=l+(m[1]!==0?m[1]:d);u>=0&&u<t&&p>=0&&p<t&&r(u,p,!1)}}o(3,3),o(t-4,3),o(3,t-4);for(let s=8;s<t-8;s++)r(s,6,s%2===0),r(6,s,s%2===0);let i=ie[a.ver-1];if(i.length>0)for(let s=0;s<i.length;s++)for(let l=0;l<i.length;l++){let c=i[s],d=i[l];if(!n[c][d])for(let m=-2;m<=2;m++)for(let u=-2;u<=2;u++)r(d+u,c+m,Math.max(Math.abs(u),Math.abs(m))!==1)}r(8,4*a.ver+9,!0);for(let s=0;s<8;s++)n[8][s]||(n[8][s]=1),n[8][t-1-s]||(n[8][t-1-s]=1),n[s][8]||(n[s][8]=1),n[t-1-s][8]||(n[t-1-s][8]=1);return n[8][8]=1,{grid:e,reserved:n,n:t}}function de(a,t){let{grid:e,reserved:n,n:r}=a,o=[];for(let c of t)for(let d=7;d>=0;d--)o.push(c>>d&1);let i=0,s=r-1,l=!0;for(;s>=0;){if(s===6){s--;continue}let c=l?r-1:0,d=l?-1:r,m=l?-1:1;for(let u=c;u!==d;u+=m)for(let p=0;p<2;p++){let y=s-p;y<0||n[u][y]||(e[u][y]=i<o.length&&o[i]?1:-1,i++)}s-=2,l=!l}}var me=[(a,t)=>(a+t)%2===0,(a,t)=>t%2===0,(a,t)=>a%3===0,(a,t)=>(a+t)%3===0,(a,t)=>(Math.floor(t/2)+Math.floor(a/3))%2===0,(a,t)=>a*t%2+a*t%3===0,(a,t)=>(a*t%2+a*t%3)%2===0,(a,t)=>((a+t)%2+a*t%3)%2===0];function $t(a,t,e,n){let r=me[n],o=a.map(i=>Int8Array.from(i));for(let i=0;i<e;i++)for(let s=0;s<e;s++)!t[i][s]&&r(s,i)&&(o[i][s]=o[i][s]===1?-1:1);return o}var ue=[21522,20773,24188,23371,17913,16590,20375,19104];function Dt(a,t,e){let n=ue[e],r=[];for(let s=14;s>=0;s--)r.push(n>>s&1);let o=[[0,8],[1,8],[2,8],[3,8],[4,8],[5,8],[7,8],[8,8],[8,7],[8,5],[8,4],[8,3],[8,2],[8,1],[8,0]],i=[[8,t-1],[8,t-2],[8,t-3],[8,t-4],[8,t-5],[8,t-6],[8,t-7],[t-8,8],[t-7,8],[t-6,8],[t-5,8],[t-4,8],[t-3,8],[t-2,8],[t-1,8]];for(let s=0;s<15;s++){let l=r[s]?1:-1;a[o[s][1]][o[s][0]]=l,a[i[s][1]][i[s][0]]=l}}function pe(a,t){let e=0;for(let n=0;n<t;n++){let r=1;for(let o=1;o<t;o++)a[n][o]>0==a[n][o-1]>0?r++:(r>=5&&(e+=r-2),r=1);r>=5&&(e+=r-2)}for(let n=0;n<t;n++){let r=1;for(let o=1;o<t;o++)a[o][n]>0==a[o-1][n]>0?r++:(r>=5&&(e+=r-2),r=1);r>=5&&(e+=r-2)}return e}function he(a){let t=[];for(let l=0;l<a.length;l++){let c=a.charCodeAt(l);c<128?t.push(c):c<2048&&(t.push(192|c>>6),t.push(128|c&63))}let e=se(t.length);if(!e)return null;let n=le(t,e),r=ce(e);de(r,n);let o=0,i=1/0;for(let l=0;l<8;l++){let c=$t(r.grid,r.reserved,r.n,l);Dt(c,r.n,l);let d=pe(c,r.n);d<i&&(i=d,o=l)}let s=$t(r.grid,r.reserved,r.n,o);return Dt(s,r.n,o),{grid:s,size:r.n}}function fe(a,t,e){let n=a.size,r=Math.max(2,Math.floor(88/n)),o=n*r,i=r/2,s=i*.82,l=n/2,c=n*.18;function d(x,S){let N=Math.sin(x*31+S*17)*1e4;return .75+.25*(N-Math.floor(N))}let m="";for(let x=0;x<n;x++)for(let S=0;S<n;S++){if(a.grid[x][S]<=0)continue;let N=S-l,kt=x-l;if(Math.sqrt(N*N+kt*kt)<c)continue;if(S<7&&x<7||S>=n-7&&x<7||S<7&&x>=n-7)m+=`<rect x="${S*r}" y="${x*r}" width="${r}" height="${r}" rx="${r*.15}" fill="${t}"/>`;else{let It=s*d(S,x);m+=`<circle cx="${S*r+i}" cy="${x*r+i}" r="${It.toFixed(1)}" fill="${t}"/>`}}let u=l*r,p=l*r,y=c*r*.6,h=e||t,w=y*2/100,b=70*w,$=`<g transform="translate(${u-y},${p-b/2}) scale(${w.toFixed(4)})">`;return $+=`<path d="M86 2 L86 64" stroke="${h}" stroke-width="5" stroke-linecap="round"/>`,$+=`<path d="M7 12 L98 12" stroke="${h}" stroke-width="5" stroke-linecap="round"/>`,$+=`<path d="M7 18 C7 32, 16 64, 30 64 C44 64, 38 28, 52 28 C66 28, 62 64, 86 64" stroke="${t}" stroke-width="5" stroke-linecap="round" fill="none"/>`,$+=`<circle cx="7" cy="12" r="7" fill="${t}"/>`,$+=`<circle cx="86" cy="64" r="7" fill="${h}"/>`,$+="</g>",`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${o} ${o}" width="${o}" height="${o}">${m}${$}</svg>`}var ge=`.integrity-section {
|
|
106
106
|
margin-top: 2rem;
|
|
107
107
|
padding-top: 1.5rem;
|
|
108
108
|
border-top: 1px solid var(--wt-scorecard-border);
|
|
@@ -167,8 +167,8 @@
|
|
|
167
167
|
color: var(--wt-scorecard-text-tertiary);
|
|
168
168
|
flex: 1;
|
|
169
169
|
}
|
|
170
|
-
`,_=class extends g{getStylesheet(){return
|
|
171
|
-
`+le}render(){if(!this._data)return;let{integrity:e,outputSignature:r}=this._data,a=document.createElement("div");a.className="integrity-section";let t=document.createElement("div");t.className="integrity-title",t.textContent="Integrity & Verification",a.appendChild(t);let s=document.createElement("div");s.className="integrity-stats",s.textContent=`${e.eventCount} events \xB7 ${e.checkpoints.length} checkpoints`,a.appendChild(s);let o=document.createElement("div");o.className="integrity-hash-block";let i=document.createElement("span");i.className="integrity-hash-label",i.textContent="Digest (SHA-256)";let c=document.createElement("code");c.className="hash",c.textContent=e.finalDigest,o.append(i,c),a.appendChild(o);let l=document.createElement("div");l.className="integrity-hash-block";let d=document.createElement("span");d.className="integrity-hash-label",d.textContent="Output Signature";let m=document.createElement("code");m.className="hash",m.textContent=r,l.append(d,m),a.appendChild(l);let u=document.createElement("div");u.className="integrity-bottom";let p=document.createElement("div");p.className="qr-container";let y=document.createElement("p");y.className="integrity-explainer",y.textContent="This scorecard includes cryptographic integrity verification. The digest covers all input events; the signature covers the analysis output. Compare against original session data or scan for verification.",u.appendChild(p),u.appendChild(y),a.appendChild(u),this.replaceChart(a),requestAnimationFrame(()=>this.renderQr(e.finalDigest))}renderQr(e){let r=this.shadow.querySelector(".qr-container");if(!r)return;let a=se(e);if(!a)return;let t=getComputedStyle(this),s=t.getPropertyValue("--wt-scorecard-text").trim()||"#E4E2DA",o=t.getPropertyValue("--wt-scorecard-status-clear").trim()||"#5EAE78";r.innerHTML=ie(a,s,o)}};_.tagName="wt-integrity-footer";var Dt=new Set(["WT-104","WT-106","WT-204","WT-302","WT-403","WT-503","WT-506","WT-509","WT-601","WT-602","WT-603"]);function Ot(n){return Dt.has(n)}function M(n){return n?Dt.has(n)?"pass":"flag":"unknown"}var L={contentOrigin:"Content Origin",timingAuthenticity:"Timing & Rhythm",revisionBehavior:"Revision Behavior",sessionContinuity:"Session Continuity",physicalPlausibility:"Physical Plausibility",temporalPatterns:"Temporal Patterns"},mt=["contentOrigin","timingAuthenticity","revisionBehavior","sessionContinuity","physicalPlausibility","temporalPatterns"],ut=["contentOrigin","timingAuthenticity","revisionBehavior"],pt=["sessionContinuity","physicalPlausibility","temporalPatterns"],ce={"WT-100":()=>"No content was recorded during this session.","WT-101":n=>{let e=n.params.pct??0,r=100-e;return`Nearly all content (${e}%) was pasted from an external source. Only ${r}% of characters were typed directly.`},"WT-102":n=>`${n.params.pct??0}% of text was inserted via autocomplete, suggesting reliance on predictive input rather than original composition.`,"WT-103":n=>{let e=n.params.pct??0,r=100-e;return`${e}% of text was pasted from external sources. The remaining ${r}% was typed directly.`},"WT-104":()=>"All text was typed directly \u2014 no paste or autocomplete events were detected.","WT-105":()=>"Unmodified external content detected \u2014 pasted text was not edited after insertion, suggesting pre-composed content.","WT-106":n=>`${n.params.rework??0}% of pasted content was subsequently reworked, indicating the writer integrated external material into their own composition.`,"WT-107":n=>{let e=n.params.pasteRatio??0,r=n.params.retentionPct??0;return`High paste volume (${e}% paste ratio) with ${r}% left unmodified \u2014 content was pasted in bulk without rework.`}},de={"WT-105":()=>"Unmodified external content detected \u2014 pasted text was not edited after insertion, suggesting pre-composed content.","WT-106":n=>`${n.params.rework??0}% of pasted content was subsequently reworked, indicating the writer integrated external material into their own composition.`,"WT-107":n=>{let e=n.params.pasteRatio??0,r=n.params.retentionPct??0;return`High paste volume (${e}% paste ratio) with ${r}% left unmodified \u2014 content was pasted in bulk without rework.`}},me={"WT-200":n=>{let e=(n.params.dwellMean??0).toFixed(1),r=(n.params.flightMean??0).toFixed(1);return`Keystroke timing magnitudes (dwell ${e}ms, flight ${r}ms) fall below plausible human ranges, consistent with programmatic input injection.`},"WT-201":n=>`Keystroke timing is mechanically uniform \u2014 the coefficient of variation (${(n.params.cv??0).toFixed(2)}) falls far below the human range of 0.3\u20130.8. This pattern is consistent with automated input.`,"WT-202":n=>`A highly periodic keystroke pattern was detected (score ${(n.params.score??0).toFixed(2)}). Human typing naturally varies; metronomic regularity suggests automation.`,"WT-203":n=>`Flight times between keystrokes are suspiciously uniform (CV ${(n.params.cv??0).toFixed(2)}), lacking the natural variability expected from human finger movement.`,"WT-204":()=>"Keystroke timing variability falls within normal human ranges. The rhythm is consistent with natural typing."},ue={"WT-500":(n,e)=>`Zero corrections across the entire session. Human writers make mistakes \u2014 a ${e.keydownCount}-keystroke session with no corrections is a strong signal content was not composed here.`,"WT-501":()=>"No keystrokes were recorded, so revision behavior could not be analyzed.","WT-502":n=>`Very low correction rate (${(n.params.pct??0).toFixed(1)}%). While some writers are precise, this level of accuracy across an entire session is unusual.`,"WT-503":n=>`Normal correction rate (${(n.params.pct??0).toFixed(1)}%). The writer made and fixed mistakes at a rate consistent with natural composition.`,"WT-504":n=>`No corrections, navigation, or undo in a ${n.params.count??0}-keystroke session \u2014 the text was entered linearly without any revision.`,"WT-505":()=>"Non-linear editing was detected despite a low correction rate, suggesting some revision activity.","WT-506":n=>`Authentic revision depth detected (product-process ratio ${(n.params.ratio??0).toFixed(2)}). The writing process shows genuine iterative refinement.`,"WT-507":n=>{let e=n.params.count??0,r=n.params.keydowns??0;return`Linear transcription pattern: only ${e} insertions in a ${r}-keystroke session, with minimal revision or restructuring.`},"WT-508":n=>`Forward-edge concentration: ${Math.round((n.params.ratio??0)*100)}% of keystrokes occurred at the end of the document with almost no in-document editing, consistent with copy-typing or automation.`,"WT-509":n=>`Multi-word restructuring detected (${Math.round((n.params.ratio??0)*100)}% of chars from multi-word pastes), suggesting authentic revision where the writer rearranged their own text.`},pe={"WT-300":n=>{let e=Math.round(n.params.timestamp??0),r=(n.params.magnitude??0).toFixed(1);return`Typing rhythm changed abruptly at ${e}s (magnitude ${r}), suggesting a possible switch in input method or author.`},"WT-301":n=>`${n.params.count??0} tab-away events detected \u2014 the writer left and returned to this field multiple times during the session.`,"WT-302":()=>"Behavior was consistent throughout the session with no abrupt changes in typing rhythm or style."},he={"WT-400":n=>`${n.params.pct??0}% of events lack browser trust indicators (isTrusted=false), suggesting synthetic event injection.`,"WT-401":n=>{let e=n.params.count??0,r=n.params.pct??0;return`${e} keydown events had no matching keyup (${r}% of keydowns). Automation tools often omit keyup events.`},"WT-402":n=>`${n.params.count??0} keystroke sequences exceed the maximum human typing speed, indicating programmatic input.`,"WT-403":()=>"All keystroke timing is physically plausible \u2014 no evidence of synthetic or injected events.","WT-404":n=>{let e=n.params.chars??0,r=n.params.pct??0;return`${e} characters (${r}%) were inserted programmatically, bypassing normal keystroke input. This is consistent with automated text injection.`},"WT-405":n=>{let e=n.params.count??0,r=n.params.pct??0;return`${e} events (${r}% of keydowns) have sub-millisecond dwell time. Human key press/release always takes 30\u2013150ms; zero-latency events indicate programmatic injection.`}},fe={"WT-600":n=>`No speed variation over a ${n.params.minutes??0}-minute session. Human typing naturally fluctuates; constant speed suggests automation.`,"WT-601":()=>"Natural warmup and fatigue pattern detected \u2014 the writer started slow, reached peak speed, then gradually slowed.","WT-602":()=>"Significant fatigue detected toward the end of the session, consistent with sustained human cognitive effort.","WT-603":()=>"Temporal patterns fall within normal range \u2014 typing pace varied naturally over the session.","WT-604":n=>`${n.params.ratio??0}% of keystrokes occurred in machine-like bursts, suggesting automated input segments.`,"WT-605":n=>`Uniform typing pace across the session (fluency SD ${(n.params.sd??0).toFixed(1)}). Human writers show more variation as they think, pause, and revise.`,"WT-606":n=>`Frequent revision interruptions detected (R-burst median ${(n.params.median??0).toFixed(1)}s), consistent with active editing behavior.`,"WT-607":n=>`No linguistic pause structure detected (sentence/word pause ratio ${(n.params.ratio??0).toFixed(2)}). Human writers pause longer before sentences than within words.`,"WT-608":n=>`Low cognitive pause rate (${(n.params.rate??0).toFixed(1)}% of keystrokes), suggesting text was transcribed rather than composed.`},ge={contentOrigin:ce,timingAuthenticity:me,revisionBehavior:ue,sessionContinuity:pe,physicalPlausibility:he,temporalPatterns:fe};function et(n,e){let r=e[n];if(!(r!=null&&r.indicator))return"Analysis data not available.";let a=ge[n];if(!a)return _t(r.indicator);if(n==="contentOrigin"&&r.pasteReworkIndicator){let s=r.pasteReworkIndicator.code,o=de[s];if(o)return o(r.pasteReworkIndicator,e)}let t=a[r.indicator.code];return t?t(r.indicator,e):_t(r.indicator)}function _t(n){return`Indicator ${n.code} detected.`}var ye={contentOrigin:"In a typical session, you'd see a continuous band of typed content with occasional small paste events. A single bulk insertion is characteristic of copy-paste submission.",timingAuthenticity:"A human heatmap shows scattered clusters reflecting natural variation in finger movement. Tight single-point concentration indicates programmatic keystroke injection.",revisionBehavior:"Human writers produce clusters of corrections as they re-read and revise. Absence of corrections suggests transcription rather than composition.",sessionContinuity:"Steady growth with small plateaus (thinking pauses) is typical. A sudden vertical jump indicates bulk content insertion.",physicalPlausibility:"Human editing jumps around the document \u2014 revising earlier sections, appending new text. Strictly sequential cursor movement suggests automated input.",temporalPatterns:"Human typing shows varied pause durations \u2014 short pauses within words, longer pauses between sentences. Uniform pause lengths suggest automated pacing."};function ht(n){return ye[n]??null}function rt(n,e){return({contentOrigin:a=>{let t=a.contentOrigin.metrics,s=Math.round(t.charactersByOrigin.pasted*100),o=Math.round(t.charactersByOrigin.typed*100),i=t.pasteEvents.length,c=t.pasteEvents.reduce((l,d)=>l+d.characterCount,0);return[{label:"pasted",value:`${s}%`,flagged:s>50},{label:"typed",value:`${o}%`,flagged:!1},{label:"paste events",value:String(i),flagged:!1},{label:"chars pasted",value:be(c),flagged:!1}]},timingAuthenticity:a=>{let t=a.timingAuthenticity.metrics,s=t.flightTimeDistribution.cv,o=t.dwellTimeDistribution.mean;return[{label:"timing cv",value:s.toFixed(2),flagged:s<.2},{label:"mean dwell",value:`${Math.round(o)}ms`,flagged:o<20},{label:"periodicity",value:t.periodicityScore.toFixed(2),flagged:t.periodicityScore>.5},{label:"entropy",value:t.entropy.toFixed(1),flagged:t.entropy<1.5}]},revisionBehavior:a=>{let t=a.revisionBehavior.metrics;return[{label:"corrections",value:String(t.correctionCount),flagged:t.correctionCount===0},{label:"navigation",value:String(t.navigationCount),flagged:t.navigationCount===0},{label:"undo / redo",value:String(t.undoRedoCount),flagged:!1},{label:"product-process",value:t.productProcessRatio.toFixed(2),flagged:t.productProcessRatio===0}]},sessionContinuity:a=>{let t=a.sessionContinuity.metrics;return[{label:"change points",value:String(t.changePoints.length),flagged:t.changePoints.length>2},{label:"tab-away events",value:String(t.tabAwayEvents.length),flagged:!1}]},physicalPlausibility:a=>{let t=a.physicalPlausibility.metrics;return[{label:"synthetic ratio",value:`${Math.round(t.syntheticEventRatio*100)}%`,flagged:t.syntheticEventRatio>.05},{label:"impossible seq.",value:String(t.impossibleSequences.count),flagged:t.impossibleSequences.count>0},{label:"unmatched keydowns",value:String(t.unmatchedKeydownCount),flagged:t.unmatchedKeydownCount>5},{label:"zero-latency",value:String(t.zeroLatencyEventCount),flagged:t.zeroLatencyEventCount>0},{label:"Bulk Insert",value:String(t.bulkInsertCharCount),flagged:t.bulkInsertCharCount>0}]},temporalPatterns:a=>{let t=a.temporalPatterns.metrics;return[{label:"duration",value:at(t.sessionDurationMs),flagged:!1},{label:"warmup ratio",value:t.warmupRatio.toFixed(2),flagged:!1},{label:"fatigue ratio",value:t.fatigueRatio.toFixed(2),flagged:!1},{label:"burst ratio",value:t.burstPattern.burstToTotalRatio.toFixed(2),flagged:t.burstPattern.burstToTotalRatio>.7}]}}[n]??(()=>[]))(e)}function be(n){return n>=1e6?`${(n/1e6).toFixed(1)}m`:n>=1e3?`${(n/1e3).toFixed(1)}k`:String(n)}function at(n){let e=Math.round(n/1e3);if(e<60)return`${e}s`;let r=Math.floor(e/60),a=e%60;return a===0?`${r}m`:`${r}m ${a}s`}var vt={"coefficient of variation":{definition:"Standard deviation divided by the mean \u2014 measures how spread out values are relative to their average. Low CV means uniform timing.",docsPath:"/docs/analysis/timing/"},"dwell time":{definition:"How long a key is held down before being released.",docsPath:"/docs/analysis/timing/"},"flight time":{definition:"The gap between releasing one key and pressing the next.",docsPath:"/docs/analysis/timing/"},"product-process ratio":{definition:"The ratio of final text length to total characters typed. Low values suggest heavy revision; near 1.0 suggests linear transcription.",docsPath:"/docs/analysis/revision/"},periodicity:{definition:"How rhythmically regular the typing pattern is. High periodicity suggests metronomic (automated) input."},entropy:{definition:"A measure of randomness in timing. Low entropy means predictable, uniform intervals."},burst:{definition:"A rapid sequence of keystrokes between pauses. Human typing naturally occurs in bursts."},"synthetic event":{definition:"A keyboard event generated programmatically rather than by a real keypress. Browsers mark these with isTrusted=false."},"change point":{definition:"A moment where typing rhythm shifts abruptly, potentially indicating a switch in input method."}};function nt(n,e){let r=v(n);for(let[a,t]of Object.entries(vt)){let s=new RegExp(`\\b(${we(a)})\\b`,"gi");r=r.replace(s,o=>{let i=`title="${v(t.definition)}" class="wt-term"`,c=v(o);if(t.docsPath){let l=(e??"https://writetrack.dev")+t.docsPath;return`<a href="${v(l)}" target="_blank" rel="noopener"><abbr ${i}>${c}</abbr></a>`}return`<abbr ${i}>${c}</abbr>`})}return r}function we(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var f=P(require("@observablehq/plot"),1);var ve={contentOrigin:[0,1],timingAuthenticity:[0,1],revisionBehavior:[0,3],sessionContinuity:[0,1],physicalPlausibility:[0,1],temporalPatterns:[1,2]},xe={contentOrigin:{name:"Composition Timeline",desc:"Horizontal bar showing typing vs paste segments over time"},timingAuthenticity:{name:"Rhythm Heatmap",desc:"Dwell time vs flight time scatter showing keystroke timing distribution"},revisionBehavior:{name:"Corrections Timeline",desc:"Edit operations plotted over session time, sized by magnitude"},sessionContinuity:{name:"Document Growth Curve",desc:"Document length over session time, highlighting change points"},physicalPlausibility:{name:"Edit Waterfall",desc:"Cursor position over time, showing insertion and deletion patterns"},temporalPatterns:{name:"Speed Timeline",desc:"Words per minute over session duration, showing warmup, peak, and fatigue"}},Lt={contentOrigin:1,timingAuthenticity:1,revisionBehavior:1,sessionContinuity:2,physicalPlausibility:2,temporalPatterns:2},ke=`:host { display: block; overflow: hidden; }
|
|
170
|
+
`,_=class extends g{getStylesheet(){return tt+`
|
|
171
|
+
`+ge}render(){if(!this._data)return;let{integrity:t,outputSignature:e}=this._data,n=document.createElement("div");n.className="integrity-section";let r=document.createElement("div");r.className="integrity-title",r.textContent="Integrity & Verification",n.appendChild(r);let o=document.createElement("div");o.className="integrity-stats",o.textContent=`${t.eventCount} events \xB7 ${t.checkpoints.length} checkpoints`,n.appendChild(o);let i=document.createElement("div");i.className="integrity-hash-block";let s=document.createElement("span");s.className="integrity-hash-label",s.textContent="Digest (SHA-256)";let l=document.createElement("code");l.className="hash",l.textContent=t.finalDigest,i.append(s,l),n.appendChild(i);let c=document.createElement("div");c.className="integrity-hash-block";let d=document.createElement("span");d.className="integrity-hash-label",d.textContent="Output Signature";let m=document.createElement("code");m.className="hash",m.textContent=e,c.append(d,m),n.appendChild(c);let u=document.createElement("div");u.className="integrity-bottom";let p=document.createElement("div");p.className="qr-container";let y=document.createElement("p");y.className="integrity-explainer",y.textContent="This scorecard includes cryptographic integrity verification. The digest covers all input events; the signature covers the analysis output. Compare against original session data or scan for verification.",u.appendChild(p),u.appendChild(y),n.appendChild(u),this.replaceChart(n),requestAnimationFrame(()=>this.renderQr(t.finalDigest))}renderQr(t){let e=this.shadow.querySelector(".qr-container");if(!e)return;let n=he(t);if(!n)return;let r=getComputedStyle(this),o=r.getPropertyValue("--wt-scorecard-text").trim()||"#E4E2DA",i=r.getPropertyValue("--wt-scorecard-status-clear").trim()||"#5EAE78";e.innerHTML=fe(n,o,i)}};_.tagName="wt-integrity-footer";var Lt=new Set(["WT-104","WT-106","WT-204","WT-302","WT-403","WT-503","WT-506","WT-509","WT-601","WT-602","WT-603"]);function Bt(a){return Lt.has(a)}function W(a){return a?Lt.has(a)?"pass":"flag":"unknown"}var B={contentOrigin:"Content Origin",timingAuthenticity:"Timing & Rhythm",revisionBehavior:"Revision Behavior",sessionContinuity:"Session Continuity",physicalPlausibility:"Physical Plausibility",temporalPatterns:"Temporal Patterns"},ut=["contentOrigin","timingAuthenticity","revisionBehavior","sessionContinuity","physicalPlausibility","temporalPatterns"],pt=["contentOrigin","timingAuthenticity","revisionBehavior"],ht=["sessionContinuity","physicalPlausibility","temporalPatterns"],ye={"WT-100":()=>"No content was recorded during this session.","WT-101":a=>{let t=a.params.pct??0,e=100-t;return`Nearly all content (${t}%) was pasted from an external source. Only ${e}% of characters were typed directly.`},"WT-102":a=>`${a.params.pct??0}% of text was inserted via autocomplete, suggesting reliance on predictive input rather than original composition.`,"WT-103":a=>{let t=a.params.pct??0,e=100-t;return`${t}% of text was pasted from external sources. The remaining ${e}% was typed directly.`},"WT-104":()=>"All text was typed directly \u2014 no paste or autocomplete events were detected.","WT-105":()=>"Unmodified external content detected \u2014 pasted text was not edited after insertion, suggesting pre-composed content.","WT-106":a=>`${a.params.rework??0}% of pasted content was subsequently reworked, indicating the writer integrated external material into their own composition.`,"WT-107":a=>{let t=a.params.pasteRatio??0,e=a.params.retentionPct??0;return`High paste volume (${t}% paste ratio) with ${e}% left unmodified \u2014 content was pasted in bulk without rework.`}},be={"WT-105":()=>"Unmodified external content detected \u2014 pasted text was not edited after insertion, suggesting pre-composed content.","WT-106":a=>`${a.params.rework??0}% of pasted content was subsequently reworked, indicating the writer integrated external material into their own composition.`,"WT-107":a=>{let t=a.params.pasteRatio??0,e=a.params.retentionPct??0;return`High paste volume (${t}% paste ratio) with ${e}% left unmodified \u2014 content was pasted in bulk without rework.`}},we={"WT-200":a=>{let t=(a.params.dwellMean??0).toFixed(1),e=(a.params.flightMean??0).toFixed(1);return`Keystroke timing magnitudes (dwell ${t}ms, flight ${e}ms) fall below plausible human ranges, consistent with programmatic input injection.`},"WT-201":a=>`Keystroke timing is mechanically uniform \u2014 the coefficient of variation (${(a.params.cv??0).toFixed(2)}) falls far below the human range of 0.3\u20130.8. This pattern is consistent with automated input.`,"WT-202":a=>`A highly periodic keystroke pattern was detected (score ${(a.params.score??0).toFixed(2)}). Human typing naturally varies; metronomic regularity suggests automation.`,"WT-203":a=>`Flight times between keystrokes are suspiciously uniform (CV ${(a.params.cv??0).toFixed(2)}), lacking the natural variability expected from human finger movement.`,"WT-204":()=>"Keystroke timing variability falls within normal human ranges. The rhythm is consistent with natural typing."},ve={"WT-500":(a,t)=>`Zero corrections across the entire session. Human writers make mistakes \u2014 a ${t.keydownCount}-keystroke session with no corrections is a strong signal content was not composed here.`,"WT-501":()=>"No keystrokes were recorded, so revision behavior could not be analyzed.","WT-502":a=>`Very low correction rate (${(a.params.pct??0).toFixed(1)}%). While some writers are precise, this level of accuracy across an entire session is unusual.`,"WT-503":a=>`Normal correction rate (${(a.params.pct??0).toFixed(1)}%). The writer made and fixed mistakes at a rate consistent with natural composition.`,"WT-504":a=>`No corrections, navigation, or undo in a ${a.params.count??0}-keystroke session \u2014 the text was entered linearly without any revision.`,"WT-505":()=>"Non-linear editing was detected despite a low correction rate, suggesting some revision activity.","WT-506":a=>`Authentic revision depth detected (product-process ratio ${(a.params.ratio??0).toFixed(2)}). The writing process shows genuine iterative refinement.`,"WT-507":a=>{let t=a.params.count??0,e=a.params.keydowns??0;return`Sequential typing pattern: ${t} mid-document insertions in a ${e}-keystroke session. Content was entered start-to-finish without returning to edit earlier sections.`},"WT-508":a=>`Forward-edge concentration: ${Math.round((a.params.ratio??0)*100)}% of keystrokes occurred at the end of the document with almost no in-document editing, consistent with copy-typing or automation.`,"WT-509":a=>`Multi-word restructuring detected (${Math.round((a.params.ratio??0)*100)}% of chars from multi-word pastes), suggesting authentic revision where the writer rearranged their own text.`},xe={"WT-300":a=>{let t=Math.round(a.params.timestamp??0),e=(a.params.magnitude??0).toFixed(1);return`Typing rhythm changed abruptly at ${t}s (magnitude ${e}), suggesting a possible switch in input method or author.`},"WT-301":a=>`${a.params.count??0} tab-away events detected \u2014 the writer left and returned to this field multiple times during the session.`,"WT-302":()=>"Behavior was consistent throughout the session with no abrupt changes in typing rhythm or style."},Se={"WT-400":a=>`${a.params.pct??0}% of events lack browser trust indicators (isTrusted=false), suggesting synthetic event injection.`,"WT-401":a=>{let t=a.params.count??0,e=a.params.pct??0;return`${t} keydown events had no matching keyup (${e}% of keydowns). Automation tools often omit keyup events.`},"WT-402":a=>`${a.params.count??0} keystroke sequences exceed the maximum human typing speed, indicating programmatic input.`,"WT-403":()=>"All keystroke timing is physically plausible \u2014 no evidence of synthetic or injected events.","WT-404":a=>{let t=a.params.chars??0,e=a.params.pct??0;return`${t} characters (${e}%) were inserted via untrusted programmatic events rather than direct user input.`},"WT-405":a=>{let t=a.params.count??0,e=a.params.pct??0;return`${t} events (${e}% of keydowns) have sub-millisecond dwell time. Human key press/release always takes 30\u2013150ms; zero-latency events indicate programmatic injection.`}},ke={"WT-600":a=>`No speed variation over a ${a.params.minutes??0}-minute session. Human typing naturally fluctuates; constant speed suggests automation.`,"WT-601":()=>"Natural warmup and fatigue pattern detected \u2014 the writer started slow, reached peak speed, then gradually slowed.","WT-602":()=>"Significant fatigue detected toward the end of the session, consistent with sustained human cognitive effort.","WT-603":()=>"Temporal patterns fall within normal range \u2014 typing pace varied naturally over the session.","WT-604":a=>`${a.params.ratio??0}% of keystrokes occurred in machine-like bursts, suggesting automated input segments.`,"WT-605":a=>`Uniform typing pace across the session (fluency SD ${(a.params.sd??0).toFixed(1)}). Human writers show more variation as they think, pause, and revise.`,"WT-606":a=>`Frequent revision interruptions detected (R-burst median ${(a.params.median??0).toFixed(1)}s), consistent with active editing behavior.`,"WT-607":a=>`No linguistic pause structure detected (sentence/word pause ratio ${(a.params.ratio??0).toFixed(2)}). Human writers pause longer before sentences than within words.`,"WT-608":a=>`Low cognitive pause rate (${(a.params.rate??0).toFixed(1)}% of keystrokes), suggesting text was transcribed rather than composed.`},Ce={contentOrigin:ye,timingAuthenticity:we,revisionBehavior:ve,sessionContinuity:xe,physicalPlausibility:Se,temporalPatterns:ke};function rt(a,t){let e=t[a];if(!(e!=null&&e.indicator))return"Analysis data not available.";let n=Ce[a];if(!n)return Ot(e.indicator);if(a==="contentOrigin"&&e.pasteReworkIndicator){let o=e.pasteReworkIndicator.code,i=be[o];if(i)return i(e.pasteReworkIndicator,t)}let r=n[e.indicator.code];return r?r(e.indicator,t):Ot(e.indicator)}function Ot(a){return`Indicator ${a.code} detected.`}var Te={contentOrigin:"Shows the mix of typed, pasted, and autocompleted content. Most writing sessions include some paste events \u2014 the balance and context matter more than presence alone.",timingAuthenticity:"A human heatmap shows scattered clusters reflecting natural variation in finger movement. Tight single-point concentration indicates programmatic keystroke injection.",revisionBehavior:"Human writers produce clusters of corrections as they re-read and revise. Absence of corrections suggests transcription rather than composition.",sessionContinuity:"Steady growth with small plateaus (thinking pauses) is typical. A sudden vertical jump indicates bulk content insertion.",physicalPlausibility:"Human editing jumps around the document \u2014 revising earlier sections, appending new text. Strictly sequential cursor movement suggests automated input.",temporalPatterns:"Human typing shows varied pause durations \u2014 short pauses within words, longer pauses between sentences. Uniform pause lengths suggest automated pacing."};function ft(a){return Te[a]??null}function nt(a,t){return({contentOrigin:Ee,timingAuthenticity:Pe,revisionBehavior:Ae,sessionContinuity:Me,physicalPlausibility:Re,temporalPatterns:We}[a]??(()=>[]))(t)}function Ee(a){let t=a.contentOrigin.metrics,e=Math.round(t.charactersByOrigin.pasted*100),n=Math.round(t.charactersByOrigin.typed*100),r=t.pasteEvents.length,o=t.pasteEvents.reduce((i,s)=>i+s.characterCount,0);return[{label:"pasted",value:`${e}%`,flagged:e>50},{label:"typed",value:`${n}%`,flagged:!1},{label:"paste events",value:String(r),flagged:!1},{label:"chars pasted",value:$e(o),flagged:!1}]}function Pe(a){let t=a.timingAuthenticity.metrics,e=t.flightTimeDistribution.cv,n=t.dwellTimeDistribution.mean;return[{label:"timing cv",value:e.toFixed(2),flagged:e<.2},{label:"mean dwell",value:`${Math.round(n)}ms`,flagged:n<20},{label:"periodicity",value:t.periodicityScore.toFixed(2),flagged:t.periodicityScore>.5},{label:"entropy",value:t.entropy.toFixed(1),flagged:t.entropy<1.5}]}function Ae(a){let t=a.revisionBehavior.metrics;return[{label:"corrections",value:String(t.correctionCount),flagged:t.correctionCount===0},{label:"navigation",value:String(t.navigationCount),flagged:t.navigationCount===0},{label:"undo / redo",value:String(t.undoRedoCount),flagged:!1},{label:"product-process",value:t.productProcessRatio.toFixed(2),flagged:t.productProcessRatio===0}]}function Me(a){let t=a.sessionContinuity.metrics;return[{label:"change points",value:String(t.changePoints.length),flagged:t.changePoints.length>2},{label:"tab-away events",value:String(t.tabAwayEvents.length),flagged:!1}]}function Re(a){let t=a.physicalPlausibility.metrics;return[{label:"synthetic ratio",value:`${Math.round(t.syntheticEventRatio*100)}%`,flagged:t.syntheticEventRatio>.05},{label:"impossible seq.",value:String(t.impossibleSequences.count),flagged:t.impossibleSequences.count>0},{label:"unmatched keydowns",value:String(t.unmatchedKeydownCount),flagged:t.unmatchedKeydownCount>5},{label:"zero-latency",value:String(t.zeroLatencyEventCount),flagged:t.zeroLatencyEventCount>0},{label:"Bulk Insert",value:String(t.bulkInsertCharCount),flagged:t.bulkInsertCharCount>0}]}function We(a){let t=a.temporalPatterns.metrics;return[{label:"duration",value:at(t.sessionDurationMs),flagged:!1},{label:"warmup ratio",value:t.warmupRatio.toFixed(2),flagged:!1},{label:"fatigue ratio",value:t.fatigueRatio.toFixed(2),flagged:!1},{label:"burst ratio",value:t.burstPattern.burstToTotalRatio.toFixed(2),flagged:t.burstPattern.burstToTotalRatio>.7}]}function $e(a){return a>=1e6?`${(a/1e6).toFixed(1)}m`:a>=1e3?`${(a/1e3).toFixed(1)}k`:String(a)}function at(a){let t=Math.round(a/1e3);if(t<60)return`${t}s`;let e=Math.floor(t/60),n=t%60;return n===0?`${e}m`:`${e}m ${n}s`}var St={"coefficient of variation":{definition:"Standard deviation divided by the mean \u2014 measures how spread out values are relative to their average. Low CV means uniform timing.",docsPath:"/docs/analysis/timing/"},"dwell time":{definition:"How long a key is held down before being released.",docsPath:"/docs/analysis/timing/"},"flight time":{definition:"The gap between releasing one key and pressing the next.",docsPath:"/docs/analysis/timing/"},"product-process ratio":{definition:"The ratio of final text length to total characters typed. Low values suggest heavy revision; near 1.0 suggests linear transcription.",docsPath:"/docs/analysis/revision/"},periodicity:{definition:"How rhythmically regular the typing pattern is. High periodicity suggests metronomic (automated) input."},entropy:{definition:"A measure of randomness in timing. Low entropy means predictable, uniform intervals."},burst:{definition:"A rapid sequence of keystrokes between pauses. Human typing naturally occurs in bursts."},"synthetic event":{definition:"A keyboard event generated programmatically rather than by a real keypress. Browsers mark these with isTrusted=false."},"change point":{definition:"A moment where typing rhythm shifts abruptly, potentially indicating a switch in input method."}};function ot(a,t){let e=v(a);for(let[n,r]of Object.entries(St)){let o=new RegExp(`\\b(${De(n)})\\b`,"gi");e=e.replace(o,i=>{let s=`title="${v(r.definition)}" class="wt-term"`,l=v(i);if(r.docsPath){let c=(t??"https://writetrack.dev")+r.docsPath;return`<a href="${v(c)}" target="_blank" rel="noopener"><abbr ${s}>${l}</abbr></a>`}return`<abbr ${s}>${l}</abbr>`})}return e}function De(a){return a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var f=P(require("@observablehq/plot"),1);var _e={contentOrigin:[0,1],timingAuthenticity:[0,1],revisionBehavior:[0,3],sessionContinuity:[0,1],physicalPlausibility:[0,1],temporalPatterns:[1,2]},Oe={contentOrigin:{name:"Composition Timeline",desc:"Horizontal bar showing typing vs paste segments over time"},timingAuthenticity:{name:"Rhythm Heatmap",desc:"Dwell time vs flight time scatter showing keystroke timing distribution"},revisionBehavior:{name:"Corrections Timeline",desc:"Edit operations plotted over session time, sized by magnitude"},sessionContinuity:{name:"Document Growth Curve",desc:"Document length over session time, highlighting change points"},physicalPlausibility:{name:"Edit Waterfall",desc:"Cursor position over time, showing insertion and deletion patterns"},temporalPatterns:{name:"Speed Timeline",desc:"Words per minute over session duration, showing warmup, peak, and fatigue"}},Nt={contentOrigin:1,timingAuthenticity:1,revisionBehavior:1,sessionContinuity:2,physicalPlausibility:2,temporalPatterns:2},Le=`:host { display: block; overflow: hidden; }
|
|
172
172
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
173
173
|
.page {
|
|
174
174
|
max-width: 100%;
|
|
@@ -355,5 +355,5 @@
|
|
|
355
355
|
.page { padding: 1.25rem 1rem 2rem; }
|
|
356
356
|
.detail-inner { padding: 1rem; }
|
|
357
357
|
}
|
|
358
|
-
`,
|
|
359
|
-
`+ke}attributeChangedCallback(r,a,t){if(r==="theme"&&this._data&&this.hasRendered){let s=this.shadow.querySelector(".theme-toggle");s&&(s.textContent=t==="dark"?"Light":"Dark");let o=this.shadow.querySelector("wt-integrity-footer");o&&t&&o.setAttribute("theme",t),requestAnimationFrame(()=>this.rerenderAllCharts());return}super.attributeChangedCallback(r,a,t)}render(){var m;if(!((m=this._data)!=null&&m.analysis))return;let{data:r,analysis:a}=this._data;this.t={1:null,2:null};let t=document.createElement("div");t.className="page",t.appendChild(this.buildHeader(a,r.metadata.sessionId??"")),t.appendChild(this.buildSummary(a)),t.appendChild(this.buildTierLabel("Primary Evidence"));let s=this.buildGrid(1,a);t.appendChild(s);let o=this.buildDetailPanel(1);t.appendChild(o),t.appendChild(this.buildTierLabel("Supporting Context"));let i=this.buildGrid(2,a);t.appendChild(i);let c=this.buildDetailPanel(2);t.appendChild(c);let l=document.createElement("wt-integrity-footer"),d=this.getAttribute("theme");d&&l.setAttribute("theme",d),Rt(l),l.setData({integrity:a.integrity,outputSignature:a.outputSignature,sessionId:r.metadata.sessionId??""}),t.appendChild(l),this.replaceChart(t),requestAnimationFrame(()=>{this.renderAllCharts()})}buildHeader(r,a){let t=document.createElement("header");t.className="header";let s=document.createElement("div");s.className="header-meta";let o=document.createElement("span");o.textContent=`WriteTrack v${r.version}`;let i=document.createElement("span");i.className="sep",i.innerHTML="·";let c=document.createElement("span"),l=new Date(r.analyzedAt);c.textContent=l.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"});let d=document.createElement("span");d.className="sep",d.innerHTML="·";let m=document.createElement("span");m.className="mono",m.textContent=a,s.append(o,i,c,d,m);let u=document.createElement("button");return u.className="theme-toggle",u.textContent=this.getAttribute("theme")==="dark"?"Light":"Dark",u.addEventListener("click",()=>{let y=this.getAttribute("theme")==="dark"?"light":"dark";this.setAttribute("theme",y);try{localStorage.setItem("writetrack-v4-theme",y)}catch{}}),t.append(s,u),t}buildSummary(r){let a=document.createElement("section");a.className="summary";let t=document.createElement("div");t.className="summary-headline";let s=document.createElement("h1");s.textContent="Session Scorecard";let o=mt.filter(d=>M(this.getIndicatorCode(r,d))==="pass").length,i=document.createElement("span");i.className="tally",i.textContent=`${o} of ${mt.length} clear`,t.append(s,i),a.appendChild(t);let c=document.createElement("div");c.className="summary-stats";let l=at(r.temporalPatterns.metrics.sessionDurationMs);c.innerHTML=`<span>${v(l)} duration</span><span class="sep">·</span><span>${r.keydownCount} keystrokes</span>`,a.appendChild(c);for(let d of mt)if(M(this.getIndicatorCode(r,d))==="flag"){let m=document.createElement("div");m.className="summary-flag";let u=et(d,r);m.innerHTML=`<strong>Flagged</strong> ${v(L[d]??d)}\u2009\u2014\u2009${v(u)}`,a.appendChild(m)}return a}buildTierLabel(r){let a=document.createElement("div");return a.className="tier-label",a.textContent=r,a}buildGrid(r,a){let t=document.createElement("div");t.className="indicator-grid",t.id=`grid-${r}`;let s=r===1?ut:pt;for(let o of s)t.appendChild(this.buildCell(o,a));return t}buildCell(r,a){let t=this.getIndicatorCode(a,r),o=M(t)==="flag",i=document.createElement("div");i.className="cell"+(o?" flagged":""),i.setAttribute("data-category",r),i.addEventListener("click",()=>this.selectCell(r));let c=document.createElement("div");c.className="cell-header";let l=document.createElement("div");l.className="cell-name-col";let d=document.createElement("span");d.className="cell-name",d.textContent=L[r]??r,l.appendChild(d);let m=document.createElement("span");m.className=`cell-status ${o?"flagged":"clear"}`,m.textContent=o?"flagged":"clear",c.append(l,m),i.appendChild(c);let u=document.createElement("div");u.className="cell-chart",i.appendChild(u);let p=rt(r,a),y=ve[r];if(r==="physicalPlausibility"&&!o)if(p.every(b=>b.value==="0"||b.value==="0%")){let b=document.createElement("div");b.className="cell-allclear",b.innerHTML='<span class="cell-allclear-dot"></span>No anomalies detected',i.appendChild(b)}else i.appendChild(this.buildCellMetrics(p,y));else i.appendChild(this.buildCellMetrics(p,y));let h=document.createElement("div");return h.className="cell-affordance",h.innerHTML='<span>Details</span><span class="cell-affordance-arrow">▸</span>',i.appendChild(h),i}buildCellMetrics(r,a){let t=document.createElement("div");t.className="cell-metrics";for(let s of a){let o=r[s];if(!o)continue;let i=document.createElement("div");i.className="cell-metric",i.innerHTML=`<span class="cell-metric-label">${v(o.label)}</span><span class="cell-metric-value">${v(o.value)}</span>`,t.appendChild(i)}return t}buildDetailPanel(r){let a=document.createElement("div");a.className="detail-panel",a.id=`detail-${r}`;let t=document.createElement("button");t.className="detail-close",t.setAttribute("aria-label","Close detail"),t.innerHTML="× Close",t.addEventListener("click",o=>{o.stopPropagation(),this.closeDetail(r)}),a.appendChild(t);let s=document.createElement("div");return s.className="detail-inner",s.id=`detail-${r}-inner`,a.appendChild(s),a}selectCell(r){var d;let a=(d=this._data)==null?void 0:d.analysis;if(!a)return;let t=Lt[r],s=this.shadow.getElementById(`detail-${t}`),o=this.shadow.getElementById(`detail-${t}-inner`);if(!s||!o)return;let i=this.shadow.getElementById(`grid-${t}`);if(i==null||i.querySelectorAll(".cell").forEach(m=>m.classList.remove("selected")),this.t[t]===r){this.collapsePanel(s),this.t[t]=null;return}let c=this.t[t]!==null;this.t[t]=r;let l=i==null?void 0:i.querySelector(`[data-category="${r}"]`);l==null||l.classList.add("selected"),this.populateDetail(o,r,a),c?requestAnimationFrame(()=>{let m=o.querySelector(".detail-chart-area");if(m){let u=this.plotCategory(r,!1);u&&m.replaceChildren(u)}}):this.expandPanel(s,()=>{let m=o.querySelector(".detail-chart-area");if(m){let u=this.plotCategory(r,!1);u&&m.replaceChildren(u)}})}populateDetail(r,a,t){let s=this.getIndicatorCode(t,a),i=M(s)==="flag",c='<div class="detail-head">';c+=`<span class="detail-name">${v(L[a]??a)}</span>`,c+=`<span class="detail-code">${v(s??"")}</span>`,c+=`<span class="detail-status-label ${i?"flagged":"clear"}">${i?"flagged":"clear"}</span>`,c+="</div>";let l=et(a,t);c+=`<p class="detail-summary">${nt(l)}</p>`,c+='<div class="detail-chart-area"></div>';let d=xe[a];c+=`<div class="detail-chart-caption">${v(d.name)} \u2014 ${v(d.desc)}</div>`;let m=rt(a,t);c+='<div class="detail-metrics">';for(let p of m)c+=`<div class="detail-metric"><span class="detail-metric-value">${v(p.value)}</span><span class="detail-metric-label">${v(p.label)}</span></div>`;c+="</div>";let u=ht(a);u&&(c+=`<p class="detail-explainer">${nt(u)}</p>`),r.innerHTML=c}closeDetail(r){let a=this.shadow.getElementById(`detail-${r}`);if(!a)return;let t=this.shadow.getElementById(`grid-${r}`);t==null||t.querySelectorAll(".cell").forEach(s=>s.classList.remove("selected")),this.collapsePanel(a),this.t[r]=null}expandPanel(r,a){let t=r.querySelector(".detail-inner");r.style.height="0px",r.style.display="block",r.offsetHeight,r.style.height=`${t.offsetHeight+40}px`;let s=()=>{r.style.height="auto",a==null||a()};r.addEventListener("transitionend",s,{once:!0})}collapsePanel(r){r.style.height=`${r.scrollHeight}px`,r.offsetHeight,r.style.height="0px";let a=()=>{r.style.display=""};r.addEventListener("transitionend",a,{once:!0})}getIndicatorCode(r,a){var s;let t=r[a];return(s=t==null?void 0:t.indicator)==null?void 0:s.code}getComputedColors(){let r=getComputedStyle(this);return{line:r.getPropertyValue("--wt-scorecard-chart-line").trim()||"#1C1B18",accent:r.getPropertyValue("--wt-scorecard-chart-accent").trim()||"#2B7A5D",flagged:r.getPropertyValue("--wt-scorecard-chart-flagged").trim()||"#B8412D",border:r.getPropertyValue("--wt-scorecard-border").trim()||"#E0DED6",tertiary:r.getPropertyValue("--wt-scorecard-text-tertiary").trim()||"#706E64"}}getChartWidth(r,a){var s;let t=a?`[data-category="${r}"] .cell-chart`:`#detail-${Lt[r]}-inner .detail-chart-area`;return((s=this.shadow.querySelector(t))==null?void 0:s.getBoundingClientRect().width)??300}plotOpts(r,a,t,s,o){return{width:r,height:a?52:200,marginTop:a?4:36,marginRight:a?0:16,marginBottom:a?4:44,marginLeft:a?0:55,x:a?{axis:null,...s}:{...s},y:a?{axis:null,...o}:{...o},style:{background:"transparent",color:t.tertiary,fontFamily:"var(--wt-scorecard-font-data)",fontSize:"10px"}}}plotCategory(r,a){var d;if(!((d=this._data)!=null&&d.analysis))return null;let{data:t,analysis:s}=this._data,o=this.getComputedColors(),i=this.getIndicatorCode(s,r),l=M(i)==="flag"?o.flagged:o.accent;switch(r){case"contentOrigin":return this.plotContentOrigin(s,a,o);case"timingAuthenticity":return this.plotTimingAuthenticity(s,a,o,l);case"revisionBehavior":return this.plotRevisionBehavior(t,a,o);case"sessionContinuity":return this.plotSessionContinuity(t,s,a,o,l);case"physicalPlausibility":return this.plotPhysicalPlausibility(t,a,o);case"temporalPatterns":return this.plotTemporalPatterns(s,a,o,l)}}renderAllCharts(){this.shadow.querySelectorAll(".cell-chart").forEach(r=>{let a=r.closest(".cell"),t=a==null?void 0:a.getAttribute("data-category");if(!t)return;let s=this.plotCategory(t,!0);s&&r.replaceChildren(s)})}rerenderAllCharts(){this.renderAllCharts();for(let r of[1,2]){let a=this.t[r];if(a){let t=this.shadow.querySelector(`#detail-${r}-inner .detail-chart-area`);if(t){let s=this.plotCategory(a,!1);s&&t.replaceChildren(s)}}}}plotContentOrigin(r,a,t){let s=G(r);if(s.length===0)return null;let o={typing:t.accent,paste:t.flagged,pause:t.border,tabAway:t.tertiary,autocomplete:t.flagged,navigating:t.line},i=s.map(d=>({...d,color:o[d.type]??t.line})),c=this.getChartWidth("contentOrigin",a),l=this.plotOpts(c,a,t,{label:"Time (s)"},{padding:.2});return f.plot({...l,marginLeft:a?0:8,y:{axis:null,padding:.2},marks:[f.barX(i,{x1:"start",x2:"end",fill:"color",y:()=>"Activity",inset:.5})]})}plotTimingAuthenticity(r,a,t,s){let o=V(r);if(o.length===0)return null;let i=this.getChartWidth("timingAuthenticity",a),c=[f.dot(o,{x:"dwell",y:"flight",fill:s,fillOpacity:a?.4:.5,r:a?2:3,stroke:"none"})];if(!a){let l=o.reduce((m,u)=>m+u.dwell,0)/o.length,d=o.reduce((m,u)=>m+u.flight,0)/o.length;c.push(f.ruleX([l],{stroke:t.accent,strokeDasharray:"4,4",strokeWidth:1}),f.ruleY([d],{stroke:t.accent,strokeDasharray:"4,4",strokeWidth:1}))}return f.plot({...this.plotOpts(i,a,t,{label:"Dwell (ms)"},{label:"Flight (ms)"}),marginRight:a?4:12,marks:c})}plotRevisionBehavior(r,a,t){let s=J(r);if(s.length===0)return null;let o={insert:t.accent,delete:t.flagged,paste:t.line,cut:t.tertiary},i=s.map(l=>({...l,color:o[l.type]??t.line})),c=this.getChartWidth("revisionBehavior",a);return a?f.plot({...this.plotOpts(c,a,t),marks:[f.dot(i,{x:"time",y:()=>0,fill:"color",fillOpacity:.6,r:Math.min(3,Math.max(2,c/i.length/4)),stroke:"none"})],style:{background:"transparent"}}):f.plot({...this.plotOpts(c,a,t,{label:"Time (s)"},{label:null,domain:["insert","delete","paste","cut"]}),marginLeft:70,r:{range:[3,12]},marks:[f.dot(i,{x:"time",y:"type",r:"chars",fill:"color",fillOpacity:.7,stroke:"none"})]})}plotSessionContinuity(r,a,t,s,o){var m,u;let i=q(r);if(i.length===0)return null;let c=this.getChartWidth("sessionContinuity",t),l=[f.areaY(i,{x:"time",y:"chars",fill:o,fillOpacity:.1,curve:"step-after"}),f.lineY(i,{x:"time",y:"chars",stroke:o,strokeWidth:1.5,curve:"step-after"})],d=((u=(m=a.sessionContinuity)==null?void 0:m.metrics)==null?void 0:u.changePoints)??[];if(d.length>0){let p=d[0].timestamp/1e3;l.push(f.ruleX([p],{stroke:s.flagged,strokeDasharray:"4,3",strokeWidth:1}))}if(!t){let p=i.filter(h=>h.isPaste),y=i.filter(h=>h.isCut);p.length>0&&l.push(f.dot(p,{x:"time",y:"chars",fill:s.accent,r:4,stroke:"none"})),y.length>0&&l.push(f.dot(y,{x:"time",y:"chars",fill:s.flagged,r:4,symbol:"diamond",stroke:"none"}))}return f.plot({...this.plotOpts(c,t,s,{label:"Time (s)"},{label:"Characters",grid:!0}),marks:l})}plotPhysicalPlausibility(r,a,t){let s=Q(r);if(s.keystrokes.length===0)return null;let o=this.getChartWidth("physicalPlausibility",a),i=[f.line(s.keystrokes,{x:"time",y:"position",stroke:t.line,strokeWidth:a?1:1.5,strokeOpacity:a?.6:.8})];return a||(s.pastes.length>0&&i.push(f.dot(s.pastes,{x:"time",y:"position",fill:t.accent,r:4,stroke:"none"})),s.cuts.length>0&&i.push(f.dot(s.cuts,{x:"time",y:"position",fill:t.flagged,r:4,stroke:"none"}))),f.plot({...this.plotOpts(o,a,t,{label:"Time (s)"},{label:"Position",reverse:!0}),marks:i})}plotTemporalPatterns(r,a,t,s){let o=z(r);if(o.length===0)return null;let i=this.getChartWidth("temporalPatterns",a);return f.plot({...this.plotOpts(i,a,t,{label:"Time (s)"},{label:"Speed (CPM)",grid:!0}),marks:[f.areaY(o,{x:"time",y:"speed",fill:s,fillOpacity:.12,curve:"natural"}),f.lineY(o,{x:"time",y:"speed",stroke:s,strokeWidth:1.5,curve:"natural"})]})}};ot.tagName="wt-scorecard";0&&(module.exports={BaseChart,CATEGORY_NAMES,CompositionTimeline,CorrectionsBubble,DocumentGrowth,DocumentRibbon,EditWaterfall,GLOSSARY,IntegrityFooter,PauseDistribution,RhythmHeatmap,SEGMENT_COLORS,Sparkline,SpeedTimeline,TIER1_CATEGORIES,TIER2_CATEGORIES,WtScorecard,extractCorrectionBubbles,extractGrowthData,extractPasteMarkers,extractPauseHistogram,extractRhythmPairs,extractRibbonData,extractSegments,extractSeries,extractSpeedData,extractWaterfallData,formatDuration,generateCaption,generateSummary,getMetrics,getStatus,isPass,wrapTerms});
|
|
358
|
+
`,it=class extends g{constructor(){super();this.t={1:null,2:null};_.register()}onResize(){this.rerenderAllCharts()}getStylesheet(){return tt+`
|
|
359
|
+
`+Le}attributeChangedCallback(e,n,r){if(e==="theme"&&this._data&&this.hasRendered){let o=this.shadow.querySelector(".theme-toggle");o&&(o.textContent=r==="dark"?"Light":"Dark");let i=this.shadow.querySelector("wt-integrity-footer");i&&r&&i.setAttribute("theme",r),requestAnimationFrame(()=>this.rerenderAllCharts());return}super.attributeChangedCallback(e,n,r)}render(){var m;if(!((m=this._data)!=null&&m.analysis))return;let{data:e,analysis:n}=this._data;this.t={1:null,2:null};let r=document.createElement("div");r.className="page",r.appendChild(this.buildHeader(n,e.metadata.sessionId??"")),r.appendChild(this.buildSummary(n)),r.appendChild(this.buildTierLabel("Primary Evidence"));let o=this.buildGrid(1,n);r.appendChild(o);let i=this.buildDetailPanel(1);r.appendChild(i),r.appendChild(this.buildTierLabel("Supporting Context"));let s=this.buildGrid(2,n);r.appendChild(s);let l=this.buildDetailPanel(2);r.appendChild(l);let c=document.createElement("wt-integrity-footer"),d=this.getAttribute("theme");d&&c.setAttribute("theme",d),Wt(c),c.setData({integrity:n.integrity,outputSignature:n.outputSignature,sessionId:e.metadata.sessionId??""}),r.appendChild(c),this.replaceChart(r),requestAnimationFrame(()=>{this.renderAllCharts()})}buildHeader(e,n){let r=document.createElement("header");r.className="header";let o=document.createElement("div");o.className="header-meta";let i=document.createElement("span");i.textContent=`WriteTrack v${e.version}`;let s=document.createElement("span");s.className="sep",s.innerHTML="·";let l=document.createElement("span"),c=new Date(e.analyzedAt);l.textContent=c.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"});let d=document.createElement("span");d.className="sep",d.innerHTML="·";let m=document.createElement("span");if(m.className="mono",m.textContent=n,o.append(i,s,l,d,m),this.hasAttribute("no-toggle"))r.append(o);else{let u=document.createElement("button");u.className="theme-toggle",u.textContent=this.getAttribute("theme")==="dark"?"Light":"Dark",u.addEventListener("click",()=>{let y=this.getAttribute("theme")==="dark"?"light":"dark";this.setAttribute("theme",y);try{localStorage.setItem("writetrack-v4-theme",y)}catch{}}),r.append(o,u)}return r}buildSummary(e){let n=document.createElement("section");n.className="summary";let r=document.createElement("div");r.className="summary-headline";let o=document.createElement("h1");o.textContent="Session Scorecard";let i=ut.filter(d=>W(this.getIndicatorCode(e,d))==="pass").length,s=document.createElement("span");s.className="tally",s.textContent=`${i} of ${ut.length} clear`,r.append(o,s),n.appendChild(r);let l=document.createElement("div");l.className="summary-stats";let c=at(e.temporalPatterns.metrics.sessionDurationMs);l.innerHTML=`<span>${v(c)} duration</span><span class="sep">·</span><span>${e.keydownCount} keystrokes</span>`,n.appendChild(l);for(let d of ut)if(W(this.getIndicatorCode(e,d))==="flag"){let m=document.createElement("div");m.className="summary-flag";let u=rt(d,e);m.innerHTML=`<strong>Flagged</strong> ${v(B[d]??d)}\u2009\u2014\u2009${v(u)}`,n.appendChild(m)}return n}buildTierLabel(e){let n=document.createElement("div");return n.className="tier-label",n.textContent=e,n}buildGrid(e,n){let r=document.createElement("div");r.className="indicator-grid",r.id=`grid-${e}`;let o=e===1?pt:ht;for(let i of o)r.appendChild(this.buildCell(i,n));return r}buildCell(e,n){let r=this.getIndicatorCode(n,e),i=W(r)==="flag",s=document.createElement("div");s.className="cell"+(i?" flagged":""),s.setAttribute("data-category",e),s.addEventListener("click",()=>this.selectCell(e));let l=document.createElement("div");l.className="cell-header";let c=document.createElement("div");c.className="cell-name-col";let d=document.createElement("span");d.className="cell-name",d.textContent=B[e]??e,c.appendChild(d);let m=document.createElement("span");m.className=`cell-status ${i?"flagged":"clear"}`,m.textContent=i?"flagged":"clear",l.append(c,m),s.appendChild(l);let u=document.createElement("div");u.className="cell-chart",s.appendChild(u);let p=nt(e,n),y=_e[e];if(e==="physicalPlausibility"&&!i)if(p.every(b=>b.value==="0"||b.value==="0%")){let b=document.createElement("div");b.className="cell-allclear",b.innerHTML='<span class="cell-allclear-dot"></span>No anomalies detected',s.appendChild(b)}else s.appendChild(this.buildCellMetrics(p,y));else s.appendChild(this.buildCellMetrics(p,y));let h=document.createElement("div");return h.className="cell-affordance",h.innerHTML='<span>Details</span><span class="cell-affordance-arrow">▸</span>',s.appendChild(h),s}buildCellMetrics(e,n){let r=document.createElement("div");r.className="cell-metrics";for(let o of n){let i=e[o];if(!i)continue;let s=document.createElement("div");s.className="cell-metric",s.innerHTML=`<span class="cell-metric-label">${v(i.label)}</span><span class="cell-metric-value">${v(i.value)}</span>`,r.appendChild(s)}return r}buildDetailPanel(e){let n=document.createElement("div");n.className="detail-panel",n.id=`detail-${e}`;let r=document.createElement("button");r.className="detail-close",r.setAttribute("aria-label","Close detail"),r.innerHTML="× Close",r.addEventListener("click",i=>{i.stopPropagation(),this.closeDetail(e)}),n.appendChild(r);let o=document.createElement("div");return o.className="detail-inner",o.id=`detail-${e}-inner`,n.appendChild(o),n}selectCell(e){var d;let n=(d=this._data)==null?void 0:d.analysis;if(!n)return;let r=Nt[e],o=this.shadow.getElementById(`detail-${r}`),i=this.shadow.getElementById(`detail-${r}-inner`);if(!o||!i)return;let s=this.shadow.getElementById(`grid-${r}`);if(s==null||s.querySelectorAll(".cell").forEach(m=>m.classList.remove("selected")),this.t[r]===e){this.collapsePanel(o),this.t[r]=null;return}let l=this.t[r]!==null;this.t[r]=e;let c=s==null?void 0:s.querySelector(`[data-category="${e}"]`);c==null||c.classList.add("selected"),this.populateDetail(i,e,n),l?requestAnimationFrame(()=>{let m=i.querySelector(".detail-chart-area");if(m){let u=this.plotCategory(e,!1);u&&m.replaceChildren(u)}}):this.expandPanel(o,()=>{let m=i.querySelector(".detail-chart-area");if(m){let u=this.plotCategory(e,!1);u&&m.replaceChildren(u)}})}populateDetail(e,n,r){let o=this.getIndicatorCode(r,n),s=W(o)==="flag",l='<div class="detail-head">';l+=`<span class="detail-name">${v(B[n]??n)}</span>`,l+=`<span class="detail-code">${v(o??"")}</span>`,l+=`<span class="detail-status-label ${s?"flagged":"clear"}">${s?"flagged":"clear"}</span>`,l+="</div>";let c=rt(n,r);l+=`<p class="detail-summary">${ot(c)}</p>`,l+='<div class="detail-chart-area"></div>';let d=Oe[n];l+=`<div class="detail-chart-caption">${v(d.name)} \u2014 ${v(d.desc)}</div>`;let m=nt(n,r);l+='<div class="detail-metrics">';for(let p of m)l+=`<div class="detail-metric"><span class="detail-metric-value">${v(p.value)}</span><span class="detail-metric-label">${v(p.label)}</span></div>`;l+="</div>";let u=ft(n);u&&(l+=`<p class="detail-explainer">${ot(u)}</p>`),e.innerHTML=l}closeDetail(e){let n=this.shadow.getElementById(`detail-${e}`);if(!n)return;let r=this.shadow.getElementById(`grid-${e}`);r==null||r.querySelectorAll(".cell").forEach(o=>o.classList.remove("selected")),this.collapsePanel(n),this.t[e]=null}expandPanel(e,n){let r=e.querySelector(".detail-inner");e.style.height="0px",e.style.display="block",e.offsetHeight,e.style.height=`${r.offsetHeight+40}px`;let o=()=>{e.style.height="auto",n==null||n()};e.addEventListener("transitionend",o,{once:!0})}collapsePanel(e){e.style.height=`${e.scrollHeight}px`,e.offsetHeight,e.style.height="0px";let n=()=>{e.style.display=""};e.addEventListener("transitionend",n,{once:!0})}getIndicatorCode(e,n){var o;let r=e[n];return(o=r==null?void 0:r.indicator)==null?void 0:o.code}getComputedColors(){let e=getComputedStyle(this);return{line:e.getPropertyValue("--wt-scorecard-chart-line").trim()||"#1C1B18",accent:e.getPropertyValue("--wt-scorecard-chart-accent").trim()||"#2B7A5D",flagged:e.getPropertyValue("--wt-scorecard-chart-flagged").trim()||"#B8412D",border:e.getPropertyValue("--wt-scorecard-border").trim()||"#E0DED6",tertiary:e.getPropertyValue("--wt-scorecard-text-tertiary").trim()||"#706E64"}}getChartWidth(e,n){var o;let r=n?`[data-category="${e}"] .cell-chart`:`#detail-${Nt[e]}-inner .detail-chart-area`;return((o=this.shadow.querySelector(r))==null?void 0:o.getBoundingClientRect().width)??300}plotOpts(e,n,r,o,i){return{width:e,height:n?52:200,marginTop:n?4:36,marginRight:n?0:16,marginBottom:n?4:44,marginLeft:n?0:55,x:n?{axis:null,...o}:{...o},y:n?{axis:null,...i}:{...i},style:{background:"transparent",color:r.tertiary,fontFamily:"var(--wt-scorecard-font-data)",fontSize:"10px"}}}plotCategory(e,n){var d;if(!((d=this._data)!=null&&d.analysis))return null;let{data:r,analysis:o}=this._data,i=this.getComputedColors(),s=this.getIndicatorCode(o,e),c=W(s)==="flag"?i.flagged:i.accent;switch(e){case"contentOrigin":return this.plotContentOrigin(o,n,i);case"timingAuthenticity":return this.plotTimingAuthenticity(o,n,i,c);case"revisionBehavior":return this.plotRevisionBehavior(r,n,i);case"sessionContinuity":return this.plotSessionContinuity(r,o,n,i,c);case"physicalPlausibility":return this.plotPhysicalPlausibility(r,n,i);case"temporalPatterns":return this.plotTemporalPatterns(o,n,i,c)}}renderAllCharts(){this.shadow.querySelectorAll(".cell-chart").forEach(e=>{let n=e.closest(".cell"),r=n==null?void 0:n.getAttribute("data-category");if(!r)return;let o=this.plotCategory(r,!0);o&&e.replaceChildren(o)})}rerenderAllCharts(){this.renderAllCharts();for(let e of[1,2]){let n=this.t[e];if(n){let r=this.shadow.querySelector(`#detail-${e}-inner .detail-chart-area`);if(r){let o=this.plotCategory(n,!1);o&&r.replaceChildren(o)}}}}plotContentOrigin(e,n,r){let o=H(e);if(o.length===0)return null;let i={typing:r.accent,paste:r.flagged,pause:r.border,tabAway:r.tertiary,autocomplete:r.flagged,navigating:r.line},s=o.map(d=>({...d,color:i[d.type]??r.line})),l=this.getChartWidth("contentOrigin",n),c=this.plotOpts(l,n,r,{label:"Time (s)"},{padding:.2});return f.plot({...c,marginLeft:n?0:8,y:{axis:null,padding:.2},marks:[f.barX(s,{x1:"start",x2:"end",fill:"color",y:()=>"Activity",inset:.5})]})}plotTimingAuthenticity(e,n,r,o){let i=j(e);if(i.length===0)return null;let s=this.getChartWidth("timingAuthenticity",n),l=[f.dot(i,{x:"dwell",y:"flight",fill:o,fillOpacity:n?.4:.5,r:n?2:3,stroke:"none"})];if(!n){let c=i.reduce((m,u)=>m+u.dwell,0)/i.length,d=i.reduce((m,u)=>m+u.flight,0)/i.length;l.push(f.ruleX([c],{stroke:r.accent,strokeDasharray:"4,4",strokeWidth:1}),f.ruleY([d],{stroke:r.accent,strokeDasharray:"4,4",strokeWidth:1}))}return f.plot({...this.plotOpts(s,n,r,{label:"Dwell (ms)"},{label:"Flight (ms)"}),marginRight:n?4:12,marks:l})}plotRevisionBehavior(e,n,r){let o=Z(e);if(o.length===0)return null;let i={insert:r.accent,delete:r.flagged,paste:r.line,cut:r.tertiary},s=o.map(c=>({...c,color:i[c.type]??r.line})),l=this.getChartWidth("revisionBehavior",n);return n?f.plot({...this.plotOpts(l,n,r),marks:[f.dot(s,{x:"time",y:()=>0,fill:"color",fillOpacity:.6,r:Math.min(3,Math.max(2,l/s.length/4)),stroke:"none"})],style:{background:"transparent"}}):f.plot({...this.plotOpts(l,n,r,{label:"Time (s)"},{label:null,domain:["insert","delete","paste","cut"]}),marginLeft:70,r:{range:[3,12]},marks:[f.dot(s,{x:"time",y:"type",r:"chars",fill:"color",fillOpacity:.7,stroke:"none"})]})}plotSessionContinuity(e,n,r,o,i){var m,u;let s=K(e);if(s.length===0)return null;let l=this.getChartWidth("sessionContinuity",r),c=[f.areaY(s,{x:"time",y:"chars",fill:i,fillOpacity:.1,curve:"step-after"}),f.lineY(s,{x:"time",y:"chars",stroke:i,strokeWidth:1.5,curve:"step-after"})],d=((u=(m=n.sessionContinuity)==null?void 0:m.metrics)==null?void 0:u.changePoints)??[];if(d.length>0){let p=d[0].timestamp/1e3;c.push(f.ruleX([p],{stroke:o.flagged,strokeDasharray:"4,3",strokeWidth:1}))}if(!r){let p=s.filter(h=>h.isPaste),y=s.filter(h=>h.isCut);p.length>0&&c.push(f.dot(p,{x:"time",y:"chars",fill:o.accent,r:4,stroke:"none"})),y.length>0&&c.push(f.dot(y,{x:"time",y:"chars",fill:o.flagged,r:4,symbol:"diamond",stroke:"none"}))}return f.plot({...this.plotOpts(l,r,o,{label:"Time (s)"},{label:"Characters",grid:!0}),marks:c})}plotPhysicalPlausibility(e,n,r){let o=X(e);if(o.keystrokes.length===0)return null;let i=this.getChartWidth("physicalPlausibility",n),s=[f.line(o.keystrokes,{x:"time",y:"position",stroke:r.line,strokeWidth:n?1:1.5,strokeOpacity:n?.6:.8})];return n||(o.pastes.length>0&&s.push(f.dot(o.pastes,{x:"time",y:"position",fill:r.accent,r:4,stroke:"none"})),o.cuts.length>0&&s.push(f.dot(o.cuts,{x:"time",y:"position",fill:r.flagged,r:4,stroke:"none"}))),f.plot({...this.plotOpts(i,n,r,{label:"Time (s)"},{label:"Position",reverse:!0}),marks:s})}plotTemporalPatterns(e,n,r,o){let i=z(e);if(i.length===0)return null;let s=this.getChartWidth("temporalPatterns",n);return f.plot({...this.plotOpts(s,n,r,{label:"Time (s)"},{label:"Speed (CPM)",grid:!0}),marks:[f.areaY(i,{x:"time",y:"speed",fill:o,fillOpacity:.12,curve:"monotone-x"}),f.lineY(i,{x:"time",y:"speed",stroke:o,strokeWidth:1.5,curve:"monotone-x"})]})}};it.tagName="wt-scorecard";0&&(module.exports={BaseChart,CATEGORY_NAMES,CompositionTimeline,CorrectionsBubble,DocumentGrowth,DocumentRibbon,EditWaterfall,GLOSSARY,IntegrityFooter,PauseDistribution,RhythmHeatmap,SEGMENT_COLORS,Sparkline,SpeedTimeline,TIER1_CATEGORIES,TIER2_CATEGORIES,WtScorecard,extractCorrectionBubbles,extractGrowthData,extractPasteMarkers,extractPauseHistogram,extractRhythmPairs,extractRibbonData,extractSegments,extractSeries,extractSpeedData,extractWaterfallData,formatDuration,generateCaption,generateSummary,getMetrics,getStatus,isPass,wrapTerms});
|
package/dist/writetrack.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "writetrack",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Lightweight keystroke telemetry capture for web applications",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -170,6 +170,14 @@
|
|
|
170
170
|
"behavioral-analysis",
|
|
171
171
|
"security"
|
|
172
172
|
],
|
|
173
|
-
"author": "",
|
|
174
|
-
"license": "SEE LICENSE IN LICENSE"
|
|
173
|
+
"author": "ammil industries",
|
|
174
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
175
|
+
"repository": {
|
|
176
|
+
"type": "git",
|
|
177
|
+
"url": "git+https://github.com/ammil-industries/writetrack.git"
|
|
178
|
+
},
|
|
179
|
+
"homepage": "https://writetrack.dev",
|
|
180
|
+
"bugs": {
|
|
181
|
+
"url": "https://github.com/ammil-industries/writetrack/issues"
|
|
182
|
+
}
|
|
175
183
|
}
|