@rr0/ufoathome 0.121.0 → 0.123.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +3 -2
  2. package/dist-embed-interview/InterviewMessages_es-D5d2JVA3.js +1 -0
  3. package/dist-embed-interview/InterviewMessages_fr-CmScqfza.js +1 -0
  4. package/dist-embed-interview/InterviewMessages_it-2SNw5xMp.js +1 -0
  5. package/dist-embed-interview/rr0-interview.mjs +34 -0
  6. package/dist-embed-scene/rr0-scene.mjs +2 -2
  7. package/dist-embed-sighting/rr0-sighting.mjs +27 -27
  8. package/dist-embed-sighting-editor/{AdsbLolArchiveProvider-fy3504GB.js → AdsbLolArchiveProvider-CDtWnd9O.js} +1 -1
  9. package/dist-embed-sighting-editor/{BodyEditor-CzR-jvO7.js → BodyEditor-ChwDW_Ws.js} +1 -1
  10. package/dist-embed-sighting-editor/CaseEditorMessages_es-CNLEMPjy.js +1 -0
  11. package/dist-embed-sighting-editor/CaseEditorMessages_fr-DN3xxn9o.js +1 -0
  12. package/dist-embed-sighting-editor/CaseEditorMessages_it-B6aG-baK.js +1 -0
  13. package/dist-embed-sighting-editor/{ContrailSystem-DPqcSIVY.js → ContrailSystem-C1ugmbHe.js} +1 -1
  14. package/dist-embed-sighting-editor/{CoverageAssessor-Cvcqlzqm.js → CoverageAssessor-CmEo7iZm.js} +1 -1
  15. package/dist-embed-sighting-editor/GLTFLoader-C8s-rYg8.js +1 -0
  16. package/dist-embed-sighting-editor/HeadlightSystem-NhpS6K9T.js +34 -0
  17. package/dist-embed-sighting-editor/{HynekAssessor-EGYF4GLv.js → HynekAssessor-BzyMfAGm.js} +1 -1
  18. package/dist-embed-sighting-editor/InterviewEditorElement-CT26rBmp.js +101 -0
  19. package/dist-embed-sighting-editor/InterviewMedia-CvAxC62V.js +1 -0
  20. package/dist-embed-sighting-editor/InterviewMessages_en-cs-wWpmz.js +1 -0
  21. package/dist-embed-sighting-editor/InterviewMessages_es-D5d2JVA3.js +1 -0
  22. package/dist-embed-sighting-editor/InterviewMessages_fr-CmScqfza.js +1 -0
  23. package/dist-embed-sighting-editor/InterviewMessages_it-2SNw5xMp.js +1 -0
  24. package/dist-embed-sighting-editor/{LaunchEditor-V2d95SPb.js → LaunchEditor-BCbplrLt.js} +1 -1
  25. package/dist-embed-sighting-editor/{ModelSource-BsUEhu3K.js → ModelSource-C3dP1aBw.js} +1 -1
  26. package/dist-embed-sighting-editor/{ModelThumbnails-Bxh0kDEJ.js → ModelThumbnails-B2MXsKrk.js} +1 -1
  27. package/dist-embed-sighting-editor/{ModelViewer-8GDjRszL.js → ModelViewer-BltV6g37.js} +1 -1
  28. package/dist-embed-sighting-editor/{RoadMarkings-DgTkyJ3L.js → RoadMarkings-B3u94pIv.js} +1 -1
  29. package/dist-embed-sighting-editor/{TraceSystem-B432m_Cj.js → TraceSystem-CZFR0soj.js} +2 -2
  30. package/dist-embed-sighting-editor/interviewImport-C-TiARLK.js +4 -0
  31. package/dist-embed-sighting-editor/interviewJson-CfwBPiuG.js +8 -0
  32. package/dist-embed-sighting-editor/interviewSchema-CMRZUnRy.js +1 -0
  33. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +341 -364
  34. package/dist-embed-sighting-editor/surroundingsSources-CvhFXPJx.js +1 -0
  35. package/dist-embed-sighting-editor/{trafficRuntime-j3m3LpCc.js → trafficRuntime-XVgt3vom.js} +2 -2
  36. package/package.json +10 -6
  37. package/dist-embed-sighting-editor/CaseEditorMessages_es-D73IC39g.js +0 -1
  38. package/dist-embed-sighting-editor/CaseEditorMessages_fr-Ct3RkRag.js +0 -1
  39. package/dist-embed-sighting-editor/CaseEditorMessages_it-DLJsrUtH.js +0 -1
  40. package/dist-embed-sighting-editor/GLTFLoader-7CUTWiMy.js +0 -1
  41. package/dist-embed-sighting-editor/HeadlightSystem-BSokhsgi.js +0 -34
  42. package/dist-embed-sighting-editor/InterviewMessages_es-TjWn41kX.js +0 -1
  43. package/dist-embed-sighting-editor/InterviewMessages_fr-BY_iezXh.js +0 -1
  44. package/dist-embed-sighting-editor/InterviewMessages_it-DkQ8uaNR.js +0 -1
  45. package/dist-embed-sighting-editor/interviewSchema-DcJWoqJZ.js +0 -1
  46. package/dist-embed-sighting-editor/surroundingsSources-CCnNDL0o.js +0 -1
