railwatch 0.3.5 → 0.3.6

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 (134) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -2
  3. data/app/channels/railwatch/environment_channel.rb +17 -4
  4. data/app/models/railwatch/ingest/batch.rb +1 -1
  5. data/app/models/railwatch/ingest/mapper.rb +1 -3
  6. data/docs/embedded.md +17 -6
  7. data/docs/getting-started.md +0 -2
  8. data/docs/source-maps.md +1 -3
  9. data/lib/generators/railwatch/install/install_generator.rb +0 -8
  10. data/lib/railwatch/backtrace.rb +12 -2
  11. data/lib/railwatch/configuration.rb +6 -5
  12. data/lib/railwatch/engine.rb +2 -2
  13. data/lib/railwatch/export/client.rb +10 -3
  14. data/lib/railwatch/reporter.rb +2 -12
  15. data/lib/railwatch/source_maps.rb +13 -1
  16. data/lib/railwatch/spec_helper.rb +1 -1
  17. data/lib/railwatch/transport/http.rb +14 -5
  18. data/lib/railwatch/version.rb +1 -1
  19. data/public/railwatch/assets/{app-layout-CdJ5Qjms.js → app-layout-B5Fcdwfz.js} +1 -1
  20. data/public/railwatch/assets/{app-wordmark-B-0yZiDb.js → app-wordmark-1SRllgHv.js} +1 -1
  21. data/public/railwatch/assets/{appearance-CU28GBf1.js → appearance-DbwahDrc.js} +1 -1
  22. data/public/railwatch/assets/{arrow-up-DY1fS0tD.js → arrow-up-DwKQcab4.js} +1 -1
  23. data/public/railwatch/assets/{auth-layout-C3FKuUJz.js → auth-layout-DXfxXAN_.js} +1 -1
  24. data/public/railwatch/assets/{badge-DKvItdlb.js → badge-CApjyWcg.js} +1 -1
  25. data/public/railwatch/assets/{braces-Bse5Gh3K.js → braces-kGSgxWnS.js} +1 -1
  26. data/public/railwatch/assets/{card-C9j_ffR9.js → card-BaJ8kNkp.js} +1 -1
  27. data/public/railwatch/assets/{chart-Cmh6JEww.js → chart-Xnrz1Nqw.js} +1 -1
  28. data/public/railwatch/assets/{chart-hover-B0SjyWFy.js → chart-hover-XYPNE2CX.js} +1 -1
  29. data/public/railwatch/assets/{chart-panel-DKNxoauI.js → chart-panel-BYk68mJJ.js} +1 -1
  30. data/public/railwatch/assets/{checkbox-BsBkRg5n.js → checkbox-Bf41R8W6.js} +1 -1
  31. data/public/railwatch/assets/{code-C879Qwgg.js → code-a-9sh36A.js} +1 -1
  32. data/public/railwatch/assets/{copy-block-DtO_3esq.js → copy-block-zykZWQym.js} +1 -1
  33. data/public/railwatch/assets/{copy-id-SeLCKsW2.js → copy-id-b6CW5ESL.js} +1 -1
  34. data/public/railwatch/assets/{cursor-load-more-OpHbe_kE.js → cursor-load-more-0cHzbTPT.js} +1 -1
  35. data/public/railwatch/assets/{data-table-Bc3ZRnpb.js → data-table-IvA7xvrK.js} +1 -1
  36. data/public/railwatch/assets/{edit-DDvf9mkq.js → edit-7lmf3k80.js} +1 -1
  37. data/public/railwatch/assets/{edit-BMpgcQhU.js → edit-DTtRV1fO.js} +1 -1
  38. data/public/railwatch/assets/{edit-CTD1jSWh.js → edit-ZKE15r-F.js} +1 -1
  39. data/public/railwatch/assets/{empty-state-CkPROZB0.js → empty-state-BFTnQ2oT.js} +1 -1
  40. data/public/railwatch/assets/{env-layout-aGQgTZRg.js → env-layout-erSDpIXg.js} +1 -1
  41. data/public/railwatch/assets/{execution-path-BX5NcXUZ.js → execution-path-Di5uUHi-.js} +1 -1
  42. data/public/railwatch/assets/{filter-bar-C0O2rJVr.js → filter-bar-Btm__gQi.js} +1 -1
  43. data/public/railwatch/assets/{flamegraph-Vj4QSAlT.js → flamegraph-C-mZdqa7.js} +1 -1
  44. data/public/railwatch/assets/{frames-CTiGwm4E.js → frames-KZBsjg6-.js} +1 -1
  45. data/public/railwatch/assets/{google-sign-in-button-BzogBGeF.js → google-sign-in-button-DJRoD72g.js} +1 -1
  46. data/public/railwatch/assets/{index-chS28dvS.js → index-9LL_C3eG.js} +1 -1
  47. data/public/railwatch/assets/{index-C__S10ze.js → index-B-bSm1jB.js} +1 -1
  48. data/public/railwatch/assets/{index-Dy7Wg880.js → index-B0VXzXYG.js} +1 -1
  49. data/public/railwatch/assets/{index-B-kuWp-m.js → index-BAkZNNEh.js} +1 -1
  50. data/public/railwatch/assets/{index-CPQKOQxV.js → index-BWSyQRZI.js} +1 -1
  51. data/public/railwatch/assets/{index-FgpFDA1Z.js → index-Bjw4sTXU.js} +1 -1
  52. data/public/railwatch/assets/{index-D9cV-IQr.js → index-Bo8hrjbs.js} +1 -1
  53. data/public/railwatch/assets/{index-BCLvKVhP.js → index-BoTOVM0v.js} +1 -1
  54. data/public/railwatch/assets/{index-y2c8xKzI.js → index-Bot7kHMA.js} +1 -1
  55. data/public/railwatch/assets/{index-DbyRgbzQ.js → index-BsrCnQqg.js} +1 -1
  56. data/public/railwatch/assets/{index-BKgAm-w2.js → index-BtSlLmkg.js} +1 -1
  57. data/public/railwatch/assets/{index-DigUOHQ8.js → index-CAzQkw-h.js} +1 -1
  58. data/public/railwatch/assets/{index-ChQ1_u8u.js → index-CBJZQgHA.js} +1 -1
  59. data/public/railwatch/assets/{index-uuKg6Zqn.js → index-CIUl9POV.js} +1 -1
  60. data/public/railwatch/assets/{index-DepurF6s.js → index-CP6jrrPT.js} +1 -1
  61. data/public/railwatch/assets/{index-Bvy021Vv.js → index-CU6yhEyt.js} +1 -1
  62. data/public/railwatch/assets/{index-B2_QluAw.js → index-CX8Br7m9.js} +1 -1
  63. data/public/railwatch/assets/{index-Dcxd_H-U.js → index-CYYmZpZu.js} +1 -1
  64. data/public/railwatch/assets/{index-DxuDLoTc.js → index-CeqMDByC.js} +1 -1
  65. data/public/railwatch/assets/{index-D3Axxkk2.js → index-Cj3_jD1E.js} +1 -1
  66. data/public/railwatch/assets/{index-D5YVcrqR.js → index-D4968-TC.js} +1 -1
  67. data/public/railwatch/assets/{index-DkgImCOg.js → index-DAEzO_vq.js} +1 -1
  68. data/public/railwatch/assets/{index-CtT4T6kp.js → index-DBTxQw77.js} +1 -1
  69. data/public/railwatch/assets/{index-CCLMaY9k.js → index-DCAho97K.js} +1 -1
  70. data/public/railwatch/assets/{index-jSEU_Yp7.js → index-DEfu_YvU.js} +1 -1
  71. data/public/railwatch/assets/{index-CY6lbwAC.js → index-DXUwhSCQ.js} +1 -1
  72. data/public/railwatch/assets/{index-Wb_U2_hz.js → index-DcItJxa5.js} +1 -1
  73. data/public/railwatch/assets/{index-CD4HIHq0.js → index-EGU__DOB.js} +1 -1
  74. data/public/railwatch/assets/{index-LaTKDe0-.js → index-HCJmFcZu.js} +1 -1
  75. data/public/railwatch/assets/{index-BRN_bXV_.js → index-P_e_cI0O.js} +1 -1
  76. data/public/railwatch/assets/{index-Ble4RoA3.js → index-QyHE9WsU.js} +1 -1
  77. data/public/railwatch/assets/{index-B69Iad2U.js → index-Z1c4nFL0.js} +1 -1
  78. data/public/railwatch/assets/{index-z2YfKBJl.js → index-kNhZPLVj.js} +1 -1
  79. data/public/railwatch/assets/{index-CxU1Jj35.js → index-uHBVO8Lh.js} +1 -1
  80. data/public/railwatch/assets/{index-Dep2XomH.js → index-wOj5j0KC.js} +1 -1
  81. data/public/railwatch/assets/{inertia-CgBdJDaE.js → inertia-Degv_G9N.js} +2 -2
  82. data/public/railwatch/assets/{input-error-DfpIawjl.js → input-error-C6SqO_iU.js} +1 -1
  83. data/public/railwatch/assets/{json-viewer-CH7nEIUs.js → json-viewer-DcQIxT86.js} +1 -1
  84. data/public/railwatch/assets/{klass-BTg1l2AO.js → klass-WgQEfWpo.js} +1 -1
  85. data/public/railwatch/assets/{label-BWgQzHCO.js → label-B_vK19tR.js} +1 -1
  86. data/public/railwatch/assets/{layout-neknbxn-.js → layout-C8q7GUlZ.js} +1 -1
  87. data/public/railwatch/assets/{live-dot-Bejk0a5o.js → live-dot-DaXEbkXo.js} +1 -1
  88. data/public/railwatch/assets/{nav-C1M8941-.js → nav-BnD5XArZ.js} +1 -1
  89. data/public/railwatch/assets/{new-BnGIYM37.js → new-BL9OqXHe.js} +1 -1
  90. data/public/railwatch/assets/{new-DGYPcz7w.js → new-BhRnQn4w.js} +1 -1
  91. data/public/railwatch/assets/{new-DElC-JCS.js → new-BqP0NhOF.js} +1 -1
  92. data/public/railwatch/assets/{new-bBwawsEg.js → new-CWP3wtwt.js} +1 -1
  93. data/public/railwatch/assets/{new-B8CzyoMu.js → new-DIjwu2jF.js} +1 -1
  94. data/public/railwatch/assets/{new-DLgCLBiW.js → new-uxMnBtoY.js} +1 -1
  95. data/public/railwatch/assets/{onboarding-CW0jUhHT.js → onboarding-C_Y3xTsH.js} +1 -1
  96. data/public/railwatch/assets/{origin-identity-bJMxeEHB.js → origin-identity-CNhOnfBa.js} +1 -1
  97. data/public/railwatch/assets/{percentile-picker-DLAnTKY3.js → percentile-picker-BujVEhP6.js} +1 -1
  98. data/public/railwatch/assets/{relative-time-BHbJh8HW.js → relative-time-6CoKr1lN.js} +1 -1
  99. data/public/railwatch/assets/{release-health-2O1GRclB.js → release-health-1Qzc_XhT.js} +1 -1
  100. data/public/railwatch/assets/{route-DSw8aIZa.js → route-xqgYjOwJ.js} +1 -1
  101. data/public/railwatch/assets/{segmented-Dg8CES94.js → segmented-CVKq2Xpa.js} +1 -1
  102. data/public/railwatch/assets/{select-CqKpvI98.js → select-CsmSXsJ4.js} +1 -1
  103. data/public/railwatch/assets/{separator-BOp2LHw3.js → separator-CrM10Oot.js} +1 -1
  104. data/public/railwatch/assets/{series-chart-COEtj3PY.js → series-chart-D33UhdG2.js} +1 -1
  105. data/public/railwatch/assets/{show-DrhEDGPn.js → show-8H9WAGav.js} +1 -1
  106. data/public/railwatch/assets/{show-dRDz8OVu.js → show-9jDeBNpc.js} +1 -1
  107. data/public/railwatch/assets/{show-C-xpDkoj.js → show-B0nHy31L.js} +1 -1
  108. data/public/railwatch/assets/{show-B7Zqjlqc.js → show-B3izvRdU.js} +1 -1
  109. data/public/railwatch/assets/{show-CGv85sRo.js → show-B7NhcWgp.js} +1 -1
  110. data/public/railwatch/assets/{show-Zr2xV4OD.js → show-BM-E2iYc.js} +1 -1
  111. data/public/railwatch/assets/{show-B40560ZT.js → show-BlNR3ZOZ.js} +1 -1
  112. data/public/railwatch/assets/{show-C9Y1To9_.js → show-CJMeX75E.js} +1 -1
  113. data/public/railwatch/assets/{show-BAxMoNvw.js → show-CMisHNAI.js} +1 -1
  114. data/public/railwatch/assets/{show-HjjzcKRq.js → show-CQ4Ze-Un.js} +1 -1
  115. data/public/railwatch/assets/{show-CPh-7VGL.js → show-CvNV23gH.js} +1 -1
  116. data/public/railwatch/assets/{show-DqtE0LI6.js → show-DMZlwzL_.js} +1 -1
  117. data/public/railwatch/assets/{show-C_9M2nLy.js → show-DUwQlohF.js} +1 -1
  118. data/public/railwatch/assets/{show-DFlP1ktM.js → show-DZwcZZrz.js} +1 -1
  119. data/public/railwatch/assets/{show-B_QVoqKE.js → show-ixK2r2f1.js} +1 -1
  120. data/public/railwatch/assets/{show-pbkvGRER.js → show-rysBbvt-.js} +1 -1
  121. data/public/railwatch/assets/{show-Bbs1i46N.js → show-zxVxhUel.js} +1 -1
  122. data/public/railwatch/assets/{sort-header-DBxQ_KFX.js → sort-header-CKj_7G3U.js} +1 -1
  123. data/public/railwatch/assets/{sparkline-cell-BbfXw3kA.js → sparkline-cell-Ckg29yVq.js} +1 -1
  124. data/public/railwatch/assets/{stat-Cd8QaTGw.js → stat-TxvoBiC8.js} +1 -1
  125. data/public/railwatch/assets/{status-badge-Ys4b0fcG.js → status-badge-5NCVJHjo.js} +1 -1
  126. data/public/railwatch/assets/{tenant-path-CQWzaNYR.js → tenant-path-B5ZRK4x3.js} +1 -1
  127. data/public/railwatch/assets/{text-link-BY8FY-CJ.js → text-link-BPllRj0F.js} +1 -1
  128. data/public/railwatch/assets/{textarea-Bq2jjOMC.js → textarea-DtD5yZp_.js} +1 -1
  129. data/public/railwatch/assets/{timeline-SxStCFO2.js → timeline-DZz5ZnHN.js} +1 -1
  130. data/public/railwatch/assets/{transition-CQ9yvfPa.js → transition-Ds6Cakuc.js} +1 -1
  131. data/public/railwatch/assets/{use-clipboard-3hTXU91g.js → use-clipboard-BLjjYH8V.js} +1 -1
  132. data/public/railwatch/assets/{use-live-LwJStJvD.js → use-live-GKze1mNC.js} +1 -1
  133. data/public/railwatch/manifest.json +1285 -1285
  134. metadata +115 -115
