harperdb 4.7.18 → 4.7.20
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 +1 -1
- package/bin/harperdb.js +57 -57
- package/bin/lite.js +54 -54
- package/components/EntryHandler.d.ts +2 -1
- package/components/Logger.d.ts +12 -0
- package/components/OptionsWatcher.d.ts +2 -1
- package/components/Scope.d.ts +16 -5
- package/index.d.ts +20 -9
- package/index.js +3 -0
- package/launchServiceScripts/launchNatsIngestService.js +54 -54
- package/launchServiceScripts/launchNatsReplyService.js +54 -54
- package/launchServiceScripts/launchUpdateNodes4-0-0.js +54 -54
- package/npm-shrinkwrap.json +346 -335
- package/package.json +1 -1
- package/resources/Table.d.ts +10 -4
- package/resources/databases.d.ts +12 -2
- package/server/jobs/jobProcess.js +54 -54
- package/server/threads/threadServer.js +54 -54
- package/studio/web/assets/{index-reMfz-PE.js → index-D-fcKyYx.js} +1 -1
- package/studio/web/assets/{index-C7BE1t1i.js → index-JYy8fJSs.js} +1 -1
- package/studio/web/assets/index-Zl65hD8K.css +1 -0
- package/studio/web/assets/index-oKJ2dNTo.js +234 -0
- package/studio/web/assets/{index.lazy-DG7DUk1C.js → index.lazy-C7Y8KaC7.js} +1 -1
- package/studio/web/assets/profiler-CxDJoqcP.js +1 -0
- package/studio/web/assets/{react-redux-4JeOy3fU.js → react-redux-LHAYowSO.js} +1 -1
- package/studio/web/assets/startRecording-CTUOSIln.js +2 -0
- package/studio/web/index.html +2 -2
- package/utility/scripts/restartHdb.js +54 -54
- package/v1.d.ts +8 -16
- package/v1.js +3 -0
- package/v2.d.ts +8 -16
- package/v2.js +41 -0
- package/studio/web/assets/index-BZ1HpJ7A.css +0 -1
- package/studio/web/assets/index-Bu-PphJh.js +0 -234
- package/studio/web/assets/profiler-B4vE9rPH.js +0 -1
- package/studio/web/assets/startRecording-B3i2VhSx.js +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Y as x,an as N,ao as C,_ as G,ap as X,aq as Y,ar as y,y as O,as as J,at as K,U as Q,au as R,T as W,o as Z,av as $}from"./index-Bu-PphJh.js";function ee(e,t,r,a){const l=o=>{t.notify(14,{error:o}),G("Error reported to customer",{"error.message":o.message})},d=x([e.profilingEndpointBuilder],l),f=r(a);return{async send({event:o,...E}){const p=new FormData,m=N(o);if(!m)throw new Error("Failed to serialize event");p.append("event",new Blob([m],{type:"application/json"}),"event.json");let s=m.length;for(const[v,k]of C(E)){const w=N(k);if(!w)throw new Error("Failed to serialize attachment");const g=await te(f,w);s+=g.outputBytesCount,p.append(v,new Blob([g.output]),v)}d.send({data:p,bytesCount:s})}}}function te(e,t){return new Promise(r=>{e.write(t),e.finish(a=>{r(a)})})}function ne(e){let t=0;for(const r of e)r.stackId!==void 0&&t++;return t}const se=/\/(?![vV]\d{1,2}\/)([^/\d?]*\d+[^/?]*)/g;function re(e){return e?e.replace(se,"/?"):"/"}const j=(e,t)=>e||re(t);function ae(e,t,r){const a={application:{id:t}};r&&(a.session={id:r});const{ids:l,names:d}=oe(e.views);l.length&&(a.view={id:l,name:d});const f=e.longTasks.map(o=>o.id).filter(o=>o!==void 0);return f.length&&(a.long_task={id:f}),a}function oe(e){const t={ids:[],names:[]};for(const r of e)t.ids.push(r.viewId),r.viewName&&t.names.push(r.viewName);return t.names=Array.from(new Set(t.names)),t}function ie(e,t,r){return{event:ce(e,t,r),"wall-time.json":e}}function ce(e,t,r){const a=X(t),l=ae(e,t.applicationId,r),d=ue(a);return{...l,attachments:["wall-time.json"],start:new Date(e.startClocks.timeStamp).toISOString(),end:new Date(e.endClocks.timeStamp).toISOString(),family:"chrome",runtime:"chrome",format:"json",version:4,tags_profiler:d.join(","),_dd:{clock_drift:Y()}}}function ue(e){return e.concat(["language:javascript","runtime:chrome","family:chrome","host:browser"])}const le={sampleIntervalMs:10,collectIntervalMs:6e4,minProfileDurationMs:5e3,minNumberOfSamples:50};function fe(e,t,r,a,l,d,f,o=le){const E=ee(e,t,d,6);let p;const m=[];let s={state:"stopped",stateReason:"initializing"};t.subscribe(9,()=>{w("session-expired").catch(y)}),t.subscribe(10,()=>{s.state==="stopped"&&s.stateReason==="session-expired"&&v()});function v(){if(s.state==="running")return;const n=f.findView();p=n?{startClocks:n.startClocks,viewId:n.id,viewName:j(n.name,document.location.pathname)}:void 0,m.push(O(e,window,"visibilitychange",L).stop,O(e,window,"beforeunload",V).stop),h()}async function k(){await w("stopped-by-user")}async function w(n){await M(n),m.forEach(i=>i()),a.set({status:"stopped",error_reason:void 0})}function g(n){if(n.state==="running")return{cleanupTasks:n.cleanupTasks};const i=[],u=t.subscribe(2,c=>{const b={viewId:c.id,viewName:j(c.name,document.location.pathname),startClocks:c.startClocks};I(b),p=b});return i.push(u.unsubscribe),{cleanupTasks:i}}function h(){const n=J().Profiler;if(!n)throw a.set({status:"error",error_reason:"not-supported-by-browser"}),new Error("RUM Profiler is not supported in this browser.");P(s).catch(y);const{cleanupTasks:i}=g(s);let u;try{u=new n({sampleInterval:o.sampleIntervalMs,maxBufferSize:Math.round(o.collectIntervalMs*1.5/o.sampleIntervalMs)})}catch(c){c instanceof Error&&c.message.includes("disabled by Document Policy")?(K.warn("[DD_RUM] Profiler startup failed. Ensure your server includes the `Document-Policy: js-profiling` response header when serving HTML pages.",c),a.set({status:"error",error_reason:"missing-document-policy-header"})):a.set({status:"error",error_reason:"unexpected-exception"});return}a.set({status:"running",error_reason:void 0}),s={state:"running",startClocks:R(),profiler:u,timeoutId:Q(h,o.collectIntervalMs),views:[],cleanupTasks:i,longTasks:[]},I(p),u.addEventListener("samplebufferfull",S)}async function P(n){if(n.state!=="running")return;W(n.timeoutId),n.profiler.removeEventListener("samplebufferfull",S);const{startClocks:i,views:u}=n;await n.profiler.stop().then(c=>{const b=R(),D=Z(i.timeStamp,b.timeStamp),_=l.findLongTasks(i.relative,D),H=D<o.minProfileDurationMs,q=ne(c.samples)<o.minNumberOfSamples;_.length===0&&(H||q)||B(Object.assign(c,{startClocks:i,endClocks:b,clocksOrigin:$(),longTasks:_,views:u,sampleInterval:o.sampleIntervalMs}))}).catch(y)}async function M(n){s.state==="running"&&(await T(),s={state:"stopped",stateReason:n})}async function A(){s.state==="running"&&(await T(),s={state:"paused"})}async function T(){s.state==="running"&&(s.cleanupTasks.forEach(n=>n()),await P(s))}function I(n){s.state!=="running"||!n||s.views.push(n)}function B(n){var i;const u=(i=r.findTrackedSession())===null||i===void 0?void 0:i.id,c=ie(n,e,u);E.send(c)}function S(){h()}function L(){document.visibilityState==="hidden"&&s.state==="running"?A().catch(y):document.visibilityState==="visible"&&s.state==="paused"&&h()}function V(){h()}function F(){return s.state==="stopped"}function U(){return s.state==="running"}function z(){return s.state==="paused"}return{start:v,stop:k,isStopped:F,isRunning:U,isPaused:z}}export{le as DEFAULT_RUM_PROFILER_CONFIGURATION,fe as createRumProfiler};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{s as D,C as Z,b as ve,N as g,a as Me,c as X,d as Re,i as _e,g as L,r as Q,e as ee,P as te,f as ne,h as De,j as P,k,l as Ae,m as V,n as F,t as y,o as oe,p as xe,q as se,E as re,u as ie,v as O,w as b,x as I,y as Oe,z as ze,A as w,B as _,R as Le,D as Pe,F as M,G as ke,H as Ve,I as Fe,J as U,K as Ue,L as He,M as Be,O as Ge,Q as Ye,S as $e,T as Xe,U as We,V as je,W as qe,X as Je,Y as Ke,Z as Ze,_ as Qe}from"./index-Bu-PphJh.js";const m={FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Focus:6,ViewEnd:7,VisualViewport:8,FrustrationRecord:9,Change:12},C={Document:0,DocumentType:1,Element:2,Text:3,CDATA:4,DocumentFragment:11},h={AddString:0,AddNode:1,RemoveNode:2,Attribute:3,Text:4,Size:5,ScrollPosition:6,AddStyleSheet:7,AttachedStyleSheets:8,MediaPlaybackState:9,VisualViewport:10},S={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,StyleSheetRule:8},N={MouseUp:0,MouseDown:1,Click:2,ContextMenu:3,DblClick:4,Focus:5,Blur:6,TouchStart:7,TouchEnd:9},A={Play:0,Pause:1};function et(e){let t={parent:void 0,previousSiblingId:void 0};const n=o=>{var s;if(t.previousSiblingId===o-1)return 0;const r=(s=t.parent)===null||s===void 0?void 0:s.previousSiblingId;return r!==void 0?o-r:null};return{advance(o){const s=e.getOrInsert(o),r=n(s);return t.previousSiblingId=s,{nodeId:s,insertionPoint:r}},ascend(){t.parent&&(t=t.parent)},descend(){t.previousSiblingId!==void 0&&(t={parent:t,previousSiblingId:void 0})}}}function H(e,t){const n=e.tagName,o=e.value;if(D(e,t)){const s=e.type;return n==="INPUT"&&(s==="button"||s==="submit"||s==="reset")?o:!o||n==="OPTION"?void 0:Z}if(n==="OPTION"||n==="SELECT")return e.value;if(!(n!=="INPUT"&&n!=="TEXTAREA"))return o}const tt=/url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm,nt=/^[A-Za-z]+:|^\/\//,ot=/^["']?data:.*,/i;function st(e,t){return e.replace(tt,(n,o,s,r,i,a)=>{const u=s||i||a;if(!t||!u||nt.test(u)||ot.test(u))return n;const c=o||r||"";return`url(${c}${rt(u,t)}${c})`})}function rt(e,t){try{return ve(e,t).href}catch{return e}}const it=/[^a-z1-6-_]/;function at(e){const t=e.toLowerCase().trim();return it.test(t)?"div":t}function ae(e){return e.tagName.toLowerCase()}function W(e,t){return`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${t}' style='background-color:silver'%3E%3C/svg%3E`}function ue(e,t){if(!(e===void 0||e.length===0))return e.map(n=>{const o=n.cssRules||n.rules,s=Array.from(o,i=>i.cssText);return t.addMetric("cssText",s.reduce((i,a)=>i+a.length,0)),{cssRules:s,disabled:n.disabled||void 0,media:n.media.length>0?Array.from(n.media):void 0}})}const ut=1e6;function ce(e,t,n,o){if(t===g.HIDDEN)return null;const s=e.getAttribute(n),r=e.tagName;if(Me(r,n,s,t,o)){if(r==="IMG"){const i=e;if(i.naturalWidth>0)return W(i.naturalWidth,i.naturalHeight);const{width:a,height:u}=e.getBoundingClientRect();return a>0||u>0?W(a,u):X}return r==="SOURCE"?X:Z}return s&&Re(s,ut)}function ct(e,t,n){return{...de(e,t,n),...le(e,t,n)}}function de(e,t,n){if(t===g.HIDDEN)return{};const o={},s=ae(e);for(let i=0;i<e.attributes.length;i+=1){const u=e.attributes.item(i).name,c=ce(e,t,u,n.scope.configuration);c!==null&&(o[u]=c)}if(e.value&&(s==="textarea"||s==="select"||s==="option"||s==="input")){const i=H(e,t);i!==void 0&&(o.value=i)}if(s==="option"){const i=e;i.selected&&!D(i,t)?o.selected="":delete o.selected}const r=e;return s==="input"&&(r.type==="radio"||r.type==="checkbox")&&(r.checked&&!D(r,t)?o.checked="":delete o.checked),o}function le(e,t,n){if(t===g.HIDDEN)return{};const o={},s=e.ownerDocument,r=ae(e);if(r==="link"){const u=Array.from(s.styleSheets).find(l=>l.href===e.href),c=z(u);c&&u&&(n.addMetric("cssText",c.length),o._cssText=c)}if(r==="style"&&e.sheet){const u=z(e.sheet);u&&(n.addMetric("cssText",u.length),o._cssText=u)}if(r==="audio"||r==="video"){const u=e;o.rr_mediaState=u.paused?"paused":"played"}let i,a;switch(n.kind){case 0:i=Math.round(e.scrollTop),a=Math.round(e.scrollLeft),(i||a)&&n.scope.elementsScrollPositions.set(e,{scrollTop:i,scrollLeft:a});break;case 1:n.scope.elementsScrollPositions.has(e)&&({scrollTop:i,scrollLeft:a}=n.scope.elementsScrollPositions.get(e));break}return a&&(o.rr_scrollLeft=a),i&&(o.rr_scrollTop=i),o}function z(e){if(!e)return null;let t;try{t=e.rules||e.cssRules}catch{}if(!t)return null;const n=Array.from(t,_e()?dt:fe).join("");return st(n,e.href)}function dt(e){if(ft(e)&&e.selectorText.includes(":")){const t=/(\[[\w-]+[^\\])(:[^\]]+\])/g;return e.cssText.replace(t,"$1\\$2")}return fe(e)}function fe(e){return lt(e)&&z(e.styleSheet)||e.cssText}function lt(e){return"styleSheet"in e}function ft(e){return"selectorText"in e}function B(e,t,n){switch(e.nodeType){case e.DOCUMENT_NODE:return pt(e,t,n);case e.DOCUMENT_FRAGMENT_NODE:return ht(e,t,n);case e.DOCUMENT_TYPE_NODE:return gt(e,n);case e.ELEMENT_NODE:return St(e,t,n);case e.TEXT_NODE:return Et(e,t,n);case e.CDATA_SECTION_NODE:return Nt(e,n);default:return null}}function G(e,t,n){const o=[];return k(e,s=>{const r=B(s,t,n);r&&o.push(r)}),o}function pt(e,t,n){return{type:C.Document,id:n.assignId(e),childNodes:G(e,t,n),adoptedStyleSheets:ue(e.adoptedStyleSheets,n)}}function ht(e,t,n){const o=P(e);return o&&n.scope.shadowRootsController.addShadowRoot(e,n.scope),{type:C.DocumentFragment,id:n.assignId(e),childNodes:G(e,t,n),isShadowRoot:o,adoptedStyleSheets:o?ue(e.adoptedStyleSheets,n):void 0}}function gt(e,t){return{type:C.DocumentType,id:t.assignId(e),name:e.name,publicId:e.publicId,systemId:e.systemId}}function St(e,t,n){const o=at(e.tagName),s=mt(e)||void 0,r=Q(ee(e),t);if(r===g.HIDDEN){const{width:c,height:l}=e.getBoundingClientRect();return{type:C.Element,id:n.assignId(e),tagName:o,attributes:{rr_width:`${c}px`,rr_height:`${l}px`,[ne]:te},childNodes:[],isSVG:s}}if(r===g.IGNORE)return null;const i=n.assignId(e),a=ct(e,r,n);let u=[];return De(e)&&o!=="style"&&(u=G(e,r,n)),{type:C.Element,id:i,tagName:o,attributes:a,childNodes:u,isSVG:s}}function mt(e){return e.tagName==="svg"||e instanceof SVGElement}function Et(e,t,n){const o=L(e,t);return o===void 0?null:{type:C.Text,id:n.assignId(e),textContent:o}}function Nt(e,t){return{type:C.CDATA,id:t.assignId(e),textContent:""}}function Tt(e,t){const n=t.scope.configuration.defaultPrivacyLevel;return B(e,n,t)}function pe(e,t,n,o){let s;const r=ee(t);if(r?s=Q(r,n):s=n,s===g.HIDDEN){Mt(e,t,o);return}if(s!==g.IGNORE){switch(t.nodeType){case t.CDATA_SECTION_NODE:vt(e,t,o);break;case t.DOCUMENT_NODE:yt(e,t,o);break;case t.DOCUMENT_FRAGMENT_NODE:It(e,t,o);break;case t.DOCUMENT_TYPE_NODE:wt(e,t,o);break;case t.ELEMENT_NODE:Ct(e,t,s,o);break;case t.TEXT_NODE:bt(e,t,s,o);break;default:return}switch(t.nodeType){case t.CDATA_SECTION_NODE:case t.DOCUMENT_TYPE_NODE:case t.TEXT_NODE:return}t.nodeName!=="STYLE"&&(e.descend(),k(t,i=>{pe(e,i,s,o)}),e.ascend())}}function yt(e,t,n){const{nodeId:o,insertionPoint:s}=e.advance(t);n.addNode(s,"#document"),n.setScrollPosition(o,V(),F()),he(t.adoptedStyleSheets,o,n)}function It(e,t,n){const{nodeId:o,insertionPoint:s}=e.advance(t);if(!P(t)){n.addNode(s,"#document-fragment");return}n.addNode(s,"#shadow-root"),n.scope.shadowRootsController.addShadowRoot(t,n.scope),he(t.adoptedStyleSheets,o,n)}function wt(e,t,n){const{insertionPoint:o}=e.advance(t);n.addNode(o,"#doctype",t.name,t.publicId,t.systemId)}function Ct(e,t,n,o){const{nodeId:s,insertionPoint:r}=e.advance(t),i=Object.entries(de(t,n,o));o.addNode(r,ge(t),...i);const{_cssText:a,rr_mediaState:u,rr_scrollLeft:c,rr_scrollTop:l}=le(t,n,o),d=t;if(a!==void 0&&d.sheet){const f=o.scope.styleSheetIds.getOrInsert(d.sheet);o.addStyleSheet(a),o.attachStyleSheets(s,[f])}u==="played"?o.setMediaPlaybackState(s,A.Play):u==="paused"&&o.setMediaPlaybackState(s,A.Pause),(c!==void 0||l!==void 0)&&o.setScrollPosition(s,c||0,l||0)}function bt(e,t,n,o){const s=L(t,n);if(s===void 0)return;const{insertionPoint:r}=e.advance(t);o.addNode(r,"#text",s)}function vt(e,t,n){const{insertionPoint:o}=e.advance(t);n.addNode(o,"#cdata-section")}function Mt(e,t,n){if(!Ae(t))return;const{nodeId:o,insertionPoint:s}=e.advance(t);n.addNode(s,ge(t),[ne,te]);const{width:r,height:i}=t.getBoundingClientRect();n.setSize(o,r,i)}function he(e,t,n){!e||e.length===0||n.attachStyleSheets(t,e.map(o=>Rt(o,n)))}function Rt(e,t){const n=Array.from(e.cssRules||e.rules,s=>s.cssText),o=e.media.length>0?Array.from(e.media):void 0;return t.addMetric("cssText",n.reduce((s,r)=>s+r.length,0)),t.addStyleSheet(n,o,e.disabled),t.scope.styleSheetIds.getOrInsert(e)}function ge(e){const t=e.nodeName;return _t(e)?`svg>${t}`:t}function _t(e){return e.namespaceURI==="http://www.w3.org/2000/svg"}function Y(){return{cssText:{count:0,max:0,sum:0},serializationDuration:{count:0,max:0,sum:0}}}function x(e,t,n){e[t].count+=1,e[t].max=Math.max(e[t].max,n),e[t].sum+=n}function Dt(e,t){for(const n of["cssText","serializationDuration"])e[n].count+=t[n].count,e[n].max=Math.max(e[n].max,t[n].max),e[n].sum+=t[n].sum}function At(e){let t={};const n=r=>{for(let i=0,a=r.length;i<a;i++){const u=r[i];if(typeof u=="string"){const c=e.size;r[i]=e.getOrInsert(u),e.size>c&&o(h.AddString,u)}else Array.isArray(u)&&n(u)}},o=(r,i)=>{r in t||(t[r]=[r]),r!==h.AddString&&Array.isArray(i)&&n(i),t[r].push(i)};return{add:o,flush:()=>{const r=[];return[h.AddString,h.AddNode,h.RemoveNode,h.Attribute,h.Text,h.Size,h.ScrollPosition,h.AddStyleSheet,h.AttachedStyleSheets,h.MediaPlaybackState,h.VisualViewport].forEach(i=>{const a=t[i];a&&r.push(a)}),t={},r}}}function Se(e,t,n,o,s){const r=[],i=Y(),a={add(c){r.push(c)},addMetric(c,l){x(i,c,l)},assignId(c){const l=o.nodeIds.getOrInsert(c);return a.serializedNodeIds&&a.serializedNodeIds.add(l),l},kind:e,scope:o},u=y();s(a),x(i,"serializationDuration",oe(u,y()));for(const c of r)t(c);n(i)}function xt(e,t,n,o,s,r){const i=At(o.stringIds),a=Y(),u={addMetric(d,f){x(a,d,f)},addNode(...d){i.add(h.AddNode,d)},addStyleSheet(d,f,p){p?i.add(h.AddStyleSheet,[d,f||[],p]):f?i.add(h.AddStyleSheet,[d,f]):i.add(h.AddStyleSheet,[d])},attachStyleSheets(d,f){const p=[d];for(const E of f)p.push(E);i.add(h.AttachedStyleSheets,p)},setMediaPlaybackState(d,f){i.add(h.MediaPlaybackState,[d,f])},setScrollPosition(d,f,p){i.add(h.ScrollPosition,[d,f,p])},setSize(d,f,p){i.add(h.Size,[d,f,p])},kind:e,scope:o},c=y();r(u),x(a,"serializationDuration",oe(c,y()));const l=i.flush();l.length>0&&t({data:l,type:m.Change,timestamp:s}),n(a)}const j=25;function Ot(e){return Math.abs(e.pageTop-e.offsetTop-window.scrollY)>j||Math.abs(e.pageLeft-e.offsetLeft-window.scrollX)>j}const zt=(e,t)=>{const n=window.visualViewport,o={layoutViewportX:e,layoutViewportY:t,visualViewportX:e,visualViewportY:t};if(n)Ot(n)?(o.layoutViewportX=Math.round(e+n.offsetLeft),o.layoutViewportY=Math.round(t+n.offsetTop)):(o.visualViewportX=Math.round(e-n.offsetLeft),o.visualViewportY=Math.round(t-n.offsetTop));else return o;return o},me=e=>({scale:e.scale,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,pageLeft:e.pageLeft,pageTop:e.pageTop,height:e.height,width:e.width});function Lt(e,t,n,o,s){q(y(),0,t,n,s);const{unsubscribe:r}=e.subscribe(2,i=>{o(),q(i.startClocks.timeStamp,1,t,n,s)});return{stop:r}}function q(e,t,n,o,s){const{width:r,height:i}=xe();n({data:{height:i,href:window.location.href,width:r},type:m.Meta,timestamp:e}),n({data:{has_focus:document.hasFocus()},type:m.Focus,timestamp:e}),se(re.USE_CHANGE_RECORDS)?(t===1&&s.resetIds(),xt(t,n,o,s,e,a=>{pe(et(s.nodeIds),document,s.configuration.defaultPrivacyLevel,a)})):Se(t,n,o,s,a=>{a.add(Pt(e,a))}),window.visualViewport&&n({data:me(window.visualViewport),type:m.VisualViewport,timestamp:e})}function Pt(e,t){return{data:{node:Tt(document,t),initialOffset:{left:V(),top:F()}},type:m.FullSnapshot,timestamp:e}}function kt(){return $(1)}function Vt(){return $(0)}function Ft(){return Ht(0)}function Ut(){return $(0)}function Ht(e){return Ee(()=>new Map,e)}function $(e){return Ee(()=>new WeakMap,e)}function Ee(e,t){let n=e(),o=t;const s=r=>n.get(r);return{clear(){n=e(),o=t},get:s,getOrInsert(r){let i=s(r);return i===void 0&&(i=o++,n.set(r,i)),i},get size(){return o-t}}}function Bt(e,t,n){const o=kt(),s=Vt(),r=Ft(),i=Ut();return{resetIds(){o.clear(),s.clear(),r.clear(),i.clear()},configuration:e,elementsScrollPositions:t,eventIds:o,nodeIds:s,shadowRootsController:n,stringIds:r,styleSheetIds:i}}function Gt(){const e=new WeakMap;return{set(t,n){t===document&&!document.scrollingElement||e.set(t===document?document.scrollingElement:t,n)},get(t){return e.get(t)},has(t){return e.has(t)}}}function Ne(e){return!!e.changedTouches}function R(e){return e.composed===!0&&ie(e.target)?e.composedPath()[0]:e.target}function T(e,t){return{data:{source:e,...t},type:m.IncrementalSnapshot,timestamp:y()}}const Yt=50;function $t(e,t){const{throttled:n,cancel:o}=O(r=>{const i=R(r),a=t.nodeIds.get(i);if(a===void 0)return;const u=Te(r);if(!u)return;const c={id:a,timeOffset:0,x:u.x,y:u.y};e(T(Ne(r)?S.TouchMove:S.MouseMove,{positions:[c]}))},Yt,{trailing:!1}),{stop:s}=b(t.configuration,document,["mousemove","touchmove"],n,{capture:!0,passive:!0});return{stop:()=>{s(),o()}}}function Te(e){let{clientX:t,clientY:n}=Ne(e)?e.changedTouches[0]:e;if(window.visualViewport){const{visualViewportX:o,visualViewportY:s}=zt(t,n);t=o,n=s}if(!(!Number.isFinite(t)||!Number.isFinite(n)))return{x:t,y:n}}const J={pointerup:N.MouseUp,mousedown:N.MouseDown,click:N.Click,contextmenu:N.ContextMenu,dblclick:N.DblClick,focus:N.Focus,blur:N.Blur,touchstart:N.TouchStart,touchend:N.TouchEnd};function Xt(e,t){const n=o=>{const s=R(o),r=t.nodeIds.get(s);if(r===void 0||I(s,t.configuration.defaultPrivacyLevel)===g.HIDDEN)return;const i=J[o.type];let a;if(i!==N.Blur&&i!==N.Focus){const u=Te(o);if(!u)return;a={id:r,type:i,x:u.x,y:u.y}}else a={id:r,type:i};e({id:t.eventIds.getOrInsert(o),...T(S.MouseInteraction,a)})};return b(t.configuration,document,Object.keys(J),n,{capture:!0,passive:!0})}const Wt=100;function ye(e,t,n){const{throttled:o,cancel:s}=O(i=>{const a=R(i);if(!a)return;const u=n.nodeIds.get(a);if(u===void 0||I(a,n.configuration.defaultPrivacyLevel)===g.HIDDEN)return;const c=a===document?{scrollTop:F(),scrollLeft:V()}:{scrollTop:Math.round(a.scrollTop),scrollLeft:Math.round(a.scrollLeft)};n.elementsScrollPositions.set(a,c),t(T(S.Scroll,{id:u,x:c.scrollLeft,y:c.scrollTop}))},Wt),{stop:r}=Oe(n.configuration,e,"scroll",o,{capture:!0,passive:!0});return{stop:()=>{r(),s()}}}const jt=200;function qt(e,t){const n=ze(t.configuration).subscribe(o=>{e(T(S.ViewportResize,o))});return{stop:()=>{n.unsubscribe()}}}function Jt(e,t){const n=window.visualViewport;if(!n)return{stop:w};const{throttled:o,cancel:s}=O(()=>{e({data:me(n),type:m.VisualViewport,timestamp:y()})},jt,{trailing:!1}),{stop:r}=b(t.configuration,n,["resize","scroll"],o,{capture:!0,passive:!0});return{stop:()=>{r(),s()}}}function Kt(e,t){return b(t.configuration,document,["play","pause"],n=>{const o=R(n);if(!o)return;const s=t.nodeIds.get(o);s===void 0||I(o,t.configuration.defaultPrivacyLevel)===g.HIDDEN||e(T(S.MediaInteraction,{id:s,type:n.type==="play"?A.Play:A.Pause}))},{capture:!0,passive:!0})}function Zt(e,t){function n(r,i){if(!r||!r.ownerNode)return;const a=t.nodeIds.get(r.ownerNode);a!==void 0&&i(a)}const o=[_(CSSStyleSheet.prototype,"insertRule",({target:r,parameters:[i,a]})=>{n(r,u=>e(T(S.StyleSheetRule,{id:u,adds:[{rule:i,index:a}]})))}),_(CSSStyleSheet.prototype,"deleteRule",({target:r,parameters:[i]})=>{n(r,a=>e(T(S.StyleSheetRule,{id:a,removes:[{index:i}]})))})];typeof CSSGroupingRule<"u"?s(CSSGroupingRule):(s(CSSMediaRule),s(CSSSupportsRule));function s(r){o.push(_(r.prototype,"insertRule",({target:i,parameters:[a,u]})=>{n(i.parentStyleSheet,c=>{const l=K(i);l&&(l.push(u||0),e(T(S.StyleSheetRule,{id:c,adds:[{rule:a,index:l}]})))})}),_(r.prototype,"deleteRule",({target:i,parameters:[a]})=>{n(i.parentStyleSheet,u=>{const c=K(i);c&&(c.push(a),e(T(S.StyleSheetRule,{id:u,removes:[{index:c}]})))})}))}return{stop:()=>{o.forEach(r=>r.stop())}}}function K(e){const t=[];let n=e;for(;n.parentRule;){const i=Array.from(n.parentRule.cssRules).indexOf(n);t.unshift(i),n=n.parentRule}if(!n.parentStyleSheet)return;const s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);return t.unshift(s),t}function Qt(e,t){return b(t.configuration,window,["focus","blur"],()=>{e({data:{has_focus:document.hasFocus()},type:m.Focus,timestamp:y()})})}function en(e,t,n){const o=e.subscribe(12,s=>{var r,i;s.rawRumEvent.type===Le.ACTION&&s.rawRumEvent.action.type===Pe.CLICK&&(!((i=(r=s.rawRumEvent.action.frustration)===null||r===void 0?void 0:r.type)===null||i===void 0)&&i.length)&&"events"in s.domainContext&&s.domainContext.events&&s.domainContext.events.length&&t({timestamp:s.rawRumEvent.date,type:m.FrustrationRecord,data:{frustrationTypes:s.rawRumEvent.action.frustration.type,recordIds:s.domainContext.events.map(a=>n.eventIds.getOrInsert(a))}})});return{stop:()=>{o.unsubscribe()}}}function tn(e,t,n){const o=e.subscribe(5,()=>{n(),t({timestamp:y(),type:m.ViewEnd})});return{stop:()=>{o.unsubscribe()}}}function Ie(e,t,n){const o=n.configuration.defaultPrivacyLevel,s=new WeakMap,r=e!==document,{stop:i}=b(n.configuration,e,r?["change"]:["input","change"],l=>{const d=R(l);(d instanceof HTMLInputElement||d instanceof HTMLTextAreaElement||d instanceof HTMLSelectElement)&&u(d)},{capture:!0,passive:!0});let a;if(r)a=w;else{const l=[M(HTMLInputElement.prototype,"value",u),M(HTMLInputElement.prototype,"checked",u),M(HTMLSelectElement.prototype,"value",u),M(HTMLTextAreaElement.prototype,"value",u),M(HTMLSelectElement.prototype,"selectedIndex",u)];a=()=>{l.forEach(d=>d.stop())}}return{stop:()=>{a(),i()}};function u(l){const d=I(l,o);if(d===g.HIDDEN)return;const f=l.type;let p;if(f==="radio"||f==="checkbox"){if(D(l,d))return;p={isChecked:l.checked}}else{const v=H(l,d);if(v===void 0)return;p={text:v}}c(l,p);const E=l.name;f==="radio"&&E&&l.checked&&document.querySelectorAll(`input[type="radio"][name="${CSS.escape(E)}"]`).forEach(v=>{v!==l&&c(v,{isChecked:!1})})}function c(l,d){const f=n.nodeIds.get(l);if(f===void 0)return;const p=s.get(l);(!p||p.text!==d.text||p.isChecked!==d.isChecked)&&(s.set(l,d),t(T(S.Input,{id:f,...d})))}}const nn=100,on=16;function sn(e){let t=w,n=[];function o(){t(),e(n),n=[]}const{throttled:s,cancel:r}=O(o,on,{leading:!1});return{addMutations:i=>{n.length===0&&(t=ke(s,{timeout:nn})),n.push(...i)},flush:o,stop:()=>{t(),r()}}}function we(e,t,n,o){const s=Ve();if(!s)return{stop:w,flush:w};const r=sn(a=>{Se(2,t,n,o,u=>rn(a.concat(i.takeRecords()),u))}),i=new s(Fe(r.addMutations));return i.observe(e,{attributeOldValue:!0,attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),{stop:()=>{i.disconnect(),r.stop()},flush:()=>{r.flush()}}}function rn(e,t){const n=new Map;e.filter(c=>c.type==="childList").forEach(c=>{c.removedNodes.forEach(l=>{Ce(l,t.scope.shadowRootsController.removeShadowRoot)})});const o=e.filter(c=>c.target.isConnected&&ln(c.target,t.scope.nodeIds)&&I(c.target,t.scope.configuration.defaultPrivacyLevel,n)!==g.HIDDEN),{adds:s,removes:r,hasBeenSerialized:i}=an(o.filter(c=>c.type==="childList"),n,t),a=un(o.filter(c=>c.type==="characterData"&&!i(c.target)),n,t),u=cn(o.filter(c=>c.type==="attributes"&&!i(c.target)),n,t);!a.length&&!u.length&&!r.length&&!s.length||t.add(T(S.Mutation,{adds:s,removes:r,texts:a,attributes:u}))}function an(e,t,n){const o=new Set,s=new Map;for(const l of e)l.addedNodes.forEach(d=>{o.add(d)}),l.removedNodes.forEach(d=>{o.has(d)||s.set(d,l.target),o.delete(d)});const r=Array.from(o);dn(r),n.serializedNodeIds=new Set;const i=[];for(const l of r){if(u(l))continue;const d=I(l.parentNode,n.scope.configuration.defaultPrivacyLevel,t);if(d===g.HIDDEN||d===g.IGNORE)continue;const f=B(l,d,n);if(!f)continue;const p=U(l);i.push({nextId:c(l),parentId:n.scope.nodeIds.get(p),node:f})}const a=[];return s.forEach((l,d)=>{const f=n.scope.nodeIds.get(l),p=n.scope.nodeIds.get(d);f!==void 0&&p!==void 0&&a.push({parentId:f,id:p})}),{adds:i,removes:a,hasBeenSerialized:u};function u(l){var d;const f=n.scope.nodeIds.get(l);return f!==void 0&&((d=n.serializedNodeIds)===null||d===void 0?void 0:d.has(f))}function c(l){let d=l.nextSibling;for(;d;){const f=n.scope.nodeIds.get(d);if(f!==void 0)return f;d=d.nextSibling}return null}}function un(e,t,n){var o;const s=[],r=new Set,i=e.filter(a=>r.has(a.target)?!1:(r.add(a.target),!0));for(const a of i){if(a.target.textContent===a.oldValue)continue;const c=n.scope.nodeIds.get(a.target);if(c===void 0)continue;const l=I(U(a.target),n.scope.configuration.defaultPrivacyLevel,t);l===g.HIDDEN||l===g.IGNORE||s.push({id:c,value:(o=L(a.target,l))!==null&&o!==void 0?o:null})}return s}function cn(e,t,n){const o=[],s=new Map,r=e.filter(a=>{const u=s.get(a.target);return u&&u.has(a.attributeName)?!1:(u?u.add(a.attributeName):s.set(a.target,new Set([a.attributeName])),!0)}),i=new Map;for(const a of r){if(a.target.getAttribute(a.attributeName)===a.oldValue)continue;const c=n.scope.nodeIds.get(a.target);if(c===void 0)continue;const l=I(a.target,n.scope.configuration.defaultPrivacyLevel,t),d=ce(a.target,l,a.attributeName,n.scope.configuration);let f;if(a.attributeName==="value"){const E=H(a.target,l);if(E===void 0)continue;f=E}else typeof d=="string"?f=d:f=null;let p=i.get(a.target);p||(p={id:c,attributes:{}},o.push(p),i.set(a.target,p)),p.attributes[a.attributeName]=f}return o}function dn(e){e.sort((t,n)=>{const o=t.compareDocumentPosition(n);return o&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:o&Node.DOCUMENT_POSITION_CONTAINS||o&Node.DOCUMENT_POSITION_FOLLOWING?1:o&Node.DOCUMENT_POSITION_PRECEDING?-1:0})}function Ce(e,t){ie(e)&&t(e.shadowRoot),k(e,n=>Ce(n,t))}function ln(e,t){let n=e;for(;n;){if(t.get(n)===void 0&&!P(n))return!1;n=U(n)}return!0}const fn=(e,t)=>{const n=new Map;return{addShadowRoot:(s,r)=>{if(n.has(s))return;const i=we(s,e,t,r),a=Ie(s,e,r),u=ye(s,e,r);n.set(s,{flush:()=>i.flush(),stop:()=>{i.stop(),a.stop(),u.stop()}})},removeShadowRoot:s=>{const r=n.get(s);r&&(r.stop(),n.delete(s))},stop:()=>{n.forEach(({stop:s})=>s())},flush:()=>{n.forEach(({flush:s})=>s())}}};function pn(e){const{emitRecord:t,emitStats:n,configuration:o,lifeCycle:s}=e;if(!t||!n)throw new Error("emit functions are required");const r=f=>{t(f),Ue("record",{record:f});const p=e.viewHistory.findView();He(p.id)},i=fn(r,n),a=Bt(o,Gt(),i),{stop:u}=Lt(s,r,n,c,a);function c(){i.flush(),l.flush()}const l=we(document,r,n,a),d=[l,$t(r,a),Xt(r,a),ye(document,r,a),qt(r,a),Ie(document,r,a),Kt(r,a),Zt(r,a),Qt(r,a),Jt(r,a),en(s,r,a),tn(s,r,c)];return{stop:()=>{i.stop(),d.forEach(f=>f.stop()),u()},flushMutations:c,shadowRootsController:i}}function hn(e,t,n,o){const s=new FormData;s.append("segment",new Blob([e],{type:"application/octet-stream"}),`${t.session.id}-${t.start}`);const r={raw_segment_size:o,compressed_segment_size:e.byteLength,...t},i=JSON.stringify(r);return s.append("event",new Blob([i],{type:"application/json"})),{data:s,bytesCount:e.byteLength,cssText:n.cssText,isFullSnapshot:t.index_in_view===0,rawSize:o,recordCount:t.records_count,serializationDuration:n.serializationDuration}}function gn({context:e,creationReason:t,encoder:n}){let o=0;const s=e.view.id,r=Be(s),i={start:1/0,end:-1/0,creation_reason:t,records_count:0,has_full_snapshot:!1,index_in_view:r,source:"browser",...e},a=Y();Ge(s);function u(d,f){i.start=Math.min(i.start,d.timestamp),i.end=Math.max(i.end,d.timestamp),i.records_count+=1,i.has_full_snapshot||(i.has_full_snapshot=d.type===m.FullSnapshot||d.type===m.Change&&i.index_in_view===0);const p=n.isEmpty?'{"records":[':",";n.write(p+JSON.stringify(d),E=>{o+=E,f(o)})}function c(d){Dt(a,d)}function l(d){if(n.isEmpty)throw new Error("Empty segment flushed");n.write(`],${JSON.stringify(i).slice(1)}
|
|
2
|
-
`),n.finish(f=>{Ye(i.view.id,f.rawBytesCount),d(i,a,f)})}return{addRecord:u,addStats:c,flush:l}}const Sn=5*je;let be=6e4;function mn(e,t,n,o,s,r){return En(e,()=>Nn(t.applicationId,n,o),s,r)}function En(e,t,n,o){let s={status:0,nextSegmentCreationReason:"init"};const{unsubscribe:r}=e.subscribe(2,()=>{a("view_change")}),{unsubscribe:i}=e.subscribe(11,u=>{a(u.reason)});function a(u){s.status===1&&(s.segment.flush((c,l,d)=>{const f=hn(d.output,c,l,d.rawBytesCount);$e(u)?n.sendOnExit(f):n.send(f)}),Xe(s.expirationTimeoutId)),u!=="stop"?s={status:0,nextSegmentCreationReason:u}:s={status:2}}return{addRecord:u=>{if(s.status!==2){if(s.status===0){const c=t();if(!c)return;s={status:1,segment:gn({encoder:o,context:c,creationReason:s.nextSegmentCreationReason}),expirationTimeoutId:We(()=>{a("segment_duration_limit")},Sn)}}s.segment.addRecord(u,c=>{c>be&&a("segment_bytes_limit")})}},addStats:u=>{s.status===1&&s.segment.addStats(u)},stop:()=>{a("stop"),r(),i()}}}function Nn(e,t,n){const o=t.findTrackedSession(),s=n.findView();if(!(!o||!s))return{application:{id:e},session:{id:o.id},view:{id:s.id}}}function Tn(e,t){if(!e.metricsEnabled)return{stop:w};const{unsubscribe:n}=t.subscribe(o=>{if(o.type==="failure"||o.type==="queue-full"||o.type==="success"&&o.payload.isFullSnapshot){const s=yn(o.type,o.bandwidth,o.payload);qe("Segment network request metrics",{metrics:s})}});return{stop:n}}function yn(e,t,n){return{cssText:{count:n.cssText.count,max:n.cssText.max,sum:n.cssText.sum},encoding:{fullSnapshot:se(re.USE_CHANGE_RECORDS)?"change":"v1",incrementalSnapshot:"v1"},isFullSnapshot:n.isFullSnapshot,ongoingRequests:{count:t.ongoingRequestCount,totalSize:t.ongoingByteCount},recordCount:n.recordCount,result:e,serializationDuration:{count:n.serializationDuration.count,max:n.serializationDuration.max,sum:n.serializationDuration.sum},size:{compressed:n.bytesCount,raw:n.rawSize}}}function In(e){const t=Je();return{addRecord:n=>{const o=e.findView();t.send("record",n,o.id)}}}function Cn(e,t,n,o,s,r,i){const a=[],u=p=>{e.notify(14,{error:p}),Qe("Error reported to customer",{"error.message":p.message})},c=i||Ke([t.sessionReplayEndpointBuilder],u,be);let l,d;if(Ze())({addRecord:l}=In(o)),d=w;else{const p=mn(e,t,n,o,c,s);l=p.addRecord,d=p.addStats,a.push(p.stop);const E=Tn(r,c.observable);a.push(E.stop)}const{stop:f}=pn({emitRecord:l,emitStats:d,configuration:t,lifeCycle:e,viewHistory:o});return a.push(f),{stop:()=>{a.forEach(p=>p())}}}export{Cn as startRecording};
|