@@ -1 +1 @@
1
- import{W as c}from"./rr0-sighting-editor.mjs";import{M as i}from"./ModelSource-BsUEhu3K.js";class l{static SIZE_PX={width:192,height:144};static cache=new Map;static queue=Promise.resolve();static pending=0;static renderer;static of(r){const t=i.key(r);let e=this.cache.get(t);return e||(this.pending++,e=this.queue.then(()=>this.draw(r)).catch(()=>{}).finally(()=>{--this.pending===0&&this.release()}),this.queue=e,this.cache.set(t,e)),e}static async draw(r){const t=await i.build(r);try{const{width:e,height:n}=this.SIZE_PX,a=i.stage(t,e/n);if(!a)return;const s=this.renderer??=new c({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});return s.setSize(e,n,!1),s.setClearColor(0,0),s.render(a.scene,a.camera),s.domElement.toDataURL("image/png")}finally{i.dispose(t)}}static release(){this.renderer?.dispose(),this.renderer?.forceContextLoss(),this.renderer=void 0}}export{l as ModelThumbnails};
1
+ import{W as c}from"./rr0-sighting-editor.mjs";import{M as i}from"./ModelSource-C3dP1aBw.js";class l{static SIZE_PX={width:192,height:144};static cache=new Map;static queue=Promise.resolve();static pending=0;static renderer;static of(r){const t=i.key(r);let e=this.cache.get(t);return e||(this.pending++,e=this.queue.then(()=>this.draw(r)).catch(()=>{}).finally(()=>{--this.pending===0&&this.release()}),this.queue=e,this.cache.set(t,e)),e}static async draw(r){const t=await i.build(r);try{const{width:e,height:n}=this.SIZE_PX,a=i.stage(t,e/n);if(!a)return;const s=this.renderer??=new c({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});return s.setSize(e,n,!1),s.setClearColor(0,0),s.render(a.scene,a.camera),s.domElement.toDataURL("image/png")}finally{i.dispose(t)}}static release(){this.renderer?.dispose(),this.renderer?.forceContextLoss(),this.renderer=void 0}}export{l as ModelThumbnails};
@@ -1 +1 @@
1
- import{W as h}from"./rr0-sighting-editor.mjs";import{M as c}from"./ModelSource-BsUEhu3K.js";class a{constructor(t,e){this.container=t,this.source=e,this.canvas=document.createElement("canvas"),this.canvas.className="model-live",this.canvas.style.cssText="position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:grab;display:none",this.canvas.addEventListener("pointerdown",s=>this.press(s)),this.canvas.addEventListener("pointermove",s=>this.move(s)),this.canvas.addEventListener("pointerup",()=>this.release()),this.canvas.addEventListener("pointercancel",()=>this.release())}static renderer;static SPIN_RAD_PER_S=.7;static DRAG_RAD_PER_PX=.012;static CLICK_TOLERANCE_PX=4;static current;object;stage;frame=0;stopped=!1;last=0;dragging;draggedPastClick=!1;canvas;static show(t,e){a.current?.stop();const s=new a(t,e);return a.current=s,s.start(),s}static end(){a.current?.stop(),a.current=void 0,a.renderer?.dispose(),a.renderer?.forceContextLoss(),a.renderer=void 0}consumeDrag(){const t=this.draggedPastClick;return this.draggedPastClick=!1,t}get active(){return!this.stopped}stop(){this.stopped=!0,cancelAnimationFrame(this.frame),this.canvas.remove(),this.object&&c.dispose(this.object),this.object=void 0,a.current===this&&(a.current=void 0)}async start(){try{const t=await c.build(this.source);if(this.stopped){c.dispose(t);return}this.object=t;const{width:e,height:s}=this.container.getBoundingClientRect(),i=e>0&&s>0?e/s:4/3;if(this.stage=c.stage(t,i),!this.stage)return;(a.renderer??=new h({antialias:!0,alpha:!0})).setClearColor(0,0),this.container.append(this.canvas),this.canvas.style.display="block",this.last=performance.now(),this.tick()}catch{}}tick=()=>{if(this.stopped||!this.stage)return;const t=performance.now(),e=Math.min(.1,(t-this.last)/1e3);this.last=t,this.dragging||(this.stage.pivot.rotation.y+=a.SPIN_RAD_PER_S*e);const s=a.renderer,{width:i,height:n}=this.canvas.getBoundingClientRect(),r=Math.min(2,window.devicePixelRatio||1);(this.canvas.width!==Math.round(i*r)||this.canvas.height!==Math.round(n*r))&&(s.setPixelRatio(r),s.setSize(i,n,!1),this.canvas.width=Math.round(i*r),this.canvas.height=Math.round(n*r),this.stage.camera.aspect=i/Math.max(1,n),this.stage.camera.updateProjectionMatrix()),s.render(this.stage.scene,this.stage.camera);const o=this.canvas.getContext("2d");o?.clearRect(0,0,this.canvas.width,this.canvas.height),o?.drawImage(s.domElement,0,0,this.canvas.width,this.canvas.height),this.frame=requestAnimationFrame(this.tick)};press(t){this.dragging={x:t.clientX,y:t.clientY,moved:!1},this.canvas.setPointerCapture(t.pointerId),this.canvas.style.cursor="grabbing"}move(t){const e=this.dragging;if(!e||!this.stage)return;const s=t.clientX-e.x,i=t.clientY-e.y;!e.moved&&Math.hypot(s,i)<a.CLICK_TOLERANCE_PX||(e.moved=!0,this.draggedPastClick=!0,this.stage.pivot.rotation.y+=s*a.DRAG_RAD_PER_PX,this.stage.pivot.rotation.x=Math.max(-1.4,Math.min(1.4,this.stage.pivot.rotation.x-i*a.DRAG_RAD_PER_PX)),e.x=t.clientX,e.y=t.clientY)}release(){this.dragging=void 0,this.canvas.style.cursor="grab"}}export{a as ModelViewer};
1
+ import{W as h}from"./rr0-sighting-editor.mjs";import{M as c}from"./ModelSource-C3dP1aBw.js";class a{constructor(t,e){this.container=t,this.source=e,this.canvas=document.createElement("canvas"),this.canvas.className="model-live",this.canvas.style.cssText="position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:grab;display:none",this.canvas.addEventListener("pointerdown",s=>this.press(s)),this.canvas.addEventListener("pointermove",s=>this.move(s)),this.canvas.addEventListener("pointerup",()=>this.release()),this.canvas.addEventListener("pointercancel",()=>this.release())}static renderer;static SPIN_RAD_PER_S=.7;static DRAG_RAD_PER_PX=.012;static CLICK_TOLERANCE_PX=4;static current;object;stage;frame=0;stopped=!1;last=0;dragging;draggedPastClick=!1;canvas;static show(t,e){a.current?.stop();const s=new a(t,e);return a.current=s,s.start(),s}static end(){a.current?.stop(),a.current=void 0,a.renderer?.dispose(),a.renderer?.forceContextLoss(),a.renderer=void 0}consumeDrag(){const t=this.draggedPastClick;return this.draggedPastClick=!1,t}get active(){return!this.stopped}stop(){this.stopped=!0,cancelAnimationFrame(this.frame),this.canvas.remove(),this.object&&c.dispose(this.object),this.object=void 0,a.current===this&&(a.current=void 0)}async start(){try{const t=await c.build(this.source);if(this.stopped){c.dispose(t);return}this.object=t;const{width:e,height:s}=this.container.getBoundingClientRect(),i=e>0&&s>0?e/s:4/3;if(this.stage=c.stage(t,i),!this.stage)return;(a.renderer??=new h({antialias:!0,alpha:!0})).setClearColor(0,0),this.container.append(this.canvas),this.canvas.style.display="block",this.last=performance.now(),this.tick()}catch{}}tick=()=>{if(this.stopped||!this.stage)return;const t=performance.now(),e=Math.min(.1,(t-this.last)/1e3);this.last=t,this.dragging||(this.stage.pivot.rotation.y+=a.SPIN_RAD_PER_S*e);const s=a.renderer,{width:i,height:n}=this.canvas.getBoundingClientRect(),r=Math.min(2,window.devicePixelRatio||1);(this.canvas.width!==Math.round(i*r)||this.canvas.height!==Math.round(n*r))&&(s.setPixelRatio(r),s.setSize(i,n,!1),this.canvas.width=Math.round(i*r),this.canvas.height=Math.round(n*r),this.stage.camera.aspect=i/Math.max(1,n),this.stage.camera.updateProjectionMatrix()),s.render(this.stage.scene,this.stage.camera);const o=this.canvas.getContext("2d");o?.clearRect(0,0,this.canvas.width,this.canvas.height),o?.drawImage(s.domElement,0,0,this.canvas.width,this.canvas.height),this.frame=requestAnimationFrame(this.tick)};press(t){this.dragging={x:t.clientX,y:t.clientY,moved:!1},this.canvas.setPointerCapture(t.pointerId),this.canvas.style.cursor="grabbing"}move(t){const e=this.dragging;if(!e||!this.stage)return;const s=t.clientX-e.x,i=t.clientY-e.y;!e.moved&&Math.hypot(s,i)<a.CLICK_TOLERANCE_PX||(e.moved=!0,this.draggedPastClick=!0,this.stage.pivot.rotation.y+=s*a.DRAG_RAD_PER_PX,this.stage.pivot.rotation.x=Math.max(-1.4,Math.min(1.4,this.stage.pivot.rotation.x-i*a.DRAG_RAD_PER_PX)),e.x=t.clientX,e.y=t.clientY)}release(){this.dragging=void 0,this.canvas.style.cursor="grab"}}export{a as ModelViewer};
@@ -1 +1 @@
1
- import{ab as D}from"./rr0-sighting-editor.mjs";class l{static MIN_ROAD_M=5.5;static WIDE_ROAD_M=9;static LINE_WIDTH_M=.12;static DASH_M=3;static GAP_M=10;static RIVE_DASH_M=2.5;static RIVE_GAP_M=3.5;static MIN_DASH_M=.5;static LANE_M=3.5;static SHOULDER_MIN_M=1.5;static SOLID_EDGE_FROM_M=7;static SOLID_EDGE_FROM_KMH=80;static BEND_RADIUS_M=300;static EDGE_SETBACK_M=.4;static PAINT_RADIUS_M=450;static LIFT_M=.015;static BARRIER_MAX_AXES_M=40;static BARRIER_MIN_AXES_M=5;static BARRIER_HEIGHT_M=.8;static BARRIER_HALF_WIDTH_M=.2;static BARRIER_STEP_M=4;static painted(t){return t.surface==="paved"&&t.widthM>=l.MIN_ROAD_M&&t.kind!=="roundabout"}static plan(t){if(!l.painted(t))return[];const M=t.widthM,r=M/2,c=l.EDGE_SETBACK_M;if(!(t.direction!==void 0&&t.lanes!==void 0)){const I=[{offsetM:r-c,pattern:"solid"},{offsetM:-(r-c),pattern:"solid"}],A=M>=l.WIDE_ROAD_M?[-M/4,M/4]:[0];for(const x of A)I.push({offsetM:x,pattern:"dashed"});return I}const s=t.lanes,n=M>=l.SOLID_EDGE_FROM_M||(t.speedKmh??0)>=l.SOLID_EDGE_FROM_KMH?"solid":"rive";if(t.direction==="both"){if(s<2)return[];const I=[{offsetM:r-c,pattern:n},{offsetM:-(r-c),pattern:n}];if(s>=4){I.push({offsetM:.1,pattern:"solid"},{offsetM:-.1,pattern:"solid"});const A=Math.floor(s/2),x=M/s;for(let z=1;z<A;z++)I.push({offsetM:z*x,pattern:"dashed"},{offsetM:-z*x,pattern:"dashed"})}else I.push({offsetM:0,pattern:"dashed",solidInBends:!0});return I}const u=t.direction==="backward"?-1:1,o=I=>u*(r-I),i=Math.min(l.LANE_M,M/Math.max(s,1)),h=s*i,_=M-h,d=(t.kind==="motorway"||t.kind==="dual")&&_>=l.SHOULDER_MIN_M,E=[{offsetM:o(c),pattern:t.kind==="motorway"||t.kind==="dual"?"solid":n}];E.push({offsetM:o(d?h:M-c),pattern:t.kind==="motorway"||t.kind==="dual"?"solid":n});for(let I=1;I<s;I++)E.push({offsetM:o(I*i),pattern:"dashed"});return E}static lay(t,M,r,c){let e=0;const s=(f,n)=>{c(f,l.LINE_WIDTH_M,{offsetM:n,liftM:l.LIFT_M,minHalfM:l.LINE_WIDTH_M/2}),e++};for(const f of t){const n=l.plan(f);if(n.length===0)continue;const u=f.points.map(o=>D(o.lat,o.lng,M,r));for(const o of l.near(u,l.PAINT_RADIUS_M))for(const i of n){if(i.pattern==="solid"){s(o,i.offsetM);continue}const[h,_]=i.pattern==="dashed"?[l.DASH_M,l.GAP_M]:[l.RIVE_DASH_M,l.RIVE_GAP_M];for(const d of i.solidInBends?l.byBends(o):[{path:o,bend:!1}])if(d.bend)s(d.path,i.offsetM);else for(const E of l.dashes(d.path,h,_))s(E,i.offsetM)}}return e}static byBends(t){if(t.length<3)return[{path:t,bend:!1}];const M=(e,s)=>Math.atan2(s.x-e.x,-(s.z-e.z)),r=new Array(t.length-1).fill(!1);for(let e=1;e<t.length-1;e++){const s=Math.hypot(t[e].x-t[e-1].x,t[e].z-t[e-1].z),f=Math.hypot(t[e+1].x-t[e].x,t[e+1].z-t[e].z);if(s<1e-6||f<1e-6)continue;let n=Math.abs(M(t[e],t[e+1])-M(t[e-1],t[e]));n>Math.PI&&(n=2*Math.PI-n),(s+f)/2/Math.max(n,1e-6)<l.BEND_RADIUS_M&&(r[e-1]=!0,r[e]=!0)}const c=[];for(let e=0;e<r.length;e++){const s=c.at(-1);s&&s.bend===r[e]?s.path.push(t[e+1]):c.push({path:[t[e],t[e+1]],bend:r[e]})}return c}static barriers(t,M,r){const c=t.filter(n=>(n.kind==="motorway"||n.kind==="dual")&&(n.direction==="forward"||n.direction==="backward")),e=c.map(n=>{const u=n.points.map(o=>D(o.lat,o.lng,M,r));return n.direction==="backward"?[...u].reverse():u}),s=[],f=l.BARRIER_STEP_M;return c.forEach((n,u)=>{for(const o of l.near(e[u],l.PAINT_RADIUS_M)){let i=[];for(const h of l.resample(o,f)){const _=l.midwayToOpposite(h,u,c,e);_?i.push(_):i.length>0&&(i.length>=2&&s.push(i),i=[])}i.length>=2&&s.push(i)}}),s}static midwayToOpposite(t,M,r,c){let e;for(let s=0;s<c.length;s++){if(s===M||r[s].id<r[M].id)continue;const f=c[s];for(let n=0;n<f.length-1;n++){const u=f[n+1].x-f[n].x,o=f[n+1].z-f[n].z,i=u*u+o*o;if(i<1e-9||(u*t.dx+o*t.dz)/Math.sqrt(i)>-.9)continue;const h=Math.max(0,Math.min(1,((t.x-f[n].x)*u+(t.z-f[n].z)*o)/i)),_={x:f[n].x+u*h,z:f[n].z+o*h},d=Math.hypot(t.x-_.x,t.z-_.z);d<l.BARRIER_MIN_AXES_M||d>l.BARRIER_MAX_AXES_M||(!e||d<e.distance)&&(e={distance:d,point:_})}}return e?{x:(t.x+e.point.x)/2,z:(t.z+e.point.z)/2}:void 0}static resample(t,M){const r=[];for(let c=0;c<t.length-1;c++){const e=Math.hypot(t[c+1].x-t[c].x,t[c+1].z-t[c].z);if(e<1e-6)continue;const s=(t[c+1].x-t[c].x)/e,f=(t[c+1].z-t[c].z)/e;for(let n=0;n<e;n+=M)r.push({x:t[c].x+s*n,z:t[c].z+f*n,dx:s,dz:f})}return r}static barrierGeometry(t,M){const r=[],c=[],e=l.BARRIER_HALF_WIDTH_M;for(const s of t){if(s.length<2)continue;const f=r.length/3;for(let n=0;n<s.length;n++){const u=s[Math.max(0,n-1)],o=s[Math.min(s.length-1,n+1)],i=Math.hypot(o.x-u.x,o.z-u.z)||1,h=-(o.z-u.z)/i*e,_=(o.x-u.x)/i*e,d=M(s[n].x,s[n].z);r.push(s[n].x+h,d,s[n].z+_,s[n].x+h,d+l.BARRIER_HEIGHT_M,s[n].z+_,s[n].x-h,d+l.BARRIER_HEIGHT_M,s[n].z-_,s[n].x-h,d,s[n].z-_)}for(let n=0;n<s.length-1;n++){const u=f+n*4,o=u+4;for(let i=0;i<3;i++)c.push(u+i,o+i,u+i+1,u+i+1,o+i,o+i+1)}}return{positions:r,indices:c}}static near(t,M){const r=[];let c;for(let e=0;e<t.length-1;e++)Math.min(Math.hypot(t[e].x,t[e].z),Math.hypot(t[e+1].x,t[e+1].z))<=M||Math.hypot((t[e].x+t[e+1].x)/2,(t[e].z+t[e+1].z)/2)<=M?(c||(c=[t[e]]),c.push(t[e+1])):c&&(r.push(c),c=void 0);return c&&r.push(c),r}static dashes(t,M,r){const c=[],e=M+r;let s=0,f;const n=(o,i)=>({x:t[o].x+(t[o+1].x-t[o].x)*i,z:t[o].z+(t[o+1].z-t[o].z)*i});for(let o=0;o<t.length-1;o++){const i=Math.hypot(t[o+1].x-t[o].x,t[o+1].z-t[o].z);if(i<1e-6)continue;let h=0;for(;h<i;){const _=(s+h)%e,d=_<M,E=d?M-_:e-_,I=Math.min(i,h+E);d&&(f||(f=[n(o,h/i)]),f.push(n(o,I/i)),I-h>=E-1e-9&&(c.push(f),f=void 0)),h=I}s+=i}f&&f.length>=2&&c.push(f);const u=o=>o.slice(1).reduce((i,h,_)=>i+Math.hypot(h.x-o[_].x,h.z-o[_].z),0);return c.filter(o=>o.length>=2&&u(o)>=l.MIN_DASH_M)}}export{l as RoadMarkings};
1
+ import{aj as D}from"./rr0-sighting-editor.mjs";class l{static MIN_ROAD_M=5.5;static WIDE_ROAD_M=9;static LINE_WIDTH_M=.12;static DASH_M=3;static GAP_M=10;static RIVE_DASH_M=2.5;static RIVE_GAP_M=3.5;static MIN_DASH_M=.5;static LANE_M=3.5;static SHOULDER_MIN_M=1.5;static SOLID_EDGE_FROM_M=7;static SOLID_EDGE_FROM_KMH=80;static BEND_RADIUS_M=300;static EDGE_SETBACK_M=.4;static PAINT_RADIUS_M=450;static LIFT_M=.015;static BARRIER_MAX_AXES_M=40;static BARRIER_MIN_AXES_M=5;static BARRIER_HEIGHT_M=.8;static BARRIER_HALF_WIDTH_M=.2;static BARRIER_STEP_M=4;static painted(t){return t.surface==="paved"&&t.widthM>=l.MIN_ROAD_M&&t.kind!=="roundabout"}static plan(t){if(!l.painted(t))return[];const M=t.widthM,r=M/2,c=l.EDGE_SETBACK_M;if(!(t.direction!==void 0&&t.lanes!==void 0)){const I=[{offsetM:r-c,pattern:"solid"},{offsetM:-(r-c),pattern:"solid"}],A=M>=l.WIDE_ROAD_M?[-M/4,M/4]:[0];for(const x of A)I.push({offsetM:x,pattern:"dashed"});return I}const s=t.lanes,n=M>=l.SOLID_EDGE_FROM_M||(t.speedKmh??0)>=l.SOLID_EDGE_FROM_KMH?"solid":"rive";if(t.direction==="both"){if(s<2)return[];const I=[{offsetM:r-c,pattern:n},{offsetM:-(r-c),pattern:n}];if(s>=4){I.push({offsetM:.1,pattern:"solid"},{offsetM:-.1,pattern:"solid"});const A=Math.floor(s/2),x=M/s;for(let z=1;z<A;z++)I.push({offsetM:z*x,pattern:"dashed"},{offsetM:-z*x,pattern:"dashed"})}else I.push({offsetM:0,pattern:"dashed",solidInBends:!0});return I}const u=t.direction==="backward"?-1:1,o=I=>u*(r-I),i=Math.min(l.LANE_M,M/Math.max(s,1)),h=s*i,_=M-h,d=(t.kind==="motorway"||t.kind==="dual")&&_>=l.SHOULDER_MIN_M,E=[{offsetM:o(c),pattern:t.kind==="motorway"||t.kind==="dual"?"solid":n}];E.push({offsetM:o(d?h:M-c),pattern:t.kind==="motorway"||t.kind==="dual"?"solid":n});for(let I=1;I<s;I++)E.push({offsetM:o(I*i),pattern:"dashed"});return E}static lay(t,M,r,c){let e=0;const s=(f,n)=>{c(f,l.LINE_WIDTH_M,{offsetM:n,liftM:l.LIFT_M,minHalfM:l.LINE_WIDTH_M/2}),e++};for(const f of t){const n=l.plan(f);if(n.length===0)continue;const u=f.points.map(o=>D(o.lat,o.lng,M,r));for(const o of l.near(u,l.PAINT_RADIUS_M))for(const i of n){if(i.pattern==="solid"){s(o,i.offsetM);continue}const[h,_]=i.pattern==="dashed"?[l.DASH_M,l.GAP_M]:[l.RIVE_DASH_M,l.RIVE_GAP_M];for(const d of i.solidInBends?l.byBends(o):[{path:o,bend:!1}])if(d.bend)s(d.path,i.offsetM);else for(const E of l.dashes(d.path,h,_))s(E,i.offsetM)}}return e}static byBends(t){if(t.length<3)return[{path:t,bend:!1}];const M=(e,s)=>Math.atan2(s.x-e.x,-(s.z-e.z)),r=new Array(t.length-1).fill(!1);for(let e=1;e<t.length-1;e++){const s=Math.hypot(t[e].x-t[e-1].x,t[e].z-t[e-1].z),f=Math.hypot(t[e+1].x-t[e].x,t[e+1].z-t[e].z);if(s<1e-6||f<1e-6)continue;let n=Math.abs(M(t[e],t[e+1])-M(t[e-1],t[e]));n>Math.PI&&(n=2*Math.PI-n),(s+f)/2/Math.max(n,1e-6)<l.BEND_RADIUS_M&&(r[e-1]=!0,r[e]=!0)}const c=[];for(let e=0;e<r.length;e++){const s=c.at(-1);s&&s.bend===r[e]?s.path.push(t[e+1]):c.push({path:[t[e],t[e+1]],bend:r[e]})}return c}static barriers(t,M,r){const c=t.filter(n=>(n.kind==="motorway"||n.kind==="dual")&&(n.direction==="forward"||n.direction==="backward")),e=c.map(n=>{const u=n.points.map(o=>D(o.lat,o.lng,M,r));return n.direction==="backward"?[...u].reverse():u}),s=[],f=l.BARRIER_STEP_M;return c.forEach((n,u)=>{for(const o of l.near(e[u],l.PAINT_RADIUS_M)){let i=[];for(const h of l.resample(o,f)){const _=l.midwayToOpposite(h,u,c,e);_?i.push(_):i.length>0&&(i.length>=2&&s.push(i),i=[])}i.length>=2&&s.push(i)}}),s}static midwayToOpposite(t,M,r,c){let e;for(let s=0;s<c.length;s++){if(s===M||r[s].id<r[M].id)continue;const f=c[s];for(let n=0;n<f.length-1;n++){const u=f[n+1].x-f[n].x,o=f[n+1].z-f[n].z,i=u*u+o*o;if(i<1e-9||(u*t.dx+o*t.dz)/Math.sqrt(i)>-.9)continue;const h=Math.max(0,Math.min(1,((t.x-f[n].x)*u+(t.z-f[n].z)*o)/i)),_={x:f[n].x+u*h,z:f[n].z+o*h},d=Math.hypot(t.x-_.x,t.z-_.z);d<l.BARRIER_MIN_AXES_M||d>l.BARRIER_MAX_AXES_M||(!e||d<e.distance)&&(e={distance:d,point:_})}}return e?{x:(t.x+e.point.x)/2,z:(t.z+e.point.z)/2}:void 0}static resample(t,M){const r=[];for(let c=0;c<t.length-1;c++){const e=Math.hypot(t[c+1].x-t[c].x,t[c+1].z-t[c].z);if(e<1e-6)continue;const s=(t[c+1].x-t[c].x)/e,f=(t[c+1].z-t[c].z)/e;for(let n=0;n<e;n+=M)r.push({x:t[c].x+s*n,z:t[c].z+f*n,dx:s,dz:f})}return r}static barrierGeometry(t,M){const r=[],c=[],e=l.BARRIER_HALF_WIDTH_M;for(const s of t){if(s.length<2)continue;const f=r.length/3;for(let n=0;n<s.length;n++){const u=s[Math.max(0,n-1)],o=s[Math.min(s.length-1,n+1)],i=Math.hypot(o.x-u.x,o.z-u.z)||1,h=-(o.z-u.z)/i*e,_=(o.x-u.x)/i*e,d=M(s[n].x,s[n].z);r.push(s[n].x+h,d,s[n].z+_,s[n].x+h,d+l.BARRIER_HEIGHT_M,s[n].z+_,s[n].x-h,d+l.BARRIER_HEIGHT_M,s[n].z-_,s[n].x-h,d,s[n].z-_)}for(let n=0;n<s.length-1;n++){const u=f+n*4,o=u+4;for(let i=0;i<3;i++)c.push(u+i,o+i,u+i+1,u+i+1,o+i,o+i+1)}}return{positions:r,indices:c}}static near(t,M){const r=[];let c;for(let e=0;e<t.length-1;e++)Math.min(Math.hypot(t[e].x,t[e].z),Math.hypot(t[e+1].x,t[e+1].z))<=M||Math.hypot((t[e].x+t[e+1].x)/2,(t[e].z+t[e+1].z)/2)<=M?(c||(c=[t[e]]),c.push(t[e+1])):c&&(r.push(c),c=void 0);return c&&r.push(c),r}static dashes(t,M,r){const c=[],e=M+r;let s=0,f;const n=(o,i)=>({x:t[o].x+(t[o+1].x-t[o].x)*i,z:t[o].z+(t[o+1].z-t[o].z)*i});for(let o=0;o<t.length-1;o++){const i=Math.hypot(t[o+1].x-t[o].x,t[o+1].z-t[o].z);if(i<1e-6)continue;let h=0;for(;h<i;){const _=(s+h)%e,d=_<M,E=d?M-_:e-_,I=Math.min(i,h+E);d&&(f||(f=[n(o,h/i)]),f.push(n(o,I/i)),I-h>=E-1e-9&&(c.push(f),f=void 0)),h=I}s+=i}f&&f.length>=2&&c.push(f);const u=o=>o.slice(1).reduce((i,h,_)=>i+Math.hypot(h.x-o[_].x,h.z-o[_].z),0);return c.filter(o=>o.length>=2&&u(o)>=l.MIN_DASH_M)}}export{l as RoadMarkings};
@@ -1,4 +1,4 @@
1
- import{z as ee,F,C as G,J as M,K as te,o as j,p as $,u as E,N as ie,Q as O,X as J,Y as ne,Z as I,M as se,$ as B,a0 as oe,a1 as ae,a2 as re,G as le,a3 as ce,a4 as de,a5 as fe,a6 as ue,a7 as pe,a8 as he,a9 as me,aa as V,ab as ge}from"./rr0-sighting-editor.mjs";const k=new j,P=new E;class Q extends ee{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new F(e,3)),this.setAttribute("uv",new F(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,i=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),i.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new G(n,6,1);return this.setAttribute("instanceStart",new M(i,3,0)),this.setAttribute("instanceEnd",new M(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new G(n,6,1);return this.setAttribute("instanceColorStart",new M(i,3,0)),this.setAttribute("instanceColorEnd",new M(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new te(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new j);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),k.setFromBufferAttribute(n),this.boundingBox.union(k))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new $),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let t=0;for(let o=0,l=e.count;o<l;o++)P.fromBufferAttribute(e,o),t=Math.max(t,i.distanceToSquared(P)),P.fromBufferAttribute(n,o),t=Math.max(t,i.distanceToSquared(P));this.boundingSphere.radius=Math.sqrt(t),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}I.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new ne},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};O.line={uniforms:J.merge([I.common,I.fog,I.line]),vertexShader:`
1
+ import{Y as ee,Z as F,$ as G,a0 as M,a1 as te,w as j,x as J,J as E,a2 as ie,a3 as O,a4 as K,a5 as ne,a6 as I,M as se,a7 as B,a8 as oe,a9 as ae,aa as re,G as le,ab as ce,ac as de,ad as fe,ae as ue,af as pe,ag as he,ah as me,ai as V,aj as ge}from"./rr0-sighting-editor.mjs";const k=new j,P=new E;class Y extends ee{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new F(e,3)),this.setAttribute("uv",new F(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,i=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),i.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new G(n,6,1);return this.setAttribute("instanceStart",new M(i,3,0)),this.setAttribute("instanceEnd",new M(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new G(n,6,1);return this.setAttribute("instanceColorStart",new M(i,3,0)),this.setAttribute("instanceColorEnd",new M(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new te(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new j);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),k.setFromBufferAttribute(n),this.boundingBox.union(k))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new J),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let t=0;for(let o=0,l=e.count;o<l;o++)P.fromBufferAttribute(e,o),t=Math.max(t,i.distanceToSquared(P)),P.fromBufferAttribute(n,o),t=Math.max(t,i.distanceToSquared(P));this.boundingSphere.radius=Math.sqrt(t),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}I.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new ne},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};O.line={uniforms:K.merge([I.common,I.fog,I.line]),vertexShader:`
2
2
  #include <common>
3
3
  #include <color_pars_vertex>
4
4
  #include <fog_pars_vertex>
@@ -390,4 +390,4 @@ import{z as ee,F,C as G,J as M,K as te,o as j,p as $,u as E,N as ie,Q as O,X as
390
390
  #include <premultiplied_alpha_fragment>
391
391
 
392
392
  }
393
- `};class N extends ie{constructor(e){super({type:"LineMaterial",uniforms:J.clone(O.line.uniforms),vertexShader:O.line.vertexShader,fragmentShader:O.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const H=new B,X=new E,q=new E,f=new B,u=new B,x=new B,W=new E,R=new ae,p=new oe,K=new E,T=new j,C=new $,S=new B;let b,z;function Z(h,e,n){return S.set(0,0,-e,1).applyMatrix4(h.projectionMatrix),S.multiplyScalar(1/S.w),S.x=z/n.width,S.y=z/n.height,S.applyMatrix4(h.projectionMatrixInverse),S.multiplyScalar(1/S.w),Math.abs(Math.max(S.x,S.y))}function ve(h,e){const n=h.matrixWorld,i=h.geometry,t=i.attributes.instanceStart,o=i.attributes.instanceEnd,l=Math.min(i.instanceCount,t.count);for(let s=0,a=l;s<a;s++){p.start.fromBufferAttribute(t,s),p.end.fromBufferAttribute(o,s),p.applyMatrix4(n);const d=new E,m=new E;b.distanceSqToSegment(p.start,p.end,m,d),m.distanceTo(d)<z*.5&&e.push({point:m,pointOnLine:d,distance:b.origin.distanceTo(m),object:h,face:null,faceIndex:s,uv:null,uv1:null})}}function ye(h,e,n){const i=e.projectionMatrix,o=h.material.resolution,l=h.matrixWorld,s=h.geometry,a=s.attributes.instanceStart,d=s.attributes.instanceEnd,m=Math.min(s.instanceCount,a.count),c=-e.near;b.at(1,x),x.w=1,x.applyMatrix4(e.matrixWorldInverse),x.applyMatrix4(i),x.multiplyScalar(1/x.w),x.x*=o.x/2,x.y*=o.y/2,x.z=0,W.copy(x),R.multiplyMatrices(e.matrixWorldInverse,l);for(let g=0,r=m;g<r;g++){if(f.fromBufferAttribute(a,g),u.fromBufferAttribute(d,g),f.w=1,u.w=1,f.applyMatrix4(R),u.applyMatrix4(R),f.z>c&&u.z>c)continue;if(f.z>c){const _=f.z-u.z,w=(f.z-c)/_;f.lerp(u,w)}else if(u.z>c){const _=u.z-f.z,w=(u.z-c)/_;u.lerp(f,w)}f.applyMatrix4(i),u.applyMatrix4(i),f.multiplyScalar(1/f.w),u.multiplyScalar(1/u.w),f.x*=o.x/2,f.y*=o.y/2,u.x*=o.x/2,u.y*=o.y/2,p.start.copy(f),p.start.z=0,p.end.copy(u),p.end.z=0;const y=p.closestPointToPointParameter(W,!0);p.at(y,K);const L=re.lerp(f.z,u.z,y),U=L>=-1&&L<=1,D=W.distanceTo(K)<z*.5;if(U&&D){p.start.fromBufferAttribute(a,g),p.end.fromBufferAttribute(d,g),p.start.applyMatrix4(l),p.end.applyMatrix4(l);const _=new E,w=new E;b.distanceSqToSegment(p.start,p.end,w,_),n.push({point:w,pointOnLine:_,distance:b.origin.distanceTo(w),object:h,face:null,faceIndex:g,uv:null,uv1:null})}}}class we extends se{constructor(e=new Q,n=new N({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,i=e.attributes.instanceEnd,t=new Float32Array(2*n.count);for(let l=0,s=0,a=n.count;l<a;l++,s+=2)X.fromBufferAttribute(n,l),q.fromBufferAttribute(i,l),t[s]=s===0?0:t[s-1],t[s+1]=t[s]+X.distanceTo(q);const o=new G(t,2,1);return e.setAttribute("instanceDistanceStart",new M(o,1,0)),e.setAttribute("instanceDistanceEnd",new M(o,1,1)),this}raycast(e,n){const i=this.material.worldUnits,t=e.camera;if(t===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),i===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;b=e.ray;const l=this.matrixWorld,s=this.geometry,a=this.material;z=a.linewidth+o,s.boundingSphere===null&&s.computeBoundingSphere(),C.copy(s.boundingSphere).applyMatrix4(l);let d;if(i)d=z*.5;else{const c=Math.max(t.near,C.distanceToPoint(b.origin));d=Z(t,c,a.resolution)}if(C.radius+=d,b.intersectsSphere(C)===!1)return;s.boundingBox===null&&s.computeBoundingBox(),T.copy(s.boundingBox).applyMatrix4(l);let m;if(i)m=z*.5;else{const c=Math.max(t.near,T.distanceToPoint(b.origin));m=Z(t,c,a.resolution)}T.expandByScalar(m),b.intersectsBox(T)!==!1&&(i?ve(this,n):ye(this,t,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(H),this.material.uniforms.resolution.value.set(H.z,H.w))}}class Y extends Q{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const n=e.length-3,i=new Float32Array(2*n);for(let t=0;t<n;t+=3)i[2*t]=e[t],i[2*t+1]=e[t+1],i[2*t+2]=e[t+2],i[2*t+3]=e[t+3],i[2*t+4]=e[t+4],i[2*t+5]=e[t+5];return super.setPositions(i),this}setColors(e){const n=e.length-3,i=new Float32Array(2*n);for(let t=0;t<n;t+=3)i[2*t]=e[t],i[2*t+1]=e[t+1],i[2*t+2]=e[t+2],i[2*t+3]=e[t+3],i[2*t+4]=e[t+4],i[2*t+5]=e[t+5];return super.setColors(i),this}setFromPoints(e){const n=e.length-1,i=new Float32Array(6*n);for(let t=0;t<n;t++)i[6*t]=e[t].x,i[6*t+1]=e[t].y,i[6*t+2]=e[t].z||0,i[6*t+3]=e[t+1].x,i[6*t+4]=e[t+1].y,i[6*t+5]=e[t+1].z||0;return super.setPositions(i),this}fromLine(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}}class xe extends we{constructor(e=new Y,n=new N({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}class A{constructor(e){this.layer=e,this.group.name="traces"}static LINE_WIDTH_PX=2.5;static MARKER_SIZE_PX=9;static LABEL_HEIGHT_PX=15;static STEP_M=15;static LIFT_M=.3;group=new le;materials=[];pointsMaterials=[];labels=[];viewportHeightPx=720;fovDeg=60;set(e,n,i,t,o,l){this.empty();for(const s of e){const a=this.positions(s,i,t,o,l),d=new ce(s.color??de),m=n.get(s.id);if(m&&a.length>=3&&this.addLabel(m,this.labelAnchor(a,s.kind)),s.kind==="point"){const c=new fe;c.setAttribute("position",new F(a.slice(0,3),3));const g=new ue({color:d,size:A.MARKER_SIZE_PX,sizeAttenuation:!1,depthTest:!1,fog:!1});this.pointsMaterials.push(g);const r=new pe(c,g);r.name="trace point",r.frustumCulled=!1,r.layers.set(this.layer),this.group.add(r)}else if(a.length>=6){const c=new Y;c.setPositions(s.kind==="polygon"?[...a,a[0],a[1],a[2]]:a);const g=new N({color:d.getHex(),linewidth:A.LINE_WIDTH_PX,worldUnits:!1,transparent:!0,opacity:.92,depthTest:!1,fog:!1});this.materials.push(g);const r=new xe(c,g);r.name=`trace ${s.kind}`,r.frustumCulled=!1,r.layers.set(this.layer),this.group.add(r)}}}setView(e,n){for(const i of this.materials)i.resolution.copy(e);e.y===this.viewportHeightPx&&n===this.fovDeg||(this.viewportHeightPx=e.y,this.fovDeg=n,this.scaleLabels())}get any(){return this.group.children.length>0}dispose(){this.empty()}labelAnchor(e,n){let i=0;if(n==="line"){let t=-1;for(let o=0;o+2<e.length;o+=3){const l=Math.hypot(e[o],e[o+2]);l>t&&(t=l,i=o)}}return[e[i],e[i+1],e[i+2]]}addLabel(e,n){const i=document.createElement("canvas"),t=i.getContext("2d");if(!t)return;const o="bold 30px sans-serif";t.font=o;const l=10;i.width=Math.ceil(t.measureText(e).width)+l*2,i.height=44,t.font=o,t.fillStyle="rgba(0, 0, 0, 0.6)",t.beginPath(),t.roundRect(0,0,i.width,i.height,10),t.fill(),t.fillStyle="#ffffff",t.textBaseline="middle",t.fillText(e,l,i.height/2+2);const s=new he({map:new me(i),depthTest:!1,depthWrite:!1,fog:!1,sizeAttenuation:!1}),a=new V(s);a.name="trace name",a.center.set(0,0),a.position.set(n[0],n[1],n[2]),a.frustumCulled=!1,a.layers.set(this.layer),this.labels.push({sprite:a,aspect:i.width/i.height}),this.group.add(a),this.scaleLabels()}scaleLabels(){const e=A.LABEL_HEIGHT_PX/(this.viewportHeightPx/2)*Math.tan(this.fovDeg*Math.PI/360);for(const{sprite:n,aspect:i}of this.labels)n.scale.set(e*i,e,1)}empty(){for(const e of[...this.group.children])this.group.remove(e),e instanceof V?(e.material.map?.dispose(),e.material.dispose()):e.geometry.dispose();this.labels.length=0;for(const e of this.materials.splice(0))e.dispose();for(const e of this.pointsMaterials.splice(0))e.dispose()}positions(e,n,i,t,o){const l=e.altitude??"ground",s=e.points.map(r=>{const{x:v,z:y}=ge(r.lat,r.lng,n,i);return{x:v,z:y,altM:r.altM??0}}),a=l!=="absolute",d=[],m=(r,v,y)=>l==="absolute"?y-t:o(r,v)+(l==="relative"?y:0)+A.LIFT_M,c=e.kind==="polygon",g=c?s.length:s.length-1;for(let r=0;r<Math.max(g,1);r++){const v=s[r],y=s[(r+1)%s.length],L=a&&e.kind!=="point"?Math.max(1,Math.ceil(Math.hypot(y.x-v.x,y.z-v.z)/A.STEP_M)):1;for(let U=0;U<L;U++){const D=U/L,_=v.x+(y.x-v.x)*D,w=v.z+(y.z-v.z)*D;d.push(_,m(_,w,v.altM+(y.altM-v.altM)*D),w)}}if(!c&&e.kind!=="point"){const r=s[s.length-1];d.push(r.x,m(r.x,r.z,r.altM),r.z)}return d}}export{A as TraceSystem};
393
+ `};class N extends ie{constructor(e){super({type:"LineMaterial",uniforms:K.clone(O.line.uniforms),vertexShader:O.line.vertexShader,fragmentShader:O.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const H=new B,X=new E,q=new E,f=new B,u=new B,x=new B,W=new E,R=new ae,p=new oe,Z=new E,T=new j,C=new J,S=new B;let b,z;function $(h,e,n){return S.set(0,0,-e,1).applyMatrix4(h.projectionMatrix),S.multiplyScalar(1/S.w),S.x=z/n.width,S.y=z/n.height,S.applyMatrix4(h.projectionMatrixInverse),S.multiplyScalar(1/S.w),Math.abs(Math.max(S.x,S.y))}function ve(h,e){const n=h.matrixWorld,i=h.geometry,t=i.attributes.instanceStart,o=i.attributes.instanceEnd,l=Math.min(i.instanceCount,t.count);for(let s=0,a=l;s<a;s++){p.start.fromBufferAttribute(t,s),p.end.fromBufferAttribute(o,s),p.applyMatrix4(n);const d=new E,m=new E;b.distanceSqToSegment(p.start,p.end,m,d),m.distanceTo(d)<z*.5&&e.push({point:m,pointOnLine:d,distance:b.origin.distanceTo(m),object:h,face:null,faceIndex:s,uv:null,uv1:null})}}function ye(h,e,n){const i=e.projectionMatrix,o=h.material.resolution,l=h.matrixWorld,s=h.geometry,a=s.attributes.instanceStart,d=s.attributes.instanceEnd,m=Math.min(s.instanceCount,a.count),c=-e.near;b.at(1,x),x.w=1,x.applyMatrix4(e.matrixWorldInverse),x.applyMatrix4(i),x.multiplyScalar(1/x.w),x.x*=o.x/2,x.y*=o.y/2,x.z=0,W.copy(x),R.multiplyMatrices(e.matrixWorldInverse,l);for(let g=0,r=m;g<r;g++){if(f.fromBufferAttribute(a,g),u.fromBufferAttribute(d,g),f.w=1,u.w=1,f.applyMatrix4(R),u.applyMatrix4(R),f.z>c&&u.z>c)continue;if(f.z>c){const _=f.z-u.z,w=(f.z-c)/_;f.lerp(u,w)}else if(u.z>c){const _=u.z-f.z,w=(u.z-c)/_;u.lerp(f,w)}f.applyMatrix4(i),u.applyMatrix4(i),f.multiplyScalar(1/f.w),u.multiplyScalar(1/u.w),f.x*=o.x/2,f.y*=o.y/2,u.x*=o.x/2,u.y*=o.y/2,p.start.copy(f),p.start.z=0,p.end.copy(u),p.end.z=0;const y=p.closestPointToPointParameter(W,!0);p.at(y,Z);const L=re.lerp(f.z,u.z,y),U=L>=-1&&L<=1,D=W.distanceTo(Z)<z*.5;if(U&&D){p.start.fromBufferAttribute(a,g),p.end.fromBufferAttribute(d,g),p.start.applyMatrix4(l),p.end.applyMatrix4(l);const _=new E,w=new E;b.distanceSqToSegment(p.start,p.end,w,_),n.push({point:w,pointOnLine:_,distance:b.origin.distanceTo(w),object:h,face:null,faceIndex:g,uv:null,uv1:null})}}}class we extends se{constructor(e=new Y,n=new N({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,i=e.attributes.instanceEnd,t=new Float32Array(2*n.count);for(let l=0,s=0,a=n.count;l<a;l++,s+=2)X.fromBufferAttribute(n,l),q.fromBufferAttribute(i,l),t[s]=s===0?0:t[s-1],t[s+1]=t[s]+X.distanceTo(q);const o=new G(t,2,1);return e.setAttribute("instanceDistanceStart",new M(o,1,0)),e.setAttribute("instanceDistanceEnd",new M(o,1,1)),this}raycast(e,n){const i=this.material.worldUnits,t=e.camera;if(t===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),i===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;b=e.ray;const l=this.matrixWorld,s=this.geometry,a=this.material;z=a.linewidth+o,s.boundingSphere===null&&s.computeBoundingSphere(),C.copy(s.boundingSphere).applyMatrix4(l);let d;if(i)d=z*.5;else{const c=Math.max(t.near,C.distanceToPoint(b.origin));d=$(t,c,a.resolution)}if(C.radius+=d,b.intersectsSphere(C)===!1)return;s.boundingBox===null&&s.computeBoundingBox(),T.copy(s.boundingBox).applyMatrix4(l);let m;if(i)m=z*.5;else{const c=Math.max(t.near,T.distanceToPoint(b.origin));m=$(t,c,a.resolution)}T.expandByScalar(m),b.intersectsBox(T)!==!1&&(i?ve(this,n):ye(this,t,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(H),this.material.uniforms.resolution.value.set(H.z,H.w))}}class Q extends Y{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const n=e.length-3,i=new Float32Array(2*n);for(let t=0;t<n;t+=3)i[2*t]=e[t],i[2*t+1]=e[t+1],i[2*t+2]=e[t+2],i[2*t+3]=e[t+3],i[2*t+4]=e[t+4],i[2*t+5]=e[t+5];return super.setPositions(i),this}setColors(e){const n=e.length-3,i=new Float32Array(2*n);for(let t=0;t<n;t+=3)i[2*t]=e[t],i[2*t+1]=e[t+1],i[2*t+2]=e[t+2],i[2*t+3]=e[t+3],i[2*t+4]=e[t+4],i[2*t+5]=e[t+5];return super.setColors(i),this}setFromPoints(e){const n=e.length-1,i=new Float32Array(6*n);for(let t=0;t<n;t++)i[6*t]=e[t].x,i[6*t+1]=e[t].y,i[6*t+2]=e[t].z||0,i[6*t+3]=e[t+1].x,i[6*t+4]=e[t+1].y,i[6*t+5]=e[t+1].z||0;return super.setPositions(i),this}fromLine(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}}class xe extends we{constructor(e=new Q,n=new N({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}class A{constructor(e){this.layer=e,this.group.name="traces"}static LINE_WIDTH_PX=2.5;static MARKER_SIZE_PX=9;static LABEL_HEIGHT_PX=15;static STEP_M=15;static LIFT_M=.3;group=new le;materials=[];pointsMaterials=[];labels=[];viewportHeightPx=720;fovDeg=60;set(e,n,i,t,o,l){this.empty();for(const s of e){const a=this.positions(s,i,t,o,l),d=new ce(s.color??de),m=n.get(s.id);if(m&&a.length>=3&&this.addLabel(m,this.labelAnchor(a,s.kind)),s.kind==="point"){const c=new fe;c.setAttribute("position",new F(a.slice(0,3),3));const g=new ue({color:d,size:A.MARKER_SIZE_PX,sizeAttenuation:!1,depthTest:!1,fog:!1});this.pointsMaterials.push(g);const r=new pe(c,g);r.name="trace point",r.frustumCulled=!1,r.layers.set(this.layer),this.group.add(r)}else if(a.length>=6){const c=new Q;c.setPositions(s.kind==="polygon"?[...a,a[0],a[1],a[2]]:a);const g=new N({color:d.getHex(),linewidth:A.LINE_WIDTH_PX,worldUnits:!1,transparent:!0,opacity:.92,depthTest:!1,fog:!1});this.materials.push(g);const r=new xe(c,g);r.name=`trace ${s.kind}`,r.frustumCulled=!1,r.layers.set(this.layer),this.group.add(r)}}}setView(e,n){for(const i of this.materials)i.resolution.copy(e);e.y===this.viewportHeightPx&&n===this.fovDeg||(this.viewportHeightPx=e.y,this.fovDeg=n,this.scaleLabels())}get any(){return this.group.children.length>0}dispose(){this.empty()}labelAnchor(e,n){let i=0;if(n==="line"){let t=-1;for(let o=0;o+2<e.length;o+=3){const l=Math.hypot(e[o],e[o+2]);l>t&&(t=l,i=o)}}return[e[i],e[i+1],e[i+2]]}addLabel(e,n){const i=document.createElement("canvas"),t=i.getContext("2d");if(!t)return;const o="bold 30px sans-serif";t.font=o;const l=10;i.width=Math.ceil(t.measureText(e).width)+l*2,i.height=44,t.font=o,t.fillStyle="rgba(0, 0, 0, 0.6)",t.beginPath(),t.roundRect(0,0,i.width,i.height,10),t.fill(),t.fillStyle="#ffffff",t.textBaseline="middle",t.fillText(e,l,i.height/2+2);const s=new he({map:new me(i),depthTest:!1,depthWrite:!1,fog:!1,sizeAttenuation:!1}),a=new V(s);a.name="trace name",a.center.set(0,0),a.position.set(n[0],n[1],n[2]),a.frustumCulled=!1,a.layers.set(this.layer),this.labels.push({sprite:a,aspect:i.width/i.height}),this.group.add(a),this.scaleLabels()}scaleLabels(){const e=A.LABEL_HEIGHT_PX/(this.viewportHeightPx/2)*Math.tan(this.fovDeg*Math.PI/360);for(const{sprite:n,aspect:i}of this.labels)n.scale.set(e*i,e,1)}empty(){for(const e of[...this.group.children])this.group.remove(e),e instanceof V?(e.material.map?.dispose(),e.material.dispose()):e.geometry.dispose();this.labels.length=0;for(const e of this.materials.splice(0))e.dispose();for(const e of this.pointsMaterials.splice(0))e.dispose()}positions(e,n,i,t,o){const l=e.altitude??"ground",s=e.points.map(r=>{const{x:v,z:y}=ge(r.lat,r.lng,n,i);return{x:v,z:y,altM:r.altM??0}}),a=l!=="absolute",d=[],m=(r,v,y)=>l==="absolute"?y-t:o(r,v)+(l==="relative"?y:0)+A.LIFT_M,c=e.kind==="polygon",g=c?s.length:s.length-1;for(let r=0;r<Math.max(g,1);r++){const v=s[r],y=s[(r+1)%s.length],L=a&&e.kind!=="point"?Math.max(1,Math.ceil(Math.hypot(y.x-v.x,y.z-v.z)/A.STEP_M)):1;for(let U=0;U<L;U++){const D=U/L,_=v.x+(y.x-v.x)*D,w=v.z+(y.z-v.z)*D;d.push(_,m(_,w,v.altM+(y.altM-v.altM)*D),w)}}if(!c&&e.kind!=="point"){const r=s[s.length-1];d.push(r.x,m(r.x,r.z,r.altM),r.z)}return d}}export{A as TraceSystem};
@@ -0,0 +1,4 @@
1
+ class r{static ASKS=/^(q|question|pregunta|domanda|interviewer|enquêteur|enqueteur|intervieweur|entrevistador|intervistatore)$/i;static ANSWERS=/^(r|a|réponse|reponse|answer|respuesta|risposta|témoin|temoin|witness|testigo|testimone)$/i;static seconds(o){const t=/^(?:(\d{1,2}):)?(\d{1,3}):(\d{1,2})(?:[.,](\d{1,3}))?$/.exec(o.trim());if(!t)return;const[,n,i,e,c]=t;return Number(n??0)*3600+Number(i)*60+Number(e)+(c?+`0.${c}`:0)}static parse(o,t={}){const n=o.replace(/^/,"").replace(/\r\n?/g,`
2
+ `).trim();if(n==="")return;const i=/-->/.test(n)?r.cues(n):r.labelled(n)??r.paragraphs(n);if(i.length!==0)return r.build(i,t)}static cues(o){const t=[];for(const n of o.split(/\n{2,}/)){const i=n.split(`
3
+ `),e=i.findIndex(g=>g.includes("-->"));if(e<0)continue;const c=r.seconds(i[e].split("-->")[0].trim().split(/\s+/)[0]),d=i.slice(e+1).join(" ").trim(),a=/^<v(?:\.[^\s>]*)?\s+([^>]+)>/.exec(d),l=d.replace(/<\/?[^>]+>/g,"").replace(/\s+/g," ").trim();if(l==="")continue;if(a){t.push({label:a[1].trim(),start:c,text:l});continue}const p=r.label(l);t.push(p?{label:p.label,start:c,text:p.text}:{start:c,text:l})}return r.joined(t)}static labelled(o){const t=[];let n=0,i=0;for(const a of o.split(`
4
+ `)){const l=a.trim();if(l==="")continue;i++;const p=r.label(l);p?(n++,t.push(p)):t.length>0?t[t.length-1].text+=` ${l}`:t.push({text:l})}const e=new Set(t.map(a=>a.label).filter(a=>a!==void 0)),c=new Map;for(const a of t)a.label!==void 0&&c.set(a.label,(c.get(a.label)??0)+1);const d=[...c.values()].some(a=>a>=2)||[...e].every(a=>r.ASKS.test(a)||r.ANSWERS.test(a));if(!(n<2||e.size>10||n/i<.3||!d))return r.joined(t)}static label(o){const t=String.raw`(?:\d{1,2}:)?\d{1,3}:\d{1,2}(?:[.,]\d{1,3})?`,n=String.raw`[\p{L}][\p{L}\p{N} .'’\-]{0,38}?`,i=[[new RegExp(String.raw`^[\[(]?(${t})[\])]?\s*[-–]?\s*(${n})\s*:\s*(.+)$`,"u"),e=>({label:e[2].trim(),start:r.seconds(e[1]),text:e[3].trim()})],[new RegExp(String.raw`^(${n})\s*[\[(](${t})[\])]\s*:?\s*(.+)$`,"u"),e=>({label:e[1].trim(),start:r.seconds(e[2]),text:e[3].trim()})],[new RegExp(String.raw`^(${n})\s*:\s*(.+)$`,"u"),e=>({label:e[1].trim(),text:e[2].trim()})]];for(const[e,c]of i){const d=e.exec(o);if(d)return c(d)}}static paragraphs(o){return o.split(/\n{2,}/).map(t=>t.replace(/\s+/g," ").trim()).filter(t=>t!=="").map(t=>({text:t}))}static joined(o){const t=[];for(const n of o){const i=t[t.length-1];i&&i.label===n.label&&n.label!==void 0?i.text+=` ${n.text}`:t.push({...n})}return t}static same(o,t){const n=c=>c.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]/g,""),i=n(o),e=n(t);return i!==""&&e!==""&&(i===e||i.includes(e)||e.includes(i))}static build(o,t){const n=[...new Set(o.map(s=>s.label??""))],i={},e=new Map,c={interviewer:0,witness:0,other:0},d=(s,u)=>{const f=c[s]++,b=f===0?s:`${s}${f+1}`;return i[b]={...u,role:s},b},a=t.by??[];let l=!0;for(const s of n){const u=a.find(b=>s!==""&&r.same(s,b)),f=t.witnesses?.find(b=>s!==""&&r.same(s,b.label));s===""?e.set(s,d(l?"interviewer":"witness",{})):u!==void 0||r.ASKS.test(s)?e.set(s,d("interviewer",u!==void 0?{by:{people:u}}:{})):f||r.ANSWERS.test(s)?e.set(s,d("witness",f?{title:f.label,of:f.id}:{})):e.set(s,d(l&&a.length===0?"interviewer":"witness",{})),l=!1}n.forEach(s=>{const u=i[e.get(s)];s!==""&&!r.ASKS.test(s)&&!r.ANSWERS.test(s)&&u.title===void 0&&u.by===void 0&&(u.title=s)});const p=o.map((s,u)=>{const f=o.slice(u+1).find(b=>b.start!==void 0);return{speaker:e.get(s.label??""),...s.start!==void 0?{start:s.start}:{},...s.start!==void 0&&f?.start!==void 0&&f.start>=s.start?{end:f.start}:{},text:s.text}}),g=Object.fromEntries(Object.keys(i).map(s=>[s,{status:"pending"}]));return{version:1,speakers:i,proofreading:g,segments:p}}}export{r as InterviewImport};
@@ -0,0 +1,8 @@
1
+ class n{static isProofread(r){const a=Object.keys(r.speakers);return a.length>0&&a.every(t=>{const e=r.proofreading?.[t]?.status;return e==="approved"||e==="covered"})}static said(r){return r.parts?r.parts.map(a=>"redacted"in a?"…":n.plain(a.text)).join(" "):r.redacted?void 0:n.plain(r.text??"")}static ENTITIES={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "};static plain(r){return/[<&]/.test(r)?r.replace(/<br\s*\/?>/gi,`
2
+ `).replace(/<\/?[a-z][^>]*>/gi,"").replace(/&#x([0-9a-f]+);/gi,(a,t)=>String.fromCodePoint(parseInt(t,16))).replace(/&#(\d+);/g,(a,t)=>String.fromCodePoint(Number(t))).replace(/&(\w+);/g,(a,t)=>n.ENTITIES[t.toLowerCase()]??a):r}static sightingsOf(r){return[r.interviewOf].flat().filter(a=>typeof a=="string")}static passagesAbout(r,a){const t=n.sightingsOf(r),e=[];return r.segments.forEach((s,c)=>{for(const o of s.refs??[]){if(o.sighting===void 0?!t.includes(a):o.sighting!==a)continue;const i=n.said(s);e.push({index:c,speaker:s.speaker,at:o.at,...i!==void 0?{text:i}:{},...o.range?{range:o.range}:{}})}}),e.sort((s,c)=>s.at-c.at||s.index-c.index)}static clock(r,a=!1){const t=Math.round(r*10),e=Math.floor(t/10),s=i=>String(i).padStart(2,"0"),c=Math.floor(e/3600),o=`${c>0||a?s(Math.floor(e/60)%60):Math.floor(e/60)}:${s(e%60)}`;return`${c>0?`${c}:`:""}${o}${a||t%10!==0?`.${t%10}`:""}`}static speakerName(r,a){const t=r.speakers[a];if(!t)return a;const e=typeof t.title=="string"?t.title:t.title?Object.values(t.title)[0]:void 0;return e||t.by&&n.agentName(t.by)||t.role}static agentName(r){if("people"in r){const[a,...t]=r.people.replace(/([a-z])([A-Z])/g,"$1 $2").split(" ");return[...t,a].join(" ")}return"org"in r?r.org:r.title??""}static stamp(r){const a=Math.round(r*1e3),t=(e,s=2)=>String(e).padStart(s,"0");return`${t(Math.floor(a/36e5))}:${t(Math.floor(a/6e4)%60)}:${t(Math.floor(a/1e3)%60)}.${t(a%1e3,3)}`}static toVtt(r){const a=s=>s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=r.segments.filter(s=>s.start!==void 0);return`WEBVTT
3
+
4
+ ${t.map((s,c)=>{const o=t[c+1],i=s.end??o?.start??s.start+5,p=o&&o.start<i?Math.max(s.start,o.start):i;return`${n.stamp(s.start)} --> ${n.stamp(p)}
5
+ <v ${a(n.speakerName(r,s.speaker))}>${a(n.said(s)??"[…]")}`}).join(`
6
+
7
+ `)}
8
+ `}}export{n as InterviewFile};
@@ -0,0 +1 @@
1
+ const e={type:"number"},t={type:"string"},s={type:"string"},n={type:"string",doc:"What the interview is called, in the languages it has.",loose:!0},i={type:"string",doc:"When it was held, as RR0 writes a time."},o={type:"enum",doc:"What it was held through: face to face (`in-person`), by `phone`, in a `video` call, by `chat`, by `email`, by `letter`, or `other`.",values:["letter","in-person","phone","video","chat","email","other"]},a={type:"array",doc:"Who held it."},r={type:"string",doc:"The `id`, or the ids, of the sighting events of the case it was held with.",loose:!0},c={type:"string",doc:"What it established, in the languages it has.",loose:!0},h={type:"object"},p={type:"object",fields:{method:{type:"enum",values:["automatic","manual"]},engine:{type:"string"},note:{type:"string"}}},d={type:"object",doc:"Who approved the transcript, by speaker id."},y={type:"object",doc:"What was taken out to anonymise it, and what stands in its place.",fields:{replaced:{type:"array"},marker:{type:"string"}}},l={type:"array",fields:{speaker:{type:"string"},start:{type:"number"},end:{type:"number"},text:{type:"string"},redacted:{type:"object",fields:{reason:{type:"string",doc:"Why, in the languages it has: what kind of passage (private life, identifying detail, small talk, recognition error).",loose:!0}}},parts:{type:"array"},refs:{type:"array",doc:"The moments of the observation this passage tells of.",fields:{sighting:{type:"string",doc:"The `id` of the sighting event of the case; the interview's own `interviewOf` when omitted."},at:{type:"number",doc:"Seconds since the beginning of the observation."},range:{type:"object",doc:"The part of the segment's text it is about, as `[from, to)` character offsets."}}}}},g={version:e,id:t,language:s,title:n,time:i,medium:o,by:a,interviewOf:r,summary:c,speakers:h,transcription:p,proofreading:d,anonymization:y,segments:l};export{y as anonymization,a as by,g as default,t as id,r as interviewOf,s as language,o as medium,d as proofreading,l as segments,h as speakers,c as summary,i as time,n as title,p as transcription,e as version};