@inkeep/open-knowledge 0.54.0-beta.0 → 0.54.0-beta.2

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 (115) hide show
  1. package/dist/{acp-harness-probe-BAU5A5o3.mjs → acp-harness-probe-CdgnSiX1.mjs} +2 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/constants-BfTkfLb_.mjs +2 -0
  4. package/dist/index.mjs +1 -1
  5. package/dist/{init-DqyJAJAm.mjs → init-BMOmCTtk.mjs} +3 -3
  6. package/dist/init-BgBNBsz1.mjs +1 -0
  7. package/dist/{launch-json-removal-CBpeW9Ah.mjs → launch-json-removal-lcolwR_B.mjs} +2 -2
  8. package/dist/{loader-BkusT1hI.mjs → loader-21jtkH8-.mjs} +2 -2
  9. package/dist/loader-DBCQd3aT.mjs +1 -0
  10. package/dist/{open-browser-BqA6XiT0.mjs → open-browser-DYnRS1jz.mjs} +2 -2
  11. package/dist/preview-CX7XU2cj.mjs +1 -0
  12. package/dist/{preview-kSEjxYuX.mjs → preview-DILIawX2.mjs} +2 -2
  13. package/dist/public/assets/{ActivityModeContent-CQnmKBGo.js → ActivityModeContent-BLw3WMWz.js} +1 -1
  14. package/dist/public/assets/{AgentDiffPane-BMJtHPB0.js → AgentDiffPane-DrZCRBSs.js} +1 -1
  15. package/dist/public/assets/{AgentThreadClientBinder-CSCbo226.js → AgentThreadClientBinder-CWcDlN8A.js} +1 -1
  16. package/dist/public/assets/{ChangedOutsideBadge-DGYi7hdZ.js → ChangedOutsideBadge-BRBEndlT.js} +1 -1
  17. package/dist/public/assets/{CodeMirrorPropInput-DywYyBz8.js → CodeMirrorPropInput-B5_xejDl.js} +1 -1
  18. package/dist/public/assets/{DocumentContext-CKR9tIsX.js → DocumentContext-y4udwaSS.js} +1 -1
  19. package/dist/public/assets/{EditorModeToggle-CiWiUMD4.js → EditorModeToggle-BlT04JPF.js} +1 -1
  20. package/dist/public/assets/{EnableSyncConfirmDialog-PNZ3-bzD.js → EnableSyncConfirmDialog-BKrwMqLx.js} +1 -1
  21. package/dist/public/assets/FeedbackForm-lEn2xy5h.js +1 -0
  22. package/dist/public/assets/{ImportSkillDialog-D_zbPvrz.js → ImportSkillDialog-Cx_uO9te.js} +1 -1
  23. package/dist/public/assets/{LintConfigEditor-CmDISx0R.js → LintConfigEditor-DpkMgp67.js} +1 -1
  24. package/dist/public/assets/{ManagedArtifactProperties-D1j8yV7G.js → ManagedArtifactProperties-DQV6Xkkp.js} +1 -1
  25. package/dist/public/assets/ManagedArtifactProperties-DfOLsWxL.js +1 -0
  26. package/dist/public/assets/{MermaidDocEditor-CClwSJEd.js → MermaidDocEditor-D02-RjZh.js} +1 -1
  27. package/dist/public/assets/SchemaConfigEditor-DhU_jWFU.js +1 -0
  28. package/dist/public/assets/{SessionsHost-DvCES4YX.js → SessionsHost-aL9Yi0YA.js} +2 -2
  29. package/dist/public/assets/{SettingsDialogBody-CGs75yJY.js → SettingsDialogBody-FvV7PJ-x.js} +4 -4
  30. package/dist/public/assets/{ShareReceiveMissDialog-B-CD8c9A.js → ShareReceiveMissDialog-C6Fw1jSy.js} +1 -1
  31. package/dist/public/assets/{SkillToolbarControls-BbJJTW3S.js → SkillToolbarControls-CV5iqOyh.js} +1 -1
  32. package/dist/public/assets/{SourceEditor-Dakmm381.js → SourceEditor-Cgcjeeix.js} +1 -1
  33. package/dist/public/assets/{TerminalWindowApp-Bzecjegv.js → TerminalWindowApp-pFQbcyvr.js} +1 -1
  34. package/dist/public/assets/{TextDocEditor-B73XTMKM.js → TextDocEditor-BIvaeGcP.js} +1 -1
  35. package/dist/public/assets/ThreadView-uJiWLV3S.js +10 -0
  36. package/dist/public/assets/{TimelineDiffPane-BnuEYjxI.js → TimelineDiffPane-DP3x-bCT.js} +1 -1
  37. package/dist/public/assets/{agent-diff-store-CJK-vc6Z.js → agent-diff-store-BvJOHqlb.js} +1 -1
  38. package/dist/public/assets/{auth-state-cache-BR8S3JrV.js → auth-state-cache-B-pvyyml.js} +1 -1
  39. package/dist/public/assets/{client-version-stzG9fok.js → client-version-Dl9MDBtc.js} +1 -1
  40. package/dist/public/assets/{comment-chips-VYzrfZOz.js → comment-chips-JdDlBBOC.js} +1 -1
  41. package/dist/public/assets/{config-provider-K5pliovj.js → config-provider-BEm_X5z4.js} +3 -3
  42. package/dist/public/assets/{follow-file-CoVZeHYJ.js → follow-file-DXj47N4P.js} +4 -4
  43. package/dist/public/assets/globals-CJLw9I7s.css +1 -0
  44. package/dist/public/assets/i18n-9-u0vIHQ.js +1 -0
  45. package/dist/public/assets/{index-CQiP7zms.js → index-CzQHudrL.js} +7 -7
  46. package/dist/public/assets/messages-70uyb6Sl.js +1 -0
  47. package/dist/public/assets/messages-BZmGV91Y.js +1 -0
  48. package/dist/public/assets/messages-C5UOlhWV.js +1 -0
  49. package/dist/public/assets/messages-C9FmY7uu.js +1 -0
  50. package/dist/public/assets/messages-CW3KcnxY.js +1 -0
  51. package/dist/public/assets/messages-CaxDnJNi.js +1 -0
  52. package/dist/public/assets/messages-CdzCdHWg.js +1 -0
  53. package/dist/public/assets/messages-D0j48ldR.js +1 -0
  54. package/dist/public/assets/messages-DvPjiVuw.js +1 -0
  55. package/dist/public/assets/messages-h8GDTlCf.js +1 -0
  56. package/dist/public/assets/messages-vdVQRalr.js +1 -0
  57. package/dist/public/assets/{pending-receive-nav-store-CaeSNfXj.js → pending-receive-nav-store-NNPZxbyU.js} +1 -1
  58. package/dist/public/assets/schema-fields-view-intent-DGCRVgw4.js +1 -0
  59. package/dist/public/assets/{selection-context-DPs8vxvW.js → selection-context-DaBEt_qe.js} +1 -1
  60. package/dist/public/assets/{skill-actions-CzmorCTi.js → skill-actions-rrqHJf1p.js} +1 -1
  61. package/dist/public/assets/{src-B87zThCs.js → src-D9vfSdRg.js} +1 -1
  62. package/dist/public/assets/{telemetry-impl-DSYzVKpq.js → telemetry-impl-CyzYpIO_.js} +1 -1
  63. package/dist/public/assets/{telemetry-startup-Da9NTocG.js → telemetry-startup-D_qndbLQ.js} +1 -1
  64. package/dist/public/assets/thread-client-CDd-DZmX.js +1 -0
  65. package/dist/public/assets/{typing-burst-detector-BY-anD9p.js → typing-burst-detector-4lnkqJUG.js} +1 -1
  66. package/dist/public/assets/{uninstall-wgIMFaoT.js → uninstall-DvHaOfxL.js} +1 -1
  67. package/dist/public/assets/{use-activity-panel-DqTP5DTk.js → use-activity-panel-YwUA1Y9R.js} +1 -1
  68. package/dist/public/assets/{use-open-skill-BK6woDan.js → use-open-skill-CLA3orpv.js} +1 -1
  69. package/dist/public/assets/{use-popular-skills-Wut1asdd.js → use-popular-skills-DRLF7dJB.js} +1 -1
  70. package/dist/public/assets/{use-terminal-enabled-CuoUv2VD.js → use-terminal-enabled-NR-FDyhW.js} +1 -1
  71. package/dist/public/assets/{use-timeline-entry-diff-Ci46DL5w.js → use-timeline-entry-diff-D_UL2qvn.js} +1 -1
  72. package/dist/public/index.html +23 -23
  73. package/dist/public/uninstall.html +5 -5
  74. package/dist/{repair-launch-json-CbCU3tYc.mjs → repair-launch-json-BGuk6v5-.mjs} +2 -2
  75. package/dist/{repair-mcp-configs-DDEeRKrI.mjs → repair-mcp-configs-CxB7cmFQ.mjs} +2 -2
  76. package/dist/{repair-skills-DTNqAGfI.mjs → repair-skills-CfH-4HV1.mjs} +2 -2
  77. package/dist/repair-skills-eHShRAdH.mjs +1 -0
  78. package/dist/{skill-teardown-ottam6sV.mjs → skill-teardown-BDCZSEP-.mjs} +2 -2
  79. package/dist/src-D3K5FFwY.mjs +1 -0
  80. package/dist/{src-BA3VPog2.mjs → src-D3S37RZY.mjs} +2 -2
  81. package/dist/{src-BF0nCoer.mjs → src-DCqoFl4a.mjs} +1 -1
  82. package/dist/src-Da93CAF3.mjs +2040 -0
  83. package/dist/start-9YOKl_ky.mjs +1 -0
  84. package/dist/{start-BbzEXh_C.mjs → start-Buf2BHBD.mjs} +4 -4
  85. package/dist/{ui-B7mhq8_g.mjs → ui-CGn0Cm6_.mjs} +3 -3
  86. package/dist/{write-project-skill-DWGQrWRr.mjs → write-project-skill-Bzg8sfOX.mjs} +2 -2
  87. package/package.json +4 -4
  88. package/dist/constants-CdO7Ip8K.mjs +0 -2
  89. package/dist/init-Cc1kMhai.mjs +0 -1
  90. package/dist/loader-COoyAZy6.mjs +0 -1
  91. package/dist/preview-eDBiuPbb.mjs +0 -1
  92. package/dist/public/assets/FeedbackForm-CNHw5U32.js +0 -1
  93. package/dist/public/assets/ManagedArtifactProperties-C5neRevI.js +0 -1
  94. package/dist/public/assets/SchemaConfigEditor-DmzRjNLX.js +0 -1
  95. package/dist/public/assets/ThreadView-Dyqxn2Co.js +0 -10
  96. package/dist/public/assets/globals-Cl9DVROF.css +0 -1
  97. package/dist/public/assets/i18n-DdNV3ihn.js +0 -1
  98. package/dist/public/assets/messages-BD6xU0hl.js +0 -1
  99. package/dist/public/assets/messages-BrOihCC2.js +0 -1
  100. package/dist/public/assets/messages-CeGZ3qGI.js +0 -1
  101. package/dist/public/assets/messages-DLAxD4Ea.js +0 -1
  102. package/dist/public/assets/messages-DiRAd1Pa.js +0 -1
  103. package/dist/public/assets/messages-DoSs73jK.js +0 -1
  104. package/dist/public/assets/messages-FGGtYX0Z.js +0 -1
  105. package/dist/public/assets/messages-QNJusJtV.js +0 -1
  106. package/dist/public/assets/messages-T7J7xjCi.js +0 -1
  107. package/dist/public/assets/messages-rE7VifgH.js +0 -1
  108. package/dist/public/assets/messages-zscDryNK.js +0 -1
  109. package/dist/public/assets/schema-fields-view-intent-D0jz38_6.js +0 -1
  110. package/dist/public/assets/thread-client-DnaLPSLV.js +0 -1
  111. package/dist/repair-skills-DI3Fy43j.mjs +0 -1
  112. package/dist/src-BPm9wAhY.mjs +0 -1
  113. package/dist/src-BXlWNOZp.mjs +0 -2040
  114. package/dist/start-CfJGPzvO.mjs +0 -1
  115. /package/dist/public/assets/{globals-CI7YXh9U.js → globals-DMS6iUdG.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./__vite-browser-external-DD8Jl_VU.js","./chunk-CYidjpOJ.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{a as n,c as r,d as i,f as a,i as o,l as s,n as c,o as l,p as u,r as d,t as f,u as p}from"./trace-api-18gcBe0u.js";import{n as m,r as ee,t as h}from"./propagation-api-PBYTadVM.js";var te=class{constructor(){}createGauge(e,t){return fe}createHistogram(e,t){return pe}createCounter(e,t){return de}createUpDownCounter(e,t){return me}createObservableGauge(e,t){return ge}createObservableCounter(e,t){return he}createObservableUpDownCounter(e,t){return _e}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},g=class{},ne=class extends g{add(e,t){}},re=class extends g{add(e,t){}},ie=class extends g{record(e,t){}},ae=class extends g{record(e,t){}},oe=class{addCallback(e){}removeCallback(e){}},se=class extends oe{},ce=class extends oe{},le=class extends oe{},ue=new te,de=new ne,fe=new ie,pe=new ae,me=new re,he=new se,ge=new ce,_e=new le;function ve(){return ue}var ye;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(ye||={});var be;(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(be||={});var _=p.instance(),xe=new class{getMeter(e,t,n){return ue}},Se=`metrics`,Ce=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalMeterProvider(e){return a(Se,e,p.instance())}getMeterProvider(){return i(Se)||xe}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){u(Se,p.instance())}}.getInstance(),we=class{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}},Te=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}};function Ee(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function De(e){if(e!=null)return()=>e}function Oe(e,t,n){return{timeoutMillis:Ee(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function ke(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var Ae=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function je(e){return new Ae(e.concurrencyLimit)}var Me=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{},Ne=performance,Pe=`http.url`,Fe=`http.user_agent`,Ie=Pe,Le=Fe,Re=`deployment.environment.name`,ze=`error.type`,Be=`exception.message`,Ve=`exception.stacktrace`,He=`exception.type`,Ue=`http.request.method`,We=`http.request.method_original`,Ge=`http.response.status_code`,Ke=`server.address`,qe=`server.port`,Je=`service.name`,Ye=`service.version`,Xe=`telemetry.sdk.language`,Ze=`webjs`,Qe=`telemetry.sdk.name`,$e=`telemetry.sdk.version`,et=`url.full`,tt=9,nt=10**6,rt=10**tt;function v(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*nt)]}function it(){let e=Ne.timeOrigin;if(typeof e!=`number`){let t=Ne;e=t.timing&&t.timing.fetchStart}return e}function at(e){return st(v(it()),v(typeof e==`number`?e:Ne.now()))}function y(e){if(ot(e))return e;if(typeof e==`number`)return e<it()?at(e):v(e);if(e instanceof Date)return v(e.getTime());throw TypeError(`Invalid input type`)}function b(e){return e[0]*rt+e[1]}function ot(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function st(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=rt&&(n[1]-=rt,n[0]+=1),n}var x;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(x||={});function ct(e,t){return typeof t==`string`?e===t:!!e.match(t)}function lt(e,t){if(!t)return!1;for(let n of t)if(ct(e,n))return!0;return!1}function ut(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function dt(){return{handleResponse(e){e==null||!ut(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||_.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var ft=class{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=_.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:x.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:x.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:x.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:x.FAILED,error:e.error});return}else e.status===`retryable`?t({code:x.FAILED,error:new Te(`Export failed with retryable status`)}):t({code:x.FAILED,error:new Te(`Export failed with unknown error`)})},e=>t({code:x.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}};function pt(e,t){return new ft(e.transport,e.serializer,dt(),e.promiseHandler,t.timeout)}function mt(e,t,n){return pt({transport:n,serializer:t,promiseHandler:je(e)},{timeout:e.timeoutMillis})}function ht(e){return e>=48&&e<=57?e-48:e>=97&&e<=102?e-87:e-55}function gt(e){let t=new Uint8Array(e.length/2),n=0;for(let r=0;r<e.length;r+=2){let i=ht(e.charCodeAt(r)),a=ht(e.charCodeAt(r+1));t[n++]=i<<4|a}return t}function _t(e){let t=BigInt(1e9);return BigInt(e[0])*t+BigInt(e[1])}function vt(e){return{low:Number(BigInt.asUintN(32,e)),high:Number(BigInt.asUintN(32,e>>BigInt(32)))}}function yt(e){return vt(_t(e))}function bt(e){return _t(e).toString()}var xt=typeof BigInt<`u`?bt:b;function St(e){return e}function Ct(e){if(e!==void 0)return gt(e)}var wt={encodeHrTime:yt,encodeSpanContext:gt,encodeOptionalSpanContext:Ct};function Tt(e){if(e===void 0)return wt;let t=e.useLongBits??!0,n=e.useHex??!1;return{encodeHrTime:t?yt:xt,encodeSpanContext:n?St:gt,encodeOptionalSpanContext:n?St:Ct}}function Et(e){let t={attributes:S(e.attributes),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==``&&(t.schemaUrl=n),t}function Dt(e){return{name:e.name,version:e.version}}function S(e){return Object.keys(e).map(t=>Ot(t,e[t]))}function Ot(e,t){return{key:e,value:kt(t)}}function kt(e){let t=typeof e;return t===`string`?{stringValue:e}:t===`number`?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:t===`boolean`?{boolValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{arrayValue:{values:e.map(kt)}}:t===`object`&&e!=null?{kvlistValue:{values:Object.entries(e).map(([e,t])=>Ot(e,t))}}:{}}function At(e,t){let n=e.spanContext(),r=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:S(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Mt(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>jt(e,t)),droppedLinksCount:e.droppedLinksCount}}function jt(e,t){return{attributes:e.attributes?S(e.attributes):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0}}function Mt(e,t){return{attributes:e.attributes?S(e.attributes):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Nt(e,t){return{resourceSpans:Ft(e,Tt(t))}}function Pt(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function Ft(e,t){let n=Pt(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>At(e,t));o.push({scope:Dt(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=Et(e),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var It={serializeRequest:e=>{let t=Nt(e,{useHex:!0,useLongBits:!1});return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}},Lt=5,Rt=1e3,zt=5e3,Bt=1.5,Vt=.2;function Ht(){return 2*Vt*Math.random()-Vt}var Ut=class{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=Date.now()+t,r=await this._transport.send(e,t),i=Lt,a=Rt;for(;r.status===`retryable`&&i>0;){i--;let t=Math.max(Math.min(a,zt)+Ht(),0);a*=Bt;let o=r.retryInMillis??t,s=n-Date.now();if(o>s)return r;r=await this.retry(e,s,o)}return r}shutdown(){return this._transport.shutdown()}};function Wt(e){return new Ut(e.transport)}function Gt(e){return[429,502,503,504].includes(e)}function Kt(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var qt=class{_parameters;constructor(e){this._parameters=e}send(e,t){return new Promise(n=>{let r=new XMLHttpRequest;r.timeout=t,r.open(`POST`,this._parameters.url);let i=this._parameters.headers();Object.entries(i).forEach(([e,t])=>{r.setRequestHeader(e,t)}),r.ontimeout=e=>{n({status:`failure`,error:Error(`XHR request timed out`)})},r.onreadystatechange=()=>{r.status>=200&&r.status<=299?(_.debug(`XHR success`),n({status:`success`})):r.status&&Gt(r.status)?n({status:`retryable`,retryInMillis:Kt(r.getResponseHeader(`Retry-After`))}):r.status!==0&&n({status:`failure`,error:Error(`XHR request failed with non-retryable status`)})},r.onabort=()=>{n({status:`failure`,error:Error(`XHR request aborted`)})},r.onerror=()=>{n({status:`failure`,error:Error(`XHR request errored`)})},r.send(e)})}shutdown(){}};function Jt(e){return new qt(e)}var Yt=class{_params;constructor(e){this._params=e}send(e){return new Promise(t=>{navigator.sendBeacon(this._params.url,new Blob([e],{type:this._params.blobType}))?(_.debug(`SendBeacon success`),t({status:`success`})):t({status:`failure`,error:Error(`SendBeacon failed`)})})}shutdown(){}};function Xt(e){return new Yt(e)}var Zt=class{_parameters;constructor(e){this._parameters=e}async send(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),t);try{let t=!!globalThis.location,r=new URL(this._parameters.url),i=await fetch(r.href,{method:`POST`,headers:this._parameters.headers(),body:e,signal:n.signal,keepalive:t,mode:t?globalThis.location?.origin===r.origin?`same-origin`:`cors`:`no-cors`});return i.status>=200&&i.status<=299?(_.debug(`response success`),{status:`success`}):Gt(i.status)?{status:`retryable`,retryInMillis:Kt(i.headers.get(`Retry-After`))}:{status:`failure`,error:Error(`Fetch request failed with non-retryable status`)}}catch(e){return e?.name===`AbortError`?{status:`failure`,error:Error(`Fetch request timed out`,{cause:e})}:{status:`failure`,error:Error(`Fetch request errored`,{cause:e})}}finally{clearTimeout(r)}}shutdown(){}};function Qt(e){return new Zt(e)}function $t(e,t){return mt(e,t,Wt({transport:Jt(e)}))}function en(e,t){return mt(e,t,Wt({transport:Qt(e)}))}function tn(e,t){return mt(e,t,Wt({transport:Xt({url:e.url,blobType:e.headers()[`Content-Type`]})}))}function nn(e){return()=>{let t={};return Object.entries(e?.()??{}).forEach(([e,n])=>{n===void 0?_.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}}function rn(e,t,n){let r={...n()},i={};return()=>(t!=null&&Object.assign(i,t()),e!=null&&Object.assign(i,e()),Object.assign(i,r))}function an(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function on(n){return async r=>{let{Agent:i}=await t(()=>import(`./__vite-browser-external-DD8Jl_VU.js`).then(t=>e(t.default)),__vite__mapDeps([0,1]),import.meta.url);return new i(n)}}function sn(e,t,n){return{...Oe(e,t,n),headers:rn(nn(e.headers),t.headers,n.headers),url:an(e.url)??t.url??n.url,agentFactory:e.agentFactory??t.agentFactory??n.agentFactory}}function cn(e,t){return{...ke(),headers:()=>e,url:`http://localhost:4318/`+t,agentFactory:on({keepAlive:!0})}}function ln(e,t,n){return sn({url:e.url,timeoutMillis:e.timeoutMillis,headers:De(e.headers),concurrencyLimit:e.concurrencyLimit},{},cn(n,t))}function un(e,t,n,r){return dn(e.headers)(ln(e,n,r),t)}function dn(e){return!e&&typeof navigator.sendBeacon==`function`?tn:globalThis.fetch===void 0?$t:en}var fn=class extends we{constructor(e={}){super(un(e,It,`v1/traces`,{"Content-Type":`application/json`}))}},pn=class{emit(e){}},mn=new pn,hn=new class{getLogger(e,t,n){return new pn}},gn=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):mn}},_n=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new gn(this,e,t,n)}_getDelegate(){return this._delegate??hn}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}},vn=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{},C=Symbol.for(`io.opentelemetry.js.api.logs`),w=vn;function yn(e,t,n){return r=>r===e?t:n}var bn=class e{constructor(){this._proxyLoggerProvider=new _n}static getInstance(){return this._instance||=new e,this._instance}setGlobalLoggerProvider(e){return w[C]?this.getLoggerProvider():(w[C]=yn(1,e,hn),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return w[C]?.call(w,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete w[C],this._proxyLoggerProvider=new _n}}.getInstance();function xn(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function Sn(e){e.forEach(e=>e.disable())}function Cn(e){let t=e.tracerProvider||f.getTracerProvider(),n=e.meterProvider||Ce.getMeterProvider(),r=e.loggerProvider||bn.getLoggerProvider(),i=e.instrumentations?.flat()??[];return xn(i,t,n,r),()=>{Sn(i)}}var T=console.error.bind(console);function E(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}var wn=(e,t,n)=>{if(!e||!e[t]){T(`no original function `+String(t)+` to wrap`);return}if(!n){T(`no wrapper function`),T(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){T(`original object and wrapper must be functions`);return}let i=n(r,t);return E(i,`__original`,r),E(i,`__unwrap`,()=>{e[t]===i&&E(e,t,r)}),E(i,`__wrapped`,!0),E(e,t,i),i},Tn=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{T(`must provide one or more modules to patch`),T(Error().stack);return}if(!(t&&Array.isArray(t))){T(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{wn(e,t,n)})})},En=(e,t)=>{if(!e||!e[t]){T(`no function to unwrap.`),T(Error().stack);return}let n=e[t];if(!n.__unwrap)T(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},Dn=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{T(`must provide one or more modules to patch`),T(Error().stack);return}if(!(t&&Array.isArray(t))){T(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{En(e,t)})})};function D(e){e&&e.logger&&(typeof e.logger==`function`?T=e.logger:T(`new logger isn't a function, not replacing`))}D.wrap=wn,D.massWrap=Tn,D.unwrap=En,D.massUnwrap=Dn;var On=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=_.createComponentLogger({namespace:e}),this._tracer=f.getTracer(e,t),this._meter=Ce.getMeter(e,t),this._logger=bn.getLogger(e,t),this._updateMetricInstruments()}_wrap=wn;_unwrap=En;_massWrap=Tn;_massUnwrap=Dn;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}},kn=class extends On{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}};function O(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function k(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var A;(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(A||={});function An(e,t){let n=A.OLD,r=t?.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r??[])if(t.toLowerCase()===e+`/dup`){n=A.DUPLICATE;break}else t.toLowerCase()===e&&(n=A.STABLE);return n}var jn=s(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Mn(e){return e.setValue(jn,!0)}function Nn(e){return e.getValue(jn)===!0}var Pn=`baggage`,Fn=4096;function In(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function Ln(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function Rn(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch{return}let c;return t!==-1&&t<e.length-1&&(c=ee(e.substring(t+1))),{key:o,value:s,metadata:c}}function zn(e,t,n,r){let i=0;for(;i<e.length&&n<180;){let a=e.indexOf(`,`,i),o=a===-1?e.length:a,s=o-i;if(s<=4096){let a=Rn(e.substring(i,o));if(a){let e=(n===0?0:1)+s;if(r+e>8192)break;t[a.key]=a.metadata?{value:a.value,metadata:a.metadata}:{value:a.value},n++,r+=e}}if(a===-1)break;i=a+1}return[n,r]}var Bn=class{inject(e,t,n){let r=h.getBaggage(e);if(!r||Nn(e))return;let i=In(Ln(r).filter(e=>e.length<=Fn).slice(0,180));i.length>0&&n.set(t,Pn,i)}extract(e,t,n){let r=n.get(t,Pn);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=zn(r[e],i,a,o);else [a]=zn(r,i,a,o);return a===0?e:h.setBaggage(e,h.createBaggage(i))}fields(){return[Pn]}};function j(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Vn(n)){_.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Hn(r)){_.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Vn(e){return typeof e==`string`&&e!==``}function Hn(e){return e==null?!0:Array.isArray(e)?Un(e):Wn(typeof e)}function Un(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Wn(e)){t=e;continue}return!1}return!1}}return!0}function Wn(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function Gn(){return e=>{_.error(Kn(e))}}function Kn(e){return typeof e==`string`?e:JSON.stringify(qn(e))}function qn(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var Jn=Gn();function M(e){try{Jn(e)}catch{}}var Yn=`2.9.0`,Xn=`process.runtime.name`,Zn={[Qe]:`opentelemetry`,[Xn]:`browser`,[Xe]:Ze,[$e]:Yn},N=performance,Qn=9,$n=10**6,er=10**Qn;function P(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*$n)]}function tr(e){return ar(P(N.timeOrigin),P(typeof e==`number`?e:N.now()))}function nr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=er),[n,r]}function rr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function ir(e){return rr(e)||typeof e==`number`||e instanceof Date}function ar(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=er&&(n[1]-=er,n[0]+=1),n}var or;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(or||={});var sr=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];let t=new Set;for(let e of this._propagators){let n=typeof e.fields==`function`?e.fields():[];for(let e of n)t.add(e)}this._fields=Array.from(t)}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){_.warn(`Failed to inject with ${r.constructor.name}. Err: ${e.message}`)}}extract(e,t,n){return this._propagators.reduce((e,r)=>{try{return r.extract(e,t,n)}catch(e){_.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}},cr=`[_0-9a-z-*/]`,lr=`[a-z]${cr}{0,255}`,ur=`[a-z0-9]${cr}{0,240}@[a-z]${cr}{0,13}`,dr=RegExp(`^(?:${lr}|${ur})$`),fr=/^[ -~]{0,255}[!-~]$/,pr=/,|=/;function mr(e){return dr.test(e)}function hr(e){return fr.test(e)&&!pr.test(e)}var gr=32,_r=512,vr=`,`,yr=`=`,br=class e{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!mr(e)||!hr(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>_r)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=vr+e),e=`${n[0]}${yr}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(vr),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(yr);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!mr(a)||!hr(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>_r)&&(t.set(a,o),n=s,t.size>=gr))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}},F=`traceparent`,xr=`tracestate`,Sr=`00`,Cr=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function wr(e){let t=Cr.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Tr=class{inject(e,t,n){let r=f.getSpanContext(e);if(!r||Nn(e)||!d(r))return;let i=`${Sr}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||l.NONE).toString(16)}`;n.set(t,F,i),r.traceState&&n.set(t,xr,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,F);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=wr(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,xr);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new br(typeof e==`string`?e:void 0)}return f.setSpanContext(e,a)}fields(){return[F,xr]}},Er=`[object Object]`,Dr=`[object Null]`,Or=`[object Undefined]`,kr=Function.prototype.toString,Ar=kr.call(Object),jr=Object.getPrototypeOf,Mr=Object.prototype,Nr=Mr.hasOwnProperty,I=Symbol?Symbol.toStringTag:void 0,Pr=Mr.toString;function Fr(e){if(!Ir(e)||Lr(e)!==Er)return!1;let t=jr(e);if(t===null)return!0;let n=Nr.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&kr.call(n)===Ar}function Ir(e){return typeof e==`object`&&!!e}function Lr(e){return e==null?e===void 0?Or:Dr:I&&I in Object(e)?Rr(e):zr(e)}function Rr(e){let t=Nr.call(e,I),n=e[I],r=!1;try{e[I]=void 0,r=!0}catch{}let i=Pr.call(e);return r&&(t?e[I]=n:delete e[I]),i}function zr(e){return Pr.call(e)}var Br=20;function Vr(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=Ur(t,e.shift(),0,n);return t}function Hr(e){return L(e)?e.slice():e}function Ur(e,t,n=0,r){let i;if(!(n>Br)){if(n++,z(e)||z(t)||Gr(t))i=Hr(t);else if(L(e)){if(i=e.slice(),L(t))for(let e=0,n=t.length;e<n;e++)i.push(Hr(t[e]));else if(R(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=Hr(t[r]))}}}else if(R(e))if(R(t)){if(!Kr(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(z(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Wr(e,s,r)||Wr(t,s,r))delete i[s];else{if(R(a)&&R(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=Ur(i[s],c,n,r)}}}}else i=t;return i}}function Wr(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function L(e){return Array.isArray(e)}function Gr(e){return typeof e==`function`}function R(e){return!z(e)&&!L(e)&&!Gr(e)&&typeof e==`object`}function z(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function Kr(e,t){return!(!Fr(e)||!Fr(t))}var qr=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},Jr=class{_isCalled=!1;_deferred=new qr;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}},B;function Yr(){if(B===void 0)try{let e=globalThis.process.argv0;B=e?`unknown_service:${e}`:`unknown_service`}catch{B=`unknown_service`}return B}var V=e=>typeof e==`object`&&!!e&&typeof e.then==`function`,Xr=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=$r(t),r._asyncAttributesPending=t.filter(([e,t])=>V(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(V(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=$r(this._rawAttributes),this._schemaUrl=ei(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,V(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&_.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(V(n)){_.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=ti(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Zr(e,t){return Xr.FromAttributeList(Object.entries(e),t)}function Qr(){return Zr({[Je]:Yr(),[Xe]:Zn[Xe],[Qe]:Zn[Qe],[$e]:Zn[$e]})}function $r(e){return e.map(([e,t])=>V(t)?[e,t.catch(t=>{_.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function ei(e){if(typeof e==`string`||e===void 0)return e;_.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function ti(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;_.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var ni=`exception`,ri=Symbol.for(`nodejs.util.inspect.custom`);function ii(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function ai(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}var oi=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:c.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=N.now(),this._performanceOffset=t-(this._performanceStartTime+N.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return _.warn(`Invalid attribute key: ${e}`),this;if(!Hn(t))return _.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return _.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&_.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),ir(t)&&(ir(n)||(n=t),t=void 0);let i=j(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&_.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=j(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===c.UNSET||this.status.code===c.OK)return this;let t={code:e.code};return e.code===c.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&_.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){_.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=nr(this.startTime,this.endTime),this._duration[0]<0&&(_.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&_.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&_.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=N.now())return tr(e+this._performanceOffset);if(typeof e==`number`)return P(e);if(e instanceof Date)return P(e.getTime());if(rr(e))return e;if(this._startTimeProvided)return P(Date.now());let t=N.now()-this._performanceStartTime;return ar(this.startTime,P(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[Be]=e:e&&(e.code?n[He]=e.code.toString():e.name&&(n[He]=e.name),e.message&&(n[Be]=e.message),e.stack&&(n[Ve]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(ni,n,t):_.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);_.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(_.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[ri](e,t,n){return ai(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:ii(this.resource)}},e,t,n)}},H;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(H||={});var si=`otel.component.name`,ci=`otel.component.type`,li=`otel.span.parent.origin`,ui=`otel.span.sampling_result`,di=`otel.sdk.processor.span.processed`,fi=`otel.sdk.processor.span.queue.capacity`,pi=`otel.sdk.processor.span.queue.size`,mi=`otel.sdk.span.live`,hi=`otel.sdk.span.started`,gi=`batching_span_processor`,_i=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(hi,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(mi,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=yi(t);if(this.startedSpans.add(1,{[li]:vi(e),[ui]:n}),t===H.NOT_RECORD)return()=>{};let r={[ui]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function vi(e){return e?e.isRemote?`remote`:`local`:`none`}function yi(e){switch(e){case H.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case H.RECORD:return`RECORD_ONLY`;case H.NOT_RECORD:return`DROP`}}var bi=`2.9.0`,xi=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t){this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor,this._tracerMetrics=new _i(t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,bi))}startSpan(e,t={},r=m.active()){t.root&&(r=f.deleteSpan(r));let i=f.getSpan(r);if(Nn(r))return _.debug(`Instrumentation suppressed, returning Noop Span`),f.wrapSpanContext(n);let a=i?.spanContext(),o=this._idGenerator.generateSpanId(),s,c,u;!a||!f.isSpanContextValid(a)?c=this._idGenerator.generateTraceId():(c=a.traceId,u=a.traceState,s=a);let d=t.kind??be.INTERNAL,p=(t.links??[]).map(e=>({context:e.context,attributes:j(e.attributes)})),ee=j(t.attributes),h=this._sampler.shouldSample(r,c,e,d,ee,p),te=this._tracerMetrics.startSpan(a,h.decision);u=h.traceState??u;let g=h.decision===ye.RECORD_AND_SAMPLED?l.SAMPLED:l.NONE,ne={traceId:c,spanId:o,traceFlags:g,traceState:u};if(h.decision===ye.NOT_RECORD)return _.debug(`Recording is off, propagating context in a non-recording span`),f.wrapSpanContext(ne);let re=j(Object.assign(ee,h.attributes));return new oi({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:ne,name:e,kind:d,links:p,parentSpanContext:s,attributes:re,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:te})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??m.active(),c=this.startSpan(e,i,s),l=f.setSpan(s,c);return m.with(l,o,void 0,c)}[ri](e,t,n){return ai(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:ii(this._resource)},spanLimits:this._spanLimits},e,t,n)}},Si=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{M(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},U=class{shouldSample(){return{decision:H.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},W=class{shouldSample(){return{decision:H.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}},G=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(M(Error(`ParentBasedSampler must have a root sampler configured`)),new W),this._remoteParentSampled=e.remoteParentSampled??new W,this._remoteParentNotSampled=e.remoteParentNotSampled??new U,this._localParentSampled=e.localParentSampled??new W,this._localParentNotSampled=e.localParentNotSampled??new U}shouldSample(e,t,n,r,i,a){let o=f.getSpanContext(e);return!o||!d(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&l.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&l.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}},Ci=new Map,wi=class{processedSpans;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,t,n){let r=Ci.get(e)??0;if(Ci.set(e,r+1),this.standardAttrs={[ci]:e,[si]:`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[ze]:`queue_full`},this.processedSpans=t.createCounter(di,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(fi,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(pi,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n={...this.standardAttrs,[ze]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}},Ti=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_metrics;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e){this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new Jr(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(_.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize),this._metrics=new wi(gi,e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):ve(),{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&l.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&_.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(_.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);m.with(Mn(m.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,i=>{clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===or.SUCCESS?e():t(i.error??Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??=[],a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{M(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,M(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},Ei=class extends Ti{_visibilityChangeListener;_pageHideListener;constructor(e){super(e),this.onInit(e)}onInit(e){e.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{M(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{M(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}},Di=16,Oi=8,ki=new Uint8Array(Di),Ai=new Uint8Array(Oi),ji=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Mi(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function Ni(e){let t=``;for(let n=0;n<e.length;n++)t+=ji[e[n]];return t}var Pi=class{generateTraceId(){return Mi(ki),Ni(ki)}generateSpanId(){return Mi(Ai),Ni(Ai)}},K;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(K||={});var Fi=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??Qr(),this._activeSpanProcessor=new Si(e.spanProcessors??[]),this._tracerOptions={resource:this._resource,sampler:e.sampler??new G({root:new W}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new Pi,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return ve()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new xi({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(){let e=this._forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=K.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==K.timeout&&(r=K.resolved,n(r))}).catch(e=>{clearTimeout(i),r=K.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==K.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[ri](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return ai(`TracerProvider`,{resource:{attributes:ii(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}},Ii=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:o(t)&&this._accumulate(t)<this._upperBound?H.RECORD_AND_SAMPLED:H.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}},q;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(q||={});var Li=1;function Ri(){return{sampler:zi(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function zi(){let e=q.ParentBasedAlwaysOn;switch(e){case q.AlwaysOn:return new W;case q.AlwaysOff:return new U;case q.ParentBasedAlwaysOn:return new G({root:new W});case q.ParentBasedAlwaysOff:return new G({root:new U});case q.TraceIdRatio:return new Ii(Bi());case q.ParentBasedTraceIdRatio:return new G({root:new Ii(Bi())});default:return _.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${q.ParentBasedAlwaysOn}".`),new G({root:new W})}}function Bi(){return _.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Li}.`),Li}function Vi(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??1/0,Object.assign({},e,{spanLimits:t})}var Hi=class extends Fi{constructor(e={}){let t=Vr({},Ri(),Vi(e));delete t.generalLimits,super(t)}},Ui=class extends Ei{constructor(e,t){t||={};for(let[e,n]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])t[e];super({exporter:e,...t})}},Wi=class{_enabled=!1;_currentContext=r;_bindFunction(e=r,t){let n=this,i=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(i,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),i}active(){return this._currentContext}bind(e,t){return e===void 0&&(e=this.active()),typeof t==`function`?this._bindFunction(e,t):t}disable(){return this._currentContext=r,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=r,this)}with(e,t,n,...i){let a=this._currentContext;this._currentContext=e||r;try{return t.call(n,...i)}finally{this._currentContext=a}}};function Gi(e){if(e!==null){if(e===void 0){let e=new Wi;e.enable(),m.setGlobalContextManager(e);return}e.enable(),m.setGlobalContextManager(e)}}function Ki(e){if(e!==null){if(e===void 0){h.setGlobalPropagator(new sr({propagators:[new Tr,new Bn]}));return}h.setGlobalPropagator(e)}}var qi=class extends Hi{constructor(e={}){super(e)}register(e={}){f.setGlobalTracerProvider(this),Ki(e.propagator),Gi(e.contextManager)}},J;(function(e){e.CONNECT_END=`connectEnd`,e.CONNECT_START=`connectStart`,e.DECODED_BODY_SIZE=`decodedBodySize`,e.DOM_COMPLETE=`domComplete`,e.DOM_CONTENT_LOADED_EVENT_END=`domContentLoadedEventEnd`,e.DOM_CONTENT_LOADED_EVENT_START=`domContentLoadedEventStart`,e.DOM_INTERACTIVE=`domInteractive`,e.DOMAIN_LOOKUP_END=`domainLookupEnd`,e.DOMAIN_LOOKUP_START=`domainLookupStart`,e.ENCODED_BODY_SIZE=`encodedBodySize`,e.FETCH_START=`fetchStart`,e.LOAD_EVENT_END=`loadEventEnd`,e.LOAD_EVENT_START=`loadEventStart`,e.NAVIGATION_START=`navigationStart`,e.REDIRECT_END=`redirectEnd`,e.REDIRECT_START=`redirectStart`,e.REQUEST_START=`requestStart`,e.RESPONSE_END=`responseEnd`,e.RESPONSE_START=`responseStart`,e.SECURE_CONNECTION_START=`secureConnectionStart`,e.START_TIME=`startTime`,e.UNLOAD_EVENT_END=`unloadEventEnd`,e.UNLOAD_EVENT_START=`unloadEventStart`})(J||={});var Ji=`http.response_content_length`,Yi=`http.response_content_length_uncompressed`;function Y(e,t){return t in e}function X(e,t,n,r=!0){if(Y(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function Xi(e,t,n=!1,r,i){if(r===void 0&&(r=t[J.START_TIME]!==0),n||(X(e,J.FETCH_START,t,r),X(e,J.DOMAIN_LOOKUP_START,t,r),X(e,J.DOMAIN_LOOKUP_END,t,r),X(e,J.CONNECT_START,t,r),X(e,J.SECURE_CONNECTION_START,t,r),X(e,J.CONNECT_END,t,r),X(e,J.REQUEST_START,t,r),X(e,J.RESPONSE_START,t,r),X(e,J.RESPONSE_END,t,r)),!i){let n=t[J.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(Ji,n);let r=t[J.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(Yi,r)}}function Zi(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return`/`;let n=$i(e,t);if(t&&n.indexOf(`@id`)>0)return n;let r=``;return e.parentNode&&(r+=Zi(e.parentNode,t)),r+=n,r}function Qi(e){if(!e.parentNode)return 0;let t=[e.nodeType];e.nodeType===Node.CDATA_SECTION_NODE&&t.push(Node.TEXT_NODE);let n=Array.from(e.parentNode.childNodes);return n=n.filter(n=>{let r=n.localName;return t.indexOf(n.nodeType)>=0&&r===e.localName}),n.length>=1?n.indexOf(e)+1:0}function $i(e,t){let n=e.nodeType,r=Qi(e),i;if(n===Node.ELEMENT_NODE){let n=e.getAttribute(`id`);if(t&&n)return`//*[@id="${n}"]`;i=e.localName}else if(n===Node.TEXT_NODE||n===Node.CDATA_SECTION_NODE)i=`text()`;else if(n===Node.COMMENT_NODE)i=`comment()`;else return``;return i&&r>1?`/${i}[${r}]`:`/${i}`}var ea;(function(e){e.DOCUMENT_LOAD=`documentLoad`,e.DOCUMENT_FETCH=`documentFetch`,e.RESOURCE_FETCH=`resourceFetch`})(ea||={});var ta=`0.49.0`,na=`@opentelemetry/instrumentation-document-load`,ra;(function(e){e.FIRST_PAINT=`firstPaint`,e.FIRST_CONTENTFUL_PAINT=`firstContentfulPaint`})(ra||={});var ia=()=>{let e={},t=N.getEntriesByType?.(`navigation`)[0];if(t)Object.values(J).forEach(n=>{if(Y(t,n)){let r=t[n];typeof r==`number`&&(e[n]=r)}});else{let t=N.timing;t&&Object.values(J).forEach(n=>{if(Y(t,n)){let r=t[n];typeof r==`number`&&(e[n]=r)}})}return e},aa={"first-paint":ra.FIRST_PAINT,"first-contentful-paint":ra.FIRST_CONTENTFUL_PAINT},oa=e=>{let t=N.getEntriesByType?.(`paint`);t&&t.forEach(({name:t,startTime:n})=>{Y(aa,t)&&e.addEvent(aa[t],n)})},sa=class extends kn{component=`document-load`;version=`1`;moduleName=this.component;constructor(e={}){super(na,ta,e)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(e){let t=N.getEntriesByType?.(`resource`);t&&t.forEach(t=>{this._initResourceSpan(t,e)})}_collectPerformance(){let e=Array.from(document.getElementsByTagName(`meta`)).find(e=>e.getAttribute(`name`)===F),t=ia(),n=e&&e.content||``;m.with(h.extract(r,{traceparent:n}),()=>{let e=this._startSpan(ea.DOCUMENT_LOAD,J.FETCH_START,t);e&&(m.with(f.setSpan(m.active(),e),()=>{let e=this._startSpan(ea.DOCUMENT_FETCH,J.FETCH_START,t);e&&(e.setAttribute(Ie,location.href),m.with(f.setSpan(m.active(),e),()=>{Xi(e,t,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnSpan(e,this.getConfig().applyCustomAttributesOnSpan?.documentFetch),this._endSpan(e,J.RESPONSE_END,t)}))}),e.setAttribute(Ie,location.href),e.setAttribute(Le,navigator.userAgent),this._addResourcesSpans(e),this.getConfig().ignoreNetworkEvents||(X(e,J.FETCH_START,t),X(e,J.UNLOAD_EVENT_START,t),X(e,J.UNLOAD_EVENT_END,t),X(e,J.DOM_INTERACTIVE,t),X(e,J.DOM_CONTENT_LOADED_EVENT_START,t),X(e,J.DOM_CONTENT_LOADED_EVENT_END,t),X(e,J.DOM_COMPLETE,t),X(e,J.LOAD_EVENT_START,t),X(e,J.LOAD_EVENT_END,t)),this.getConfig().ignorePerformancePaintEvents||oa(e),this._addCustomAttributesOnSpan(e,this.getConfig().applyCustomAttributesOnSpan?.documentLoad),this._endSpan(e,J.LOAD_EVENT_END,t))})}_endSpan(e,t,n){e&&(Y(n,t)?e.end(n[t]):e.end())}_initResourceSpan(e,t){let n=this._startSpan(ea.RESOURCE_FETCH,J.FETCH_START,e,t);n&&(n.setAttribute(Ie,e.name),Xi(n,e,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnResourceSpan(n,e,this.getConfig().applyCustomAttributesOnSpan?.resourceFetch),this._endSpan(n,J.RESPONSE_END,e))}_startSpan(e,t,n,r){if(Y(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:n[t]},r?f.setSpan(m.active(),r):void 0)}_waitForPageLoad(){window.document.readyState===`complete`?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener(`load`,this._onDocumentLoaded))}_addCustomAttributesOnSpan(e,t){t&&O(()=>t(e),e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addCustomAttributesOnResourceSpan(e,t,n){n&&O(()=>n(e,t),e=>{e&&this._diag.error(`addCustomAttributesOnResourceSpan`,e)},!0)}enable(){window.removeEventListener(`load`,this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener(`load`,this._onDocumentLoaded)}},Z;(function(e){e.CONNECT_END=`connectEnd`,e.CONNECT_START=`connectStart`,e.DECODED_BODY_SIZE=`decodedBodySize`,e.DOM_COMPLETE=`domComplete`,e.DOM_CONTENT_LOADED_EVENT_END=`domContentLoadedEventEnd`,e.DOM_CONTENT_LOADED_EVENT_START=`domContentLoadedEventStart`,e.DOM_INTERACTIVE=`domInteractive`,e.DOMAIN_LOOKUP_END=`domainLookupEnd`,e.DOMAIN_LOOKUP_START=`domainLookupStart`,e.ENCODED_BODY_SIZE=`encodedBodySize`,e.FETCH_START=`fetchStart`,e.LOAD_EVENT_END=`loadEventEnd`,e.LOAD_EVENT_START=`loadEventStart`,e.NAVIGATION_START=`navigationStart`,e.REDIRECT_END=`redirectEnd`,e.REDIRECT_START=`redirectStart`,e.REQUEST_START=`requestStart`,e.RESPONSE_END=`responseEnd`,e.RESPONSE_START=`responseStart`,e.SECURE_CONNECTION_START=`secureConnectionStart`,e.START_TIME=`startTime`,e.UNLOAD_EVENT_END=`unloadEventEnd`,e.UNLOAD_EVENT_START=`unloadEventStart`})(Z||={});var ca=`http.response_content_length`,la=`http.response_content_length_uncompressed`,ua;function da(){return ua||=document.createElement(`a`),ua}function fa(e,t){return t in e}function Q(e,t,n,r=!0){if(fa(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function pa(e,t,n=!1,r,i){if(r===void 0&&(r=t[Z.START_TIME]!==0),n||(Q(e,Z.FETCH_START,t,r),Q(e,Z.DOMAIN_LOOKUP_START,t,r),Q(e,Z.DOMAIN_LOOKUP_END,t,r),Q(e,Z.CONNECT_START,t,r),Q(e,Z.SECURE_CONNECTION_START,t,r),Q(e,Z.CONNECT_END,t,r),Q(e,Z.REQUEST_START,t,r),Q(e,Z.RESPONSE_START,t,r),Q(e,Z.RESPONSE_END,t,r)),!i){let n=t[Z.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(ca,n);let r=t[Z.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(la,r)}}function ma(e){return e.slice().sort((e,t)=>{let n=e[Z.FETCH_START],r=t[Z.FETCH_START];return n>r?1:n<r?-1:0})}function ha(){return typeof location<`u`?location.origin:void 0}function ga(e,t,n,r,i=new WeakSet,a){let o=ya(e);e=o.toString();let s=va(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=ma(s);if(o.origin!==ha()&&c.length>1){let e=c[0],t=_a(c,e[Z.RESPONSE_END],n),r=e[Z.RESPONSE_END];return t[Z.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function _a(e,t,n){let r=b(n),i=b(y(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=b(y(n[Z.FETCH_START])),c=r-b(y(n[Z.RESPONSE_END]));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function va(e,t,n,r,i,a){let o=b(t),s=b(n),c=r.filter(t=>{let n=b(y(t[Z.FETCH_START])),r=b(y(t[Z.RESPONSE_END]));return t.initiatorType.toLowerCase()===(a||`xmlhttprequest`)&&t.name===e&&n>=o&&r<=s});return c.length>0&&(c=c.filter(e=>!i.has(e))),c}function ya(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=da();return t.href=e,t}function ba(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),ya(e).origin===ha()?!0:n.some(t=>ct(e,t))}var xa;(function(e){e.COMPONENT=`component`,e.HTTP_STATUS_TEXT=`http.status_text`})(xa||={});var Sa=`http.host`,Ca=`http.method`,wa=`http.request.body.size`,Ta=`http.request_content_length_uncompressed`,Ea=`http.scheme`,Da=`http.status_code`,Oa=`http.url`,ka=`http.user_agent`,Aa=_.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`});function ja(...e){if(e[0]instanceof URL||typeof e[0]==`string`){let t=e[1];if(!t?.body)return Promise.resolve();if(t.body instanceof ReadableStream){let{body:e,length:n}=Ma(t.body);return t.body=e,n}else return Promise.resolve(Pa(t.body))}else{let t=e[0];return t?.body?t.clone().text().then(e=>Ia(e)):Promise.resolve()}}function Ma(e){if(!e.pipeThrough)return Aa.warn(`Platform has ReadableStream but not pipeThrough!`),{body:e,length:Promise.resolve(void 0)};let t=0,n,r=new Promise(e=>{n=e}),i=new TransformStream({start(){},async transform(e,n){let r=await e;t+=r.byteLength,n.enqueue(e)},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function Na(e){return typeof Document<`u`&&e instanceof Document}function Pa(e){if(Na(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Ia(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return La(e);if(e instanceof URLSearchParams)return Ia(e.toString());if(e.byteLength!==void 0)return e.byteLength;Aa.warn(`unknown body type`)}var Fa=new TextEncoder;function Ia(e){return Fa.encode(e).byteLength}function La(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function Ra(e){let t=Va(),n=e.toUpperCase();return n in t?n:`_OTHER`}var za={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0},Ba;function Va(){return Ba===void 0&&(Ba=za),Ba}var Ha={"https:":`443`,"http:":`80`};function Ua(e){let t=Number(e.port||Ha[e.protocol]);if(t&&!isNaN(t))return t}var Wa=`0.204.0`,Ga=300,Ka=typeof process==`object`&&process.release?.name===`node`,qa=class extends kn{component=`fetch`;version=Wa;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;_semconvStability;constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,Wa,e),this._semconvStability=An(`http`,e?.semconvStabilityOptIn)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[Z.FETCH_START]},f.setSpan(m.active(),e)),r=!(this._semconvStability&A.OLD);pa(n,t,this.getConfig().ignoreNetworkEvents,void 0,r),n.end(t[Z.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=ya(t.url);if(this._semconvStability&A.OLD&&(e.setAttribute(Da,t.status),t.statusText!=null&&e.setAttribute(xa.HTTP_STATUS_TEXT,t.statusText),e.setAttribute(Sa,n.host),e.setAttribute(Ea,n.protocol.replace(`:`,``)),typeof navigator<`u`&&e.setAttribute(ka,navigator.userAgent)),this._semconvStability&A.STABLE){e.setAttribute(Ge,t.status),e.setAttribute(Ke,n.hostname);let r=Ua(n);r&&e.setAttribute(qe,r)}}_addHeaders(e,t){if(!ba(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};h.inject(m.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)h.inject(m.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else if(e.headers instanceof Headers)h.inject(m.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else if(e.headers instanceof Map)h.inject(m.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t={};h.inject(m.active(),t),e.headers=Object.assign({},t,e.headers||{})}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(e,t={}){if(lt(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n=``,r={};if(this._semconvStability&A.OLD){let i=(t.method||`GET`).toUpperCase();n=`HTTP ${i}`,r[xa.COMPONENT]=this.moduleName,r[Ca]=i,r[Oa]=e}if(this._semconvStability&A.STABLE){let i=t.method,a=Ra(t.method||`GET`);n||=a,r[Ue]=a,a!==i&&(r[We]=i),r[et]=e}return this.tracer.startSpan(n,{kind:be.CLIENT,attributes:r})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=ga(t.spanUrl,t.startTime,n,r,this._usedResources,`fetch`);if(i.mainRequest){let t=i.mainRequest;this._markResourceAsUsed(t);let n=i.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n));let r=!(this._semconvStability&A.OLD);pa(e,t,this.getConfig().ignoreNetworkEvents,void 0,r)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=v(Date.now()),i=at();this._addFinalSpanAttributes(e,n),this._semconvStability&A.STABLE&&n.status>=400&&(e.setStatus({code:c.ERROR}),e.setAttribute(ze,String(n.status))),setTimeout(()=>{t.observer?.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},Ga)}_patchConstructor(){return e=>{let t=this;return function(...n){let r=this,i=ya(n[0]instanceof Request?n[0].url:String(n[0])).href,a=n[0]instanceof Request?n[0]:n[1]||{},o=t._createSpan(i,a);if(!o)return e.apply(this,n);let s=t._prepareSpanData(i);t.getConfig().measureRequestSize&&ja(...n).then(e=>{e&&(t._semconvStability&A.OLD&&o.setAttribute(Ta,e),t._semconvStability&A.STABLE&&o.setAttribute(wa,e))}).catch(e=>{t._diag.warn(`getFetchBodyLength`,e)});function c(e,n){t._applyAttributesAfterFetch(e,a,n),t._endSpan(e,s,{status:n.status||0,statusText:n.message,url:i})}function l(e,n){t._applyAttributesAfterFetch(e,a,n),n.status>=200&&n.status<400?t._endSpan(e,s,n):t._endSpan(e,s,{status:n.status,statusText:n.statusText,url:i})}function u(e,t,n){try{let t=n.clone().body;if(t){let r=t.getReader(),i=()=>{r.read().then(({done:t})=>{t?l(e,n):i()},t=>{c(e,t)})};i()}else l(e,n)}finally{t(n)}}function d(e,t,n){try{c(e,n)}finally{t(n)}}return new Promise((n,s)=>m.with(f.setSpan(m.active(),o),()=>(t._addHeaders(a,i),t._callRequestHook(o,a),t._tasksCount++,e.apply(r,a instanceof Request?[a]:[i,a]).then(u.bind(r,o,n),d.bind(r,o,s)))))}}}_applyAttributesAfterFetch(e,t,n){let r=this.getConfig().applyCustomAttributesOnSpan;r&&O(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&O(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=at(),n=[];if(typeof PerformanceObserver!=`function`)return{entries:n,startTime:t,spanUrl:e};let r=new PerformanceObserver(t=>{t.getEntries().forEach(t=>{t.initiatorType===`fetch`&&t.name===e&&n.push(t)})});return r.observe({entryTypes:[`resource`]}),{entries:n,observer:r,startTime:t,spanUrl:e}}enable(){if(Ka){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument Node.js's fetch()`);return}k(fetch)&&(this._unwrap(Me,`fetch`),this._diag.debug(`removing previous patch for constructor`)),this._wrap(Me,`fetch`,this._patchConstructor())}disable(){Ka||(this._unwrap(Me,`fetch`),this._usedResources=new WeakSet)}},$;(function(e){e.EVENT_TYPE=`event_type`,e.TARGET_ELEMENT=`target_element`,e.TARGET_XPATH=`target_xpath`,e.HTTP_URL=`http.url`})($||={});var Ja=`0.49.0`,Ya=`@opentelemetry/instrumentation-user-interaction`,Xa=`OT_ZONE_CONTEXT`,Za=`Navigation:`,Qa=[`click`];function $a(){return!1}var eo=class extends kn{version=Ja;moduleName=`user-interaction`;_spansData=new WeakMap;_wrappedListeners=new WeakMap;_eventsSpanMap=new WeakMap;_eventNames;_shouldPreventSpanCreation;constructor(e={}){super(Ya,Ja,e),this._eventNames=new Set(e?.eventNames??Qa),this._shouldPreventSpanCreation=typeof e?.shouldPreventSpanCreation==`function`?e.shouldPreventSpanCreation:$a}init(){}_checkForTimeout(e,t){let n=this._spansData.get(t);n&&(e.source===`setTimeout`?n.hrTimeLastTimeout=tr():e.source!==`Promise.then`&&e.source!==`setTimeout`&&(n.hrTimeLastTimeout=void 0))}_allowEventName(e){return this._eventNames.has(e)}_createSpan(e,t,n){if(!(e instanceof HTMLElement)||!e.getAttribute||e.hasAttribute(`disabled`)||!this._allowEventName(t))return;let r=Zi(e,!0);try{let i=this.tracer.startSpan(t,{attributes:{[$.EVENT_TYPE]:t,[$.TARGET_ELEMENT]:e.tagName,[$.TARGET_XPATH]:r,[$.HTTP_URL]:window.location.href}},n?f.setSpan(m.active(),n):void 0);return this._shouldPreventSpanCreation(t,e,i)===!0?void 0:(this._spansData.set(i,{taskCount:0}),i)}catch(e){this._diag.error(`failed to start create new user interaction span`,e)}}_decrementTask(e){let t=this._spansData.get(e);t&&(t.taskCount--,t.taskCount===0&&this._tryToEndSpan(e,t.hrTimeLastTimeout))}_getCurrentSpan(e){let t=e.get(Xa);return t&&f.getSpan(t)}_incrementTask(e){let t=this._spansData.get(e);t&&t.taskCount++}addPatchedListener(e,t,n,r){let i=this._wrappedListeners.get(n);i||(i=new Map,this._wrappedListeners.set(n,i));let a=i.get(t);return a||(a=new Map,i.set(t,a)),a.has(e)?!1:(a.set(e,r),!0)}removePatchedListener(e,t,n){let r=this._wrappedListeners.get(n);if(!r)return;let i=r.get(t);if(!i)return;let a=i.get(e);return a&&(i.delete(e),i.size===0&&(r.delete(t),r.size===0&&this._wrappedListeners.delete(n))),a}_invokeListener(e,t,n){return typeof e==`function`?e.apply(t,n):e.handleEvent(n[0])}_patchAddEventListener(){let e=this;return t=>function(n,r,i){if(!r)return t.call(this,n,r,i);let a=i&&typeof i==`object`&&i.once,o=function(...t){let i,o=t[0],s=o?.target;o&&(i=e._eventsSpanMap.get(o)),a&&e.removePatchedListener(this,n,r);let c=e._createSpan(s,n,i);return c?(o&&e._eventsSpanMap.set(o,c),m.with(f.setSpan(m.active(),c),()=>{let n=e._invokeListener(r,this,t);return c.end(),n})):e._invokeListener(r,this,t)};if(e.addPatchedListener(this,n,r,o))return t.call(this,n,o,i)}}_patchRemoveEventListener(){let e=this;return t=>function(n,r,i){let a=e.removePatchedListener(this,n,r);return a?t.call(this,n,a,i):t.call(this,n,r,i)}}_getPatchableEventTargets(){return window.EventTarget?[EventTarget.prototype]:[Node.prototype,Window.prototype]}_patchHistoryApi(){this._unpatchHistoryApi(),this._wrap(history,`replaceState`,this._patchHistoryMethod()),this._wrap(history,`pushState`,this._patchHistoryMethod()),this._wrap(history,`back`,this._patchHistoryMethod()),this._wrap(history,`forward`,this._patchHistoryMethod()),this._wrap(history,`go`,this._patchHistoryMethod())}_patchHistoryMethod(){let e=this;return t=>function(...n){let r=`${location.pathname}${location.hash}${location.search}`,i=t.apply(this,n),a=`${location.pathname}${location.hash}${location.search}`;return r!==a&&e._updateInteractionName(a),i}}_unpatchHistoryApi(){k(history.replaceState)&&this._unwrap(history,`replaceState`),k(history.pushState)&&this._unwrap(history,`pushState`),k(history.back)&&this._unwrap(history,`back`),k(history.forward)&&this._unwrap(history,`forward`),k(history.go)&&this._unwrap(history,`go`)}_updateInteractionName(e){let t=f.getSpan(m.active());t&&typeof t.updateName==`function`&&t.updateName(`${Za} ${e}`)}_patchZoneCancelTask(){let e=this;return t=>function(n){let r=Zone.current,i=e._getCurrentSpan(r);return i&&e._shouldCountTask(n,r)&&e._decrementTask(i),t.call(this,n)}}_patchZoneScheduleTask(){let e=this;return t=>function(n){let r=Zone.current,i=e._getCurrentSpan(r);return i&&e._shouldCountTask(n,r)&&(e._incrementTask(i),e._checkForTimeout(n,i)),t.call(this,n)}}_patchZoneRunTask(){let e=this;return t=>function(n,r,i){let a=(Array.isArray(i)&&i[0]instanceof Event?i[0]:void 0)?.target,o,s=this;if(a){if(o=e._createSpan(a,n.eventName),o)return e._incrementTask(o),s.run(()=>{try{return m.with(f.setSpan(m.active(),o),()=>{let e=Zone.current;return n._zone=e,t.call(e,n,r,i)})}finally{e._decrementTask(o)}})}else o=e._getCurrentSpan(s);try{return t.call(s,n,r,i)}finally{o&&e._shouldCountTask(n,s)&&e._decrementTask(o)}}}_shouldCountTask(e,t){if(e._zone&&(t=e._zone),!t||!e.data||e.data.isPeriodic)return!1;let n=this._getCurrentSpan(t);return!n||!this._spansData.get(n)?!1:e.type===`macroTask`||e.type===`microTask`}_tryToEndSpan(e,t){e&&this._spansData.get(e)&&(e.end(t),this._spansData.delete(e))}enable(){let e=this._getZoneWithPrototype();this._diag.debug(`applying patch to`,this.moduleName,this.version,`zone:`,!!e),e?(k(e.prototype.runTask)&&(this._unwrap(e.prototype,`runTask`),this._diag.debug(`removing previous patch from method runTask`)),k(e.prototype.scheduleTask)&&(this._unwrap(e.prototype,`scheduleTask`),this._diag.debug(`removing previous patch from method scheduleTask`)),k(e.prototype.cancelTask)&&(this._unwrap(e.prototype,`cancelTask`),this._diag.debug(`removing previous patch from method cancelTask`)),this._zonePatched=!0,this._wrap(e.prototype,`runTask`,this._patchZoneRunTask()),this._wrap(e.prototype,`scheduleTask`,this._patchZoneScheduleTask()),this._wrap(e.prototype,`cancelTask`,this._patchZoneCancelTask())):(this._zonePatched=!1,this._getPatchableEventTargets().forEach(e=>{k(e.addEventListener)&&(this._unwrap(e,`addEventListener`),this._diag.debug(`removing previous patch from method addEventListener`)),k(e.removeEventListener)&&(this._unwrap(e,`removeEventListener`),this._diag.debug(`removing previous patch from method removeEventListener`)),this._wrap(e,`addEventListener`,this._patchAddEventListener()),this._wrap(e,`removeEventListener`,this._patchRemoveEventListener())})),this._patchHistoryApi()}disable(){let e=this._getZoneWithPrototype();this._diag.debug(`removing patch from`,this.moduleName,this.version,`zone:`,!!e),e&&this._zonePatched?(k(e.prototype.runTask)&&this._unwrap(e.prototype,`runTask`),k(e.prototype.scheduleTask)&&this._unwrap(e.prototype,`scheduleTask`),k(e.prototype.cancelTask)&&this._unwrap(e.prototype,`cancelTask`)):this._getPatchableEventTargets().forEach(e=>{k(e.addEventListener)&&this._unwrap(e,`addEventListener`),k(e.removeEventListener)&&this._unwrap(e,`removeEventListener`)}),this._unpatchHistoryApi()}_getZoneWithPrototype(){return window.Zone}},to=`open-knowledge-app`,no=!1;function ro(){return{BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.53.0`}?.VITE_OTEL_COLLECTOR_URL??`http://localhost:14318`}function io(){if(no)return;no=!0;let e=null,t=!1;try{let n=ro(),r={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.53.0`};e=new qi({resource:Zr({[Je]:`open-knowledge-app`,[Ye]:r?.VITE_APP_VERSION??`dev`,[Re]:r?.MODE??`dev`}),spanProcessors:[new Ui(new fn({url:`${n}/v1/traces`}),{maxExportBatchSize:50,scheduledDelayMillis:2e3})]}),e.register(),t=!0,Cn({instrumentations:[new sa,new eo({eventNames:[`click`,`submit`]}),new qa({propagateTraceHeaderCorsUrls:[/^https?:\/\/localhost(:\d+)?\/api\//,/^https?:\/\/127\.0\.0\.1(:\d+)?\/api\//,/^\/api\//],clearTimingResources:!0})]}),console.info(`[otel] frontend telemetry initialized — OTLP/HTTP → ${n}/v1/traces`)}catch(n){console.warn(`[otel] frontend telemetry init failed — continuing without`,n),t&&e&&e.shutdown().catch(()=>{}),no=!1}}function ao(){return f.getTracer(to)}export{ao as getAppTracer,io as install};
2
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{a as n,c as r,d as i,f as a,i as o,l as s,n as c,o as l,p as u,r as d,t as f,u as p}from"./trace-api-18gcBe0u.js";import{n as m,r as ee,t as h}from"./propagation-api-PBYTadVM.js";var te=class{constructor(){}createGauge(e,t){return fe}createHistogram(e,t){return pe}createCounter(e,t){return de}createUpDownCounter(e,t){return me}createObservableGauge(e,t){return ge}createObservableCounter(e,t){return he}createObservableUpDownCounter(e,t){return _e}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},g=class{},ne=class extends g{add(e,t){}},re=class extends g{add(e,t){}},ie=class extends g{record(e,t){}},ae=class extends g{record(e,t){}},oe=class{addCallback(e){}removeCallback(e){}},se=class extends oe{},ce=class extends oe{},le=class extends oe{},ue=new te,de=new ne,fe=new ie,pe=new ae,me=new re,he=new se,ge=new ce,_e=new le;function ve(){return ue}var ye;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(ye||={});var be;(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(be||={});var _=p.instance(),xe=new class{getMeter(e,t,n){return ue}},Se=`metrics`,Ce=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalMeterProvider(e){return a(Se,e,p.instance())}getMeterProvider(){return i(Se)||xe}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){u(Se,p.instance())}}.getInstance(),we=class{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}},Te=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}};function Ee(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function De(e){if(e!=null)return()=>e}function Oe(e,t,n){return{timeoutMillis:Ee(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function ke(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var Ae=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function je(e){return new Ae(e.concurrencyLimit)}var Me=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{},Ne=performance,Pe=`http.url`,Fe=`http.user_agent`,Ie=Pe,Le=Fe,Re=`deployment.environment.name`,ze=`error.type`,Be=`exception.message`,Ve=`exception.stacktrace`,He=`exception.type`,Ue=`http.request.method`,We=`http.request.method_original`,Ge=`http.response.status_code`,Ke=`server.address`,qe=`server.port`,Je=`service.name`,Ye=`service.version`,Xe=`telemetry.sdk.language`,Ze=`webjs`,Qe=`telemetry.sdk.name`,$e=`telemetry.sdk.version`,et=`url.full`,tt=9,nt=10**6,rt=10**tt;function v(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*nt)]}function it(){let e=Ne.timeOrigin;if(typeof e!=`number`){let t=Ne;e=t.timing&&t.timing.fetchStart}return e}function at(e){return st(v(it()),v(typeof e==`number`?e:Ne.now()))}function y(e){if(ot(e))return e;if(typeof e==`number`)return e<it()?at(e):v(e);if(e instanceof Date)return v(e.getTime());throw TypeError(`Invalid input type`)}function b(e){return e[0]*rt+e[1]}function ot(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function st(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=rt&&(n[1]-=rt,n[0]+=1),n}var x;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(x||={});function ct(e,t){return typeof t==`string`?e===t:!!e.match(t)}function lt(e,t){if(!t)return!1;for(let n of t)if(ct(e,n))return!0;return!1}function ut(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function dt(){return{handleResponse(e){e==null||!ut(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||_.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var ft=class{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=_.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:x.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:x.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:x.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:x.FAILED,error:e.error});return}else e.status===`retryable`?t({code:x.FAILED,error:new Te(`Export failed with retryable status`)}):t({code:x.FAILED,error:new Te(`Export failed with unknown error`)})},e=>t({code:x.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}};function pt(e,t){return new ft(e.transport,e.serializer,dt(),e.promiseHandler,t.timeout)}function mt(e,t,n){return pt({transport:n,serializer:t,promiseHandler:je(e)},{timeout:e.timeoutMillis})}function ht(e){return e>=48&&e<=57?e-48:e>=97&&e<=102?e-87:e-55}function gt(e){let t=new Uint8Array(e.length/2),n=0;for(let r=0;r<e.length;r+=2){let i=ht(e.charCodeAt(r)),a=ht(e.charCodeAt(r+1));t[n++]=i<<4|a}return t}function _t(e){let t=BigInt(1e9);return BigInt(e[0])*t+BigInt(e[1])}function vt(e){return{low:Number(BigInt.asUintN(32,e)),high:Number(BigInt.asUintN(32,e>>BigInt(32)))}}function yt(e){return vt(_t(e))}function bt(e){return _t(e).toString()}var xt=typeof BigInt<`u`?bt:b;function St(e){return e}function Ct(e){if(e!==void 0)return gt(e)}var wt={encodeHrTime:yt,encodeSpanContext:gt,encodeOptionalSpanContext:Ct};function Tt(e){if(e===void 0)return wt;let t=e.useLongBits??!0,n=e.useHex??!1;return{encodeHrTime:t?yt:xt,encodeSpanContext:n?St:gt,encodeOptionalSpanContext:n?St:Ct}}function Et(e){let t={attributes:S(e.attributes),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==``&&(t.schemaUrl=n),t}function Dt(e){return{name:e.name,version:e.version}}function S(e){return Object.keys(e).map(t=>Ot(t,e[t]))}function Ot(e,t){return{key:e,value:kt(t)}}function kt(e){let t=typeof e;return t===`string`?{stringValue:e}:t===`number`?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:t===`boolean`?{boolValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{arrayValue:{values:e.map(kt)}}:t===`object`&&e!=null?{kvlistValue:{values:Object.entries(e).map(([e,t])=>Ot(e,t))}}:{}}function At(e,t){let n=e.spanContext(),r=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:S(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Mt(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>jt(e,t)),droppedLinksCount:e.droppedLinksCount}}function jt(e,t){return{attributes:e.attributes?S(e.attributes):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0}}function Mt(e,t){return{attributes:e.attributes?S(e.attributes):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Nt(e,t){return{resourceSpans:Ft(e,Tt(t))}}function Pt(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function Ft(e,t){let n=Pt(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>At(e,t));o.push({scope:Dt(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=Et(e),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var It={serializeRequest:e=>{let t=Nt(e,{useHex:!0,useLongBits:!1});return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}},Lt=5,Rt=1e3,zt=5e3,Bt=1.5,Vt=.2;function Ht(){return 2*Vt*Math.random()-Vt}var Ut=class{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=Date.now()+t,r=await this._transport.send(e,t),i=Lt,a=Rt;for(;r.status===`retryable`&&i>0;){i--;let t=Math.max(Math.min(a,zt)+Ht(),0);a*=Bt;let o=r.retryInMillis??t,s=n-Date.now();if(o>s)return r;r=await this.retry(e,s,o)}return r}shutdown(){return this._transport.shutdown()}};function Wt(e){return new Ut(e.transport)}function Gt(e){return[429,502,503,504].includes(e)}function Kt(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var qt=class{_parameters;constructor(e){this._parameters=e}send(e,t){return new Promise(n=>{let r=new XMLHttpRequest;r.timeout=t,r.open(`POST`,this._parameters.url);let i=this._parameters.headers();Object.entries(i).forEach(([e,t])=>{r.setRequestHeader(e,t)}),r.ontimeout=e=>{n({status:`failure`,error:Error(`XHR request timed out`)})},r.onreadystatechange=()=>{r.status>=200&&r.status<=299?(_.debug(`XHR success`),n({status:`success`})):r.status&&Gt(r.status)?n({status:`retryable`,retryInMillis:Kt(r.getResponseHeader(`Retry-After`))}):r.status!==0&&n({status:`failure`,error:Error(`XHR request failed with non-retryable status`)})},r.onabort=()=>{n({status:`failure`,error:Error(`XHR request aborted`)})},r.onerror=()=>{n({status:`failure`,error:Error(`XHR request errored`)})},r.send(e)})}shutdown(){}};function Jt(e){return new qt(e)}var Yt=class{_params;constructor(e){this._params=e}send(e){return new Promise(t=>{navigator.sendBeacon(this._params.url,new Blob([e],{type:this._params.blobType}))?(_.debug(`SendBeacon success`),t({status:`success`})):t({status:`failure`,error:Error(`SendBeacon failed`)})})}shutdown(){}};function Xt(e){return new Yt(e)}var Zt=class{_parameters;constructor(e){this._parameters=e}async send(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),t);try{let t=!!globalThis.location,r=new URL(this._parameters.url),i=await fetch(r.href,{method:`POST`,headers:this._parameters.headers(),body:e,signal:n.signal,keepalive:t,mode:t?globalThis.location?.origin===r.origin?`same-origin`:`cors`:`no-cors`});return i.status>=200&&i.status<=299?(_.debug(`response success`),{status:`success`}):Gt(i.status)?{status:`retryable`,retryInMillis:Kt(i.headers.get(`Retry-After`))}:{status:`failure`,error:Error(`Fetch request failed with non-retryable status`)}}catch(e){return e?.name===`AbortError`?{status:`failure`,error:Error(`Fetch request timed out`,{cause:e})}:{status:`failure`,error:Error(`Fetch request errored`,{cause:e})}}finally{clearTimeout(r)}}shutdown(){}};function Qt(e){return new Zt(e)}function $t(e,t){return mt(e,t,Wt({transport:Jt(e)}))}function en(e,t){return mt(e,t,Wt({transport:Qt(e)}))}function tn(e,t){return mt(e,t,Wt({transport:Xt({url:e.url,blobType:e.headers()[`Content-Type`]})}))}function nn(e){return()=>{let t={};return Object.entries(e?.()??{}).forEach(([e,n])=>{n===void 0?_.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}}function rn(e,t,n){let r={...n()},i={};return()=>(t!=null&&Object.assign(i,t()),e!=null&&Object.assign(i,e()),Object.assign(i,r))}function an(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function on(n){return async r=>{let{Agent:i}=await t(()=>import(`./__vite-browser-external-DD8Jl_VU.js`).then(t=>e(t.default)),__vite__mapDeps([0,1]),import.meta.url);return new i(n)}}function sn(e,t,n){return{...Oe(e,t,n),headers:rn(nn(e.headers),t.headers,n.headers),url:an(e.url)??t.url??n.url,agentFactory:e.agentFactory??t.agentFactory??n.agentFactory}}function cn(e,t){return{...ke(),headers:()=>e,url:`http://localhost:4318/`+t,agentFactory:on({keepAlive:!0})}}function ln(e,t,n){return sn({url:e.url,timeoutMillis:e.timeoutMillis,headers:De(e.headers),concurrencyLimit:e.concurrencyLimit},{},cn(n,t))}function un(e,t,n,r){return dn(e.headers)(ln(e,n,r),t)}function dn(e){return!e&&typeof navigator.sendBeacon==`function`?tn:globalThis.fetch===void 0?$t:en}var fn=class extends we{constructor(e={}){super(un(e,It,`v1/traces`,{"Content-Type":`application/json`}))}},pn=class{emit(e){}},mn=new pn,hn=new class{getLogger(e,t,n){return new pn}},gn=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):mn}},_n=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new gn(this,e,t,n)}_getDelegate(){return this._delegate??hn}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}},vn=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{},C=Symbol.for(`io.opentelemetry.js.api.logs`),w=vn;function yn(e,t,n){return r=>r===e?t:n}var bn=class e{constructor(){this._proxyLoggerProvider=new _n}static getInstance(){return this._instance||=new e,this._instance}setGlobalLoggerProvider(e){return w[C]?this.getLoggerProvider():(w[C]=yn(1,e,hn),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return w[C]?.call(w,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete w[C],this._proxyLoggerProvider=new _n}}.getInstance();function xn(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function Sn(e){e.forEach(e=>e.disable())}function Cn(e){let t=e.tracerProvider||f.getTracerProvider(),n=e.meterProvider||Ce.getMeterProvider(),r=e.loggerProvider||bn.getLoggerProvider(),i=e.instrumentations?.flat()??[];return xn(i,t,n,r),()=>{Sn(i)}}var T=console.error.bind(console);function E(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}var wn=(e,t,n)=>{if(!e||!e[t]){T(`no original function `+String(t)+` to wrap`);return}if(!n){T(`no wrapper function`),T(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){T(`original object and wrapper must be functions`);return}let i=n(r,t);return E(i,`__original`,r),E(i,`__unwrap`,()=>{e[t]===i&&E(e,t,r)}),E(i,`__wrapped`,!0),E(e,t,i),i},Tn=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{T(`must provide one or more modules to patch`),T(Error().stack);return}if(!(t&&Array.isArray(t))){T(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{wn(e,t,n)})})},En=(e,t)=>{if(!e||!e[t]){T(`no function to unwrap.`),T(Error().stack);return}let n=e[t];if(!n.__unwrap)T(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},Dn=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{T(`must provide one or more modules to patch`),T(Error().stack);return}if(!(t&&Array.isArray(t))){T(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{En(e,t)})})};function D(e){e&&e.logger&&(typeof e.logger==`function`?T=e.logger:T(`new logger isn't a function, not replacing`))}D.wrap=wn,D.massWrap=Tn,D.unwrap=En,D.massUnwrap=Dn;var On=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=_.createComponentLogger({namespace:e}),this._tracer=f.getTracer(e,t),this._meter=Ce.getMeter(e,t),this._logger=bn.getLogger(e,t),this._updateMetricInstruments()}_wrap=wn;_unwrap=En;_massWrap=Tn;_massUnwrap=Dn;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}},kn=class extends On{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}};function O(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function k(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var A;(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(A||={});function An(e,t){let n=A.OLD,r=t?.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r??[])if(t.toLowerCase()===e+`/dup`){n=A.DUPLICATE;break}else t.toLowerCase()===e&&(n=A.STABLE);return n}var jn=s(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Mn(e){return e.setValue(jn,!0)}function Nn(e){return e.getValue(jn)===!0}var Pn=`baggage`,Fn=4096;function In(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function Ln(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function Rn(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch{return}let c;return t!==-1&&t<e.length-1&&(c=ee(e.substring(t+1))),{key:o,value:s,metadata:c}}function zn(e,t,n,r){let i=0;for(;i<e.length&&n<180;){let a=e.indexOf(`,`,i),o=a===-1?e.length:a,s=o-i;if(s<=4096){let a=Rn(e.substring(i,o));if(a){let e=(n===0?0:1)+s;if(r+e>8192)break;t[a.key]=a.metadata?{value:a.value,metadata:a.metadata}:{value:a.value},n++,r+=e}}if(a===-1)break;i=a+1}return[n,r]}var Bn=class{inject(e,t,n){let r=h.getBaggage(e);if(!r||Nn(e))return;let i=In(Ln(r).filter(e=>e.length<=Fn).slice(0,180));i.length>0&&n.set(t,Pn,i)}extract(e,t,n){let r=n.get(t,Pn);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=zn(r[e],i,a,o);else [a]=zn(r,i,a,o);return a===0?e:h.setBaggage(e,h.createBaggage(i))}fields(){return[Pn]}};function j(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Vn(n)){_.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Hn(r)){_.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Vn(e){return typeof e==`string`&&e!==``}function Hn(e){return e==null?!0:Array.isArray(e)?Un(e):Wn(typeof e)}function Un(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Wn(e)){t=e;continue}return!1}return!1}}return!0}function Wn(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function Gn(){return e=>{_.error(Kn(e))}}function Kn(e){return typeof e==`string`?e:JSON.stringify(qn(e))}function qn(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var Jn=Gn();function M(e){try{Jn(e)}catch{}}var Yn=`2.9.0`,Xn=`process.runtime.name`,Zn={[Qe]:`opentelemetry`,[Xn]:`browser`,[Xe]:Ze,[$e]:Yn},N=performance,Qn=9,$n=10**6,er=10**Qn;function P(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*$n)]}function tr(e){return ar(P(N.timeOrigin),P(typeof e==`number`?e:N.now()))}function nr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=er),[n,r]}function rr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function ir(e){return rr(e)||typeof e==`number`||e instanceof Date}function ar(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=er&&(n[1]-=er,n[0]+=1),n}var or;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(or||={});var sr=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];let t=new Set;for(let e of this._propagators){let n=typeof e.fields==`function`?e.fields():[];for(let e of n)t.add(e)}this._fields=Array.from(t)}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){_.warn(`Failed to inject with ${r.constructor.name}. Err: ${e.message}`)}}extract(e,t,n){return this._propagators.reduce((e,r)=>{try{return r.extract(e,t,n)}catch(e){_.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}},cr=`[_0-9a-z-*/]`,lr=`[a-z]${cr}{0,255}`,ur=`[a-z0-9]${cr}{0,240}@[a-z]${cr}{0,13}`,dr=RegExp(`^(?:${lr}|${ur})$`),fr=/^[ -~]{0,255}[!-~]$/,pr=/,|=/;function mr(e){return dr.test(e)}function hr(e){return fr.test(e)&&!pr.test(e)}var gr=32,_r=512,vr=`,`,yr=`=`,br=class e{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!mr(e)||!hr(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>_r)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=vr+e),e=`${n[0]}${yr}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(vr),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(yr);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!mr(a)||!hr(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>_r)&&(t.set(a,o),n=s,t.size>=gr))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}},F=`traceparent`,xr=`tracestate`,Sr=`00`,Cr=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function wr(e){let t=Cr.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Tr=class{inject(e,t,n){let r=f.getSpanContext(e);if(!r||Nn(e)||!d(r))return;let i=`${Sr}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||l.NONE).toString(16)}`;n.set(t,F,i),r.traceState&&n.set(t,xr,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,F);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=wr(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,xr);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new br(typeof e==`string`?e:void 0)}return f.setSpanContext(e,a)}fields(){return[F,xr]}},Er=`[object Object]`,Dr=`[object Null]`,Or=`[object Undefined]`,kr=Function.prototype.toString,Ar=kr.call(Object),jr=Object.getPrototypeOf,Mr=Object.prototype,Nr=Mr.hasOwnProperty,I=Symbol?Symbol.toStringTag:void 0,Pr=Mr.toString;function Fr(e){if(!Ir(e)||Lr(e)!==Er)return!1;let t=jr(e);if(t===null)return!0;let n=Nr.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&kr.call(n)===Ar}function Ir(e){return typeof e==`object`&&!!e}function Lr(e){return e==null?e===void 0?Or:Dr:I&&I in Object(e)?Rr(e):zr(e)}function Rr(e){let t=Nr.call(e,I),n=e[I],r=!1;try{e[I]=void 0,r=!0}catch{}let i=Pr.call(e);return r&&(t?e[I]=n:delete e[I]),i}function zr(e){return Pr.call(e)}var Br=20;function Vr(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=Ur(t,e.shift(),0,n);return t}function Hr(e){return L(e)?e.slice():e}function Ur(e,t,n=0,r){let i;if(!(n>Br)){if(n++,z(e)||z(t)||Gr(t))i=Hr(t);else if(L(e)){if(i=e.slice(),L(t))for(let e=0,n=t.length;e<n;e++)i.push(Hr(t[e]));else if(R(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=Hr(t[r]))}}}else if(R(e))if(R(t)){if(!Kr(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(z(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Wr(e,s,r)||Wr(t,s,r))delete i[s];else{if(R(a)&&R(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=Ur(i[s],c,n,r)}}}}else i=t;return i}}function Wr(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function L(e){return Array.isArray(e)}function Gr(e){return typeof e==`function`}function R(e){return!z(e)&&!L(e)&&!Gr(e)&&typeof e==`object`}function z(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function Kr(e,t){return!(!Fr(e)||!Fr(t))}var qr=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},Jr=class{_isCalled=!1;_deferred=new qr;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}},B;function Yr(){if(B===void 0)try{let e=globalThis.process.argv0;B=e?`unknown_service:${e}`:`unknown_service`}catch{B=`unknown_service`}return B}var V=e=>typeof e==`object`&&!!e&&typeof e.then==`function`,Xr=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=$r(t),r._asyncAttributesPending=t.filter(([e,t])=>V(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(V(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=$r(this._rawAttributes),this._schemaUrl=ei(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,V(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&_.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(V(n)){_.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=ti(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Zr(e,t){return Xr.FromAttributeList(Object.entries(e),t)}function Qr(){return Zr({[Je]:Yr(),[Xe]:Zn[Xe],[Qe]:Zn[Qe],[$e]:Zn[$e]})}function $r(e){return e.map(([e,t])=>V(t)?[e,t.catch(t=>{_.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function ei(e){if(typeof e==`string`||e===void 0)return e;_.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function ti(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;_.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var ni=`exception`,ri=Symbol.for(`nodejs.util.inspect.custom`);function ii(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function ai(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}var oi=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:c.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=N.now(),this._performanceOffset=t-(this._performanceStartTime+N.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return _.warn(`Invalid attribute key: ${e}`),this;if(!Hn(t))return _.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return _.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&_.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),ir(t)&&(ir(n)||(n=t),t=void 0);let i=j(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&_.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=j(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===c.UNSET||this.status.code===c.OK)return this;let t={code:e.code};return e.code===c.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&_.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){_.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=nr(this.startTime,this.endTime),this._duration[0]<0&&(_.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&_.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&_.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=N.now())return tr(e+this._performanceOffset);if(typeof e==`number`)return P(e);if(e instanceof Date)return P(e.getTime());if(rr(e))return e;if(this._startTimeProvided)return P(Date.now());let t=N.now()-this._performanceStartTime;return ar(this.startTime,P(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[Be]=e:e&&(e.code?n[He]=e.code.toString():e.name&&(n[He]=e.name),e.message&&(n[Be]=e.message),e.stack&&(n[Ve]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(ni,n,t):_.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);_.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(_.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[ri](e,t,n){return ai(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:ii(this.resource)}},e,t,n)}},H;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(H||={});var si=`otel.component.name`,ci=`otel.component.type`,li=`otel.span.parent.origin`,ui=`otel.span.sampling_result`,di=`otel.sdk.processor.span.processed`,fi=`otel.sdk.processor.span.queue.capacity`,pi=`otel.sdk.processor.span.queue.size`,mi=`otel.sdk.span.live`,hi=`otel.sdk.span.started`,gi=`batching_span_processor`,_i=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(hi,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(mi,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=yi(t);if(this.startedSpans.add(1,{[li]:vi(e),[ui]:n}),t===H.NOT_RECORD)return()=>{};let r={[ui]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function vi(e){return e?e.isRemote?`remote`:`local`:`none`}function yi(e){switch(e){case H.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case H.RECORD:return`RECORD_ONLY`;case H.NOT_RECORD:return`DROP`}}var bi=`2.9.0`,xi=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t){this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor,this._tracerMetrics=new _i(t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,bi))}startSpan(e,t={},r=m.active()){t.root&&(r=f.deleteSpan(r));let i=f.getSpan(r);if(Nn(r))return _.debug(`Instrumentation suppressed, returning Noop Span`),f.wrapSpanContext(n);let a=i?.spanContext(),o=this._idGenerator.generateSpanId(),s,c,u;!a||!f.isSpanContextValid(a)?c=this._idGenerator.generateTraceId():(c=a.traceId,u=a.traceState,s=a);let d=t.kind??be.INTERNAL,p=(t.links??[]).map(e=>({context:e.context,attributes:j(e.attributes)})),ee=j(t.attributes),h=this._sampler.shouldSample(r,c,e,d,ee,p),te=this._tracerMetrics.startSpan(a,h.decision);u=h.traceState??u;let g=h.decision===ye.RECORD_AND_SAMPLED?l.SAMPLED:l.NONE,ne={traceId:c,spanId:o,traceFlags:g,traceState:u};if(h.decision===ye.NOT_RECORD)return _.debug(`Recording is off, propagating context in a non-recording span`),f.wrapSpanContext(ne);let re=j(Object.assign(ee,h.attributes));return new oi({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:ne,name:e,kind:d,links:p,parentSpanContext:s,attributes:re,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:te})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??m.active(),c=this.startSpan(e,i,s),l=f.setSpan(s,c);return m.with(l,o,void 0,c)}[ri](e,t,n){return ai(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:ii(this._resource)},spanLimits:this._spanLimits},e,t,n)}},Si=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{M(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},U=class{shouldSample(){return{decision:H.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},W=class{shouldSample(){return{decision:H.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}},G=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(M(Error(`ParentBasedSampler must have a root sampler configured`)),new W),this._remoteParentSampled=e.remoteParentSampled??new W,this._remoteParentNotSampled=e.remoteParentNotSampled??new U,this._localParentSampled=e.localParentSampled??new W,this._localParentNotSampled=e.localParentNotSampled??new U}shouldSample(e,t,n,r,i,a){let o=f.getSpanContext(e);return!o||!d(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&l.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&l.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}},Ci=new Map,wi=class{processedSpans;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,t,n){let r=Ci.get(e)??0;if(Ci.set(e,r+1),this.standardAttrs={[ci]:e,[si]:`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[ze]:`queue_full`},this.processedSpans=t.createCounter(di,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(fi,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(pi,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n={...this.standardAttrs,[ze]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}},Ti=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_metrics;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e){this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new Jr(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(_.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize),this._metrics=new wi(gi,e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):ve(),{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&l.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&_.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(_.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);m.with(Mn(m.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,i=>{clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===or.SUCCESS?e():t(i.error??Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??=[],a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{M(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,M(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},Ei=class extends Ti{_visibilityChangeListener;_pageHideListener;constructor(e){super(e),this.onInit(e)}onInit(e){e.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{M(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{M(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}},Di=16,Oi=8,ki=new Uint8Array(Di),Ai=new Uint8Array(Oi),ji=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Mi(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function Ni(e){let t=``;for(let n=0;n<e.length;n++)t+=ji[e[n]];return t}var Pi=class{generateTraceId(){return Mi(ki),Ni(ki)}generateSpanId(){return Mi(Ai),Ni(Ai)}},K;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(K||={});var Fi=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??Qr(),this._activeSpanProcessor=new Si(e.spanProcessors??[]),this._tracerOptions={resource:this._resource,sampler:e.sampler??new G({root:new W}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new Pi,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return ve()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new xi({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(){let e=this._forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=K.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==K.timeout&&(r=K.resolved,n(r))}).catch(e=>{clearTimeout(i),r=K.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==K.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[ri](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return ai(`TracerProvider`,{resource:{attributes:ii(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}},Ii=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:o(t)&&this._accumulate(t)<this._upperBound?H.RECORD_AND_SAMPLED:H.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}},q;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(q||={});var Li=1;function Ri(){return{sampler:zi(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function zi(){let e=q.ParentBasedAlwaysOn;switch(e){case q.AlwaysOn:return new W;case q.AlwaysOff:return new U;case q.ParentBasedAlwaysOn:return new G({root:new W});case q.ParentBasedAlwaysOff:return new G({root:new U});case q.TraceIdRatio:return new Ii(Bi());case q.ParentBasedTraceIdRatio:return new G({root:new Ii(Bi())});default:return _.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${q.ParentBasedAlwaysOn}".`),new G({root:new W})}}function Bi(){return _.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Li}.`),Li}function Vi(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??1/0,Object.assign({},e,{spanLimits:t})}var Hi=class extends Fi{constructor(e={}){let t=Vr({},Ri(),Vi(e));delete t.generalLimits,super(t)}},Ui=class extends Ei{constructor(e,t){t||={};for(let[e,n]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])t[e];super({exporter:e,...t})}},Wi=class{_enabled=!1;_currentContext=r;_bindFunction(e=r,t){let n=this,i=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(i,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),i}active(){return this._currentContext}bind(e,t){return e===void 0&&(e=this.active()),typeof t==`function`?this._bindFunction(e,t):t}disable(){return this._currentContext=r,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=r,this)}with(e,t,n,...i){let a=this._currentContext;this._currentContext=e||r;try{return t.call(n,...i)}finally{this._currentContext=a}}};function Gi(e){if(e!==null){if(e===void 0){let e=new Wi;e.enable(),m.setGlobalContextManager(e);return}e.enable(),m.setGlobalContextManager(e)}}function Ki(e){if(e!==null){if(e===void 0){h.setGlobalPropagator(new sr({propagators:[new Tr,new Bn]}));return}h.setGlobalPropagator(e)}}var qi=class extends Hi{constructor(e={}){super(e)}register(e={}){f.setGlobalTracerProvider(this),Ki(e.propagator),Gi(e.contextManager)}},J;(function(e){e.CONNECT_END=`connectEnd`,e.CONNECT_START=`connectStart`,e.DECODED_BODY_SIZE=`decodedBodySize`,e.DOM_COMPLETE=`domComplete`,e.DOM_CONTENT_LOADED_EVENT_END=`domContentLoadedEventEnd`,e.DOM_CONTENT_LOADED_EVENT_START=`domContentLoadedEventStart`,e.DOM_INTERACTIVE=`domInteractive`,e.DOMAIN_LOOKUP_END=`domainLookupEnd`,e.DOMAIN_LOOKUP_START=`domainLookupStart`,e.ENCODED_BODY_SIZE=`encodedBodySize`,e.FETCH_START=`fetchStart`,e.LOAD_EVENT_END=`loadEventEnd`,e.LOAD_EVENT_START=`loadEventStart`,e.NAVIGATION_START=`navigationStart`,e.REDIRECT_END=`redirectEnd`,e.REDIRECT_START=`redirectStart`,e.REQUEST_START=`requestStart`,e.RESPONSE_END=`responseEnd`,e.RESPONSE_START=`responseStart`,e.SECURE_CONNECTION_START=`secureConnectionStart`,e.START_TIME=`startTime`,e.UNLOAD_EVENT_END=`unloadEventEnd`,e.UNLOAD_EVENT_START=`unloadEventStart`})(J||={});var Ji=`http.response_content_length`,Yi=`http.response_content_length_uncompressed`;function Y(e,t){return t in e}function X(e,t,n,r=!0){if(Y(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function Xi(e,t,n=!1,r,i){if(r===void 0&&(r=t[J.START_TIME]!==0),n||(X(e,J.FETCH_START,t,r),X(e,J.DOMAIN_LOOKUP_START,t,r),X(e,J.DOMAIN_LOOKUP_END,t,r),X(e,J.CONNECT_START,t,r),X(e,J.SECURE_CONNECTION_START,t,r),X(e,J.CONNECT_END,t,r),X(e,J.REQUEST_START,t,r),X(e,J.RESPONSE_START,t,r),X(e,J.RESPONSE_END,t,r)),!i){let n=t[J.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(Ji,n);let r=t[J.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(Yi,r)}}function Zi(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return`/`;let n=$i(e,t);if(t&&n.indexOf(`@id`)>0)return n;let r=``;return e.parentNode&&(r+=Zi(e.parentNode,t)),r+=n,r}function Qi(e){if(!e.parentNode)return 0;let t=[e.nodeType];e.nodeType===Node.CDATA_SECTION_NODE&&t.push(Node.TEXT_NODE);let n=Array.from(e.parentNode.childNodes);return n=n.filter(n=>{let r=n.localName;return t.indexOf(n.nodeType)>=0&&r===e.localName}),n.length>=1?n.indexOf(e)+1:0}function $i(e,t){let n=e.nodeType,r=Qi(e),i;if(n===Node.ELEMENT_NODE){let n=e.getAttribute(`id`);if(t&&n)return`//*[@id="${n}"]`;i=e.localName}else if(n===Node.TEXT_NODE||n===Node.CDATA_SECTION_NODE)i=`text()`;else if(n===Node.COMMENT_NODE)i=`comment()`;else return``;return i&&r>1?`/${i}[${r}]`:`/${i}`}var ea;(function(e){e.DOCUMENT_LOAD=`documentLoad`,e.DOCUMENT_FETCH=`documentFetch`,e.RESOURCE_FETCH=`resourceFetch`})(ea||={});var ta=`0.49.0`,na=`@opentelemetry/instrumentation-document-load`,ra;(function(e){e.FIRST_PAINT=`firstPaint`,e.FIRST_CONTENTFUL_PAINT=`firstContentfulPaint`})(ra||={});var ia=()=>{let e={},t=N.getEntriesByType?.(`navigation`)[0];if(t)Object.values(J).forEach(n=>{if(Y(t,n)){let r=t[n];typeof r==`number`&&(e[n]=r)}});else{let t=N.timing;t&&Object.values(J).forEach(n=>{if(Y(t,n)){let r=t[n];typeof r==`number`&&(e[n]=r)}})}return e},aa={"first-paint":ra.FIRST_PAINT,"first-contentful-paint":ra.FIRST_CONTENTFUL_PAINT},oa=e=>{let t=N.getEntriesByType?.(`paint`);t&&t.forEach(({name:t,startTime:n})=>{Y(aa,t)&&e.addEvent(aa[t],n)})},sa=class extends kn{component=`document-load`;version=`1`;moduleName=this.component;constructor(e={}){super(na,ta,e)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(e){let t=N.getEntriesByType?.(`resource`);t&&t.forEach(t=>{this._initResourceSpan(t,e)})}_collectPerformance(){let e=Array.from(document.getElementsByTagName(`meta`)).find(e=>e.getAttribute(`name`)===F),t=ia(),n=e&&e.content||``;m.with(h.extract(r,{traceparent:n}),()=>{let e=this._startSpan(ea.DOCUMENT_LOAD,J.FETCH_START,t);e&&(m.with(f.setSpan(m.active(),e),()=>{let e=this._startSpan(ea.DOCUMENT_FETCH,J.FETCH_START,t);e&&(e.setAttribute(Ie,location.href),m.with(f.setSpan(m.active(),e),()=>{Xi(e,t,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnSpan(e,this.getConfig().applyCustomAttributesOnSpan?.documentFetch),this._endSpan(e,J.RESPONSE_END,t)}))}),e.setAttribute(Ie,location.href),e.setAttribute(Le,navigator.userAgent),this._addResourcesSpans(e),this.getConfig().ignoreNetworkEvents||(X(e,J.FETCH_START,t),X(e,J.UNLOAD_EVENT_START,t),X(e,J.UNLOAD_EVENT_END,t),X(e,J.DOM_INTERACTIVE,t),X(e,J.DOM_CONTENT_LOADED_EVENT_START,t),X(e,J.DOM_CONTENT_LOADED_EVENT_END,t),X(e,J.DOM_COMPLETE,t),X(e,J.LOAD_EVENT_START,t),X(e,J.LOAD_EVENT_END,t)),this.getConfig().ignorePerformancePaintEvents||oa(e),this._addCustomAttributesOnSpan(e,this.getConfig().applyCustomAttributesOnSpan?.documentLoad),this._endSpan(e,J.LOAD_EVENT_END,t))})}_endSpan(e,t,n){e&&(Y(n,t)?e.end(n[t]):e.end())}_initResourceSpan(e,t){let n=this._startSpan(ea.RESOURCE_FETCH,J.FETCH_START,e,t);n&&(n.setAttribute(Ie,e.name),Xi(n,e,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnResourceSpan(n,e,this.getConfig().applyCustomAttributesOnSpan?.resourceFetch),this._endSpan(n,J.RESPONSE_END,e))}_startSpan(e,t,n,r){if(Y(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:n[t]},r?f.setSpan(m.active(),r):void 0)}_waitForPageLoad(){window.document.readyState===`complete`?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener(`load`,this._onDocumentLoaded))}_addCustomAttributesOnSpan(e,t){t&&O(()=>t(e),e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addCustomAttributesOnResourceSpan(e,t,n){n&&O(()=>n(e,t),e=>{e&&this._diag.error(`addCustomAttributesOnResourceSpan`,e)},!0)}enable(){window.removeEventListener(`load`,this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener(`load`,this._onDocumentLoaded)}},Z;(function(e){e.CONNECT_END=`connectEnd`,e.CONNECT_START=`connectStart`,e.DECODED_BODY_SIZE=`decodedBodySize`,e.DOM_COMPLETE=`domComplete`,e.DOM_CONTENT_LOADED_EVENT_END=`domContentLoadedEventEnd`,e.DOM_CONTENT_LOADED_EVENT_START=`domContentLoadedEventStart`,e.DOM_INTERACTIVE=`domInteractive`,e.DOMAIN_LOOKUP_END=`domainLookupEnd`,e.DOMAIN_LOOKUP_START=`domainLookupStart`,e.ENCODED_BODY_SIZE=`encodedBodySize`,e.FETCH_START=`fetchStart`,e.LOAD_EVENT_END=`loadEventEnd`,e.LOAD_EVENT_START=`loadEventStart`,e.NAVIGATION_START=`navigationStart`,e.REDIRECT_END=`redirectEnd`,e.REDIRECT_START=`redirectStart`,e.REQUEST_START=`requestStart`,e.RESPONSE_END=`responseEnd`,e.RESPONSE_START=`responseStart`,e.SECURE_CONNECTION_START=`secureConnectionStart`,e.START_TIME=`startTime`,e.UNLOAD_EVENT_END=`unloadEventEnd`,e.UNLOAD_EVENT_START=`unloadEventStart`})(Z||={});var ca=`http.response_content_length`,la=`http.response_content_length_uncompressed`,ua;function da(){return ua||=document.createElement(`a`),ua}function fa(e,t){return t in e}function Q(e,t,n,r=!0){if(fa(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function pa(e,t,n=!1,r,i){if(r===void 0&&(r=t[Z.START_TIME]!==0),n||(Q(e,Z.FETCH_START,t,r),Q(e,Z.DOMAIN_LOOKUP_START,t,r),Q(e,Z.DOMAIN_LOOKUP_END,t,r),Q(e,Z.CONNECT_START,t,r),Q(e,Z.SECURE_CONNECTION_START,t,r),Q(e,Z.CONNECT_END,t,r),Q(e,Z.REQUEST_START,t,r),Q(e,Z.RESPONSE_START,t,r),Q(e,Z.RESPONSE_END,t,r)),!i){let n=t[Z.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(ca,n);let r=t[Z.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(la,r)}}function ma(e){return e.slice().sort((e,t)=>{let n=e[Z.FETCH_START],r=t[Z.FETCH_START];return n>r?1:n<r?-1:0})}function ha(){return typeof location<`u`?location.origin:void 0}function ga(e,t,n,r,i=new WeakSet,a){let o=ya(e);e=o.toString();let s=va(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=ma(s);if(o.origin!==ha()&&c.length>1){let e=c[0],t=_a(c,e[Z.RESPONSE_END],n),r=e[Z.RESPONSE_END];return t[Z.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function _a(e,t,n){let r=b(n),i=b(y(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=b(y(n[Z.FETCH_START])),c=r-b(y(n[Z.RESPONSE_END]));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function va(e,t,n,r,i,a){let o=b(t),s=b(n),c=r.filter(t=>{let n=b(y(t[Z.FETCH_START])),r=b(y(t[Z.RESPONSE_END]));return t.initiatorType.toLowerCase()===(a||`xmlhttprequest`)&&t.name===e&&n>=o&&r<=s});return c.length>0&&(c=c.filter(e=>!i.has(e))),c}function ya(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=da();return t.href=e,t}function ba(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),ya(e).origin===ha()?!0:n.some(t=>ct(e,t))}var xa;(function(e){e.COMPONENT=`component`,e.HTTP_STATUS_TEXT=`http.status_text`})(xa||={});var Sa=`http.host`,Ca=`http.method`,wa=`http.request.body.size`,Ta=`http.request_content_length_uncompressed`,Ea=`http.scheme`,Da=`http.status_code`,Oa=`http.url`,ka=`http.user_agent`,Aa=_.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`});function ja(...e){if(e[0]instanceof URL||typeof e[0]==`string`){let t=e[1];if(!t?.body)return Promise.resolve();if(t.body instanceof ReadableStream){let{body:e,length:n}=Ma(t.body);return t.body=e,n}else return Promise.resolve(Pa(t.body))}else{let t=e[0];return t?.body?t.clone().text().then(e=>Ia(e)):Promise.resolve()}}function Ma(e){if(!e.pipeThrough)return Aa.warn(`Platform has ReadableStream but not pipeThrough!`),{body:e,length:Promise.resolve(void 0)};let t=0,n,r=new Promise(e=>{n=e}),i=new TransformStream({start(){},async transform(e,n){let r=await e;t+=r.byteLength,n.enqueue(e)},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function Na(e){return typeof Document<`u`&&e instanceof Document}function Pa(e){if(Na(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Ia(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return La(e);if(e instanceof URLSearchParams)return Ia(e.toString());if(e.byteLength!==void 0)return e.byteLength;Aa.warn(`unknown body type`)}var Fa=new TextEncoder;function Ia(e){return Fa.encode(e).byteLength}function La(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function Ra(e){let t=Va(),n=e.toUpperCase();return n in t?n:`_OTHER`}var za={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0},Ba;function Va(){return Ba===void 0&&(Ba=za),Ba}var Ha={"https:":`443`,"http:":`80`};function Ua(e){let t=Number(e.port||Ha[e.protocol]);if(t&&!isNaN(t))return t}var Wa=`0.204.0`,Ga=300,Ka=typeof process==`object`&&process.release?.name===`node`,qa=class extends kn{component=`fetch`;version=Wa;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;_semconvStability;constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,Wa,e),this._semconvStability=An(`http`,e?.semconvStabilityOptIn)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[Z.FETCH_START]},f.setSpan(m.active(),e)),r=!(this._semconvStability&A.OLD);pa(n,t,this.getConfig().ignoreNetworkEvents,void 0,r),n.end(t[Z.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=ya(t.url);if(this._semconvStability&A.OLD&&(e.setAttribute(Da,t.status),t.statusText!=null&&e.setAttribute(xa.HTTP_STATUS_TEXT,t.statusText),e.setAttribute(Sa,n.host),e.setAttribute(Ea,n.protocol.replace(`:`,``)),typeof navigator<`u`&&e.setAttribute(ka,navigator.userAgent)),this._semconvStability&A.STABLE){e.setAttribute(Ge,t.status),e.setAttribute(Ke,n.hostname);let r=Ua(n);r&&e.setAttribute(qe,r)}}_addHeaders(e,t){if(!ba(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};h.inject(m.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)h.inject(m.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else if(e.headers instanceof Headers)h.inject(m.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else if(e.headers instanceof Map)h.inject(m.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t={};h.inject(m.active(),t),e.headers=Object.assign({},t,e.headers||{})}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(e,t={}){if(lt(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n=``,r={};if(this._semconvStability&A.OLD){let i=(t.method||`GET`).toUpperCase();n=`HTTP ${i}`,r[xa.COMPONENT]=this.moduleName,r[Ca]=i,r[Oa]=e}if(this._semconvStability&A.STABLE){let i=t.method,a=Ra(t.method||`GET`);n||=a,r[Ue]=a,a!==i&&(r[We]=i),r[et]=e}return this.tracer.startSpan(n,{kind:be.CLIENT,attributes:r})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=ga(t.spanUrl,t.startTime,n,r,this._usedResources,`fetch`);if(i.mainRequest){let t=i.mainRequest;this._markResourceAsUsed(t);let n=i.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n));let r=!(this._semconvStability&A.OLD);pa(e,t,this.getConfig().ignoreNetworkEvents,void 0,r)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=v(Date.now()),i=at();this._addFinalSpanAttributes(e,n),this._semconvStability&A.STABLE&&n.status>=400&&(e.setStatus({code:c.ERROR}),e.setAttribute(ze,String(n.status))),setTimeout(()=>{t.observer?.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},Ga)}_patchConstructor(){return e=>{let t=this;return function(...n){let r=this,i=ya(n[0]instanceof Request?n[0].url:String(n[0])).href,a=n[0]instanceof Request?n[0]:n[1]||{},o=t._createSpan(i,a);if(!o)return e.apply(this,n);let s=t._prepareSpanData(i);t.getConfig().measureRequestSize&&ja(...n).then(e=>{e&&(t._semconvStability&A.OLD&&o.setAttribute(Ta,e),t._semconvStability&A.STABLE&&o.setAttribute(wa,e))}).catch(e=>{t._diag.warn(`getFetchBodyLength`,e)});function c(e,n){t._applyAttributesAfterFetch(e,a,n),t._endSpan(e,s,{status:n.status||0,statusText:n.message,url:i})}function l(e,n){t._applyAttributesAfterFetch(e,a,n),n.status>=200&&n.status<400?t._endSpan(e,s,n):t._endSpan(e,s,{status:n.status,statusText:n.statusText,url:i})}function u(e,t,n){try{let t=n.clone().body;if(t){let r=t.getReader(),i=()=>{r.read().then(({done:t})=>{t?l(e,n):i()},t=>{c(e,t)})};i()}else l(e,n)}finally{t(n)}}function d(e,t,n){try{c(e,n)}finally{t(n)}}return new Promise((n,s)=>m.with(f.setSpan(m.active(),o),()=>(t._addHeaders(a,i),t._callRequestHook(o,a),t._tasksCount++,e.apply(r,a instanceof Request?[a]:[i,a]).then(u.bind(r,o,n),d.bind(r,o,s)))))}}}_applyAttributesAfterFetch(e,t,n){let r=this.getConfig().applyCustomAttributesOnSpan;r&&O(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&O(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=at(),n=[];if(typeof PerformanceObserver!=`function`)return{entries:n,startTime:t,spanUrl:e};let r=new PerformanceObserver(t=>{t.getEntries().forEach(t=>{t.initiatorType===`fetch`&&t.name===e&&n.push(t)})});return r.observe({entryTypes:[`resource`]}),{entries:n,observer:r,startTime:t,spanUrl:e}}enable(){if(Ka){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument Node.js's fetch()`);return}k(fetch)&&(this._unwrap(Me,`fetch`),this._diag.debug(`removing previous patch for constructor`)),this._wrap(Me,`fetch`,this._patchConstructor())}disable(){Ka||(this._unwrap(Me,`fetch`),this._usedResources=new WeakSet)}},$;(function(e){e.EVENT_TYPE=`event_type`,e.TARGET_ELEMENT=`target_element`,e.TARGET_XPATH=`target_xpath`,e.HTTP_URL=`http.url`})($||={});var Ja=`0.49.0`,Ya=`@opentelemetry/instrumentation-user-interaction`,Xa=`OT_ZONE_CONTEXT`,Za=`Navigation:`,Qa=[`click`];function $a(){return!1}var eo=class extends kn{version=Ja;moduleName=`user-interaction`;_spansData=new WeakMap;_wrappedListeners=new WeakMap;_eventsSpanMap=new WeakMap;_eventNames;_shouldPreventSpanCreation;constructor(e={}){super(Ya,Ja,e),this._eventNames=new Set(e?.eventNames??Qa),this._shouldPreventSpanCreation=typeof e?.shouldPreventSpanCreation==`function`?e.shouldPreventSpanCreation:$a}init(){}_checkForTimeout(e,t){let n=this._spansData.get(t);n&&(e.source===`setTimeout`?n.hrTimeLastTimeout=tr():e.source!==`Promise.then`&&e.source!==`setTimeout`&&(n.hrTimeLastTimeout=void 0))}_allowEventName(e){return this._eventNames.has(e)}_createSpan(e,t,n){if(!(e instanceof HTMLElement)||!e.getAttribute||e.hasAttribute(`disabled`)||!this._allowEventName(t))return;let r=Zi(e,!0);try{let i=this.tracer.startSpan(t,{attributes:{[$.EVENT_TYPE]:t,[$.TARGET_ELEMENT]:e.tagName,[$.TARGET_XPATH]:r,[$.HTTP_URL]:window.location.href}},n?f.setSpan(m.active(),n):void 0);return this._shouldPreventSpanCreation(t,e,i)===!0?void 0:(this._spansData.set(i,{taskCount:0}),i)}catch(e){this._diag.error(`failed to start create new user interaction span`,e)}}_decrementTask(e){let t=this._spansData.get(e);t&&(t.taskCount--,t.taskCount===0&&this._tryToEndSpan(e,t.hrTimeLastTimeout))}_getCurrentSpan(e){let t=e.get(Xa);return t&&f.getSpan(t)}_incrementTask(e){let t=this._spansData.get(e);t&&t.taskCount++}addPatchedListener(e,t,n,r){let i=this._wrappedListeners.get(n);i||(i=new Map,this._wrappedListeners.set(n,i));let a=i.get(t);return a||(a=new Map,i.set(t,a)),a.has(e)?!1:(a.set(e,r),!0)}removePatchedListener(e,t,n){let r=this._wrappedListeners.get(n);if(!r)return;let i=r.get(t);if(!i)return;let a=i.get(e);return a&&(i.delete(e),i.size===0&&(r.delete(t),r.size===0&&this._wrappedListeners.delete(n))),a}_invokeListener(e,t,n){return typeof e==`function`?e.apply(t,n):e.handleEvent(n[0])}_patchAddEventListener(){let e=this;return t=>function(n,r,i){if(!r)return t.call(this,n,r,i);let a=i&&typeof i==`object`&&i.once,o=function(...t){let i,o=t[0],s=o?.target;o&&(i=e._eventsSpanMap.get(o)),a&&e.removePatchedListener(this,n,r);let c=e._createSpan(s,n,i);return c?(o&&e._eventsSpanMap.set(o,c),m.with(f.setSpan(m.active(),c),()=>{let n=e._invokeListener(r,this,t);return c.end(),n})):e._invokeListener(r,this,t)};if(e.addPatchedListener(this,n,r,o))return t.call(this,n,o,i)}}_patchRemoveEventListener(){let e=this;return t=>function(n,r,i){let a=e.removePatchedListener(this,n,r);return a?t.call(this,n,a,i):t.call(this,n,r,i)}}_getPatchableEventTargets(){return window.EventTarget?[EventTarget.prototype]:[Node.prototype,Window.prototype]}_patchHistoryApi(){this._unpatchHistoryApi(),this._wrap(history,`replaceState`,this._patchHistoryMethod()),this._wrap(history,`pushState`,this._patchHistoryMethod()),this._wrap(history,`back`,this._patchHistoryMethod()),this._wrap(history,`forward`,this._patchHistoryMethod()),this._wrap(history,`go`,this._patchHistoryMethod())}_patchHistoryMethod(){let e=this;return t=>function(...n){let r=`${location.pathname}${location.hash}${location.search}`,i=t.apply(this,n),a=`${location.pathname}${location.hash}${location.search}`;return r!==a&&e._updateInteractionName(a),i}}_unpatchHistoryApi(){k(history.replaceState)&&this._unwrap(history,`replaceState`),k(history.pushState)&&this._unwrap(history,`pushState`),k(history.back)&&this._unwrap(history,`back`),k(history.forward)&&this._unwrap(history,`forward`),k(history.go)&&this._unwrap(history,`go`)}_updateInteractionName(e){let t=f.getSpan(m.active());t&&typeof t.updateName==`function`&&t.updateName(`${Za} ${e}`)}_patchZoneCancelTask(){let e=this;return t=>function(n){let r=Zone.current,i=e._getCurrentSpan(r);return i&&e._shouldCountTask(n,r)&&e._decrementTask(i),t.call(this,n)}}_patchZoneScheduleTask(){let e=this;return t=>function(n){let r=Zone.current,i=e._getCurrentSpan(r);return i&&e._shouldCountTask(n,r)&&(e._incrementTask(i),e._checkForTimeout(n,i)),t.call(this,n)}}_patchZoneRunTask(){let e=this;return t=>function(n,r,i){let a=(Array.isArray(i)&&i[0]instanceof Event?i[0]:void 0)?.target,o,s=this;if(a){if(o=e._createSpan(a,n.eventName),o)return e._incrementTask(o),s.run(()=>{try{return m.with(f.setSpan(m.active(),o),()=>{let e=Zone.current;return n._zone=e,t.call(e,n,r,i)})}finally{e._decrementTask(o)}})}else o=e._getCurrentSpan(s);try{return t.call(s,n,r,i)}finally{o&&e._shouldCountTask(n,s)&&e._decrementTask(o)}}}_shouldCountTask(e,t){if(e._zone&&(t=e._zone),!t||!e.data||e.data.isPeriodic)return!1;let n=this._getCurrentSpan(t);return!n||!this._spansData.get(n)?!1:e.type===`macroTask`||e.type===`microTask`}_tryToEndSpan(e,t){e&&this._spansData.get(e)&&(e.end(t),this._spansData.delete(e))}enable(){let e=this._getZoneWithPrototype();this._diag.debug(`applying patch to`,this.moduleName,this.version,`zone:`,!!e),e?(k(e.prototype.runTask)&&(this._unwrap(e.prototype,`runTask`),this._diag.debug(`removing previous patch from method runTask`)),k(e.prototype.scheduleTask)&&(this._unwrap(e.prototype,`scheduleTask`),this._diag.debug(`removing previous patch from method scheduleTask`)),k(e.prototype.cancelTask)&&(this._unwrap(e.prototype,`cancelTask`),this._diag.debug(`removing previous patch from method cancelTask`)),this._zonePatched=!0,this._wrap(e.prototype,`runTask`,this._patchZoneRunTask()),this._wrap(e.prototype,`scheduleTask`,this._patchZoneScheduleTask()),this._wrap(e.prototype,`cancelTask`,this._patchZoneCancelTask())):(this._zonePatched=!1,this._getPatchableEventTargets().forEach(e=>{k(e.addEventListener)&&(this._unwrap(e,`addEventListener`),this._diag.debug(`removing previous patch from method addEventListener`)),k(e.removeEventListener)&&(this._unwrap(e,`removeEventListener`),this._diag.debug(`removing previous patch from method removeEventListener`)),this._wrap(e,`addEventListener`,this._patchAddEventListener()),this._wrap(e,`removeEventListener`,this._patchRemoveEventListener())})),this._patchHistoryApi()}disable(){let e=this._getZoneWithPrototype();this._diag.debug(`removing patch from`,this.moduleName,this.version,`zone:`,!!e),e&&this._zonePatched?(k(e.prototype.runTask)&&this._unwrap(e.prototype,`runTask`),k(e.prototype.scheduleTask)&&this._unwrap(e.prototype,`scheduleTask`),k(e.prototype.cancelTask)&&this._unwrap(e.prototype,`cancelTask`)):this._getPatchableEventTargets().forEach(e=>{k(e.addEventListener)&&this._unwrap(e,`addEventListener`),k(e.removeEventListener)&&this._unwrap(e,`removeEventListener`)}),this._unpatchHistoryApi()}_getZoneWithPrototype(){return window.Zone}},to=`open-knowledge-app`,no=!1;function ro(){return{BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.53.1`}?.VITE_OTEL_COLLECTOR_URL??`http://localhost:14318`}function io(){if(no)return;no=!0;let e=null,t=!1;try{let n=ro(),r={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.53.1`};e=new qi({resource:Zr({[Je]:`open-knowledge-app`,[Ye]:r?.VITE_APP_VERSION??`dev`,[Re]:r?.MODE??`dev`}),spanProcessors:[new Ui(new fn({url:`${n}/v1/traces`}),{maxExportBatchSize:50,scheduledDelayMillis:2e3})]}),e.register(),t=!0,Cn({instrumentations:[new sa,new eo({eventNames:[`click`,`submit`]}),new qa({propagateTraceHeaderCorsUrls:[/^https?:\/\/localhost(:\d+)?\/api\//,/^https?:\/\/127\.0\.0\.1(:\d+)?\/api\//,/^\/api\//],clearTimingResources:!0})]}),console.info(`[otel] frontend telemetry initialized — OTLP/HTTP → ${n}/v1/traces`)}catch(n){console.warn(`[otel] frontend telemetry init failed — continuing without`,n),t&&e&&e.shutdown().catch(()=>{}),no=!1}}function ao(){return f.getTracer(to)}export{ao as getAppTracer,io as install};
@@ -1 +1 @@
1
- import{n as e,t}from"./propagation-api-PBYTadVM.js";import{n}from"./startup-marks-CTM7uDIJ.js";import{getAppTracer as r}from"./telemetry-impl-DSYzVKpq.js";var i;function a(){if(!i)try{let a=typeof window<`u`?window.okDesktop?.config.startupTraceparent:void 0;if(!a)return;let o=t.extract(e.active(),{traceparent:a}),s=r().startSpan(`ok.app-startup`,void 0,o);i=s,n(e=>{try{s.end(e)}catch{}i=void 0})}catch{}}export{a as initStartupTrace};
1
+ import{n as e,t}from"./propagation-api-PBYTadVM.js";import{n}from"./startup-marks-CTM7uDIJ.js";import{getAppTracer as r}from"./telemetry-impl-CyzYpIO_.js";var i;function a(){if(!i)try{let a=typeof window<`u`?window.okDesktop?.config.startupTraceparent:void 0;if(!a)return;let o=t.extract(e.active(),{traceparent:a}),s=r().startSpan(`ok.app-startup`,void 0,o);i=s,n(e=>{try{s.end(e)}catch{}i=void 0})}catch{}}export{a as initStartupTrace};
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{t as r}from"./dist-DUfEoSbR.js";import{n as i}from"./dist-B6jB2qbD2.js";var a=e(t(),1),o=n(),s=`ok-acp-agent-settings-v1`;function c(e){return`${e.source}:${e.id}`}function l(){try{let e=localStorage.getItem(s);if(e===null)return{};let t=JSON.parse(e);return typeof t==`object`&&t?t:{}}catch{return{}}}function u(e){try{localStorage.setItem(s,JSON.stringify(e))}catch(e){console.warn(`[acp-settings] could not persist agent settings`,e)}}function d(e,t,n){let r=l(),i=r[e]??{};r[e]={...i,config:{...i.config,[t]:n}},u(r)}function f(e){let t=l()[e]?.config;if(typeof t!=`object`||!t)return;let n={};for(let[e,r]of Object.entries(t))(typeof r==`string`||typeof r==`boolean`)&&(n[e]=r);return Object.keys(n).length>0?n:void 0}function p(e,t){if(t===``)return;let n=l();n[e]={...n[e]??{},modeId:t},u(n)}function m(e){let t=l()[e]?.modeId;return typeof t==`string`&&t!==``?t:void 0}var h=64e3;function g(e){if(typeof e!=`object`||!e)return null;let t=e;return t.type===`text`&&typeof t.text==`string`?t.text:null}var _=class{items=[];plan=[];turnActive=!1;tokenUsage=null;terminals={};toolCallIndex=new Map;permissionIndex=new Map;permissionByToolCall=new Map;permissionsByToolCall={};messageIndex=new Map;runtimeConsentIndex=new Map;lastConsentIndex=null;appliedCount=0;dirty=!1;snapshot={items:[],plan:[],turnActive:!1,tokenUsage:null,terminals:{},permissionsByToolCall:{}};sync(e){e.length<this.appliedCount&&this.reset();for(let t=this.appliedCount;t<e.length;t++)this.applyEvent(e[t]);return this.appliedCount=e.length,this.dirty&&=(this.snapshot={items:[...this.items],plan:this.plan,turnActive:this.turnActive,tokenUsage:this.tokenUsage,terminals:{...this.terminals},permissionsByToolCall:{...this.permissionsByToolCall}},!1),this.snapshot}reset(){this.items=[],this.plan=[],this.turnActive=!1,this.tokenUsage=null,this.terminals={},this.toolCallIndex=new Map,this.permissionIndex=new Map,this.permissionByToolCall=new Map,this.permissionsByToolCall={},this.messageIndex=new Map,this.runtimeConsentIndex=new Map,this.lastConsentIndex=null,this.appliedCount=0,this.dirty=!0}applyEvent(e){switch(this.dirty=!0,e.kind){case`user_message`:{let t={kind:`message`,role:`user`,text:e.content,messageId:`user-${this.items.length}`};e.attachments!==void 0&&e.attachments.length>0&&(t.attachments=e.attachments),this.items.push(t),this.messageIndex.clear();break}case`turn_started`:this.turnActive=!0;break;case`turn_ended`:this.turnActive=!1,this.messageIndex.clear();break;case`status`:if(e.status===`exited`&&(this.turnActive=!1),this.lastConsentIndex!==null){let t=this.items[this.lastConsentIndex];t?.kind===`runtime_consent`&&t.install===`running`&&(e.status===`spawning`||e.status===`ready`||e.status===`running`?this.items[this.lastConsentIndex]={...t,install:`done`}:(e.status===`error`||e.status===`exited`)&&(this.items[this.lastConsentIndex]={...t,install:`failed`}))}(e.status===`error`||e.status===`auth_required`)&&(e.failure!==void 0||(e.detail??``)!==``)&&this.items.push({kind:`notice`,text:e.detail??``,tone:e.status===`error`?`error`:`info`,failure:e.failure??null});break;case`permission_request`:{let t=e.toolCall.toolCallId??null,n={kind:`permission`,requestId:e.requestId,title:e.toolCall.title??r._({id:`Ya3PlJ`}),toolKind:e.toolCall.kind??`other`,options:e.options,resolved:null,toolCallId:t,mergedIntoToolCall:t!==null&&this.toolCallIndex.has(t)};this.permissionIndex.set(e.requestId,this.items.length),t!==null&&(this.permissionByToolCall.set(t,this.items.length),this.permissionsByToolCall[t]=n),this.items.push(n);break}case`permission_resolved`:{let t=this.permissionIndex.get(e.requestId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`permission`)break;let r={...n,resolved:{optionId:e.optionId,auto:e.auto}};this.items[t]=r,r.toolCallId!==null&&(this.permissionsByToolCall[r.toolCallId]=r);break}case`runtime_consent_request`:this.runtimeConsentIndex.set(e.requestId,this.items.length),this.lastConsentIndex=this.items.length,this.items.push({kind:`runtime_consent`,requestId:e.requestId,runtime:e.runtime,displayName:e.displayName,provides:e.provides,version:e.version,approxSizeMB:e.approxSizeMB,sourceHost:e.sourceHost,agentName:e.agentName,resolved:null,install:null,progress:null});break;case`runtime_consent_resolved`:{let t=this.runtimeConsentIndex.get(e.requestId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`runtime_consent`)break;this.items[t]={...n,resolved:e.decision,install:e.decision===`granted`?`running`:null};break}case`runtime_install_progress`:{if(this.lastConsentIndex===null)break;let t=this.items[this.lastConsentIndex];if(t===void 0||t.kind!==`runtime_consent`)break;this.items[this.lastConsentIndex]={...t,progress:{receivedBytes:e.receivedBytes??0,totalBytes:e.totalBytes??null}};break}case`terminal_created`:this.terminals[e.terminalId]={terminalId:e.terminalId,command:e.command,args:e.args,output:``,truncated:!1,exit:null};break;case`terminal_output`:{let t=this.terminals[e.terminalId];if(t===void 0)break;let n=t.output+e.chunk,r=t.truncated;n.length>h&&(n=n.slice(-h),r=!0),this.terminals[e.terminalId]={...t,output:n,truncated:r};break}case`terminal_exit`:{let t=this.terminals[e.terminalId];if(t===void 0)break;this.terminals[e.terminalId]={...t,exit:{exitCode:e.exitCode,signal:e.signal}};break}case`session_update`:this.applyUpdate(e.update);break;default:break}}mergePermissionInto(e){let t=this.permissionByToolCall.get(e);if(t===void 0)return;let n=this.items[t];if(n===void 0||n.kind!==`permission`||n.mergedIntoToolCall)return;let r={...n,mergedIntoToolCall:!0};this.items[t]=r,this.permissionsByToolCall[e]=r}pushMessageChunk(e,t,n){let r=`${e}:${t}`,i=this.messageIndex.get(r);if(i!==void 0&&i===this.items.length-1){let e=this.items[i];this.items[i]={...e,text:e.text+n};return}this.messageIndex.set(r,this.items.length),this.items.push({kind:`message`,role:e,text:n,messageId:t})}applyUpdate(e){switch(e.sessionUpdate){case`agent_message_chunk`:{let t=g(e.content);t!==null&&this.pushMessageChunk(`agent`,y(e),t);break}case`agent_thought_chunk`:{let t=g(e.content);t!==null&&this.pushMessageChunk(`thought`,y(e),t);break}case`user_message_chunk`:{let t=g(e.content);t!==null&&this.pushMessageChunk(`user`,y(e),t);break}case`tool_call`:{let t={kind:`tool_call`,toolCallId:e.toolCallId,title:e.title??r._({id:`EvIJVD`}),toolKind:e.kind??`other`,status:e.status??`pending`,diffs:[],terminalIds:[],content:[],locations:b(e.locations),rawInput:e.rawInput};x(t,e.content),this.toolCallIndex.set(e.toolCallId,this.items.length),this.items.push(t),this.mergePermissionInto(e.toolCallId);break}case`tool_call_update`:{let t=this.toolCallIndex.get(e.toolCallId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`tool_call`)break;let r={...n,diffs:[...n.diffs],terminalIds:[...n.terminalIds],content:[...n.content]};e.status&&(r.status=e.status),e.title&&(r.title=e.title),e.locations&&(r.locations=b(e.locations));let i=e.rawInput;i!==void 0&&(r.rawInput=i),x(r,e.content),this.items[t]=r;break}case`plan`:{let t=e.entries;Array.isArray(t)&&(this.plan=t.map(e=>e).filter(e=>typeof e.content==`string`).map(e=>({content:e.content,priority:typeof e.priority==`string`?e.priority:void 0,status:typeof e.status==`string`?e.status:void 0})));break}case`usage_update`:{let t=e;this.tokenUsage={used:typeof t.used==`number`?t.used:void 0,size:typeof t.size==`number`?t.size:void 0};break}default:{let t=e.usage;t!==void 0&&(this.tokenUsage={used:t.used,size:t.size});break}}}};function v(e){let t=e.resolved;if(t===null)return null;if(t.optionId===null)return t.auto?{kind:`dismissed`}:{kind:`denied`,auto:!1,optionName:null};let n=e.options.find(e=>e.optionId===t.optionId);if(n===void 0)return{kind:`dismissed`};let r=n.kind.startsWith(`reject`),i=n.kind.startsWith(`allow`);return!r&&!i?{kind:`dismissed`}:{kind:r?`denied`:`approved`,auto:t.auto,optionName:n.name}}function y(e){let t=e.messageId;return typeof t==`string`?t:`default`}function b(e){return Array.isArray(e)?e.map(e=>e).filter(e=>typeof e.path==`string`).map(e=>({path:e.path,line:typeof e.line==`number`?e.line:void 0})):[]}function x(e,t){if(Array.isArray(t))for(let n of t){let t=n;if(t.type===`diff`&&typeof t.path==`string`&&typeof t.newText==`string`)e.diffs.push({path:t.path,oldText:typeof t.oldText==`string`?t.oldText:null,newText:t.newText});else if(t.type===`terminal`&&typeof t.terminalId==`string`)e.terminalIds.includes(t.terminalId)||e.terminalIds.push(t.terminalId);else if(t.type===`content`){let n=g(t.content);n!==null&&e.content.push(n)}else{let n=g(t);n!==null&&e.content.push(n)}}}var S=500,C=15e3,w=3e4,T=9e4,E=9e4,D=18e4,O=8e3,k=1e4,A=class extends Error{code;constructor(e,t){super(t),this.name=`ThreadResumeError`,this.code=e}},j=class extends Error{constructor(){super(`agent-thread channel is not connected`),this.name=`ThreadChannelUnavailableError`}},M=class{url=null;ws=null;reconnectDelay=S;reconnectTimer=null;threads=new Map;listeners=new Set;pendingCreates=new Map;pendingResumes=new Map;pendingRetries=new Map;pendingAuths=new Map;pendingQueueEdits=new Map;openedArchived=new Set;reqCounter=0;status=`idle`;version=0;setUrl(e){e!==this.url&&(this.url=e,this.teardownSocket(),e===null?this.setStatus(`idle`):this.connect())}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));threadsSnapshot=[];threadsSnapshotVersion=-1;getThreads=()=>(this.threadsSnapshotVersion!==this.version&&(this.threadsSnapshot=[...this.threads.values()].map(e=>e.info).sort((e,t)=>e.createdAt-t.createdAt),this.threadsSnapshotVersion=this.version),this.threadsSnapshot);openTabsSnapshot=[];openTabsSnapshotVersion=-1;getOpenTabs=()=>(this.openTabsSnapshotVersion!==this.version&&(this.openTabsSnapshot=[...this.threads.values()].map(e=>e.info).filter(e=>e.archived!==!0||this.openedArchived.has(e.threadId)).sort((e,t)=>e.createdAt-t.createdAt),this.openTabsSnapshotVersion=this.version),this.openTabsSnapshot);archivedSnapshot=[];archivedSnapshotVersion=-1;getArchivedThreads=()=>(this.archivedSnapshotVersion!==this.version&&(this.archivedSnapshot=[...this.threads.values()].map(e=>e.info).filter(e=>e.archived===!0).sort((e,t)=>t.lastActivityAt-e.lastActivityAt),this.archivedSnapshotVersion=this.version),this.archivedSnapshot);getThread=e=>this.threads.get(e)??null;modelBuilders=new Map;getThreadModel=e=>{let t=this.threads.get(e);if(t===void 0)return null;let n=this.modelBuilders.get(e);return n===void 0&&(n=new _,this.modelBuilders.set(e,n)),n.sync(t.events)};getConnectionStatus=()=>this.status;async createThread(e){this.connectNow(),await this.waitForOpen(O),this.reqCounter+=1;let t=`create-${this.reqCounter}`,n=new Promise((e,n)=>{let r=setTimeout(()=>{this.pendingCreates.delete(t),n(Error(`thread creation timed out`))},w);this.pendingCreates.set(t,{resolve:e,reject:n,timer:r})}),r=c(e.agent),i=f(r),a=m(r),o=i!==void 0||a!==void 0?{...i===void 0?{}:{config:i},...a===void 0?{}:{modeId:a}}:void 0;return this.send({op:`create`,reqId:t,...e,...o===void 0?{}:{settings:o}}),n}prompt(e,t,n){let r=t.trim(),i=n!==void 0&&n.length>0;r===``&&!i||(this.reqCounter+=1,this.send({op:`prompt`,threadId:e,reqId:`prompt-${this.reqCounter}`,content:r,...i?{attachments:n}:{}}))}steer(e,t,n){let r=t.trim(),i=n!==void 0&&n.length>0;r===``&&!i||(this.reqCounter+=1,this.send({op:`steer`,threadId:e,reqId:`steer-${this.reqCounter}`,content:r,...i?{attachments:n}:{}}))}editQueued(e,t,n){let r=n.trim();if(r===``)return Promise.resolve();this.reqCounter+=1;let i=`queue-edit-${this.reqCounter}`,a=new Promise((e,t)=>{let n=setTimeout(()=>{this.pendingQueueEdits.delete(i),e()},k);this.pendingQueueEdits.set(i,{resolve:e,reject:t,timer:n})});return this.send({op:`queue_edit`,threadId:e,id:t,content:r,reqId:i}),a}holdQueued(e,t,n){this.send({op:`queue_hold`,threadId:e,id:t,held:n})}removeQueued(e,t){this.send({op:`queue_remove`,threadId:e,id:t})}respondPermission(e,t,n){this.send({op:`permission_response`,threadId:e,requestId:t,outcome:n})}respondRuntimeConsent(e,t,n){this.send({op:`runtime_consent_response`,threadId:e,requestId:t,outcome:n})}cancel(e){this.send({op:`cancel`,threadId:e})}setMode(e,t){this.send({op:`set_mode`,threadId:e,modeId:t})}renameThread(e,t){let n=t.trim();n!==``&&this.send({op:`rename`,threadId:e,title:n})}setConfigOption(e,t,n){this.send({op:`set_config_option`,threadId:e,configId:t,value:n})}closeThread(e){let t=this.threads.get(e);if(t?.info.archived===!0){this.send({op:`unsubscribe`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.set(e,{info:t.info,events:[],lastSeq:-1}),this.bump();return}this.send({op:`close`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.delete(e)&&this.bump()}openArchivedThread(e){let t=this.threads.get(e);t===void 0||t.info.archived!==!0||this.openedArchived.has(e)||(this.openedArchived.add(e),this.send({op:`subscribe`,threadId:e,sinceSeq:t.lastSeq+1}),this.bump())}deleteThread(e){this.send({op:`delete`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.delete(e)&&this.bump()}async resumeThread(e,t,n){this.connectNow(),await this.waitForOpen(O),this.reqCounter+=1;let r=`resume-${this.reqCounter}`,i=new Promise((e,t)=>{let n=setTimeout(()=>{this.pendingResumes.delete(r),t(new A(`timeout`,`resume timed out`))},T);this.pendingResumes.set(r,{resolve:e,reject:t,timer:n})});return this.send({op:`resume`,threadId:e,reqId:r,prompt:t,...n!==void 0&&n.length>0?{attachments:n}:{}}),i}async retryThread(e){this.connectNow(),await this.waitForOpen(O),this.reqCounter+=1;let t=`retry-${this.reqCounter}`,n=new Promise((e,n)=>{let r=setTimeout(()=>{this.pendingRetries.delete(t),n(Error(`retry timed out`))},E);this.pendingRetries.set(t,{resolve:e,reject:n,timer:r})});return this.send({op:`retry`,threadId:e,reqId:t}),n}async authenticateThread(e,t){this.connectNow(),await this.waitForOpen(O),this.reqCounter+=1;let n=`authenticate-${this.reqCounter}`,r=new Promise((e,t)=>{let r=setTimeout(()=>{this.pendingAuths.delete(n),t(Error(`sign-in timed out`))},D);this.pendingAuths.set(n,{resolve:e,reject:t,timer:r})});return this.send({op:`authenticate`,threadId:e,reqId:n,methodId:t}),r}connectNow(){this.url===null||this.ws!==null||(this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnectDelay=S,this.connect())}waitForOpen(e){return this.ws!==null&&this.ws.readyState===WebSocket.OPEN?Promise.resolve():new Promise((t,n)=>{let r=e=>{clearTimeout(a),i(),e?t():n(new j)},i=this.subscribe(()=>{this.ws!==null&&this.ws.readyState===WebSocket.OPEN&&r(!0)}),a=setTimeout(()=>r(!1),e)})}connect(){if(this.url===null)return;this.setStatus(`connecting`);let e;try{e=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws=e,e.onopen=()=>{if(this.ws===e){this.reconnectDelay=S,this.setStatus(`open`),this.send({op:`list`});for(let[e,t]of this.threads)t.info.archived===!0&&!this.openedArchived.has(e)||this.send({op:`subscribe`,threadId:e,sinceSeq:t.lastSeq+1})}},e.onmessage=t=>{if(this.ws!==e||typeof t.data!=`string`)return;let n;try{n=JSON.parse(t.data)}catch{return}this.handleFrame(n)},e.onclose=()=>{this.ws===e&&(this.ws=null,this.setStatus(`closed`),this.scheduleReconnect())},e.onerror=()=>{}}teardownSocket(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);for(let e of this.pendingCreates.values())clearTimeout(e.timer),e.reject(new j);this.pendingCreates.clear();for(let e of this.pendingResumes.values())clearTimeout(e.timer),e.reject(new j);this.pendingResumes.clear();for(let e of this.pendingRetries.values())clearTimeout(e.timer),e.reject(new j);this.pendingRetries.clear();for(let e of this.pendingAuths.values())clearTimeout(e.timer),e.reject(new j);this.pendingAuths.clear();for(let e of this.pendingQueueEdits.values())clearTimeout(e.timer),e.resolve();this.pendingQueueEdits.clear();let e=this.ws;if(this.ws=null,e!==null)try{e.close()}catch{}}scheduleReconnect(){if(this.url===null||this.reconnectTimer!==null)return;let e=this.reconnectDelay;this.reconnectDelay=Math.min(this.reconnectDelay*2,C),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}send(e){let t=this.ws;if(!(t===null||t.readyState!==WebSocket.OPEN))try{t.send(JSON.stringify(e))}catch{}}handleFrame(e){switch(e.op){case`created`:{let t=this.pendingCreates.get(e.reqId);t!==void 0&&(this.pendingCreates.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`threads`:{let t=new Set;for(let n of e.threads){t.add(n.threadId);let e=this.threads.has(n.threadId);this.upsertInfo(n),!e&&n.archived!==!0&&this.send({op:`subscribe`,threadId:n.threadId,sinceSeq:0})}let n=!1;for(let e of Array.from(this.threads.keys()))t.has(e)||(this.threads.delete(e),this.modelBuilders.delete(e),this.openedArchived.delete(e),n=!0);n&&this.bump();return}case`resumed`:{let t=this.pendingResumes.get(e.reqId);t!==void 0&&(this.pendingResumes.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`retried`:{let t=this.pendingRetries.get(e.reqId);t!==void 0&&(this.pendingRetries.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`authenticated`:{let t=this.pendingAuths.get(e.reqId);t!==void 0&&(this.pendingAuths.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`subscribed`:this.upsertInfo(e.info);return;case`queue_edited`:{let t=this.pendingQueueEdits.get(e.reqId);t!==void 0&&(this.pendingQueueEdits.delete(e.reqId),clearTimeout(t.timer),t.resolve());return}case`info`:this.upsertInfo(e.info);return;case`event`:this.appendEvents(e.threadId,e.seq,[e.event]);return;case`events`:this.appendEvents(e.threadId,e.fromSeq,e.events);return;case`error`:if(e.reqId!==void 0){let t=this.pendingCreates.get(e.reqId);if(t!==void 0){this.pendingCreates.delete(e.reqId),clearTimeout(t.timer),t.reject(Error(e.message));return}let n=this.pendingResumes.get(e.reqId);if(n!==void 0){this.pendingResumes.delete(e.reqId),clearTimeout(n.timer),n.reject(new A(e.code,e.message));return}let a=this.pendingRetries.get(e.reqId);if(a!==void 0){this.pendingRetries.delete(e.reqId),clearTimeout(a.timer),a.reject(Error(e.message));return}let o=this.pendingAuths.get(e.reqId);if(o!==void 0){this.pendingAuths.delete(e.reqId),clearTimeout(o.timer),o.reject(Error(e.message));return}let s=this.pendingQueueEdits.get(e.reqId);if(s!==void 0){this.pendingQueueEdits.delete(e.reqId),clearTimeout(s.timer),s.reject(Error(e.message));return}if(e.reqId.startsWith(`prompt-`)||e.reqId.startsWith(`steer-`)){i.error(r._({id:`XNBGZw`,values:{0:e.message}}));return}}console.warn(`[agent-threads] server error frame:`,e.code,e.message);return;default:return}}appendEvents(e,t,n){let r=this.threads.get(e);if(r===void 0||n.length===0)return;let i=Math.max(r.lastSeq+1-t,0);if(i>=n.length)return;let a=i===0?n:n.slice(i),o=r.info;for(let e of a)o=N(o,e);this.threads.set(e,{info:o,events:[...r.events,...a],lastSeq:t+n.length-1}),this.bump()}upsertInfo(e){let t=this.threads.get(e.threadId);t===void 0?this.threads.set(e.threadId,{info:e,events:[],lastSeq:-1}):e.archived===!0&&t.info.archived!==!0?(this.openedArchived.delete(e.threadId),this.modelBuilders.delete(e.threadId),this.threads.set(e.threadId,{info:e,events:[],lastSeq:-1})):this.threads.set(e.threadId,{...t,info:e}),this.bump()}setStatus(e){this.status!==e&&(this.status=e,this.bump())}bump(){this.version+=1;for(let e of this.listeners)e()}};function N(e,t){switch(t.kind){case`status`:return{...e,status:t.status,lastActivityAt:t.ts};case`title_changed`:return{...e,title:t.title,lastActivityAt:t.ts};default:return{...e,lastActivityAt:t.ts}}}var P=new M;function F(){return P}function I(){return(0,a.useSyncExternalStore)(P.subscribe,P.getOpenTabs,P.getOpenTabs)}function L(){return(0,a.useSyncExternalStore)(P.subscribe,P.getArchivedThreads,P.getArchivedThreads)}function R(e){let t=(0,o.c)(2),n;t[0]===e?n=t[1]:(n=()=>P.getThread(e),t[0]=e,t[1]=n);let r=n;return(0,a.useSyncExternalStore)(P.subscribe,r,r)}function z(e){let t=(0,o.c)(2),n;t[0]===e?n=t[1]:(n=()=>P.getThreadModel(e),t[0]=e,t[1]=n);let r=n;return(0,a.useSyncExternalStore)(P.subscribe,r,r)}function B(){return(0,a.useSyncExternalStore)(P.subscribe,P.getConnectionStatus,P.getConnectionStatus)}function V(e){if(e===null)return null;try{let t=new URL(e);return t.pathname=`/collab/thread`,t.search=``,t.toString()}catch{return null}}export{R as a,L as c,c as d,d as f,V as i,I as l,A as n,B as o,p,F as r,z as s,j as t,v as u};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Ct as n,Dt as r,Hn as i,Ht as a,In as o,Tn as s,Wt as c,_n as l,_t as u,a as d,k as f,nt as p,tt as m,yt as h}from"./DocumentContext-CKR9tIsX.js";import{t as g}from"./react-f2sANaYj.js";import{n as _,r as v}from"./dist-Nvb76hAm.js";import{r as y,t as b}from"./useQuery-ZeEDLtxh.js";import{t as x}from"./compiler-runtime-BfE3aGVn.js";import{t as S}from"./utils-CPqDy6Hr.js";import{t as C}from"./button-CA0dewJJ.js";import{i as w,n as T,t as E}from"./tooltip-DHXgxWLL.js";import{n as D,r as O,t as k}from"./collapsible-COrqeoHr.js";import{M as A,T as j,it as M,nt as N,st as P}from"./CodeMirrorPropInput-DywYyBz8.js";import{n as F,t as I}from"./toggle-group-CZcn-1gX.js";import{F as L,Gn as R,Qa as z,To as B,Wn as V,en as H,ht as U,po as ee,tn as W,xi as G,yt as te}from"./dist-C27Q9mDy.js";import{o as ne}from"./use-settings-route-Di4sAvRi.js";import{t as K}from"./dist-DUfEoSbR.js";import{n as q}from"./dist-B6jB2qbD2.js";import{_ as re,d as ie}from"./documents-events-BsVKB80J.js";import{t as J}from"./createLucideIcon-Bhw2PmPp.js";import{t as Y}from"./chevron-right-Diamp-K_.js";import{n as ae,t as oe}from"./lint-plugin-meta-CsGPauME.js";import{r as se}from"./CopyButton-CKyZY1PL.js";import{i as ce,r as le}from"./prop-types-CxA_rPl_.js";import{t as ue}from"./refresh-cw-CR2QWccs.js";import{t as de}from"./triangle-alert-DV20-jn9.js";import{t as fe}from"./wrench-C3BL-uHg.js";import{f as pe,u as me}from"./doc-paths-BVBn68AJ.js";import{a as he,i as ge}from"./startup-marks-CTM7uDIJ.js";import{t as _e}from"./badge-BYteLKha.js";import{C as ve,D as ye}from"./config-provider-K5pliovj.js";import{$ as be,It as xe,Lt as Se,Ot as Ce,Y as we,Z as Te}from"./dist-sSZdzHur.js";import{a as Ee,c as De,i as Oe,n as ke,r as Ae,s as je,t as Me}from"./panel-D2VXQC58.js";import{t as X}from"./skeleton-BOVIbSHk.js";import{a as Ne,c as Pe,d as Fe}from"./lint-config-client-kEetoezQ.js";var Ie=J(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Le=56,Re=2,ze=150,Be=2e3;function Ve(e,t,n){return e.top+e.height/2-(n+t)/2}function He(e,t){let n=Math.max(0,t.scrollHeight-t.clientHeight);return Math.max(0,Math.min(e,n))}function Ue(e){let{docName:t,container:i,measureTarget:a,placement:o,intent:s,grade:c,landedMode:l,transition:u,onOutcome:d,onDiscardQueuedTarget:f,toolbarOffset:p=Le,driftThresholdPx:m=Re,quietMs:g=ze,abandonAfterMs:_=Be}=e,v=e.contentColumn??i.firstElementChild,y=h(t),b=n(t,{yieldsToNavigation:s===`toggle`,supersede:()=>P(`superseded`)}),x=i.style.overflowAnchor;i.style.overflowAnchor=`none`,u&&he(`ok/mode-switch/transition`,{from:u.from,to:u.to,grade:c});let S=!1,C=null,w,T,E=0,D,O=()=>{let e=a();return e===null?null:He(o===`center`?Ve(e,i.clientHeight,p):e.top-p,i)},k=()=>{let e=O();if(e===null)return{measurable:!1,moved:!1};C=e;let t=Math.abs(i.scrollTop-e)>m;return t&&(i.scrollTop=e),{measurable:!0,moved:t}},A=()=>i.scrollTop-(O()??C??i.scrollTop),j=()=>{w&&clearTimeout(w),T&&clearTimeout(T),E&&cancelAnimationFrame(E),D?.disconnect(),i.removeEventListener(`wheel`,I),i.removeEventListener(`touchstart`,I),i.removeEventListener(`contentvisibilityautostatechange`,L,!0),i.style.overflowAnchor=x,y.release(),b.release()},M=()=>{if(S)return;S=!0;let e;try{k(),e=A(),C!==null&&r({docName:t,container:i,targetScrollTop:i.scrollTop,mode:l})}finally{j()}he(`ok/landing/land`,{grade:c,delta:e}),d?.({status:`landed`,delta:e})},N=()=>{if(S)return;S=!0;let e=C??i.scrollTop,t;try{t=A()}finally{j()}he(`ok/landing/abandoned`,{grade:c,target:e,delta:t}),d?.({status:`abandoned`,delta:t})},P=e=>{S||(S=!0,j(),e===`mode-flip`&&f?.(),d?.({status:`cancelled`,reason:e}))},F=()=>{w&&clearTimeout(w),w=setTimeout(M,g)};function I(){P(`user-scroll`)}function L(){if(S)return;let{measurable:e,moved:t}=k();e&&(t||w===void 0)&&F()}try{k().measurable&&F(),i.addEventListener(`contentvisibilityautostatechange`,L,!0),i.addEventListener(`wheel`,I,{passive:!0}),i.addEventListener(`touchstart`,I,{passive:!0}),typeof ResizeObserver<`u`&&v&&(D=new ResizeObserver(L),D.observe(v)),E=requestAnimationFrame(L),T=setTimeout(N,_)}catch(e){throw S=!0,j(),e}return{cancel:P}}function We(e){switch(e){case`bulletList`:case`orderedList`:case`taskList`:case`list`:return`list`;case`codeBlock`:case`code`:return`code`;case`horizontalRule`:case`thematicBreak`:return`thematicBreak`;case`jsxComponent`:case`mdxJsxFlowElement`:case`mdxJsxTextElement`:return`jsx`;case`htmlBlock`:case`html`:return`html`;default:return e}}function Ge(e){return typeof e!=`object`||!e?``:`value`in e&&typeof e.value==`string`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(Ge).join(``):``}function Ke(e,t){let{frontmatter:n,body:r}=B(e),i=n===``?0:n.split(`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Ct as n,Dt as r,Hn as i,Ht as a,In as o,Tn as s,Wt as c,_n as l,_t as u,a as d,k as f,nt as p,tt as m,yt as h}from"./DocumentContext-y4udwaSS.js";import{t as g}from"./react-f2sANaYj.js";import{n as _,r as v}from"./dist-Nvb76hAm.js";import{r as y,t as b}from"./useQuery-ZeEDLtxh.js";import{t as x}from"./compiler-runtime-BfE3aGVn.js";import{t as S}from"./utils-CPqDy6Hr.js";import{t as C}from"./button-CA0dewJJ.js";import{i as w,n as T,t as E}from"./tooltip-DHXgxWLL.js";import{n as D,r as O,t as k}from"./collapsible-COrqeoHr.js";import{M as A,T as j,it as M,nt as N,st as P}from"./CodeMirrorPropInput-B5_xejDl.js";import{n as F,t as I}from"./toggle-group-CZcn-1gX.js";import{F as L,Gn as R,Qa as z,To as B,Wn as V,en as H,ht as U,po as ee,tn as W,xi as G,yt as te}from"./dist-C27Q9mDy.js";import{o as ne}from"./use-settings-route-Di4sAvRi.js";import{t as K}from"./dist-DUfEoSbR.js";import{n as q}from"./dist-B6jB2qbD2.js";import{_ as re,d as ie}from"./documents-events-BsVKB80J.js";import{t as J}from"./createLucideIcon-Bhw2PmPp.js";import{t as Y}from"./chevron-right-Diamp-K_.js";import{n as ae,t as oe}from"./lint-plugin-meta-CsGPauME.js";import{r as se}from"./CopyButton-CKyZY1PL.js";import{i as ce,r as le}from"./prop-types-CxA_rPl_.js";import{t as ue}from"./refresh-cw-CR2QWccs.js";import{t as de}from"./triangle-alert-DV20-jn9.js";import{t as fe}from"./wrench-C3BL-uHg.js";import{f as pe,u as me}from"./doc-paths-BVBn68AJ.js";import{a as he,i as ge}from"./startup-marks-CTM7uDIJ.js";import{t as _e}from"./badge-BYteLKha.js";import{C as ve,D as ye}from"./config-provider-BEm_X5z4.js";import{$ as be,It as xe,Lt as Se,Ot as Ce,Y as we,Z as Te}from"./dist-sSZdzHur.js";import{a as Ee,c as De,i as Oe,n as ke,r as Ae,s as je,t as Me}from"./panel-D2VXQC58.js";import{t as X}from"./skeleton-BOVIbSHk.js";import{a as Ne,c as Pe,d as Fe}from"./lint-config-client-kEetoezQ.js";var Ie=J(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Le=56,Re=2,ze=150,Be=2e3;function Ve(e,t,n){return e.top+e.height/2-(n+t)/2}function He(e,t){let n=Math.max(0,t.scrollHeight-t.clientHeight);return Math.max(0,Math.min(e,n))}function Ue(e){let{docName:t,container:i,measureTarget:a,placement:o,intent:s,grade:c,landedMode:l,transition:u,onOutcome:d,onDiscardQueuedTarget:f,toolbarOffset:p=Le,driftThresholdPx:m=Re,quietMs:g=ze,abandonAfterMs:_=Be}=e,v=e.contentColumn??i.firstElementChild,y=h(t),b=n(t,{yieldsToNavigation:s===`toggle`,supersede:()=>P(`superseded`)}),x=i.style.overflowAnchor;i.style.overflowAnchor=`none`,u&&he(`ok/mode-switch/transition`,{from:u.from,to:u.to,grade:c});let S=!1,C=null,w,T,E=0,D,O=()=>{let e=a();return e===null?null:He(o===`center`?Ve(e,i.clientHeight,p):e.top-p,i)},k=()=>{let e=O();if(e===null)return{measurable:!1,moved:!1};C=e;let t=Math.abs(i.scrollTop-e)>m;return t&&(i.scrollTop=e),{measurable:!0,moved:t}},A=()=>i.scrollTop-(O()??C??i.scrollTop),j=()=>{w&&clearTimeout(w),T&&clearTimeout(T),E&&cancelAnimationFrame(E),D?.disconnect(),i.removeEventListener(`wheel`,I),i.removeEventListener(`touchstart`,I),i.removeEventListener(`contentvisibilityautostatechange`,L,!0),i.style.overflowAnchor=x,y.release(),b.release()},M=()=>{if(S)return;S=!0;let e;try{k(),e=A(),C!==null&&r({docName:t,container:i,targetScrollTop:i.scrollTop,mode:l})}finally{j()}he(`ok/landing/land`,{grade:c,delta:e}),d?.({status:`landed`,delta:e})},N=()=>{if(S)return;S=!0;let e=C??i.scrollTop,t;try{t=A()}finally{j()}he(`ok/landing/abandoned`,{grade:c,target:e,delta:t}),d?.({status:`abandoned`,delta:t})},P=e=>{S||(S=!0,j(),e===`mode-flip`&&f?.(),d?.({status:`cancelled`,reason:e}))},F=()=>{w&&clearTimeout(w),w=setTimeout(M,g)};function I(){P(`user-scroll`)}function L(){if(S)return;let{measurable:e,moved:t}=k();e&&(t||w===void 0)&&F()}try{k().measurable&&F(),i.addEventListener(`contentvisibilityautostatechange`,L,!0),i.addEventListener(`wheel`,I,{passive:!0}),i.addEventListener(`touchstart`,I,{passive:!0}),typeof ResizeObserver<`u`&&v&&(D=new ResizeObserver(L),D.observe(v)),E=requestAnimationFrame(L),T=setTimeout(N,_)}catch(e){throw S=!0,j(),e}return{cancel:P}}function We(e){switch(e){case`bulletList`:case`orderedList`:case`taskList`:case`list`:return`list`;case`codeBlock`:case`code`:return`code`;case`horizontalRule`:case`thematicBreak`:return`thematicBreak`;case`jsxComponent`:case`mdxJsxFlowElement`:case`mdxJsxTextElement`:return`jsx`;case`htmlBlock`:case`html`:return`html`;default:return e}}function Ge(e){return typeof e!=`object`||!e?``:`value`in e&&typeof e.value==`string`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(Ge).join(``):``}function Ke(e,t){let{frontmatter:n,body:r}=B(e),i=n===``?0:n.split(`
2
2
  `).length-1;try{return{blocks:t.parseToEditorMdast(r).children.map(e=>({start:(e.position?.start.line??1/0)+i,end:(e.position?.end.line??-1/0)+i,kind:We(e.type),text:Ge(e)})),fmLineCount:i}}catch{return performance.mark(`ok/block-spans/parse-failed`),{blocks:[],fmLineCount:i}}}function qe(e,t){let{blocks:n,fmLineCount:r}=Ke(e,t);return{spans:n.map(e=>({start:e.start,end:e.end})),fmLineCount:r}}function Je(e,t){if(e.length===0)return null;let n=0,r=e.length-1,i=e.length-1;for(;n<=r;){let a=n+r>>1,o=e[a];o!==void 0&&o.end>=t?(i=a,r=a-1):n=a+1}return i}function Ye(e){let t=0;for(let n=e.childCount-1;n>=0;n--){let r=e.child(n);if(r.type.name!==`paragraph`||r.content.size!==0)break;t++}return t<2?e.childCount-t:e.childCount}function Xe(e,t,n){let r=e.childCount,i=Math.max(0,Math.min(t,r)),a=Math.max(i,Math.min(n,r));if(a<=i)return null;let o=0;for(let t=0;t<i;t++)o+=e.child(t).nodeSize;let s=o;for(let t=i;t<a;t++)o+=e.child(t).nodeSize;let c=o,l=e.content.size,u=Math.max(0,Math.min(s,l)),d=Math.max(u,Math.min(c,l));return d<=u?null:{from:u,to:d}}function Ze(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
3
3
  `&&t.push(n+1);return t}function Qe(e,t,n){return t<=1?0:t-1>=e.length?n:e[t-1]??n}function $e(e,t){let n=0,r=e.length-1,i=1;for(;n<=r;){let a=n+r>>1;(e[a]??0)<=t?(i=a+1,n=a+1):r=a-1}return i}function et(e,t,n){return Math.max(t,Math.min(e,n))}function tt(e,t){let n=e=>e.replace(/\s+/g,` `).trim();return n(e)===n(t)}function nt(e,t){return t.inRange?t.tripwireOk?tt(e.content,t.text)?`exact`:e.kind===t.kind?`same-type-ordinal`:`ordinal`:`ordinal`:`clamped`}function rt(e){let t=null,n=null;function r(r){return n!==null&&t===r?n:(n={blocks:Ke(r,e).blocks,lineStarts:Ze(r)},t=r,n)}return{captureFromWysiwyg(e,t,n){if(e.childCount===0)return null;let r=et(t,0,e.content.size),i=0,a=e.childCount-1,o=0;for(let t=0;t<e.childCount;t++){let n=e.child(t).nodeSize;if(r<i+n){a=t,o=i+1;break}i+=n,o=i+1}let s=e.child(a),c={blockIndex:a,kind:We(s.type.name),content:s.textContent};return n?.refine&&(c.selectionInBlock=Math.max(0,r-o)),c},captureFromSource(e,t,n){let{blocks:i,lineStarts:a}=r(e);if(i.length===0)return null;let o=et(t,0,e.length),s=Je(i,$e(a,o));if(s===null)return null;let c=i[s];if(!c)return null;let l={blockIndex:s,kind:c.kind,content:c.text};if(n?.refine){let t=Qe(a,c.start,e.length);l.selectionInBlock=Math.max(0,o-t)}return l},resolveInSource(e,{source:t,doc:n}){let{blocks:i,lineStarts:a}=r(t);if(i.length===0)return null;let o=e.blockIndex>=0&&e.blockIndex<i.length,s=Ye(n)===i.length,c=i[et(e.blockIndex,0,i.length-1)],l=Qe(a,c.start,t.length),u=Math.min(Qe(a,c.end+1,t.length),t.length),d=nt(e,{inRange:o,tripwireOk:s,kind:c.kind,text:c.text}),f=l;return d===`exact`&&e.selectionInBlock!==void 0&&(f=et(l+e.selectionInBlock,l,u)),{blockStart:l,blockEnd:u,point:f,confidence:d}},resolveInWysiwyg(e,{source:t,doc:n}){let i=Ye(n);if(i===0)return null;let{blocks:a}=r(t),o=e.blockIndex>=0&&e.blockIndex<i,s=i===a.length,c=et(e.blockIndex,0,i-1),l=Xe(n,c,c+1);if(l===null)return null;let u=n.child(c),d=nt(e,{inRange:o,tripwireOk:s,kind:We(u.type.name),text:u.textContent});return{blockStart:l.from,blockEnd:l.to,point:l.from,confidence:d}}}}var it=xe.define(),at=xe.define(),ot=we.mark({class:m}),st=Se.define({create(){return we.none},update(e,t){let n=e.map(t.changes);for(let e of t.effects)e.is(it)?n=we.set([ot.range(e.value.from,e.value.to)]):e.is(at)&&(n=we.none);return n},provide:e=>Te.decorations.from(e)}),ct=new WeakMap,lt=be.define(e=>({destroy(){let t=ct.get(e);t!==void 0&&(clearTimeout(t),ct.delete(e))}}));function ut(e,t,n,r){let i=p(e.state.doc.length,t,n,r);if(!i)return;e.dispatch({effects:it.of(i)});let a=ct.get(e);a!==void 0&&clearTimeout(a);let o=setTimeout(()=>{ct.delete(e),e.dispatch({effects:at.of(null)})},L);ct.set(e,o)}function dt(){return[st,lt]}var ft=3e4;function pt(){let e=new Map,t=e=>e?Date.now()-e.rememberedAt>ft?null:e.navigation:null;return{remember(t,n){e.set(t,{navigation:n,rememberedAt:Date.now()})},peek(n){return t(e.get(n))},consume(n){let r=e.get(n);return e.delete(n),t(r)},clear(t){e.delete(t)},clearForTest(){e.clear()}}}var mt=pt(),ht=pt(),gt=mt.remember,_t=mt.peek,vt=mt.consume,yt=mt.clear;mt.clearForTest;var bt=ht.remember,xt=ht.peek,St=ht.consume,Ct=ht.clear;ht.clearForTest;function wt(e,t,n){return{start:ye(e,t),end:ye(e,n)}}function Tt(e,t){let n=ve(e.start,t),r=ve(e.end,t);return n===null||r===null||r.index<=n.index?null:n.index}var Et=`open-knowledge:view-in-source`,Dt=56,Ot=null;function kt(){return Ot??=rt(j()),Ot}function At(e,t,n,r,i=`toggle`){let a=r.captureFromWysiwyg(e,t,{refine:i===`jump`});if(!a)return null;let o=r.resolveInSource(a,{source:n.toString(),doc:e});return{kind:`selection-offset`,intent:i,anchor:a,pin:o?wt(n,o.blockStart,o.blockEnd):void 0}}function jt(e){let{editor:t,docName:n,ytext:r}=e,i=N(t);if(!i)return;let a=i.state.selection.from,o=At(i.state.doc,a,r,kt(),`jump`);o&&gt(n,o),window.dispatchEvent(new CustomEvent(Et,{detail:{docName:n}}))}function Mt(e,t,n,r,i){let a=r.captureFromSource(e,t);if(!a)return null;let o=i?r.resolveInSource(a,{source:e,doc:i}):null;return{kind:`selection-offset`,anchor:a,pin:o?wt(n,o.blockStart,o.blockEnd):void 0}}function Nt(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=Tt(e.pin,i);if(t===null){let t=a.resolveInWysiwyg(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInWysiwyg(o,{source:n,doc:r})}return a.resolveInWysiwyg(e.anchor,{source:n,doc:r})}function Pt(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=Tt(e.pin,i);if(t===null){let t=a.resolveInSource(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInSource(o,{source:n,doc:r})}return a.resolveInSource(e.anchor,{source:n,doc:r})}function Ft(e,t){try{return e.coordsAtPos(t)}catch{return null}}function It(e,t,n){let r=Math.max(0,Math.min(n,e.state.doc.length)),i=t.getBoundingClientRect().top,a=Ft(e,r);if(a)return{top:a.top-i+t.scrollTop,height:a.bottom-a.top};try{let n=e.lineBlockAt(r);return{top:e.documentTop-i+t.scrollTop+n.top,height:n.height}}catch{return null}}function Lt(e,t){if(e.isDestroyed)return null;try{let n=e.nodeDOM(t);if(n instanceof HTMLElement)return n;let{node:r}=e.domAtPos(t);return r instanceof HTMLElement?r:r.parentElement}catch{return null}}function Rt(e,t,n){if(e.isDestroyed)return null;let r=Lt(e,Math.max(0,Math.min(n,e.state.doc.content.size)));if(!r)return null;let i=r.getBoundingClientRect(),a=t.getBoundingClientRect().top;return{top:i.top-a+t.scrollTop,height:i.height}}function zt(){return typeof document>`u`?null:u()}function Bt(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2;for(let t of[Dt+1,Dt+12,Dt+40]){let i=e.posAtCoords({left:r,top:n.top+t});if(i)return i.pos}return null}function Vt(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2;for(let t of[Dt+1,Dt+12,Dt+40]){let i=e.posAtCoords({x:r,y:n.top+t});if(i!==null)return i}return null}function Ht(e){let{from:t,to:n,docName:r,ytext:i}=e;t===`wysiwyg`&&n===`source`?Ut(r,i):t===`source`&&n===`wysiwyg`&&Wt(r,i)}function Ut(e,t){let n=_t(e);if(n&&n.kind!==`selection-offset`)return;let r=l(e);if(!r)return;let i=N(r);if(!i)return;let a=zt();if(!a)return;let o=Bt(i,a);if(o===null)return;let s=At(i.state.doc,o,t,kt());s&&gt(e,s)}function Wt(e,t){let n=a(e);if(!n)return;let r=zt();if(!r)return;let i=Vt(n,r);if(i===null)return;let o=l(e),s=o?N(o)?.state.doc:void 0,c=Mt(t.toString(),i,t,kt(),s);c&&bt(e,c)}function Gt(e){let{view:t,docName:r,navigation:i,ydoc:a,transition:o}=e,s=l(r),c=s?N(s)?.state.doc:void 0;if(!c)return null;let u=Pt(i,{source:t.state.doc.toString(),pmDoc:c,ydoc:a,resolver:kt()});if(!u)return null;let d=zt();if(!d)return null;let f=u,p=i.intent===`jump`,m=p?f.point:f.blockStart;t.dispatch({effects:Te.scrollIntoView(m,{y:`start`})});let h=!1,g=null,_=n(r,{yieldsToNavigation:!p,supersede:()=>{h=!0,_.release()}}),v=e=>{if(!h){if(Ft(t,m)===null&&e<8){requestAnimationFrame(()=>v(e+1));return}try{p&&(t.dispatch({selection:Ce.cursor(m)}),t.focus())}finally{_.release()}g=Ue({docName:r,container:d,contentColumn:t.contentDOM,measureTarget:()=>It(t,d,m),placement:p?`center`:`top`,intent:p?`jump`:`toggle`,grade:f.confidence,landedMode:`source`,transition:o,toolbarOffset:Dt,onOutcome:p?e=>{e.status===`landed`&&ut(t,f.blockStart,f.blockEnd,f.confidence)}:void 0,onDiscardQueuedTarget:()=>yt(r)})}};return v(0),{cancel:e=>{h=!0,_.release(),g?.cancel(e)}}}function Kt(e){let{editor:t,docName:n,navigation:r,ydoc:i,transition:a}=e,o=N(t);if(!o)return null;let s=Nt(r,{source:i.getText(`source`).toString(),pmDoc:o.state.doc,ydoc:i,resolver:kt()});if(!s)return null;let c=zt();if(!c)return null;let l=s;return Ue({docName:n,container:c,contentColumn:o.dom,measureTarget:()=>Rt(o,c,l.point),placement:`top`,intent:`toggle`,grade:l.confidence,landedMode:`wysiwyg`,transition:a,toolbarOffset:Dt,onDiscardQueuedTarget:()=>Ct(n)})}var Z=e(g(),1),Q=x(),$=t();function qt(e){let t=(0,Q.c)(14),{scope:n,onScopeChange:r,projectLabel:i}=e,{_:a}=v(),o;t[0]===r?o=t[1]:(o=e=>{e&&r(e)},t[0]=r,t[1]=o);let s;t[2]===a?s=t[3]:(s=a({id:`aBgwis`}),t[2]=a,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(F,{value:`doc`,className:`flex-1`,"data-testid":`panel-scope-doc`,children:(0,$.jsx)(_,{id:`UpCz01`})}),t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=i??(0,$.jsx)(_,{id:`e0NrBM`}),t[5]=i,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,$.jsx)(F,{value:`project`,className:`flex-1`,"data-testid":`panel-scope-project`,children:l}),t[7]=l,t[8]=u);let d;return t[9]!==n||t[10]!==o||t[11]!==s||t[12]!==u?(d=(0,$.jsx)(`div`,{className:`shrink-0 px-4 pb-2`,children:(0,$.jsxs)(I,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,value:n,onValueChange:o,"aria-label":s,className:`w-full rounded-md bg-muted p-0.5 dark:bg-background`,children:[c,u]})}),t[9]=n,t[10]=o,t[11]=s,t[12]=u,t[13]=d):d=t[13],d}function Jt(e){let t=e.localTarget;if(e.source!==`links`||t===void 0)return e.message;let n=t.resolvedTarget??t.href;return t.reason===`unresolvable`?t.role===`image`?K._({id:`W5qdI_`,values:{shown:n}}):K._({id:`bpMVIA`,values:{shown:n}}):t.targetKind===`file`?t.role===`image`?K._({id:`iSWh95`,values:{shown:n}}):K._({id:`fOzzSV`,values:{shown:n}}):K._({id:`XBBZnv`,values:{shown:n}})}var Yt=`audit-superseded`;async function Xt(e={kind:`project`},t){return Qt(e,W,!1,t)}async function Zt(e={kind:`project`},t){return Qt(e,H,!0,t)}async function Qt(e,t,n,r){try{let i=new URLSearchParams;e.kind===`path`?i.set(`path`,e.path):e.kind===`doc`&&i.set(`doc`,e.docName),n&&i.set(`counts`,`1`);let a=i.size===0?``:`?${i}`,o=await fetch(`/api/audit${a}`,r===void 0?void 0:{signal:r});if(!o.ok)return o.status===409?Yt:(console.warn(`[audit] request failed`,o.status,o.statusText),null);let s;try{s=await o.json()}catch{return r?.aborted===!0||console.warn(`[audit] response body is not valid JSON`),null}let c=t.safeParse(s);return c.success?c.data:(console.warn(`[audit] response failed schema validation`,c.error.issues),null)}catch(e){return r?.aborted===!0||console.warn(`[audit] fetch threw`,e),null}}function $t(e,t){let n=!1,r=!1,i=!1,a=[],o=null,s=()=>{if(r){i=!0;return}r=!0,o=new AbortController,t({status:`loading`,findings:a}),Xt({kind:`doc`,docName:e},o.signal).then(e=>{if(!(n||o?.signal.aborted===!0)){if(e===null){t({status:`failed`,findings:a});return}if(e===`audit-superseded`){i=!0;return}i||(a=e.files.flatMap(e=>e.diagnostics).filter(e=>e.source===`links`),t({status:`loaded`,findings:a}))}}).finally(()=>{n||(r=!1,o=null,i&&(i=!1,s()))})};s();let c=re(e=>{(e.includes(`backlinks`)||ie(e))&&s()});return()=>{n=!0,o?.abort(),c()}}function en(e){let t=(0,Q.c)(6),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={docName:null,state:{status:`idle`,findings:[]}},t[0]=n):n=t[0];let[r,i]=(0,Z.useState)(n),a,o;if(t[1]===e?(a=t[2],o=t[3]):(a=()=>{if(e===null){i({docName:null,state:{status:`idle`,findings:[]}});return}return i({docName:e,state:{status:`loading`,findings:[]}}),$t(e,t=>i({docName:e,state:t}))},o=[e],t[1]=e,t[2]=a,t[3]=o),(0,Z.useEffect)(a,o),r.docName!==e){let n;return t[4]===e?n=t[5]:(n=e===null?{status:`idle`,findings:[]}:{status:`loading`,findings:[]},t[4]=e,t[5]=n),n}return r.state}function tn(e){return Math.min(50,Math.max(1,Math.ceil(e/10)))}function nn(e,t){return e===t||e%tn(t)===0}var rn=[250,500,1e3,2e3,4e3];function an(e){return e.status===503&&e.problemType===`urn:ok:error:too-many-agent-sessions`}async function on(e,t){let n=await t.fixItem(e);for(let r of rn){if(n.ok||!an(n)||!t.shouldContinue()||(console.debug(`[sweep] capacity refusal, backing off %dms`,r),await t.sleep(r),!t.shouldContinue()))break;n=await t.fixItem(e)}return n}async function sn(e){let t=e.items.length,n=[];for(let[r,i]of e.items.entries()){if(r>0&&(await e.sleep(15),!e.shouldContinue()))return{failures:n,cancelled:!0};let a=await on(i,e);if(a.ok||n.push({item:i,detail:a.errorDetail}),!e.shouldContinue())return{failures:n,cancelled:!0};let o=r+1;nn(o,t)&&e.onProgress(o,t)}return{failures:n,cancelled:!1}}function cn(e){return new Promise(t=>setTimeout(t,e))}var ln=null,un=!1,dn=new Set,fn=new Set;function pn(e){ln=e;for(let e of dn)e()}function mn(e){return dn.add(e),()=>{dn.delete(e)}}function hn(){return ln}function gn(){return(0,Z.useSyncExternalStore)(mn,hn,hn)}function _n(e){return fn.add(e),()=>{fn.delete(e)}}function vn(){un=!0}function yn(e,t,n){if(e.length>0&&(console.warn(`[lint] fix-all: ${e.length} of ${n} files failed`,e.map(e=>({file:e.item.file,detail:e.detail}))),!t)){let t=e[0];q.error(K._({id:`se-tU0`,values:{0:e.length,total:n}}),{description:t===void 0?void 0:`${t.item.file}${t.detail===null?``:` — ${t.detail}`}`})}if(t){q.info(K._({id:`H1TmTu`}));return}e.length===0&&q.success(K._({id:`SWX1O7`,values:{total:n}}))}async function bn({items:e,fixItem:t,sleep:n=cn}){if(ln!==null||e.length===0)return;let r=e.length;un=!1,pn({done:0,total:r});let i=[],a=!1,o=!1;try{let o=await sn({items:e,fixItem:t,sleep:n,onProgress:e=>pn({done:e,total:r}),shouldContinue:()=>!un});i=o.failures,a=o.cancelled}catch(e){console.warn(`[lint] fix-all: sweep threw`,e),o=!0}finally{pn(null)}try{o?q.error(K._({id:`vwV-kH`})):yn(i,a,r)}finally{for(let e of fn)e()}}var xn={errorCount:0,warningCount:0},Sn=new Map,Cn=new Set,wn=new Map;function Tn(){let e=new Map;for(let[t,n]of Sn){let r=n.lint.errorCount+n.links.errorCount,i=n.lint.warningCount+n.links.warningCount;r===0&&i===0||e.set(t,{errorCount:r,warningCount:i})}wn=e;for(let e of Cn)e()}var En=V;function Dn(e){return Cn.add(e),()=>{Cn.delete(e)}}function On(){return wn}function kn(e){Sn.clear();for(let t of e)Sn.set(me(t.file),En(t.diagnostics));Tn()}function An(e){Sn.clear();for(let t of e)Sn.set(me(t.file),{lint:t.lint,links:t.links});Tn()}function jn(e,t){Sn.set(e,En(t)),Tn()}function Mn(e,t,n){let r=Sn.get(e)??{lint:xn,links:xn},i=r[t];i.errorCount===n.errorCount&&i.warningCount===n.warningCount||(Sn.set(e,{...r,[t]:n}),Tn())}var Nn=`open-knowledge:lint-nav`;function Pn(e,t){return e.range.start.line-t.range.start.line||e.range.start.character-t.range.start.character}function Fn(e,t){return{docName:e,line:t.range.start.line+1,column:t.range.start.character+1,source:t.source}}function In(e){if(e.source!==`links`)return null;let t=e.localTarget;return t===void 0?`document`:t.role===`image`?`image`:t.targetKind===`file`?`file`:t.targetKind===`document`?`document`:`unresolvable`}var Ln={document:o,file:i,image:M,unresolvable:o};function Rn(e){return e.linkTarget!==void 0&&In(e)===`document`}function zn(e){let t=(0,Q.c)(40),{diagnostic:n,instanceCount:r}=e,{_:i}=v(),a=n.severity===`error`?se:de,o=n.range.start.line+1,s;t[0]===n?s=t[1]:(s=In(n),t[0]=n,t[1]=s);let c=s,l=c===null?null:Ln[c],u=r!==void 0&&r>1,d=n.severity===`error`?`text-destructive`:`text-amber-500`,f;t[2]===d?f=t[3]:(f=S(`mt-0.5 size-3.5 shrink-0`,d),t[2]=d,t[3]=f);let p;t[4]!==a||t[5]!==f?(p=(0,$.jsx)(a,{"aria-hidden":`true`,className:f}),t[4]=a,t[5]=f,t[6]=p):p=t[6];let m;t[7]===n?m=t[8]:(m=Jt(n),t[7]=n,t[8]=m);let h;t[9]===m?h=t[10]:(h=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 text-foreground`,children:m}),t[9]=m,t[10]=h);let g;t[11]!==u||t[12]!==r?(g=u?(0,$.jsxs)(`span`,{className:`mt-0.5 flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(_e,{variant:`gray`,"data-testid":`problems-instance-count`,className:`h-4 px-1 font-sans text-[10px] leading-none`,children:(0,$.jsx)(_,{id:`iZCZmF`,values:{instanceCount:r}})}),(0,$.jsx)(Y,{"aria-hidden":`true`,className:`size-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`})]}):null,t[11]=u,t[12]=r,t[13]=g):g=t[13];let y;t[14]!==p||t[15]!==h||t[16]!==g?(y=(0,$.jsxs)(`span`,{className:`flex items-start gap-1.5 text-sm`,children:[p,h,g]}),t[14]=p,t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=c??void 0,x=l!==null&&`gap-0.5`,C;t[18]===x?C=t[19]:(C=S(`h-4 shrink-0 px-1 font-sans text-[10px] uppercase leading-none`,x),t[18]=x,t[19]=C);let w;t[20]===l?w=t[21]:(w=l===null?null:(0,$.jsx)(l,{"aria-hidden":`true`,className:`size-2.5`}),t[20]=l,t[21]=w);let T;t[22]!==n.source||t[23]!==C||t[24]!==w||t[25]!==b?(T=(0,$.jsxs)(_e,{variant:`gray`,"data-testid":`problems-source-tag`,"data-target-kind":b,className:C,children:[w,n.source]}),t[22]=n.source,t[23]=C,t[24]=w,t[25]=b,t[26]=T):T=t[26];let E;t[27]!==i||t[28]!==n.code||t[29]!==o||t[30]!==u?(E=u?n.code:`${n.code} · ${i({id:`enPTnx`,values:{displayLine:o}})}`,t[27]=i,t[28]=n.code,t[29]=o,t[30]=u,t[31]=E):E=t[31];let D;t[32]===E?D=t[33]:(D=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:E}),t[32]=E,t[33]=D);let O;t[34]!==T||t[35]!==D?(O=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 ps-5 font-mono text-xs text-muted-foreground`,children:[T,D]}),t[34]=T,t[35]=D,t[36]=O):O=t[36];let k;return t[37]!==O||t[38]!==y?(k=(0,$.jsxs)($.Fragment,{children:[y,O]}),t[37]=O,t[38]=y,t[39]=k):k=t[39],k}function Bn(e){let t=new Map;for(let n of e){let e=`${n.source}/${n.code}\u0000${n.linkTarget??``}\u0000${n.message}`,r=t.get(e);r===void 0?t.set(e,{key:e,instances:[n]}):r.instances.push(n)}return[...t.values()]}function Vn(e){let t=(0,Q.c)(63),{group:n,onNavigate:r,navTitle:i,renderActions:a}=e,{_:o}=v(),s=n.instances[0],c,l,u,d,f,p,m,h;if(t[0]!==o||t[1]!==s||t[2]!==n.instances.length||t[3]!==i||t[4]!==r||t[5]!==a){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Jt(s);if(n.instances.length===1){let e;t[14]!==s||t[15]!==a?(e=a(s),t[14]=s,t[15]=a,t[16]=e):e=t[16];let n=e,o;t[17]!==s||t[18]!==r?(o=()=>r(s),t[17]=s,t[18]=r,t[19]=o):o=t[19];let c;t[20]!==s||t[21]!==i?(c=i(s),t[20]=s,t[21]=i,t[22]=c):c=t[22];let l;t[23]===s?l=t[24]:(l=(0,$.jsx)(zn,{diagnostic:s}),t[23]=s,t[24]=l);let u;t[25]!==l||t[26]!==o||t[27]!==c?(u=(0,$.jsx)(`button`,{type:`button`,onClick:o,className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left`,title:c,children:l}),t[25]=l,t[26]=o,t[27]=c,t[28]=u):u=t[28];let d;t[29]===n?d=t[30]:(d=n===null?null:(0,$.jsx)(`div`,{className:`absolute bottom-1 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:n}),t[29]=n,t[30]=d);let f;t[31]!==u||t[32]!==d?(f=(0,$.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[u,d]}),t[31]=u,t[32]=d,t[33]=f):f=t[33],h=f;break bb0}p=`rounded`,m=`problems-duplicate-group`,l=k,t[34]!==s||t[35]!==n.instances.length?(f=(0,$.jsx)(O,{className:`group flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:(0,$.jsx)(zn,{diagnostic:s,instanceCount:n.instances.length})}),t[34]=s,t[35]=n.instances.length,t[36]=f):f=t[36],c=D,d=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,u=o({id:`_Bix3-`,values:{localizedFirstMessage:e}})}t[0]=o,t[1]=s,t[2]=n.instances.length,t[3]=i,t[4]=r,t[5]=a,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;if(t[37]!==o||t[38]!==n.instances||t[39]!==i||t[40]!==r||t[41]!==a){let e;t[43]!==o||t[44]!==i||t[45]!==r||t[46]!==a?(e=e=>{let t=a(e),n=e.range.start.line+1,s=Jt(e);return(0,$.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`flex w-full cursor-pointer rounded px-2 py-1 text-left font-mono text-xs text-muted-foreground`,title:i(e),"aria-label":o({id:`txUHO8`,values:{localizedMessage:s,displayLine:n}}),children:o({id:`enPTnx`,values:{displayLine:n}})}),t===null?null:(0,$.jsx)(`div`,{className:`absolute bottom-0.5 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:t})]},Hn(e))},t[43]=o,t[44]=i,t[45]=r,t[46]=a,t[47]=e):e=t[47],g=n.instances.map(e),t[37]=o,t[38]=n.instances,t[39]=i,t[40]=r,t[41]=a,t[42]=g}else g=t[42];let _;t[48]!==u||t[49]!==g?(_=(0,$.jsx)(`ul`,{"aria-label":u,className:`flex flex-col gap-0.5 pb-1 ps-5`,"data-testid":`problems-duplicate-instances`,children:g}),t[48]=u,t[49]=g,t[50]=_):_=t[50];let y;t[51]!==c||t[52]!==d||t[53]!==_?(y=(0,$.jsx)(c,{className:d,children:_}),t[51]=c,t[52]=d,t[53]=_,t[54]=y):y=t[54];let b;t[55]!==l||t[56]!==f||t[57]!==y?(b=(0,$.jsxs)(l,{children:[f,y]}),t[55]=l,t[56]=f,t[57]=y,t[58]=b):b=t[58];let x;return t[59]!==b||t[60]!==p||t[61]!==m?(x=(0,$.jsx)(`li`,{className:p,"data-testid":m,children:b}),t[59]=b,t[60]=p,t[61]=m,t[62]=x):x=t[62],x}function Hn(e){return`${e.source}/${e.code}-${e.range.start.line}-${e.range.start.character}-${e.message}`}function Un(e){return e.reduce((e,t)=>e+ +((t.fixes?.length??0)>0),0)}function Wn(e){let t=(0,Q.c)(11),{target:n,creating:r,disabled:i,onCreate:a}=e,{_:o}=v(),s;t[0]!==o||t[1]!==n?(s=o({id:`oWsZk8`,values:{target:n}}),t[0]=o,t[1]=n,t[2]=s):s=t[2];let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(P,{"aria-hidden":`true`,className:`size-3`}),t[3]=c):c=t[3];let l;t[4]===r?l=t[5]:(l=r?(0,$.jsx)(_,{id:`E9bKSA`}):(0,$.jsx)(_,{id:`XRuL0i`}),t[4]=r,t[5]=l);let u;return t[6]!==i||t[7]!==a||t[8]!==s||t[9]!==l?(u=(0,$.jsxs)(C,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:i,onClick:a,"aria-label":s,"data-testid":`problems-create-page`,children:[c,l]}),t[6]=i,t[7]=a,t[8]=s,t[9]=l,t[10]=u):u=t[10],u}function Gn(e){let t=(0,Q.c)(8),{tip:n,testId:r,children:i}=e,a;t[0]===i?a=t[1]:(a=(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:i})}),t[0]=i,t[1]=a);let o;t[2]!==r||t[3]!==n?(o=(0,$.jsx)(T,{"data-testid":r,children:n}),t[2]=r,t[3]=n,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(E,{children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Kn(e){let t=(0,Q.c)(21),{count:n,problemCount:r,aiAvailable:i,disabled:a,onClick:o,children:s}=e,{_:c}=v(),l;t[0]!==i||t[1]!==n||t[2]!==r?(l=n>0?(0,$.jsx)(_,{id:`vjwsDi`,values:{count:n}}):r===0?(0,$.jsx)(_,{id:`gAhHu7`}):i?(0,$.jsx)(_,{id:`zA9zRL`}):(0,$.jsx)(_,{id:`X3MMeA`}),t[0]=i,t[1]=n,t[2]=r,t[3]=l):l=t[3];let u;t[4]!==c||t[5]!==s||t[6]!==n||t[7]!==r?(u=s===void 0?r===0?c({id:`4m-xuX`}):n===0?c({id:`SqIoy_`}):void 0:void 0,t[4]=c,t[5]=s,t[6]=n,t[7]=r,t[8]=u):u=t[8];let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(fe,{"aria-hidden":`true`,className:`size-3`}),t[9]=d):d=t[9];let f;t[10]!==s||t[11]!==n?(f=s??(0,$.jsx)(_,{id:`RZXTlY`,values:{count:n}}),t[10]=s,t[11]=n,t[12]=f):f=t[12];let p;t[13]!==a||t[14]!==o||t[15]!==u||t[16]!==f?(p=(0,$.jsxs)(C,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:a,onClick:o,"aria-label":u,"data-testid":`problems-auto-fix`,children:[d,f]}),t[13]=a,t[14]=o,t[15]=u,t[16]=f,t[17]=p):p=t[17];let m;return t[18]!==l||t[19]!==p?(m=(0,$.jsx)(Gn,{testId:`problems-auto-fix-tip`,tip:l,children:p}),t[18]=l,t[19]=p,t[20]=m):m=t[20],m}function qn(e){let t=(0,Q.c)(12),{count:n,disabled:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(_,{id:`mgDKWS`,values:{count:n}}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(s,{"aria-hidden":`true`,className:`size-3`}),t[2]=o):o=t[2];let c;t[3]===n?c=t[4]:(c=(0,$.jsx)(_,{id:`gyHDWC`,values:{count:n}}),t[3]=n,t[4]=c);let l;t[5]!==r||t[6]!==i||t[7]!==c?(l=(0,$.jsxs)(C,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:r,onClick:i,"data-testid":`problems-fix-with-ai`,children:[o,c]}),t[5]=r,t[6]=i,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==l?(u=(0,$.jsx)(Gn,{testId:`problems-fix-with-ai-tip`,tip:a,children:l}),t[9]=a,t[10]=l,t[11]=u):u=t[11],u}function Jn(e){let t=(0,Q.c)(50),{docName:n,diagnostics:r,linkFindingsStatus:i,onFix:a,onAutoFix:o,onAskAi:c,onFixWithAi:l}=e,u=i===void 0?`loaded`:i,{_:d}=v(),[p,m]=(0,Z.useState)(`doc`),{data:h}=Fe(),g=h===null?null:h.effective.enabled?oe.filter(e=>h.effective.plugins[e.id].enabled):[],y=g!==null&&g.length===0,b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b={status:`idle`},t[0]=b):b=t[0];let[x,S]=(0,Z.useState)(b),D=gn(),O=le(),[k,A]=(0,Z.useState)(null),j=(0,Z.useRef)(!0),M,N;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>(j.current=!0,()=>{j.current=!1}),N=[],t[1]=M,t[2]=N):(M=t[1],N=t[2]),(0,Z.useEffect)(M,N);let P=(0,Z.useRef)(nr),F=(0,Z.useRef)(tr),I;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(I={status:`idle`},t[3]=I):I=t[3];let L=(0,Z.useRef)(I),R;t[4]===x?R=t[5]:(R=()=>{x.status!==`loading`&&(L.current=x)},t[4]=x,t[5]=R),(0,Z.useEffect)(R);let z=(0,Z.useRef)(0),B=[...r].sort(Pn),V=Un(B),H;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(H=async function(){z.current+=1;let e=z.current,t=L.current;S({status:`loading`});let n=await Xt();if(n===`audit-superseded`){z.current===e&&j.current&&S(t.status===`idle`?{status:`failed`}:t);return}n!==null&&kn(n.files),j.current&&S(n===null?{status:`failed`}:{status:`loaded`,result:n})},t[6]=H):H=t[6];let U=H,ee;t[7]!==d||t[8]!==x.status||t[9]!==k||t[10]!==O?(ee=async function(e){let t=e.linkTarget;if(!(t===void 0||k!==null||O===null)){A(t);try{await f({initialDir:``,suggestedName:t},{addPage:O.addPage})}catch(e){let t=e;q.error(t instanceof Error?t.message:d({id:`tfi40B`})),j.current&&A(null);return}q.success(d({id:`EWCJFu`,values:{target:t}})),j.current&&A(null),j.current&&x.status===`loaded`&&await U()}},t[7]=d,t[8]=x.status,t[9]=k,t[10]=O,t[11]=ee):ee=t[11];let W=ee,G=x.status===`loaded`?x.result.files.filter($n):[],te=function(){bn({items:G,fixItem:Qn})},K;t[12]===x.status?K=t[13]:(K=function(e){m(e),e===`project`&&x.status===`idle`&&U()},t[12]=x.status,t[13]=K);let J=K,Y;t[14]===x.status?Y=t[15]:(Y=()=>{P.current=()=>{x.status===`idle`||x.status===`failed`||U()}},t[14]=x.status,t[15]=Y),(0,Z.useEffect)(Y);let ae,se;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>Pe(()=>P.current()),se=[],t[16]=ae,t[17]=se):(ae=t[16],se=t[17]),(0,Z.useEffect)(ae,se);let ce,ue;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>re(e=>{ie(e)&&P.current()}),ue=[],t[18]=ce,t[19]=ue):(ce=t[18],ue=t[19]),(0,Z.useEffect)(ce,ue);let de;t[20]===x.status?de=t[21]:(de=()=>{F.current=()=>{x.status===`idle`||x.status===`failed`||U().catch(e=>{console.warn(`[lint] post-sweep re-audit failed`,e),j.current&&S({status:`failed`})})}},t[20]=x.status,t[21]=de),(0,Z.useEffect)(de);let he,ge;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>_n(()=>F.current()),ge=[],t[22]=he,t[23]=ge):(he=t[22],ge=t[23]),(0,Z.useEffect)(he,ge);let _e;t[24]===n?_e=t[25]:(_e=function(e){let t=Fn(n,e);gt(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(Nn,{detail:t}))},t[24]=n,t[25]=_e);let ve=_e,ye;t[26]!==n||t[27]!==ve?(ye=function(e,t){let r=me(e);if(r===n){ve(t);return}gt(r,{kind:`lint`,detail:Fn(r,t)}),window.location.hash=pe(r)},t[26]=n,t[27]=ve,t[28]=ye):ye=t[28];let be=ye,xe;t[29]!==d||t[30]!==W||t[31]!==k||t[32]!==c||t[33]!==a||t[34]!==O?(xe=function(e){let t=a!==void 0&&(e.fixes?.length??0)>0,n=Rn(e)&&O!==null;if(!t&&!n&&c===void 0)return null;let r=`${e.source}/${e.code}`;return(0,$.jsxs)($.Fragment,{children:[n?(0,$.jsx)(Wn,{target:e.linkTarget??``,creating:k===e.linkTarget,disabled:k!==null,onCreate:()=>void W(e)}):null,t?(0,$.jsxs)(C,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>a?.(e),"aria-label":d({id:`fZj9em`,values:{flatId:r}}),"data-testid":`problems-fix`,children:[(0,$.jsx)(fe,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(_,{id:`c4fVUV`})]}):null,c===void 0?null:(0,$.jsxs)(C,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>c(e),"aria-label":d({id:`hh4mVC`,values:{flatId:r}}),"data-testid":`problems-ask-ai`,children:[(0,$.jsx)(s,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(_,{id:`xWEvuo`})]})]})},t[29]=d,t[30]=W,t[31]=k,t[32]=c,t[33]=a,t[34]=O,t[35]=xe):xe=t[35];let Se=xe,Ce=Me,we;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,$.jsx)(De,{children:(0,$.jsx)(_,{id:`OXdGnd`})}),t[36]=we):we=t[36];let Te=g!==null&&g.length>0&&(0,$.jsxs)(E,{children:[(0,$.jsx)(w,{className:`shrink-0 cursor-default rounded-md bg-muted-foreground/5 px-2 py-1 font-mono text-xs text-muted-foreground`,"data-testid":`problems-active-plugins`,children:(0,$.jsx)(_,{id:`yxF19Y`,values:{0:g.length}})}),(0,$.jsx)(T,{"data-testid":`problems-active-plugins-tooltip`,children:(0,$.jsx)(_,{id:`ws5o1F`,values:{0:g.map(Zn).join(`, `)}})})]}),X;t[37]===Te?X=t[38]:(X=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[we,Te]}),t[37]=Te,t[38]=X);let Ne=p===`doc`&&B.length>0&&(0,$.jsx)(Ae,{children:B.length}),Ie;t[39]!==X||t[40]!==Ne?(Ie=(0,$.jsxs)(je,{children:[X,Ne]}),t[39]=X,t[40]=Ne,t[41]=Ie):Ie=t[41];let Le;t[42]!==J||t[43]!==p?(Le=(0,$.jsx)(qt,{scope:p,onScopeChange:J}),t[42]=J,t[43]=p,t[44]=Le):Le=t[44];let Re=p===`doc`?(0,$.jsxs)(ke,{className:`px-2 py-2`,children:[u===`idle`||u===`loading`?(0,$.jsx)(Oe,{className:`px-2 pb-2`,role:`status`,"aria-live":`polite`,"data-testid":`problems-links-loading`,children:(0,$.jsx)(_,{id:`W9NSe0`})}):u===`failed`?(0,$.jsx)(Ee,{className:`px-2 pb-2`,role:`status`,"data-testid":`problems-links-failed`,children:B.length>0?(0,$.jsx)(_,{id:`IoHQYP`}):(0,$.jsx)(_,{id:`gpbKxw`})}):null,B.length===0?u===`loaded`?y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Oe,{className:`px-2`,"data-testid":`problems-no-plugins`,children:(0,$.jsx)(_,{id:`Hngy37`})}),(0,$.jsx)(`div`,{className:`px-2 pt-2`,children:(0,$.jsx)(C,{variant:`outline`,size:`sm`,onClick:ne,"data-testid":`problems-enable-plugins`,children:(0,$.jsx)(_,{id:`rnX-1S`})})})]}):(0,$.jsx)(Oe,{className:`px-2`,children:(0,$.jsx)(_,{id:`ZI8uvA`})}):null:(0,$.jsxs)($.Fragment,{children:[o!==void 0||l!==void 0?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1 px-2 pb-1`,children:[o!==void 0&&(0,$.jsx)(Kn,{count:V,problemCount:B.length,aiAvailable:l!==void 0,disabled:V===0,onClick:o}),l!==void 0&&(0,$.jsx)(qn,{count:B.length,disabled:!1,onClick:()=>l(`doc`)})]}):null,(0,$.jsx)(`ul`,{"aria-label":d({id:`OXdGnd`}),className:`flex flex-col gap-0.5`,children:Bn(B).map(e=>(0,$.jsx)(Vn,{group:e,onNavigate:ve,navTitle:e=>d({id:`vbMHjo`,values:{0:e.range.start.line+1}}),renderActions:Se},e.key))})]})]}):(0,$.jsx)(rr,{audit:x,onRefresh:()=>void U(),onNavigate:be,fixableCount:G.reduce(Xn,0),problemCount:x.status===`loaded`?x.result.files.reduce(Yn,0):0,fixing:D,onAutoFix:te,onCancelFix:vn,onFixWithAi:l===void 0||x.status!==`loaded`?void 0:()=>l(`project`),onCreateTarget:O===null?void 0:e=>void W(e),creatingTarget:k}),ze;return t[45]!==Ce||t[46]!==Ie||t[47]!==Le||t[48]!==Re?(ze=(0,$.jsxs)(Ce,{children:[Ie,Le,Re]}),t[45]=Ce,t[46]=Ie,t[47]=Le,t[48]=Re,t[49]=ze):ze=t[49],ze}function Yn(e,t){return e+t.diagnostics.length}function Xn(e,t){return e+Un(t.diagnostics)}function Zn(e){return e.label}function Qn(e){return Ne(me(e.file))}function $n(e){return e.diagnostics.some(er)}function er(e){return(e.fixes?.length??0)>0}function tr(){}function nr(){}function rr(e){let t=(0,Q.c)(81),{audit:n,onRefresh:r,onNavigate:i,fixableCount:a,problemCount:o,fixing:s,onAutoFix:c,onCancelFix:l,onFixWithAi:u,onCreateTarget:d,creatingTarget:f}=e,{_:p}=v(),m=n.status===`loading`||n.status===`idle`,h;t[0]!==n.result||t[1]!==n.status?(h=n.status===`loaded`?n.result.files:[],t[0]=n.result,t[1]=n.status,t[2]=h):h=t[2];let g=h,[y,b]=(0,Z.useState)(or),x;t[3]!==y||t[4]!==g?(x=g.length>0&&g.every(e=>y.has(e.file)),t[3]=y,t[4]=g,t[5]=x):x=t[5];let S=x,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(e,t){b(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},t[6]=D):D=t[6];let O=D,k;t[7]!==S||t[8]!==g?(k=function(){b(S?new Set:new Set(g.map(ar)))},t[7]=S,t[8]=g,t[9]=k):k=t[9];let A=k,j;t[10]!==n.result||t[11]!==n.status?(j=n.status===`loaded`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_,{id:`DsDwR-`,values:{0:n.result.errorCount}}),` · `,(0,$.jsx)(_,{id:`W1SI2K`,values:{0:n.result.warningCount}})]}),t[10]=n.result,t[11]=n.status,t[12]=j):j=t[12];let M;t[13]===j?M=t[14]:(M=(0,$.jsx)(`p`,{className:`min-w-0 truncate text-xs text-muted-foreground`,"data-testid":`problems-audit-summary`,children:j}),t[13]=j,t[14]=M);let N;t[15]!==p||t[16]!==S||t[17]!==g.length||t[18]!==A?(N=g.length>0?(0,$.jsxs)(E,{children:[(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(C,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":p(S?{id:`I4LGsH`}:{id:`Ugvy4O`}),"data-testid":`problems-audit-expand-toggle`,onClick:A,children:S?(0,$.jsx)(Ie,{"aria-hidden":`true`,className:`size-3.5`}):(0,$.jsx)(ae,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,$.jsx)(T,{"data-testid":`problems-audit-expand-toggle-tooltip`,children:S?(0,$.jsx)(_,{id:`I4LGsH`}):(0,$.jsx)(_,{id:`Ugvy4O`})})]}):null,t[15]=p,t[16]=S,t[17]=g.length,t[18]=A,t[19]=N):N=t[19];let P;t[20]===p?P=t[21]:(P=p({id:`I7y_vn`}),t[20]=p,t[21]=P);let F=m||s!==null,I;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5`}),t[22]=I):I=t[22];let L;t[23]!==r||t[24]!==P||t[25]!==F?(L=(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(C,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":P,"data-testid":`problems-audit-refresh`,disabled:F,onClick:r,children:I})}),t[23]=r,t[24]=P,t[25]=F,t[26]=L):L=t[26];let R;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(T,{"data-testid":`problems-audit-refresh-tooltip`,children:(0,$.jsx)(_,{id:`I7y_vn`})}),t[27]=R):R=t[27];let z;t[28]===L?z=t[29]:(z=(0,$.jsxs)(E,{children:[L,R]}),t[28]=L,t[29]=z);let B;t[30]!==z||t[31]!==N?(B=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[N,z]}),t[30]=z,t[31]=N,t[32]=B):B=t[32];let V;t[33]!==B||t[34]!==M?(V=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[M,B]}),t[33]=B,t[34]=M,t[35]=V):V=t[35];let H;t[36]!==p||t[37]!==s?(H=s===null?null:(0,$.jsx)(`span`,{className:`sr-only`,role:`status`,children:p({id:`gZElfU`,values:{0:s.done,1:s.total}})}),t[36]=p,t[37]=s,t[38]=H):H=t[38];let U;t[39]!==p||t[40]!==s||t[41]!==l?(U=s===null?null:(0,$.jsxs)(E,{children:[(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(C,{variant:`ghost`,size:`sm`,className:`h-6 shrink-0 px-2 text-muted-foreground`,"aria-label":p({id:`q2cLM6`}),"data-testid":`problems-cancel-fix`,onClick:l,children:(0,$.jsx)(_,{id:`ygCKqB`})})}),(0,$.jsx)(T,{"data-testid":`problems-cancel-fix-tooltip`,children:(0,$.jsx)(_,{id:`yvSAuM`})})]}),t[39]=p,t[40]=s,t[41]=l,t[42]=U):U=t[42];let ee=u!==void 0,W=m||s!==null||a===0,G;t[43]===s?G=t[44]:(G=s===null?void 0:(0,$.jsx)(_,{id:`S9t1PI`,values:{0:s.done,1:s.total}}),t[43]=s,t[44]=G);let te;t[45]!==a||t[46]!==c||t[47]!==o||t[48]!==ee||t[49]!==W||t[50]!==G?(te=(0,$.jsx)(Kn,{count:a,problemCount:o,aiAvailable:ee,disabled:W,onClick:c,children:G}),t[45]=a,t[46]=c,t[47]=o,t[48]=ee,t[49]=W,t[50]=G,t[51]=te):te=t[51];let ne;t[52]!==s||t[53]!==u||t[54]!==o?(ne=u!==void 0&&o>0?(0,$.jsx)(qn,{count:o,disabled:s!==null,onClick:u}):null,t[52]=s,t[53]=u,t[54]=o,t[55]=ne):ne=t[55];let K;t[56]!==H||t[57]!==U||t[58]!==te||t[59]!==ne?(K=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1`,children:[H,U,te,ne]}),t[56]=H,t[57]=U,t[58]=te,t[59]=ne,t[60]=K):K=t[60];let q;t[61]!==V||t[62]!==K?(q=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 px-2 pb-1`,children:[V,K]}),t[61]=V,t[62]=K,t[63]=q):q=t[63];let re;t[64]!==p||t[65]!==m?(re=m&&(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,role:`status`,"aria-busy":`true`,"aria-label":p({id:`dx-TwN`}),children:[1,2,3].map(ir)}),t[64]=p,t[65]=m,t[66]=re):re=t[66];let ie;t[67]===n.status?ie=t[68]:(ie=n.status===`failed`&&(0,$.jsx)(Ee,{className:`px-2 text-xs`,children:(0,$.jsx)(_,{id:`IFezUv`})}),t[67]=n.status,t[68]=ie);let J;t[69]!==n.result||t[70]!==n.status||t[71]!==f||t[72]!==y||t[73]!==d||t[74]!==i?(J=n.status===`loaded`&&(0,$.jsx)(sr,{result:n.result,onNavigate:i,onCreateTarget:d,creatingTarget:f,expandedFiles:y,onToggleFile:O}),t[69]=n.result,t[70]=n.status,t[71]=f,t[72]=y,t[73]=d,t[74]=i,t[75]=J):J=t[75];let Y;return t[76]!==q||t[77]!==re||t[78]!==ie||t[79]!==J?(Y=(0,$.jsxs)(ke,{className:`px-2 py-2`,"data-testid":`problems-project-scope`,children:[q,re,ie,J]}),t[76]=q,t[77]=re,t[78]=ie,t[79]=J,t[80]=Y):Y=t[80],Y}function ir(e){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded px-2 py-1.5`,children:[(0,$.jsx)(X,{className:`mt-0.5 size-3.5 shrink-0 rounded`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,$.jsx)(X,{className:`h-3 w-28`}),(0,$.jsx)(X,{className:`h-3 w-40`})]})]},e)}function ar(e){return e.file}function or(){return new Set}function sr(e){let t=(0,Q.c)(14),{result:n,onNavigate:r,onCreateTarget:i,creatingTarget:a,expandedFiles:o,onToggleFile:s}=e,{_:c}=v(),l;t[0]!==c||t[1]!==n.warnings?(l=n.warnings.length>0&&(0,$.jsx)(`ul`,{"aria-label":c({id:`Rsdhj9`}),className:`flex flex-col gap-0.5 pb-1`,children:n.warnings.map(cr)}),t[0]=c,t[1]=n.warnings,t[2]=l):l=t[2];let u;t[3]!==a||t[4]!==o||t[5]!==i||t[6]!==r||t[7]!==s||t[8]!==n.fileCount||t[9]!==n.files?(u=n.files.length===0?(0,$.jsx)(Oe,{className:`px-2`,children:(0,$.jsx)(_,{id:`k_Dqw1`,values:{0:n.fileCount}})}):n.files.map(e=>(0,$.jsx)(lr,{file:e,onNavigate:r,onCreateTarget:i,creatingTarget:a,open:o.has(e.file),onOpenChange:t=>s(e.file,t)},e.file)),t[3]=a,t[4]=o,t[5]=i,t[6]=r,t[7]=s,t[8]=n.fileCount,t[9]=n.files,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function cr(e,t){return(0,$.jsxs)(`li`,{className:`flex items-start gap-1.5 px-2 text-xs`,children:[(0,$.jsx)(de,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-500`}),(0,$.jsx)(`span`,{className:`min-w-0 text-foreground`,children:e})]},`${t}-${e}`)}function lr(e){let t=(0,Q.c)(45),{file:n,onNavigate:r,onCreateTarget:i,creatingTarget:a,open:o,onOpenChange:s}=e,{_:c}=v(),l,u,d,f,p,m,h,g,_,y;if(t[0]!==c||t[1]!==a||t[2]!==n.diagnostics||t[3]!==n.file||t[4]!==i||t[5]!==r||t[6]!==s||t[7]!==o){let e=[...n.diagnostics].sort(Pn);u=k,h=o,g=s,_=`problems-audit-group`;let v;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(Y,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),t[18]=v):v=t[18];let b;t[19]===n.file?b=t[20]:(b=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,title:n.file,children:n.file}),t[19]=n.file,t[20]=b),y=(0,$.jsxs)(O,{className:`group flex w-full cursor-pointer items-center gap-1.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:[v,b,(0,$.jsx)(_e,{variant:`gray`,"data-testid":`problems-audit-file-count`,className:`shrink-0`,children:e.length})]}),l=D,m=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,t[21]!==c||t[22]!==n.file?(d=c({id:`zAJzIg`,values:{0:n.file}}),t[21]=c,t[22]=n.file,t[23]=d):d=t[23],f=`flex flex-col gap-0.5 pb-1 ps-3`;let x;t[24]!==c||t[25]!==a||t[26]!==n.file||t[27]!==i||t[28]!==r?(x=e=>(0,$.jsx)(Vn,{group:e,onNavigate:e=>r(n.file,e),navTitle:e=>c({id:`xKDsGS`,values:{0:e.range.start.line+1,1:n.file}}),renderActions:e=>!Rn(e)||i===void 0?null:(0,$.jsx)(Wn,{target:e.linkTarget??``,creating:a===e.linkTarget,disabled:a!==null,onCreate:()=>i(e)})},e.key),t[24]=c,t[25]=a,t[26]=n.file,t[27]=i,t[28]=r,t[29]=x):x=t[29],p=Bn(e).map(x),t[0]=c,t[1]=a,t[2]=n.diagnostics,t[3]=n.file,t[4]=i,t[5]=r,t[6]=s,t[7]=o,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_,t[17]=y}else l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13],h=t[14],g=t[15],_=t[16],y=t[17];let b;t[30]!==d||t[31]!==f||t[32]!==p?(b=(0,$.jsx)(`ul`,{"aria-label":d,className:f,children:p}),t[30]=d,t[31]=f,t[32]=p,t[33]=b):b=t[33];let x;t[34]!==l||t[35]!==m||t[36]!==b?(x=(0,$.jsx)(l,{className:m,children:b}),t[34]=l,t[35]=m,t[36]=b,t[37]=x):x=t[37];let S;return t[38]!==u||t[39]!==x||t[40]!==h||t[41]!==g||t[42]!==_||t[43]!==y?(S=(0,$.jsxs)(u,{open:h,onOpenChange:g,"data-testid":_,children:[y,x]}),t[38]=u,t[39]=x,t[40]=h,t[41]=g,t[42]=_,t[43]=y,t[44]=S):S=t[44],S}var ur=null,dr=[];function fr(e){if(e===ur)return dr;let t=pr(e);return ur=e,dr=t,t}function pr(e){let t=[],n=new Map,r=R();for(let i=mr(e);i<=e.lines;i++){let a=e.line(i);if(r(a.text))continue;let o=G(a.text,n);o&&t.push({slug:o.slug,from:a.from})}return t}function mr(e){if(!hr(e.line(1).text))return 1;for(let t=2;t<=e.lines;t++)if(hr(e.line(t).text))return t+1;return 1}function hr(e){return z.test(e.endsWith(`\r`)?e.slice(0,-1):e)}function gr(e){let t=document.getElementById(e);return t?t.getBoundingClientRect().top:null}function _r(e){let t=new Map;for(let n of fr(e.state.doc))t.set(n.slug,n.from);let n=e.documentTop;return r=>{let i=t.get(r);return i===void 0?null:n+e.lineBlockAt(i).top}}function vr(e,t){let n=(0,Q.c)(9),r;n[0]===t?r=n[1]:(r=t===void 0?{}:t,n[0]=t,n[1]=r);let{isSourceMode:i,docName:o}=r,s=i===void 0?!1:i,[l,u]=(0,Z.useState)(void 0),d=(0,Z.useRef)(null),f;n[2]===o?f=n[3]:(f=()=>o?a(o):null,n[2]=o,n[3]=f);let p=(0,Z.useSyncExternalStore)(c,f,yr),m,h;return n[4]!==s||n[5]!==e||n[6]!==p?(m=()=>{if(e.length===0||s&&!p){u(void 0);return}let t=function(){let t=s&&p?_r(p):gr,n=window.innerHeight/2,r,i;for(let a of e){let e=t(a);e!==null&&(e<0?r=a:i===void 0&&e<n&&(i=a))}u(i??r??e[0])},n=function(){d.current===null&&(d.current=requestAnimationFrame(()=>{d.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),d.current!==null&&(cancelAnimationFrame(d.current),d.current=null)}},h=[e,s,p],n[4]=s,n[5]=e,n[6]=p,n[7]=m,n[8]=h):(m=n[7],h=n[8]),(0,Z.useEffect)(m,h),l}function yr(){return null}var br=300;async function xr(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new A(K._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=te.safeParse(n);throw e.success?Error(e.data.title):new A(K._({id:`zlErBl`}),{status:t.status})}let r=U.safeParse(n);if(!r.success)throw new A(K._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var Sr=32,Cr=12,wr=6,Tr=`open-knowledge:outline-nav`;function Er(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(ge,{name:`outline-panel`,children:(0,$.jsx)(Dr,{...e})}),t[0]=e,t[1]=n),n}function Dr(e){let t=(0,Q.c)(53),{docName:n,isSourceMode:r,className:i}=e,a=i===void 0?``:i,{_:o}=v(),{pages:s,loading:c}=ce(),l=y(),{activeProvider:u,activeDocName:f}=d(),p,m;t[0]===n?(p=t[1],m=t[2]):(p=[`page-headings`,n],m=()=>xr(n),t[0]=n,t[1]=p,t[2]=m);let h;t[3]!==n||t[4]!==c||t[5]!==s?(h=!c&&(s.has(n)||ee(n)),t[3]=n,t[4]=c,t[5]=s,t[6]=h):h=t[6];let g;t[7]!==p||t[8]!==m||t[9]!==h?(g={queryKey:p,queryFn:m,enabled:h,staleTime:1/0},t[7]=p,t[8]=m,t[9]=h,t[10]=g):g=t[10];let{data:x,isLoading:C,error:w}=b(g),T;t[11]===x?T=t[12]:(T=x===void 0?[]:x,t[11]=x,t[12]=T);let E=T,D,O;t[13]!==f||t[14]!==u||t[15]!==n||t[16]!==l?(D=()=>{if(!u||f!==n)return;let e=u.document,t=null,r=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,l.invalidateQueries({queryKey:[`page-headings`,n]})},br)};return e.on(`update`,r),()=>{e.off(`update`,r),t!==null&&clearTimeout(t)}},O=[u,f,n,l],t[13]=f,t[14]=u,t[15]=n,t[16]=l,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,Z.useEffect)(D,O);let k;t[19]===E?k=t[20]:(k=E.map(Or),t[19]=E,t[20]=k);let A=k,j;t[21]!==n||t[22]!==r?(j={isSourceMode:r,docName:n},t[21]=n,t[22]=r,t[23]=j):j=t[23];let M=vr(A,j),N;t[24]!==M||t[25]!==E?(N=M?E.findIndex(e=>e.slug===M):-1,t[24]=M,t[25]=E,t[26]=N):N=t[26];let P=N,F;t[27]!==n||t[28]!==r?(F=function(e,t){let i={docName:n,index:e,slug:t,mode:r?`source`:`wysiwyg`};i.mode===`source`&&gt(n,{kind:`outline`,detail:i}),window.dispatchEvent(new CustomEvent(Tr,{detail:i}))},t[27]=n,t[28]=r,t[29]=F):F=t[29];let I=F,L=((P>=0?E[P].level:1)-1)*Cr+(Cr-wr)/2,R=P*Sr+(Sr-wr)/2,z;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(De,{children:(0,$.jsx)(_,{id:`dD7NPy`})}),t[30]=z):z=t[30];let B;t[31]!==E.length||t[32]!==C?(B=!C&&(0,$.jsx)(Ae,{children:E.length}),t[31]=E.length,t[32]=C,t[33]=B):B=t[33];let V;t[34]===B?V=t[35]:(V=(0,$.jsxs)(je,{children:[z,B]}),t[34]=B,t[35]=V);let H;t[36]!==o||t[37]!==P||t[38]!==M||t[39]!==w||t[40]!==I||t[41]!==E||t[42]!==C||t[43]!==L||t[44]!==R?(H=w?(0,$.jsx)(Ee,{className:`px-2`,children:w instanceof Error?w.message:o({id:`GuqOb1`})}):E.length===0&&!C?(0,$.jsx)(Oe,{className:`px-2`,children:(0,$.jsx)(_,{id:`0BB9ID`})}):(0,$.jsxs)(`nav`,{"aria-label":o({id:`BymzO4`}),className:`relative`,children:[P>=0&&(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-0 top-0 rounded-full bg-primary motion-safe:[transition:transform_0.25s_var(--ease-out-strong)]`,style:{width:wr,height:wr,transform:`translate(${L}px, ${R}px)`}}),E.map((e,t)=>{let n=e.slug===M;return(0,$.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>I(t,e.slug),className:S(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*Cr+20}px`},title:e.text,children:e.text},t)})]}),t[36]=o,t[37]=P,t[38]=M,t[39]=w,t[40]=I,t[41]=E,t[42]=C,t[43]=L,t[44]=R,t[45]=H):H=t[45];let U;t[46]!==C||t[47]!==H?(U=(0,$.jsx)(ke,{className:`px-3 py-2`,"aria-busy":C,children:H}),t[46]=C,t[47]=H,t[48]=U):U=t[48];let W;return t[49]!==a||t[50]!==V||t[51]!==U?(W=(0,$.jsxs)(Me,{className:a,children:[V,U]}),t[49]=a,t[50]=V,t[51]=U,t[52]=W):W=t[52],W}function Or(e){return e.slug}var kr={words:0,chars:0,tokens:0},Ar=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,jr=/[\p{L}\p{N}]/u,Mr=new Set([`text`,`inlineCode`,`code`,`tag`]),Nr=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),Pr=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function Fr(e,t){if(!e)return;let n=e.type;if(!Nr.has(n)){if(Mr.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
4
4
  `));return}if(n===`wikiLink`||n===`wikiLinkEmbed`){let n=e.data?.alias??e.value??``;n&&t.push(n);return}if(Array.isArray(e.children)){for(let n of e.children)Fr(n,t);if(Pr.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`