@@ -1 +1 @@
1
- import{B as i,c as l,r as p}from"./inertia-CgBdJDaE.js";const u=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],f=i("copy",u);function x(){const e=l.c(3),[o,c]=p.useState(null);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=async a=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(a),c(a),!0}catch(s){return console.warn("Copy failed",s),c(null),!1}},e[0]=t):t=e[0];const n=t;let r;return e[1]!==o?(r=[o,n],e[1]=o,e[2]=r):r=e[2],r}export{f as C,x as u};
1
+ import{B as i,c as l,r as p}from"./inertia-Degv_G9N.js";const u=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],f=i("copy",u);function x(){const e=l.c(3),[o,c]=p.useState(null);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=async a=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(a),c(a),!0}catch(s){return console.warn("Copy failed",s),c(null),!1}},e[0]=t):t=e[0];const n=t;let r;return e[1]!==o?(r=[o,n],e[1]=o,e[2]=r):r=e[2],r}export{f as C,x as u};
@@ -1 +1 @@
1
- import{r as c,c as nt,e as it}from"./inertia-CgBdJDaE.js";var C={logger:typeof console<"u"?console:void 0,WebSocket:typeof WebSocket<"u"?WebSocket:void 0},i={log(...n){this.enabled&&(n.push(Date.now()),C.logger.log("[ActionCable]",...n))}};const g=()=>new Date().getTime(),k=n=>(g()-n)/1e3;class x{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=t,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=g(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),i.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=g(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),i.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordMessage(){this.pingedAt=g()}recordConnect(){this.reconnectAttempts=0,delete this.disconnectedAt,i.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=g(),i.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling(),this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout((()=>{this.reconnectIfStale(),this.poll()}),this.getPollInterval())}getPollInterval(){const{staleThreshold:t,reconnectionBackoffRate:e}=this.constructor,s=Math.pow(1+e,Math.min(this.reconnectAttempts,10)),r=(this.reconnectAttempts===0?1:e)*Math.random();return t*1e3*s*(1+r)}reconnectIfStale(){this.connectionIsStale()&&(i.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${k(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?i.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${k(this.disconnectedAt)} s`):(i.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return k(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&k(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout((()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(i.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())}),200)}}x.staleThreshold=6;x.reconnectionBackoffRate=.15;var V={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]};const{message_types:p,protocols:W}=V,st=W.slice(0,W.length-1),F=[].indexOf;class j{constructor(t){this.open=this.open.bind(this),this.consumer=t,this.subscriptions=this.consumer.subscriptions,this.monitor=new x(this),this.disconnected=!0}send(t){return this.isOpen()?(this.webSocket.send(JSON.stringify(t)),!0):!1}open(){if(this.isActive())return i.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1;{const t=[...W,...this.consumer.subprotocols||[]];return i.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${t}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new C.WebSocket(this.consumer.url,t),this.installEventHandlers(),this.monitor.start(),!0}}close({allowReconnect:t}={allowReconnect:!0}){if(t||this.monitor.stop(),this.isOpen())return this.webSocket.close()}reopen(){if(i.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(t){i.log("Failed to reopen WebSocket",t)}finally{i.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay)}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return F.call(st,this.getProtocol())>=0}isState(...t){return F.call(t,this.getState())>=0}getState(){if(this.webSocket){for(let t in C.WebSocket)if(C.WebSocket[t]===this.webSocket.readyState)return t.toLowerCase()}return null}installEventHandlers(){for(let t in this.events){const e=this.events[t].bind(this);this.webSocket[`on${t}`]=e}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){}}}j.reopenDelay=500;j.prototype.events={message(n){if(!this.isProtocolSupported())return;const{identifier:t,message:e,reason:s,reconnect:o,type:r}=JSON.parse(n.data);switch(this.monitor.recordMessage(),r){case p.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case p.disconnect:return i.log(`Disconnecting. Reason: ${s}`),this.close({allowReconnect:o});case p.ping:return null;case p.confirmation:return this.subscriptions.confirmSubscription(t),this.reconnectAttempted?(this.reconnectAttempted=!1,this.subscriptions.notify(t,"connected",{reconnected:!0})):this.subscriptions.notify(t,"connected",{reconnected:!1});case p.rejection:return this.subscriptions.reject(t);default:return this.subscriptions.notify(t,"received",e)}},open(){if(i.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return i.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(n){if(i.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){i.log("WebSocket onerror event")}};const ot=function(n,t){if(t!=null)for(let e in t){const s=t[e];n[e]=s}return n};class rt{constructor(t,e={},s){this.consumer=t,this.identifier=JSON.stringify(e),ot(this,s)}perform(t,e={}){return e.action=t,this.send(e)}send(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}}class ct{constructor(t){this.subscriptions=t,this.pendingSubscriptions=[]}guarantee(t){this.pendingSubscriptions.indexOf(t)==-1?(i.log(`SubscriptionGuarantor guaranteeing ${t.identifier}`),this.pendingSubscriptions.push(t)):i.log(`SubscriptionGuarantor already guaranteeing ${t.identifier}`),this.startGuaranteeing()}forget(t){i.log(`SubscriptionGuarantor forgetting ${t.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter((e=>e!==t))}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing()}stopGuaranteeing(){clearTimeout(this.retryTimeout)}retrySubscribing(){this.retryTimeout=setTimeout((()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map((t=>{i.log(`SubscriptionGuarantor resubscribing ${t.identifier}`),this.subscriptions.subscribe(t)}))}),500)}}class lt{constructor(t){this.consumer=t,this.guarantor=new ct(this),this.subscriptions=[]}create(t,e){const s=t,o=typeof s=="object"?s:{channel:s},r=new rt(this.consumer,o,e);return this.add(r)}add(t){return this.subscriptions.push(t),this.consumer.ensureActiveConnection(),this.notify(t,"initialized"),this.subscribe(t),t}remove(t){return this.forget(t),this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe"),t}reject(t){return this.findAll(t).map((e=>(this.forget(e),this.notify(e,"rejected"),e)))}forget(t){return this.guarantor.forget(t),this.subscriptions=this.subscriptions.filter((e=>e!==t)),t}findAll(t){return this.subscriptions.filter((e=>e.identifier===t))}reload(){return this.subscriptions.map((t=>this.subscribe(t)))}notifyAll(t,...e){return this.subscriptions.map((s=>this.notify(s,t,...e)))}notify(t,e,...s){let o;return typeof t=="string"?o=this.findAll(t):o=[t],o.map((r=>typeof r[e]=="function"?r[e](...s):void 0))}subscribe(t){this.sendCommand(t,"subscribe")&&this.guarantor.guarantee(t)}confirmSubscription(t){i.log(`Subscription confirmed ${t}`),this.findAll(t).map((e=>this.guarantor.forget(e)))}sendCommand(t,e){const{identifier:s}=t;return this.consumer.send({command:e,identifier:s})}}class ut{constructor(t){this._url=t,this.subscriptions=new lt(this),this.connection=new j(this),this.subprotocols=[]}get url(){return at(this._url)}send(t){return this.connection.send(t)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(t){this.subprotocols=[...this.subprotocols,t]}}function at(n){if(typeof n=="function"&&(n=n()),n&&!/^wss?:/i.test(n)){const t=document.createElement("a");return t.href=n,t.href=t.href,t.protocol=t.protocol.replace("http","ws"),t.href}else return n}function ht(n=dt("url")||V.default_mount_path){return new ut(n)}function dt(n){const t=document.head.querySelector(`meta[name='action-cable-${n}']`);if(t)return t.getAttribute("content")}let U;function ft(){return U??=ht(),U}const pt=5e3,q="railwatch:live-paused";let L=!1;const O=new Set;function z(n){if(L!==n){L=n;for(const t of O)t()}}function gt(n){return O.add(n),()=>{O.delete(n)}}function Rt(){return c.useSyncExternalStore(gt,bt,mt)}function mt(){return!1}function bt(){return L}function kt(n,t){const e=nt.c(19);let s;e[0]!==t?(s={},e[0]=t,e[1]=s):s=e[1];const{only:o,onEvent:r}=s,[u,T]=c.useState(!1),[E,G]=c.useState(null),[_,N]=c.useState(null),[K,Y]=c.useState(n);K!==n&&(Y(n),T(!1),G(null),N(null));const[l,Q]=c.useState(At),I=c.useRef(o),H=c.useRef(r),$=c.useRef(l);let m;e[2]!==r||e[3]!==o||e[4]!==l?(m=()=>{I.current=o,H.current=r,$.current=l},e[2]=r,e[3]=o,e[4]=l,e[5]=m):m=e[5],c.useEffect(m);const P=c.useRef(vt);let b,S;e[6]!==u||e[7]!==l?(b=()=>(z(u&&!l),yt),S=[u,l],e[6]=u,e[7]=l,e[8]=b,e[9]=S):(b=e[8],S=e[9]),c.useEffect(b,S);let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=function(h){$.current=h,localStorage.setItem(q,h?"1":"0"),Q(h),P.current()},e[10]=y):y=e[10];const X=y;let v,A;e[11]!==n?(v=()=>{let a=!1,h=!1,D=!1,J=-1/0,R,M;const Z=function(){h=!1,D=!0,J=Date.now(),it.reload({only:I.current,onCancelToken:et=>{M=()=>et.cancel()},onSuccess:()=>{a||N(Date.now())},onFinish:()=>{M=void 0,D=!1,f()}})};function f(){if(clearTimeout(R),R=void 0,a||!h||D||$.current||document.visibilityState!=="visible")return;const d=pt-(Date.now()-J);d>0?R=setTimeout(f,d):Z()}const B=function(){f()};document.addEventListener("visibilitychange",B),P.current=f;const tt=ft().subscriptions.create({channel:"EnvironmentChannel",id:n},{connected:()=>{a||T(!0)},disconnected:()=>{a||T(!1)},received:d=>{a||(G(Date.now()),H.current?.(d),h=!0,f())}});return()=>{a=!0,M?.(),clearTimeout(R),P.current=St,document.removeEventListener("visibilitychange",B),tt.unsubscribe()}},A=[n],e[11]=n,e[12]=v,e[13]=A):(v=e[12],A=e[13]),c.useEffect(v,A);let w;return e[14]!==u||e[15]!==E||e[16]!==_||e[17]!==l?(w={connected:u,lastEventAt:E,lastRefreshedAt:_,paused:l,setPaused:X},e[14]=u,e[15]=E,e[16]=_,e[17]=l,e[18]=w):w=e[18],w}function St(){}function yt(){return z(!1)}function vt(){}function At(){return typeof window>"u"?!1:localStorage.getItem(q)==="1"}export{Rt as a,kt as u};
1
+ import{r as c,c as nt,e as it}from"./inertia-Degv_G9N.js";var C={logger:typeof console<"u"?console:void 0,WebSocket:typeof WebSocket<"u"?WebSocket:void 0},i={log(...n){this.enabled&&(n.push(Date.now()),C.logger.log("[ActionCable]",...n))}};const g=()=>new Date().getTime(),k=n=>(g()-n)/1e3;class x{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=t,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=g(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),i.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=g(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),i.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordMessage(){this.pingedAt=g()}recordConnect(){this.reconnectAttempts=0,delete this.disconnectedAt,i.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=g(),i.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling(),this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout((()=>{this.reconnectIfStale(),this.poll()}),this.getPollInterval())}getPollInterval(){const{staleThreshold:t,reconnectionBackoffRate:e}=this.constructor,s=Math.pow(1+e,Math.min(this.reconnectAttempts,10)),r=(this.reconnectAttempts===0?1:e)*Math.random();return t*1e3*s*(1+r)}reconnectIfStale(){this.connectionIsStale()&&(i.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${k(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?i.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${k(this.disconnectedAt)} s`):(i.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return k(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&k(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout((()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(i.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())}),200)}}x.staleThreshold=6;x.reconnectionBackoffRate=.15;var V={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]};const{message_types:p,protocols:W}=V,st=W.slice(0,W.length-1),F=[].indexOf;class j{constructor(t){this.open=this.open.bind(this),this.consumer=t,this.subscriptions=this.consumer.subscriptions,this.monitor=new x(this),this.disconnected=!0}send(t){return this.isOpen()?(this.webSocket.send(JSON.stringify(t)),!0):!1}open(){if(this.isActive())return i.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1;{const t=[...W,...this.consumer.subprotocols||[]];return i.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${t}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new C.WebSocket(this.consumer.url,t),this.installEventHandlers(),this.monitor.start(),!0}}close({allowReconnect:t}={allowReconnect:!0}){if(t||this.monitor.stop(),this.isOpen())return this.webSocket.close()}reopen(){if(i.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(t){i.log("Failed to reopen WebSocket",t)}finally{i.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay)}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return F.call(st,this.getProtocol())>=0}isState(...t){return F.call(t,this.getState())>=0}getState(){if(this.webSocket){for(let t in C.WebSocket)if(C.WebSocket[t]===this.webSocket.readyState)return t.toLowerCase()}return null}installEventHandlers(){for(let t in this.events){const e=this.events[t].bind(this);this.webSocket[`on${t}`]=e}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){}}}j.reopenDelay=500;j.prototype.events={message(n){if(!this.isProtocolSupported())return;const{identifier:t,message:e,reason:s,reconnect:o,type:r}=JSON.parse(n.data);switch(this.monitor.recordMessage(),r){case p.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case p.disconnect:return i.log(`Disconnecting. Reason: ${s}`),this.close({allowReconnect:o});case p.ping:return null;case p.confirmation:return this.subscriptions.confirmSubscription(t),this.reconnectAttempted?(this.reconnectAttempted=!1,this.subscriptions.notify(t,"connected",{reconnected:!0})):this.subscriptions.notify(t,"connected",{reconnected:!1});case p.rejection:return this.subscriptions.reject(t);default:return this.subscriptions.notify(t,"received",e)}},open(){if(i.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return i.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(n){if(i.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){i.log("WebSocket onerror event")}};const ot=function(n,t){if(t!=null)for(let e in t){const s=t[e];n[e]=s}return n};class rt{constructor(t,e={},s){this.consumer=t,this.identifier=JSON.stringify(e),ot(this,s)}perform(t,e={}){return e.action=t,this.send(e)}send(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}}class ct{constructor(t){this.subscriptions=t,this.pendingSubscriptions=[]}guarantee(t){this.pendingSubscriptions.indexOf(t)==-1?(i.log(`SubscriptionGuarantor guaranteeing ${t.identifier}`),this.pendingSubscriptions.push(t)):i.log(`SubscriptionGuarantor already guaranteeing ${t.identifier}`),this.startGuaranteeing()}forget(t){i.log(`SubscriptionGuarantor forgetting ${t.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter((e=>e!==t))}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing()}stopGuaranteeing(){clearTimeout(this.retryTimeout)}retrySubscribing(){this.retryTimeout=setTimeout((()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map((t=>{i.log(`SubscriptionGuarantor resubscribing ${t.identifier}`),this.subscriptions.subscribe(t)}))}),500)}}class lt{constructor(t){this.consumer=t,this.guarantor=new ct(this),this.subscriptions=[]}create(t,e){const s=t,o=typeof s=="object"?s:{channel:s},r=new rt(this.consumer,o,e);return this.add(r)}add(t){return this.subscriptions.push(t),this.consumer.ensureActiveConnection(),this.notify(t,"initialized"),this.subscribe(t),t}remove(t){return this.forget(t),this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe"),t}reject(t){return this.findAll(t).map((e=>(this.forget(e),this.notify(e,"rejected"),e)))}forget(t){return this.guarantor.forget(t),this.subscriptions=this.subscriptions.filter((e=>e!==t)),t}findAll(t){return this.subscriptions.filter((e=>e.identifier===t))}reload(){return this.subscriptions.map((t=>this.subscribe(t)))}notifyAll(t,...e){return this.subscriptions.map((s=>this.notify(s,t,...e)))}notify(t,e,...s){let o;return typeof t=="string"?o=this.findAll(t):o=[t],o.map((r=>typeof r[e]=="function"?r[e](...s):void 0))}subscribe(t){this.sendCommand(t,"subscribe")&&this.guarantor.guarantee(t)}confirmSubscription(t){i.log(`Subscription confirmed ${t}`),this.findAll(t).map((e=>this.guarantor.forget(e)))}sendCommand(t,e){const{identifier:s}=t;return this.consumer.send({command:e,identifier:s})}}class ut{constructor(t){this._url=t,this.subscriptions=new lt(this),this.connection=new j(this),this.subprotocols=[]}get url(){return at(this._url)}send(t){return this.connection.send(t)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(t){this.subprotocols=[...this.subprotocols,t]}}function at(n){if(typeof n=="function"&&(n=n()),n&&!/^wss?:/i.test(n)){const t=document.createElement("a");return t.href=n,t.href=t.href,t.protocol=t.protocol.replace("http","ws"),t.href}else return n}function ht(n=dt("url")||V.default_mount_path){return new ut(n)}function dt(n){const t=document.head.querySelector(`meta[name='action-cable-${n}']`);if(t)return t.getAttribute("content")}let U;function ft(){return U??=ht(),U}const pt=5e3,q="railwatch:live-paused";let L=!1;const O=new Set;function z(n){if(L!==n){L=n;for(const t of O)t()}}function gt(n){return O.add(n),()=>{O.delete(n)}}function Rt(){return c.useSyncExternalStore(gt,bt,mt)}function mt(){return!1}function bt(){return L}function kt(n,t){const e=nt.c(19);let s;e[0]!==t?(s={},e[0]=t,e[1]=s):s=e[1];const{only:o,onEvent:r}=s,[u,T]=c.useState(!1),[E,G]=c.useState(null),[_,N]=c.useState(null),[K,Y]=c.useState(n);K!==n&&(Y(n),T(!1),G(null),N(null));const[l,Q]=c.useState(At),I=c.useRef(o),H=c.useRef(r),$=c.useRef(l);let m;e[2]!==r||e[3]!==o||e[4]!==l?(m=()=>{I.current=o,H.current=r,$.current=l},e[2]=r,e[3]=o,e[4]=l,e[5]=m):m=e[5],c.useEffect(m);const P=c.useRef(vt);let b,S;e[6]!==u||e[7]!==l?(b=()=>(z(u&&!l),yt),S=[u,l],e[6]=u,e[7]=l,e[8]=b,e[9]=S):(b=e[8],S=e[9]),c.useEffect(b,S);let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=function(h){$.current=h,localStorage.setItem(q,h?"1":"0"),Q(h),P.current()},e[10]=y):y=e[10];const X=y;let v,A;e[11]!==n?(v=()=>{let a=!1,h=!1,D=!1,J=-1/0,R,M;const Z=function(){h=!1,D=!0,J=Date.now(),it.reload({only:I.current,onCancelToken:et=>{M=()=>et.cancel()},onSuccess:()=>{a||N(Date.now())},onFinish:()=>{M=void 0,D=!1,f()}})};function f(){if(clearTimeout(R),R=void 0,a||!h||D||$.current||document.visibilityState!=="visible")return;const d=pt-(Date.now()-J);d>0?R=setTimeout(f,d):Z()}const B=function(){f()};document.addEventListener("visibilitychange",B),P.current=f;const tt=ft().subscriptions.create({channel:"EnvironmentChannel",id:n},{connected:()=>{a||T(!0)},disconnected:()=>{a||T(!1)},received:d=>{a||(G(Date.now()),H.current?.(d),h=!0,f())}});return()=>{a=!0,M?.(),clearTimeout(R),P.current=St,document.removeEventListener("visibilitychange",B),tt.unsubscribe()}},A=[n],e[11]=n,e[12]=v,e[13]=A):(v=e[12],A=e[13]),c.useEffect(v,A);let w;return e[14]!==u||e[15]!==E||e[16]!==_||e[17]!==l?(w={connected:u,lastEventAt:E,lastRefreshedAt:_,paused:l,setPaused:X},e[14]=u,e[15]=E,e[16]=_,e[17]=l,e[18]=w):w=e[18],w}function St(){}function yt(){return z(!1)}function vt(){}function At(){return typeof window>"u"?!1:localStorage.getItem(q)==="1"}export{Rt as a,kt as u};