railwatch 0.3.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -0
- data/{lib/generators/railwatch/install/templates → app/frontend/lib}/railwatch.ts +162 -42
- data/app/models/railwatch/ingest/batch.rb +1 -0
- data/app/models/railwatch/ingest/mapper.rb +12 -0
- data/docs/configuration.md +8 -3
- data/lib/generators/railwatch/install/install_generator.rb +5 -1
- data/lib/railwatch/patches/rake_task.rb +10 -1
- data/lib/railwatch/patches/runner_command.rb +3 -1
- data/lib/railwatch/transport/http.rb +15 -5
- data/lib/railwatch/version.rb +1 -1
- data/lib/railwatch/wire_fixtures.json +856 -0
- data/lib/railwatch.rb +22 -0
- data/lib/tasks/railwatch_tasks.rake +7 -0
- data/public/railwatch/assets/{app-layout-B5Fcdwfz.js → app-layout-DUk54qUM.js} +1 -1
- data/public/railwatch/assets/{app-wordmark-1SRllgHv.js → app-wordmark-DDNuuq5_.js} +1 -1
- data/public/railwatch/assets/{appearance-DbwahDrc.js → appearance-C3LMdsDy.js} +1 -1
- data/public/railwatch/assets/{arrow-up-DwKQcab4.js → arrow-up-DYTCBENO.js} +1 -1
- data/public/railwatch/assets/{auth-layout-DXfxXAN_.js → auth-layout-CzPRawuI.js} +1 -1
- data/public/railwatch/assets/{badge-CApjyWcg.js → badge-s7YDycYg.js} +1 -1
- data/public/railwatch/assets/{braces-kGSgxWnS.js → braces-BFrg-bvp.js} +1 -1
- data/public/railwatch/assets/{card-BaJ8kNkp.js → card-DiW-JhK3.js} +1 -1
- data/public/railwatch/assets/{chart-hover-XYPNE2CX.js → chart-hover-DMWx5-Rs.js} +1 -1
- data/public/railwatch/assets/{chart-Xnrz1Nqw.js → chart-nsdZV0Dv.js} +1 -1
- data/public/railwatch/assets/{chart-panel-BYk68mJJ.js → chart-panel-BlirnMrQ.js} +1 -1
- data/public/railwatch/assets/{checkbox-Bf41R8W6.js → checkbox-C2AqEZXX.js} +1 -1
- data/public/railwatch/assets/{code-a-9sh36A.js → code-DVJtYP7h.js} +1 -1
- data/public/railwatch/assets/{copy-block-zykZWQym.js → copy-block-D1myf7is.js} +1 -1
- data/public/railwatch/assets/{copy-id-b6CW5ESL.js → copy-id-CyRCMfdH.js} +1 -1
- data/public/railwatch/assets/{cursor-load-more-0cHzbTPT.js → cursor-load-more-JfSVBn9C.js} +1 -1
- data/public/railwatch/assets/{data-table-IvA7xvrK.js → data-table-CwtPkw_i.js} +1 -1
- data/public/railwatch/assets/{edit-7lmf3k80.js → edit-BvTugIpj.js} +1 -1
- data/public/railwatch/assets/{edit-ZKE15r-F.js → edit-DvpDUM-t.js} +1 -1
- data/public/railwatch/assets/{edit-DTtRV1fO.js → edit-fB83T9Yh.js} +1 -1
- data/public/railwatch/assets/{empty-state-BFTnQ2oT.js → empty-state-CshhuRUU.js} +1 -1
- data/public/railwatch/assets/{env-layout-erSDpIXg.js → env-layout-Dkp_4NvM.js} +1 -1
- data/public/railwatch/assets/{execution-path-Di5uUHi-.js → execution-path-CdEerUGH.js} +1 -1
- data/public/railwatch/assets/{filter-bar-Btm__gQi.js → filter-bar-BMHf8xBb.js} +1 -1
- data/public/railwatch/assets/{flamegraph-C-mZdqa7.js → flamegraph-uYWk1Yov.js} +1 -1
- data/public/railwatch/assets/{frames-KZBsjg6-.js → frames-B5ZECkvt.js} +1 -1
- data/public/railwatch/assets/{google-sign-in-button-DJRoD72g.js → google-sign-in-button-CAvsXYb4.js} +1 -1
- data/public/railwatch/assets/{index-CeqMDByC.js → index-1-78ZewP.js} +1 -1
- data/public/railwatch/assets/{index-P_e_cI0O.js → index-B-qRsj0W.js} +1 -1
- data/public/railwatch/assets/{index-kNhZPLVj.js → index-B4IRsZXK.js} +1 -1
- data/public/railwatch/assets/{index-QyHE9WsU.js → index-BIZsdfdM.js} +1 -1
- data/public/railwatch/assets/{index-EGU__DOB.js → index-BIom4V2g.js} +1 -1
- data/public/railwatch/assets/{index-Bot7kHMA.js → index-BMgA9NNc.js} +1 -1
- data/public/railwatch/assets/{index-CX8Br7m9.js → index-BpnfuXi-.js} +1 -1
- data/public/railwatch/assets/{index-D4968-TC.js → index-Bw_ByIps.js} +1 -1
- data/public/railwatch/assets/{index-CU6yhEyt.js → index-C7bU7oUF.js} +1 -1
- data/public/railwatch/assets/{index-Z1c4nFL0.js → index-CAkCcAty.js} +1 -1
- data/public/railwatch/assets/{index-B-bSm1jB.js → index-CRShH-fR.js} +1 -1
- data/public/railwatch/assets/{index-DBTxQw77.js → index-CZWzIE8F.js} +1 -1
- data/public/railwatch/assets/{index-Cj3_jD1E.js → index-CaJvo0Oc.js} +1 -1
- data/public/railwatch/assets/{index-HCJmFcZu.js → index-CdM3F3jz.js} +1 -1
- data/public/railwatch/assets/{index-DcItJxa5.js → index-ClG89uia.js} +1 -1
- data/public/railwatch/assets/{index-CAzQkw-h.js → index-ClJtZh5Q.js} +1 -1
- data/public/railwatch/assets/{index-Bjw4sTXU.js → index-Czq2bi1U.js} +1 -1
- data/public/railwatch/assets/{index-CP6jrrPT.js → index-D-O1LUPq.js} +1 -1
- data/public/railwatch/assets/{index-CYYmZpZu.js → index-DJIXGkfB.js} +1 -1
- data/public/railwatch/assets/{index-BAkZNNEh.js → index-DMcsT2ES.js} +1 -1
- data/public/railwatch/assets/{index-wOj5j0KC.js → index-DVUwgfqP.js} +1 -1
- data/public/railwatch/assets/{index-DAEzO_vq.js → index-DWMKU6mG.js} +1 -1
- data/public/railwatch/assets/{index-BWSyQRZI.js → index-DYrF-A96.js} +1 -1
- data/public/railwatch/assets/{index-BsrCnQqg.js → index-DcuyMiuG.js} +1 -1
- data/public/railwatch/assets/{index-BoTOVM0v.js → index-DpWQMikK.js} +1 -1
- data/public/railwatch/assets/{index-CIUl9POV.js → index-DuGGTdIJ.js} +1 -1
- data/public/railwatch/assets/{index-uHBVO8Lh.js → index-DzoUj38Q.js} +1 -1
- data/public/railwatch/assets/{index-CBJZQgHA.js → index-QxAKxnHK.js} +1 -1
- data/public/railwatch/assets/{index-9LL_C3eG.js → index-X13K9BbO.js} +1 -1
- data/public/railwatch/assets/{index-DEfu_YvU.js → index-Zf9xXwq7.js} +1 -1
- data/public/railwatch/assets/{index-Bo8hrjbs.js → index-dKn1tKSX.js} +1 -1
- data/public/railwatch/assets/{index-DCAho97K.js → index-fA7h22qS.js} +1 -1
- data/public/railwatch/assets/{index-BtSlLmkg.js → index-iVNm3uzI.js} +1 -1
- data/public/railwatch/assets/{index-B0VXzXYG.js → index-n16aviHx.js} +1 -1
- data/public/railwatch/assets/{index-DXUwhSCQ.js → index-vC9KU2bt.js} +1 -1
- data/public/railwatch/assets/{inertia-Degv_G9N.js → inertia-CUTKXjxg.js} +3 -3
- data/public/railwatch/assets/{input-error-C6SqO_iU.js → input-error-C8ycyeD0.js} +1 -1
- data/public/railwatch/assets/{json-viewer-DcQIxT86.js → json-viewer-CJECqZ0l.js} +1 -1
- data/public/railwatch/assets/{klass-WgQEfWpo.js → klass-Br9dng39.js} +1 -1
- data/public/railwatch/assets/{label-B_vK19tR.js → label-B32Ks8n7.js} +1 -1
- data/public/railwatch/assets/{layout-C8q7GUlZ.js → layout-5ZhRtywp.js} +1 -1
- data/public/railwatch/assets/{live-dot-DaXEbkXo.js → live-dot-Bb1UYT9F.js} +1 -1
- data/public/railwatch/assets/{nav-BnD5XArZ.js → nav-XUcwnBso.js} +1 -1
- data/public/railwatch/assets/{new-BL9OqXHe.js → new-0xyEF6NL.js} +1 -1
- data/public/railwatch/assets/{new-DIjwu2jF.js → new-CV011uLi.js} +1 -1
- data/public/railwatch/assets/{new-BqP0NhOF.js → new-CdvlEBjJ.js} +1 -1
- data/public/railwatch/assets/{new-BhRnQn4w.js → new-D9-ORiNW.js} +1 -1
- data/public/railwatch/assets/{new-uxMnBtoY.js → new-GIkDYLt8.js} +1 -1
- data/public/railwatch/assets/{new-CWP3wtwt.js → new-YBWOo9_V.js} +1 -1
- data/public/railwatch/assets/{onboarding-C_Y3xTsH.js → onboarding-BqEuP-Ml.js} +1 -1
- data/public/railwatch/assets/{origin-identity-CNhOnfBa.js → origin-identity-DrJ4D2TX.js} +1 -1
- data/public/railwatch/assets/{percentile-picker-BujVEhP6.js → percentile-picker-_wllqYoJ.js} +1 -1
- data/public/railwatch/assets/{relative-time-6CoKr1lN.js → relative-time-CV7V8aSP.js} +1 -1
- data/public/railwatch/assets/{release-health-1Qzc_XhT.js → release-health-DRNLZtT7.js} +1 -1
- data/public/railwatch/assets/{route-xqgYjOwJ.js → route-D9slUz_a.js} +1 -1
- data/public/railwatch/assets/{segmented-CVKq2Xpa.js → segmented-Bj70Htrs.js} +1 -1
- data/public/railwatch/assets/{select-CsmSXsJ4.js → select-DJBZX2ky.js} +1 -1
- data/public/railwatch/assets/{separator-CrM10Oot.js → separator-UUo0bkyc.js} +1 -1
- data/public/railwatch/assets/{series-chart-D33UhdG2.js → series-chart-C1YrNlID.js} +1 -1
- data/public/railwatch/assets/{show-zxVxhUel.js → show-BQtEcTeD.js} +1 -1
- data/public/railwatch/assets/{show-B0nHy31L.js → show-BT3tKCgP.js} +1 -1
- data/public/railwatch/assets/{show-DZwcZZrz.js → show-BoG7jcwk.js} +1 -1
- data/public/railwatch/assets/{show-ixK2r2f1.js → show-BpyCRL-I.js} +1 -1
- data/public/railwatch/assets/{show-rysBbvt-.js → show-C0uC3gnA.js} +1 -1
- data/public/railwatch/assets/{show-B3izvRdU.js → show-COfP8yWt.js} +1 -1
- data/public/railwatch/assets/{show-B7NhcWgp.js → show-CefJwag7.js} +1 -1
- data/public/railwatch/assets/{show-8H9WAGav.js → show-ChDJZjoj.js} +1 -1
- data/public/railwatch/assets/{show-CJMeX75E.js → show-D7IL22Hy.js} +1 -1
- data/public/railwatch/assets/{show-DUwQlohF.js → show-D7tP881O.js} +1 -1
- data/public/railwatch/assets/{show-BM-E2iYc.js → show-DR6u4CR7.js} +1 -1
- data/public/railwatch/assets/{show-CMisHNAI.js → show-DnBCvlnd.js} +1 -1
- data/public/railwatch/assets/{show-BlNR3ZOZ.js → show-DoCg0ifP.js} +1 -1
- data/public/railwatch/assets/{show-9jDeBNpc.js → show-GruxlCov.js} +1 -1
- data/public/railwatch/assets/{show-CvNV23gH.js → show-Pu3Iehw5.js} +1 -1
- data/public/railwatch/assets/{show-DMZlwzL_.js → show-TTCk2Met.js} +1 -1
- data/public/railwatch/assets/{show-CQ4Ze-Un.js → show-yQipmite.js} +1 -1
- data/public/railwatch/assets/{sort-header-CKj_7G3U.js → sort-header-CqQQhaxg.js} +1 -1
- data/public/railwatch/assets/{sparkline-cell-Ckg29yVq.js → sparkline-cell-BwdBz0yv.js} +1 -1
- data/public/railwatch/assets/{stat-TxvoBiC8.js → stat-IghK3WjD.js} +1 -1
- data/public/railwatch/assets/{status-badge-5NCVJHjo.js → status-badge-XYUN9gUA.js} +1 -1
- data/public/railwatch/assets/{tenant-path-B5ZRK4x3.js → tenant-path-SxnZbfU1.js} +1 -1
- data/public/railwatch/assets/{text-link-BPllRj0F.js → text-link-NCL9N5D5.js} +1 -1
- data/public/railwatch/assets/{textarea-DtD5yZp_.js → textarea-DhI1dmQa.js} +1 -1
- data/public/railwatch/assets/{timeline-DZz5ZnHN.js → timeline-CLAwsAlo.js} +1 -1
- data/public/railwatch/assets/{transition-Ds6Cakuc.js → transition-DpTb9Yiv.js} +1 -1
- data/public/railwatch/assets/{use-clipboard-BLjjYH8V.js → use-clipboard-D5i6e5kf.js} +1 -1
- data/public/railwatch/assets/{use-live-GKze1mNC.js → use-live-V-slSdFJ.js} +1 -1
- data/public/railwatch/manifest.json +1287 -1287
- metadata +117 -116
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as i,aK as b,a3 as oe}from"./inertia-
|
|
1
|
+
import{r as i,aK as b,a3 as oe}from"./inertia-CUTKXjxg.js";var Ae=Object.defineProperty,Ne=(e,t,n)=>t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t,n)=>(Ne(e,typeof t!="symbol"?t+"":t,n),n);let ke=class{constructor(){Q(this,"current",this.detect()),Q(this,"handoffState","pending"),Q(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},D=new ke;function Pe(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function q(){let e=[],t={addEventListener(n,r,l,s){return n.addEventListener(r,l,s),t.add(()=>n.removeEventListener(r,l,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Pe(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,l){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:l}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=q();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let l of e.splice(r,1))l()}},dispose(){for(let n of e.splice(0))n()}};return t}function de(){let[e]=i.useState(q);return i.useEffect(()=>()=>e.dispose(),[e]),e}let O=(e,t)=>{D.isServer?i.useEffect(e,t):i.useLayoutEffect(e,t)};function pe(e){let t=i.useRef(e);return O(()=>{t.current=e},[e]),t}let $=function(e){let t=pe(e);return b.useCallback((...n)=>t.current(...n),[t])};function X(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function K(e,t,...n){if(e in t){let l=t[e];return typeof l=="function"?l(...n):l}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(l=>`"${l}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,K),r}var me=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(me||{}),T=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(T||{});function he(){let e=He();return i.useCallback(t=>xe({mergeRefs:e,...t}),[e])}function xe({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:l,visible:s=!0,name:f,mergeRefs:u}){u=u??Le;let a=ve(t,e);if(s)return M(a,n,r,f,u);let p=l??0;if(p&2){let{static:o=!1,...h}=a;if(o)return M(h,n,r,f,u)}if(p&1){let{unmount:o=!0,...h}=a;return K(o?0:1,{0(){return null},1(){return M({...h,hidden:!0,style:{display:"none"}},n,r,f,u)}})}return M(a,n,r,f,u)}function M(e,t={},n,r,l){let{as:s=n,children:f,refName:u="ref",...a}=W(e,["unmount","static"]),p=e.ref!==void 0?{[u]:e.ref}:{},o=typeof f=="function"?f(t):f;o=ge(o),"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let h={};if(t){let g=!1,d=[];for(let[c,v]of Object.entries(t))typeof v=="boolean"&&(g=!0),v===!0&&d.push(c.replace(/([A-Z])/g,m=>`-${m.toLowerCase()}`));if(g){h["data-headlessui-state"]=d.join(" ");for(let c of d)h[`data-${c}`]=""}}if(x(s)&&(Object.keys(R(a)).length>0||Object.keys(R(h)).length>0))if(!i.isValidElement(o)||Array.isArray(o)&&o.length>1||Ie(o)){if(Object.keys(R(a)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(R(a)).concat(Object.keys(R(h))).map(g=>` - ${g}`).join(`
|
|
2
2
|
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(g=>` - ${g}`).join(`
|
|
3
3
|
`)].join(`
|
|
4
4
|
`))}else{let g=o.props,d=g?.className,c=typeof d=="function"?(...E)=>X(d(...E),a.className):X(d,a.className),v=c?{className:c}:{},m=ve(o.props,R(W(a,["ref"])));for(let E in h)E in m&&delete h[E];return i.cloneElement(o,Object.assign({},m,h,p,{ref:l(Ue(o),p.ref)},v))}return i.createElement(s,Object.assign({},W(a,["ref"]),!x(s)&&p,!x(s)&&h),o)}function He(){let e=i.useRef([]),t=i.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function Le(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function ve(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let l in r)l.startsWith("on")&&typeof r[l]=="function"?(n[l]!=null||(n[l]=[]),n[l].push(r[l])):t[l]=r[l];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[l=>{var s;return(s=l?.preventDefault)==null?void 0:s.call(l)}]);for(let r in n)Object.assign(t,{[r](l,...s){let f=n[r];for(let u of f){if((l instanceof Event||l?.nativeEvent instanceof Event)&&l.defaultPrevented)return;u(l,...s)}}});return t}function ee(e){var t;return Object.assign(i.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function R(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function W(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Ue(e){return b.version.split(".")[0]>="19"?e.props.ref:e.ref}function ge(e){if(e!=null&&e.$$typeof===Symbol.for("react.lazy")){let t=e._payload;if(t!=null&&t.status==="fulfilled")return ge(t.value)}return e}function x(e){return e===i.Fragment||e===Symbol.for("react.fragment")}function Ie(e){return x(e.type)}let Me=Symbol();function ye(...e){let t=i.useRef(e);i.useEffect(()=>{t.current=e},[e]);let n=$(r=>{for(let l of t.current)l!=null&&(typeof l=="function"?l(r):l.current=r)});return e.every(r=>r==null||r?.[Me])?void 0:n}function De(e=0){let[t,n]=i.useState(e),r=i.useCallback(a=>n(a),[]),l=i.useCallback(a=>n(p=>p|a),[]),s=i.useCallback(a=>(t&a)===a,[t]),f=i.useCallback(a=>n(p=>p&~a),[]),u=i.useCallback(a=>n(p=>p^a),[]);return{flags:t,setFlag:r,addFlag:l,hasFlag:s,removeFlag:f,toggleFlag:u}}var qe={},fe,ce;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((fe=process==null?void 0:qe)==null?void 0:fe.NODE_ENV)==="test"&&typeof((ce=Element?.prototype)==null?void 0:ce.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as i,c as l,r as p}from"./inertia-
|
|
1
|
+
import{B as i,c as l,r as p}from"./inertia-CUTKXjxg.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-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};
|
|
1
|
+
import{r as c,c as nt,e as it}from"./inertia-CUTKXjxg.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};
|