Files
MultiRoombaRover/server/public/assets/FleetReportsApp-BH7qaqHr.js
T
Saul5662andClaude 0e1ad8c6a0 feat(webui): Volume settings section and admin boost-cap editor
Adds a server-backed Volume card to page settings with horn, TTS, and
microphone sliders. Each slider is a 0-100% share of the ceiling the
server resolved for that user, and the card shows the resulting
multiplier plus whether the user is on the normal global limit or a
raised VIP limit. A slider whose ceiling is zero renders disabled rather
than pretending to do something.

The admin section gains sliders for the VIP boost hard caps beside the
existing global gains. Both editors now render from one GAIN_FIELDS list
through a shared GainSlider instead of six copied slider blocks.

Includes the rebuilt bundle so the served UI matches the source.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-29 04:10:26 +01:00

12 lines
33 KiB
JavaScript

import{g as Me,u as Ae,a as Ne,i as De,b as Ie,D as Le,j as e,c as Te,S as Fe,t as Pe,C as de,L as Oe,r as he,d as We,e as Ue}from"./index-B8HPO9Qz.js";var be={exports:{}};var He=be.exports,Ce;function $e(){return Ce||(Ce=1,(function(S,M){(($,v)=>{S.exports=v()})(He,function $(){var v=typeof self<"u"?self:typeof window<"u"?window:v!==void 0?v:{},B,z=!v.document&&!!v.postMessage,f=v.IS_PAPA_WORKER||!1,ie={},w=0,o={};function b(t){return t.charCodeAt(0)===65279?t.slice(1):t}function C(t){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(r){var s=je(r);s.chunkSize=parseInt(s.chunkSize),r.step||r.chunk||(s.chunkSize=null),this._handle=new pe(s),(this._handle.streamer=this)._config=s}).call(this,t),this.parseChunk=function(r,s){var i=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<i){let p=this._config.newline;p||(n=this._config.quoteChar||'"',p=this._handle.guessLineEndings(r,n)),r=[...r.split(p).slice(i)].join(p)}this.isFirstChunk&&E(this._config.beforeFirstChunk)&&(n=this._config.beforeFirstChunk(r))!==void 0&&(r=n),this.isFirstChunk=!1,this._halted=!1;var i=this._partialLine+r,n=(this._partialLine="",this._handle.parse(i,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(r=n.meta.cursor,i=(this._finished||(this._partialLine=i.substring(r-this._baseIndex),this._baseIndex=r),n&&n.data&&(this._rowCount+=n.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),f)v.postMessage({results:n,workerId:o.WORKER_ID,finished:i});else if(E(this._config.chunk)&&!s){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=n=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!i||!E(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),i||n&&n.meta.paused||this._nextChunk(),n}this._halted=!0},this._sendError=function(r){E(this._config.error)?this._config.error(r):f&&this._config.error&&v.postMessage({workerId:o.WORKER_ID,error:r,finished:!1})}}function re(t){var r;(t=t||{}).chunkSize||(t.chunkSize=o.RemoteChunkSize),C.call(this,t),this._nextChunk=z?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(s){this._input=s,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(r=new XMLHttpRequest,this._config.withCredentials&&(r.withCredentials=this._config.withCredentials),z||(r.onload=ae(this._chunkLoaded,this),r.onerror=ae(this._chunkError,this)),r.open(this._config.downloadRequestBody?"POST":"GET",this._input,!z),this._config.downloadRequestHeaders){var s,i=this._config.downloadRequestHeaders;for(s in i)r.setRequestHeader(s,i[s])}var n;this._config.chunkSize&&(n=this._start+this._config.chunkSize-1,r.setRequestHeader("Range","bytes="+this._start+"-"+n));try{r.send(this._config.downloadRequestBody)}catch(p){this._chunkError(p.message)}z&&r.status===0&&this._chunkError()}},this._chunkLoaded=function(){r.readyState===4&&(r.status<200||400<=r.status?this._chunkError():(this._start+=this._config.chunkSize||r.responseText.length,this._finished=!this._config.chunkSize||this._start>=(s=>(s=s.getResponseHeader("Content-Range"))!==null?parseInt(s.substring(s.lastIndexOf("/")+1)):-1)(r),this.parseChunk(r.responseText)))},this._chunkError=function(s){s=r.statusText||s,this._sendError(new Error(s))}}function O(t){(t=t||{}).chunkSize||(t.chunkSize=o.LocalChunkSize),C.call(this,t);var r,s,i=typeof FileReader<"u";this.stream=function(n){this._input=n,s=n.slice||n.webkitSlice||n.mozSlice,i?((r=new FileReader).onload=ae(this._chunkLoaded,this),r.onerror=ae(this._chunkError,this)):r=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var n=this._input,p=(this._config.chunkSize&&(p=Math.min(this._start+this._config.chunkSize,this._input.size),n=s.call(n,this._start,p)),r.readAsText(n,this._config.encoding));i||this._chunkLoaded({target:{result:p}})},this._chunkLoaded=function(n){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(n.target.result)},this._chunkError=function(){this._sendError(r.error)}}function l(t){var r;C.call(this,t=t||{}),this.stream=function(s){return r=s,this._nextChunk()},this._nextChunk=function(){var s,i;if(!this._finished)return s=this._config.chunkSize,r=s?(i=r.substring(0,s),r.substring(s)):(i=r,""),this._finished=!r,this.parseChunk(i)}}function _(t){C.call(this,t=t||{});var r=[],s=!0,i=!1;this.pause=function(){C.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){C.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(n){this._input=n,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){i&&r.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),r.length?this.parseChunk(r.shift()):s=!0},this._streamData=ae(function(n){try{r.push(typeof n=="string"?n:n.toString(this._config.encoding)),s&&(s=!1,this._checkIsFinished(),this.parseChunk(r.shift()))}catch(p){this._streamError(p)}},this),this._streamError=ae(function(n){this._streamCleanUp(),this._sendError(n)},this),this._streamEnd=ae(function(){this._streamCleanUp(),i=!0,this._streamData("")},this),this._streamCleanUp=ae(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function pe(t){var r,s,i,n,p=Math.pow(2,53),L=-p,V=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,G=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,m=this,T=0,d=0,K=!1,c=!1,g=[],a={data:[],errors:[],meta:{}};function J(j){return t.skipEmptyLines==="greedy"?j.join("").trim()==="":j.length===1&&j[0].length===0}function A(){if(a&&i&&(Y("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),i=!1),t.skipEmptyLines&&(a.data=a.data.filter(function(h){return!J(h)})),P()){let h=function(D,U){D=b(D),E(t.transformHeader)&&(D=t.transformHeader(D,U)),g.push(D)};if(a)if(Array.isArray(a.data[0])){for(var j=0;P()&&j<a.data.length;j++)a.data[j].forEach(h);a.data.splice(0,1)}else a.data.forEach(h)}function x(h,D){for(var U=t.header?{}:[],R=0;R<h.length;R++){var N=R,y=h[R],y=((Z,u)=>(I=>(t.dynamicTypingFunction&&t.dynamicTyping[I]===void 0&&(t.dynamicTyping[I]=t.dynamicTypingFunction(I)),(t.dynamicTyping[I]||t.dynamicTyping)===!0))(Z)?u==="true"||u==="TRUE"||u!=="false"&&u!=="FALSE"&&((I=>{if(V.test(I)&&(I=parseFloat(I),L<I&&I<p))return 1})(u)?parseFloat(u):G.test(u)?new Date(u):u===""?null:u):u)(N=t.header?R>=g.length?"__parsed_extra":g[R]:N,y=t.transform?t.transform(y,N):y);N==="__parsed_extra"?(U[N]=U[N]||[],U[N].push(y)):U[N]=y}return t.header&&(R>g.length?Y("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+R,d+D):R<g.length&&Y("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+R,d+D)),U}var F;a&&(t.header||t.dynamicTyping||t.transform)&&(F=1,!a.data.length||Array.isArray(a.data[0])?(a.data=a.data.map(x),F=a.data.length):a.data=x(a.data,0),t.header&&a.meta&&(a.meta.fields=g),d+=F)}function P(){return t.header&&g.length===0}function Y(j,x,F,h){j={type:j,code:x,message:F},h!==void 0&&(j.row=h),a.errors.push(j)}E(t.step)&&(n=t.step,t.step=function(j){a=j,P()?A():(A(),a.data.length!==0&&(T+=j.data.length,t.preview&&T>t.preview?s.abort():(a.data=a.data[0],n(a,m))))}),this.parse=function(j,x,F){var h=t.quoteChar||'"',h=(t.newline||(t.newline=this.guessLineEndings(j,h)),i=!1,t.delimiter?E(t.delimiter)&&(t.delimiter=t.delimiter(j),a.meta.delimiter=t.delimiter):((h=((D,U,R,N,y)=>{var Z,u,I,le;y=y||[","," ","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var ue=0;ue<y.length;ue++){for(var X,me=y[ue],q=0,ee=0,H=0,Q=(I=void 0,new ce({comments:N,delimiter:me,newline:U,preview:10}).parse(D)),ne=0;ne<Q.data.length;ne++)R&&J(Q.data[ne])?H++:(X=Q.data[ne].length,ee+=X,I===void 0?I=X:0<X&&(q+=Math.abs(X-I),I=X));0<Q.data.length&&(ee/=Q.data.length-H),(u===void 0||q<=u)&&(le===void 0||le<ee)&&1.99<ee&&(u=q,Z=me,le=ee)}return{successful:!!(t.delimiter=Z),bestDelimiter:Z}})(j,t.newline,t.skipEmptyLines,t.comments,t.delimitersToGuess)).successful?t.delimiter=h.bestDelimiter:(i=!0,t.delimiter=o.DefaultDelimiter),a.meta.delimiter=t.delimiter),je(t));return t.preview&&t.header&&h.preview++,r=j,s=new ce(h),a=s.parse(r,x,F),A(),K?{meta:{paused:!0}}:a||{meta:{paused:!1}}},this.paused=function(){return K},this.pause=function(){K=!0,s.abort(),r=E(t.chunk)?"":r.substring(s.getCharIndex())},this.resume=function(){m.streamer._halted?(K=!1,m.streamer.parseChunk(r,!0)):setTimeout(m.resume,3)},this.aborted=function(){return c},this.abort=function(){c=!0,s.abort(),a.meta.aborted=!0,E(t.complete)&&t.complete(a),r=""},this.guessLineEndings=function(D,h){D=D.substring(0,1048576);var h=new RegExp(se(h)+"([^]*?)"+se(h),"gm"),F=(D=D.replace(h,"")).split("\r"),h=D.split(`
`),D=1<h.length&&h[0].length<F[0].length;if(F.length===1||D)return`
`;for(var U=0,R=0;R<F.length;R++)F[R][0]===`
`&&U++;return U>=F.length/2?`\r
`:"\r"}}function se(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(t){var r=(t=t||{}).delimiter,s=t.newline,i=t.comments,n=t.step,p=t.preview,L=t.fastMode,V=null,G=!1,m=t.quoteChar==null?'"':t.quoteChar,T=m;if(t.escapeChar!==void 0&&(T=t.escapeChar),(typeof r!="string"||-1<o.BAD_DELIMITERS.indexOf(r))&&(r=","),i===r)throw new Error("Comment character same as delimiter");i===!0?i="#":(typeof i!="string"||-1<o.BAD_DELIMITERS.indexOf(i))&&(i=!1),s!==`
`&&s!=="\r"&&s!==`\r
`&&(s=`
`);var d=0,K=!1;this.parse=function(c,g,a){if(typeof c!="string")throw new Error("Input must be a string");var J=c.length,A=r.length,P=s.length,Y=i.length,j=E(n),x=[],F=[],h=[],D=d=0;if(!c)return q();if(L||L!==!1&&c.indexOf(m)===-1){for(var U=c.split(s),R=0;R<U.length;R++){if(h=U[R],d+=h.length,R!==U.length-1)d+=s.length;else if(a)return q();if(!i||h.substring(0,Y)!==i){if(j){if(x=[],le(h.split(r)),ee(),K)return q()}else le(h.split(r));if(p&&p<=R)return x=x.slice(0,p),q(!0)}}return q()}for(var N=c.indexOf(r,d),y=c.indexOf(s,d),Z=new RegExp(se(T)+se(m),"g"),u=c.indexOf(m,d);;)if(c[d]===m)for(u=d,d++;;){if((u=c.indexOf(m,u+1))===-1)return a||F.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:d}),X();if(u===J-1)return X(c.substring(d,u).replace(Z,m));if(m===T&&c[u+1]===T)u++;else if(m===T||u===0||c[u-1]!==T){N!==-1&&N<u+1&&(N=c.indexOf(r,u+1));var I=ue((y=y!==-1&&y<u+1?c.indexOf(s,u+1):y)===-1?N:Math.min(N,y));if(c.substr(u+1+I,A)===r){h.push(c.substring(d,u).replace(Z,m)),c[d=u+1+I+A]!==m&&(u=c.indexOf(m,d)),N=c.indexOf(r,d),y=c.indexOf(s,d);break}if(I=ue(y),c.substring(u+1+I,u+1+I+P)===s){if(h.push(c.substring(d,u).replace(Z,m)),me(u+1+I+P),N=c.indexOf(r,d),u=c.indexOf(m,d),j&&(ee(),K))return q();if(p&&x.length>=p)return q(!0);break}F.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:d}),u++}}else if(i&&h.length===0&&c.substring(d,d+Y)===i){if(y===-1)return q();d=y+P,y=c.indexOf(s,d),N=c.indexOf(r,d)}else if(N!==-1&&(N<y||y===-1))h.push(c.substring(d,N)),d=N+A,N=c.indexOf(r,d);else{if(y===-1)break;if(h.push(c.substring(d,y)),me(y+P),j&&(ee(),K))return q();if(p&&x.length>=p)return q(!0)}return X();function le(H){x.push(H),D=d}function ue(H){var Q=0;return Q=H!==-1&&(H=c.substring(u+1,H))&&H.trim()===""?H.length:Q}function X(H){return a||(H===void 0&&(H=c.substring(d)),h.push(H),d=J,le(h),j&&ee()),q()}function me(H){d=H,le(h),h=[],y=c.indexOf(s,d)}function q(H){if(t.header&&!g&&x.length&&!G){var Q=x[0],ne=Object.create(null),_e=new Set(Q);let we=!1;for(let fe=0;fe<Q.length;fe++){let te=b(Q[fe]);if(ne[te=E(t.transformHeader)?t.transformHeader(te,fe):te]){let ge,Re=ne[te];for(;ge=te+"_"+Re,Re++,_e.has(ge););_e.add(ge),Q[fe]=ge,ne[te]++,we=!0,(V=V===null?{}:V)[ge]=te}else ne[te]=1,Q[fe]=te;_e.add(te)}we&&console.warn("Duplicate headers found and renamed."),G=!0}return{data:x,errors:F,meta:{delimiter:r,linebreak:s,aborted:K,truncated:!!H,cursor:D+(g||0),renamedHeaders:V}}}function ee(){n(q()),x=[],F=[]}},this.abort=function(){K=!0},this.getCharIndex=function(){return d}}function ye(t){var r=t.data,s=ie[r.workerId],i=!1;if(r.error)s.userError(r.error,r.file);else if(r.results&&r.results.data){var n={abort:function(){i=!0,ke(r.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:Se,resume:Se};if(E(s.userStep)){for(var p=0;p<r.results.data.length&&(s.userStep({data:r.results.data[p],errors:r.results.errors,meta:r.results.meta},n),!i);p++);delete r.results}else E(s.userChunk)&&(s.userChunk(r.results,n,r.file),delete r.results)}r.finished&&!i&&ke(r.workerId,r.results)}function ke(t,r){var s=ie[t];E(s.userComplete)&&s.userComplete(r),s.terminate(),delete ie[t]}function Se(){throw new Error("Not implemented.")}function je(t){if(typeof t!="object"||t===null)return t;var r,s=Array.isArray(t)?[]:{};for(r in t)s[r]=je(t[r]);return s}function ae(t,r){return function(){t.apply(r,arguments)}}function E(t){return typeof t=="function"}return o.parse=function(t,r){var s=(r=r||{}).dynamicTyping||!1;if(E(s)&&(r.dynamicTypingFunction=s,s={}),r.dynamicTyping=s,r.transform=!!E(r.transform)&&r.transform,!r.worker||!o.WORKERS_SUPPORTED)return s=null,o.NODE_STREAM_INPUT,typeof t=="string"?(t=b(t),s=new(r.download?re:l)(r)):t.readable===!0&&E(t.read)&&E(t.on)?s=new _(r):(v.File&&t instanceof File||t instanceof Object)&&(s=new O(r)),s.stream(t);(s=(()=>{var i;return!!o.WORKERS_SUPPORTED&&(i=(()=>{var n=v.URL||v.webkitURL||null,p=$.toString();return o.BLOB_URL||(o.BLOB_URL=n.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",p,")();"],{type:"text/javascript"})))})(),(i=new v.Worker(i)).onmessage=ye,i.id=w++,ie[i.id]=i)})()).userStep=r.step,s.userChunk=r.chunk,s.userComplete=r.complete,s.userError=r.error,r.step=E(r.step),r.chunk=E(r.chunk),r.complete=E(r.complete),r.error=E(r.error),delete r.worker,s.postMessage({input:t,config:r,workerId:s.id})},o.unparse=function(t,r){var s=!1,i=!0,n=",",p=`\r
`,L='"',V=L+L,G=!1,m=null,T=!1,d=((()=>{if(typeof r=="object"){if(typeof r.delimiter!="string"||o.BAD_DELIMITERS.filter(function(g){return r.delimiter.indexOf(g)!==-1}).length||(n=r.delimiter),typeof r.quotes!="boolean"&&typeof r.quotes!="function"&&!Array.isArray(r.quotes)||(s=r.quotes),typeof r.skipEmptyLines!="boolean"&&typeof r.skipEmptyLines!="string"||(G=r.skipEmptyLines),typeof r.newline=="string"&&(p=r.newline),typeof r.quoteChar=="string"&&(L=r.quoteChar,V=L+L),typeof r.header=="boolean"&&(i=r.header),Array.isArray(r.columns)){if(r.columns.length===0)throw new Error("Option columns is empty");m=r.columns}r.escapeChar!==void 0&&(V=r.escapeChar+L),r.escapeFormulae instanceof RegExp?T=r.escapeFormulae:typeof r.escapeFormulae=="boolean"&&r.escapeFormulae&&(T=/^[=+\-@\t\r].*$/)}})(),new RegExp(se(L),"g"));if(typeof t=="string"&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return K(null,t,G);if(typeof t[0]=="object")return K(m||Object.keys(t[0]),t,G)}else if(typeof t=="object")return typeof t.data=="string"&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||m),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:typeof t.data[0]=="object"?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||typeof t.data[0]=="object"||(t.data=[t.data])),K(t.fields||[],t.data||[],G);throw new Error("Unable to serialize unrecognized input");function K(g,a,J){var A="",P=(typeof g=="string"&&(g=JSON.parse(g)),typeof a=="string"&&(a=JSON.parse(a)),Array.isArray(g)&&0<g.length),Y=!Array.isArray(a[0]);if(P&&i){for(var j=0;j<g.length;j++)0<j&&(A+=n),A+=c(g[j],j);0<a.length&&(A+=p)}for(var x=0;x<a.length;x++){var F=(P?g:a[x]).length,h=!1,D=P?Object.keys(a[x]).length===0:a[x].length===0;if(J&&!P&&(h=J==="greedy"?a[x].join("").trim()==="":a[x].length===1&&a[x][0].length===0),J==="greedy"&&P){for(var U=[],R=0;R<F;R++){var N=Y?g[R]:R;U.push(a[x][N])}h=U.join("").trim()===""}if(!h){for(var y=0;y<F;y++){0<y&&!D&&(A+=n);var Z=P&&Y?g[y]:y;A+=c(a[x][Z],y)}x<a.length-1&&(!J||0<F&&!D)&&(A+=p)}}return A}function c(g,a){var J,A,P;return g==null?"":g.constructor===Date?JSON.stringify(g).slice(1,25):(P=!1,T&&typeof g=="string"&&T.test(g)&&(g="'"+g,P=!0),A=(J=g.toString()).replace(d,V),(P=P||s===!0||typeof s=="function"&&s(g,a)||Array.isArray(s)&&s[a]||((Y,j)=>{for(var x=0;x<j.length;x++)if(-1<Y.indexOf(j[x]))return!0;return!1})(A,o.BAD_DELIMITERS)||-1<A.indexOf(n)||-1<J.indexOf(L)||A.charAt(0)===" "||A.charAt(A.length-1)===" ")?L+A+L:A)}},o.RECORD_SEP="",o.UNIT_SEP="",o.BYTE_ORDER_MARK="\uFEFF",o.BAD_DELIMITERS=["\r",`
`,'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!z&&!!v.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=ce,o.ParserHandle=pe,o.NetworkStreamer=re,o.FileStreamer=O,o.StringStreamer=l,o.ReadableStreamStreamer=_,v.jQuery&&((B=v.jQuery).fn.parse=function(t){var r=t.config||{},s=[];return this.each(function(p){if(!(B(this).prop("tagName").toUpperCase()==="INPUT"&&B(this).attr("type").toLowerCase()==="file"&&v.FileReader)||!this.files||this.files.length===0)return!0;for(var L=0;L<this.files.length;L++)s.push({file:this.files[L],inputElem:this,instanceConfig:B.extend({},r)})}),i(),this;function i(){if(s.length===0)E(t.complete)&&t.complete();else{var p,L,V,G,m=s[0];if(E(t.before)){var T=t.before(m.file,m.inputElem);if(typeof T=="object"){if(T.action==="abort")return p="AbortError",L=m.file,V=m.inputElem,G=T.reason,void(E(t.error)&&t.error({name:p},L,V,G));if(T.action==="skip")return void n();typeof T.config=="object"&&(m.instanceConfig=B.extend(m.instanceConfig,T.config))}else if(T==="skip")return void n()}var d=m.instanceConfig.complete;m.instanceConfig.complete=function(K){E(d)&&d(K,m.file,m.inputElem),n()},o.parse(m.file,m.instanceConfig)}}function n(){s.splice(0,1),i()}}),f&&(v.onmessage=function(t){t=t.data,o.WORKER_ID===void 0&&t&&(o.WORKER_ID=t.workerId),typeof t.input=="string"?v.postMessage({workerId:o.WORKER_ID,results:o.parse(t.input,t.config),finished:!0}):(v.File&&t.input instanceof File||t.input instanceof Object)&&(t=o.parse(t.input,t.config))&&v.postMessage({workerId:o.WORKER_ID,results:t,finished:!0})}),(re.prototype=Object.create(C.prototype)).constructor=re,(O.prototype=Object.create(C.prototype)).constructor=O,(l.prototype=Object.create(l.prototype)).constructor=l,(_.prototype=Object.create(C.prototype)).constructor=_,o})})(be)),be.exports}var ze=$e();const Ke=Me(ze),Ee=[{label:"24 hours",ms:1440*60*1e3},{label:"7 days",ms:10080*60*1e3},{label:"30 days",ms:720*60*60*1e3},{label:"90 days",ms:2160*60*60*1e3},{label:"1 year",ms:365*24*60*60*1e3}];function k(S,M=2){return S!=null&&Number.isFinite(Number(S))?Number(S).toLocaleString(void 0,{maximumFractionDigits:M}):"--"}function xe(S){return Number.isFinite(Number(S))?new Date(Number(S)).toLocaleString():"--"}function qe(S){const M=Math.round((Number(S)||0)/6e4);return M<60?`${M}m`:`${Math.floor(M/60)}h ${M%60}m`}function ve(S){const M=Number(S)||0;return M>=1e6?`${k(M/1e6)} km`:`${k(M/1e3,1)} m`}function Be(S){const M=Ke.unparse(S.map(B=>({...B,batteryHealth:JSON.stringify(B.batteryHealth)}))),$=URL.createObjectURL(new Blob([M],{type:"text/csv;charset=utf-8"})),v=document.createElement("a");v.href=$,v.download="fleet-battery-efficiency.csv",v.click(),URL.revokeObjectURL($)}function oe({label:S,value:M,detail:$}){return e.jsxs("div",{className:"surface min-w-0 px-1 py-0.5",children:[e.jsx("div",{className:"text-[0.68rem] text-slate-400",children:S}),e.jsx("div",{className:"truncate text-sm font-semibold text-slate-100",children:M}),$?e.jsx("div",{className:"truncate text-[0.68rem] text-slate-500",children:$}):null]})}function W({field:S,sort:M,onSort:$,children:v}){return e.jsx("th",{children:e.jsxs("button",{type:"button",className:"whitespace-nowrap text-left",onClick:()=>$(S),children:[v,M.key===S?M.descending?" ↓":" ↑":""]})})}function Qe({report:S,refresh:M}){const $=Ue(),v=Ne(b=>b.session?.role||null),B=v==="admin"||v==="lockdown",[z,f]=he.useState({roverId:S.rovers[0]?.roverId||"",chemistry:"unknown",ratedCapacityMah:"",installedDate:new Date().toISOString().slice(0,10),notes:""}),[ie,w]=he.useState("");function o(b){b.preventDefault(),w("Saving…"),$.emit("fleetReports:replaceBattery",{...z,ratedCapacityMah:Number(z.ratedCapacityMah),installedAt:new Date(`${z.installedDate}T12:00:00`).getTime()},(C={})=>{w(C.error||`Registered ${C.battery?.batteryKey||"battery"}`),C.error||M()})}return e.jsxs(de,{title:"Battery identity and baselines",meta:`${S.batteryRegistry.length} records`,bodyClassName:"space-y-0.5 p-0.5",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full whitespace-nowrap text-left text-xs",children:[e.jsx("thead",{className:"text-slate-400",children:e.jsxs("tr",{children:[e.jsx("th",{children:"Rover"}),e.jsx("th",{children:"Battery"}),e.jsx("th",{children:"Chemistry"}),e.jsx("th",{children:"Rated mAh"}),e.jsx("th",{children:"Installed"}),e.jsx("th",{children:"Retired"}),e.jsx("th",{children:"Learned baseline mAh"}),e.jsx("th",{children:"Notes"})]})}),e.jsx("tbody",{children:S.batteryRegistry.map(b=>e.jsxs("tr",{className:"border-t border-neutral-700/70 text-slate-200",children:[e.jsx("td",{children:b.roverId}),e.jsx("td",{children:b.batteryKey}),e.jsx("td",{children:b.chemistry||"--"}),e.jsx("td",{children:k(b.ratedCapacityMah,0)}),e.jsx("td",{children:xe(b.installedAt)}),e.jsx("td",{children:xe(b.retiredAt)}),e.jsx("td",{children:k(b.healthyBaselineMah,0)}),e.jsx("td",{children:b.notes||"--"})]},b.batteryKey))})]})}),B?e.jsxs("form",{className:"surface grid gap-0.5 p-1 text-xs md:grid-cols-2 xl:grid-cols-6",onSubmit:o,children:[e.jsxs("label",{children:[e.jsx("span",{className:"text-slate-400",children:"Rover"}),e.jsx("select",{className:"w-full bg-neutral-800 p-0.5",value:z.roverId,onChange:b=>f(C=>({...C,roverId:b.target.value})),children:S.rovers.map(b=>e.jsx("option",{value:b.roverId,children:b.name},b.roverId))})]}),e.jsxs("label",{children:[e.jsx("span",{className:"text-slate-400",children:"Chemistry"}),e.jsxs("select",{className:"w-full bg-neutral-800 p-0.5",value:z.chemistry,onChange:b=>f(C=>({...C,chemistry:b.target.value})),children:[e.jsx("option",{value:"unknown",children:"Unknown"}),e.jsx("option",{value:"NiMH",children:"NiMH"}),e.jsx("option",{value:"Li-ion",children:"Li-ion"})]})]}),e.jsxs("label",{children:[e.jsx("span",{className:"text-slate-400",children:"Rated capacity mAh"}),e.jsx("input",{required:!0,min:"1",max:"65535",type:"number",className:"w-full bg-neutral-800 p-0.5",value:z.ratedCapacityMah,onChange:b=>f(C=>({...C,ratedCapacityMah:b.target.value}))})]}),e.jsxs("label",{children:[e.jsx("span",{className:"text-slate-400",children:"Installed"}),e.jsx("input",{required:!0,type:"date",className:"w-full bg-neutral-800 p-0.5",value:z.installedDate,onChange:b=>f(C=>({...C,installedDate:b.target.value}))})]}),e.jsxs("label",{children:[e.jsx("span",{className:"text-slate-400",children:"Notes"}),e.jsx("input",{className:"w-full bg-neutral-800 p-0.5",value:z.notes,onChange:b=>f(C=>({...C,notes:b.target.value}))})]}),e.jsxs("div",{className:"flex items-end gap-0.5",children:[e.jsx("button",{type:"submit",className:"button-dark px-1 py-0.5",children:"Install or replace"}),e.jsx("span",{className:"text-slate-400",children:ie})]})]}):null]})}function Ve(){const[S,M]=he.useState(Ee[1].ms),[$,v]=he.useState(()=>Date.now()),[B,z]=he.useState(""),[f,ie]=he.useState({key:"name",descending:!1}),{report:w,loading:o,error:b,refresh:C}=We({since:$-S,until:$,includeEvents:!1}),re=he.useMemo(()=>[...(w?.rovers||[]).filter(_=>`${_.name} ${_.roverId}`.toLowerCase().includes(B.trim().toLowerCase()))].sort((_,pe)=>{const se=f.key.startsWith("batteryHealth.")?_.batteryHealth?.[f.key.slice(14)]:_[f.key],ce=f.key.startsWith("batteryHealth.")?pe.batteryHealth?.[f.key.slice(14)]:pe[f.key],ye=typeof se=="string"?se.localeCompare(String(ce??"")):(Number(se)||0)-(Number(ce)||0);return f.descending?-ye:ye}),[B,w,f]);function O(l){ie(_=>({key:l,descending:_.key===l?!_.descending:!1}))}return e.jsxs(e.Fragment,{children:[e.jsxs(de,{title:"Fleet battery health and efficiency",meta:w?xe(w.generatedAt):"Loading",bodyClassName:"space-y-0.5 p-0.5",children:[e.jsxs("div",{className:"surface flex flex-wrap items-end gap-0.5 p-0.5 text-xs",children:[e.jsxs("label",{children:[e.jsx("span",{className:"mr-0.5 text-slate-400",children:"Range"}),e.jsx("select",{className:"bg-neutral-800 p-0.5",value:S,onChange:l=>M(Number(l.target.value)),children:Ee.map(l=>e.jsx("option",{value:l.ms,children:l.label},l.ms))})]}),e.jsxs("label",{children:[e.jsx("span",{className:"mr-0.5 text-slate-400",children:"Find rover"}),e.jsx("input",{className:"bg-neutral-800 p-0.5",value:B,onChange:l=>z(l.target.value)})]}),e.jsx("button",{type:"button",className:"button-dark px-1 py-0.5",onClick:()=>{v(Date.now()),C()},children:"Refresh"}),e.jsx(Oe,{className:"button-dark px-1 py-0.5",to:"/",children:"Back"})]}),o&&!w?e.jsx("p",{className:"text-slate-400",children:"Loading fleet metrics…"}):null,b?e.jsx("p",{className:"text-red-300",children:b}):null,w?e.jsxs("div",{className:"grid grid-cols-2 gap-0.5 md:grid-cols-4 xl:grid-cols-8",children:[e.jsx(oe,{label:"Rovers online",value:`${w.totals.onlineRoverCount}/${w.totals.roverCount}`}),e.jsx(oe,{label:"Distance",value:ve(w.totals.distanceMm)}),e.jsx(oe,{label:"Energy used",value:`${k(w.totals.dischargedWh)} Wh`}),e.jsx(oe,{label:"Fleet Wh/km",value:w.totals.overallWhPerKm==null?"--":k(w.totals.overallWhPerKm)}),e.jsx(oe,{label:"Moving Wh/km",value:w.totals.movingWhPerKm==null?"--":k(w.totals.movingWhPerKm)}),e.jsx(oe,{label:"Moving energy",value:`${k(w.totals.movingDischargedWh)} Wh`}),e.jsx(oe,{label:"Stationary energy",value:`${k(w.totals.stationaryDischargedWh)} Wh`}),e.jsx(oe,{label:"Attention",value:k(w.totals.attentionCount,0)})]}):null]}),w?e.jsxs(e.Fragment,{children:[e.jsx(de,{title:"All rovers",meta:`${re.length} visible`,actions:e.jsx("button",{type:"button",className:"button-dark px-1 py-0.25 text-xs",onClick:()=>Be(re),children:"Export CSV"}),bodyClassName:"overflow-x-auto p-0.5",children:e.jsxs("table",{className:"w-full whitespace-nowrap text-left text-xs",children:[e.jsx("thead",{className:"sticky top-0 bg-neutral-900 text-slate-400",children:e.jsxs("tr",{children:[e.jsx(W,{field:"name",sort:f,onSort:O,children:"Rover"}),e.jsx(W,{field:"online",sort:f,onSort:O,children:"State"}),e.jsx(W,{field:"batteryHealth.capacityRetentionPercent",sort:f,onSort:O,children:"Health"}),e.jsx(W,{field:"batteryHealth.measuredUsableMah",sort:f,onSort:O,children:"Usable Ah"}),e.jsx(W,{field:"batteryHealth.measuredUsableWh",sort:f,onSort:O,children:"Usable Wh"}),e.jsx(W,{field:"batteryHealth.confidence",sort:f,onSort:O,children:"Confidence"}),e.jsx(W,{field:"overallWhPerKm",sort:f,onSort:O,children:"Wh/km"}),e.jsx(W,{field:"movingWhPerKm",sort:f,onSort:O,children:"Moving Wh/km"}),e.jsx(W,{field:"distanceMm",sort:f,onSort:O,children:"Distance"}),e.jsx(W,{field:"dischargedWh",sort:f,onSort:O,children:"Used Wh"}),e.jsx(W,{field:"movingDischargedWh",sort:f,onSort:O,children:"Moving Wh"}),e.jsx(W,{field:"stationaryDischargedWh",sort:f,onSort:O,children:"Stationary Wh"}),e.jsx(W,{field:"movingMs",sort:f,onSort:O,children:"Moving time"}),e.jsx(W,{field:"averageSpeedMmPerSecond",sort:f,onSort:O,children:"Average speed"}),e.jsx(W,{field:"maximumSpeedMmPerSecond",sort:f,onSort:O,children:"Maximum speed"}),e.jsx(W,{field:"latestChargeMah",sort:f,onSort:O,children:"Charge"}),e.jsx(W,{field:"averageVoltageMv",sort:f,onSort:O,children:"Voltage"}),e.jsx(W,{field:"averageCurrentMa",sort:f,onSort:O,children:"Current"}),e.jsx(W,{field:"maximumTemperatureC",sort:f,onSort:O,children:"Temperature"}),e.jsx(W,{field:"lastSampleAt",sort:f,onSort:O,children:"Last data"})]})}),e.jsx("tbody",{children:re.map(l=>{const _=l.batteryHealth;return e.jsxs("tr",{className:"border-t border-neutral-700/70 text-slate-200",children:[e.jsx("td",{className:"sticky left-0 bg-neutral-900 font-semibold",children:l.name}),e.jsx("td",{children:l.online?"online":"offline"}),e.jsx("td",{children:_.capacityRetentionPercent==null?"--":`${k(_.capacityRetentionPercent,1)}%`}),e.jsx("td",{children:_.measuredUsableMah==null?"--":k(_.measuredUsableMah/1e3,3)}),e.jsx("td",{children:k(_.measuredUsableWh)}),e.jsx("td",{title:_.confidenceReason,children:_.confidence}),e.jsx("td",{children:l.overallWhPerKm==null?`need ${ve(l.efficiencyDistanceRequiredMm)}`:k(l.overallWhPerKm)}),e.jsx("td",{children:k(l.movingWhPerKm)}),e.jsx("td",{children:ve(l.distanceMm)}),e.jsx("td",{children:k(l.dischargedWh)}),e.jsx("td",{children:k(l.movingDischargedWh)}),e.jsx("td",{children:k(l.stationaryDischargedWh)}),e.jsx("td",{children:qe(l.movingMs)}),e.jsx("td",{children:l.averageSpeedMmPerSecond==null?"--":`${k(l.averageSpeedMmPerSecond)} mm/s`}),e.jsx("td",{children:l.maximumSpeedMmPerSecond==null?"--":`${k(l.maximumSpeedMmPerSecond)} mm/s`}),e.jsxs("td",{children:[k(l.latestChargeMah,0)," mAh"]}),e.jsxs("td",{children:[k(l.averageVoltageMv,0)," mV"]}),e.jsxs("td",{children:[k(l.averageCurrentMa,0)," mA"]}),e.jsxs("td",{children:[k(l.maximumTemperatureC,1)," °C"]}),e.jsx("td",{children:xe(l.lastSampleAt)})]},l.roverId)})})]})}),e.jsx(de,{title:"Battery-health evidence",meta:"All rovers",bodyClassName:"overflow-x-auto p-0.5",children:e.jsxs("table",{className:"w-full whitespace-nowrap text-left text-xs",children:[e.jsx("thead",{className:"text-slate-400",children:e.jsxs("tr",{children:[e.jsx("th",{children:"Rover"}),e.jsx("th",{children:"Battery"}),e.jsx("th",{children:"Reference mAh"}),e.jsx("th",{children:"Estimated usable mAh"}),e.jsx("th",{children:"Observed range floor"}),e.jsx("th",{children:"Retention"}),e.jsx("th",{children:"Observations"}),e.jsx("th",{children:"Average depth"}),e.jsx("th",{children:"Throughput"}),e.jsx("th",{children:"Latest evidence"}),e.jsx("th",{children:"Confidence basis"})]})}),e.jsx("tbody",{children:re.map(l=>{const _=l.batteryHealth;return e.jsxs("tr",{className:"border-t border-neutral-700/70 text-slate-200",children:[e.jsx("td",{children:l.name}),e.jsx("td",{children:_.batteryKey}),e.jsx("td",{children:k(_.referenceMah,0)}),e.jsx("td",{children:k(_.measuredUsableMah,0)}),e.jsx("td",{children:k(_.observedUsableFloorMah,0)}),e.jsx("td",{children:_.capacityRetentionPercent==null?"--":`${k(_.capacityRetentionPercent,1)}%`}),e.jsx("td",{children:k(_.observationCount,0)}),e.jsxs("td",{children:[k(_.averageObservationDepthPercent,1),"%"]}),e.jsxs("td",{children:[k(_.dischargedThroughputMah,0)," mAh"]}),e.jsx("td",{children:xe(_.latestObservationAt)}),e.jsx("td",{children:_.confidenceReason})]},l.roverId)})})]})}),w.attention.length?e.jsx(de,{title:"Attention",meta:w.attention.length,bodyClassName:"p-0.5 text-xs",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{className:"text-slate-400",children:e.jsxs("tr",{children:[e.jsx("th",{children:"Rover"}),e.jsx("th",{children:"Severity"}),e.jsx("th",{children:"Reason"})]})}),e.jsx("tbody",{children:w.attention.map(l=>e.jsxs("tr",{className:"border-t border-neutral-700/70",children:[e.jsx("td",{children:l.roverId}),e.jsx("td",{children:l.severity}),e.jsx("td",{children:l.title})]},l.key))})]})}):null,e.jsx(Qe,{report:w,refresh:C}),e.jsxs(de,{title:"Methodology",bodyClassName:"space-y-0.5 p-1 text-xs text-slate-300",children:[e.jsx("p",{children:"Energy is integrated per sensor interval from OI voltage and signed current. Existing odometer distance and speed are consumed directly; reporting does not calculate a competing speed value."}),e.jsx("p",{children:"Capacity combines partial discharge current with packet 25 charge movement. Every usable observation contributes; deeper observations increase confidence without labeling cycles good or bad. Packet 26 is only a fixed reference."}),e.jsx("p",{children:"Wh/km appears after 25 m of selected-range odometer travel. Existing historical rows predate exact power integration, so their Wh fields remain zero rather than being backfilled with false precision."})]})]}):null]})}function Ge(){Ae({identitySurface:"passive"});const S=Ne($=>De($,"fleetReports")),{value:M}=Ie("page",{backgroundTheme:Le});return e.jsxs("div",{className:`${Te(M?.backgroundTheme)} min-h-screen text-slate-100`,children:[e.jsx(Fe,{}),e.jsx("main",{className:`mx-auto flex min-h-screen w-full max-w-[120rem] flex-col ${Pe} p-1`,children:S?e.jsx(Ve,{}):e.jsxs(de,{title:"Fleet reports unavailable",bodyClassName:"space-y-0.5 p-1 text-sm text-slate-300",children:[e.jsx("p",{children:"This server has not enabled fleet reporting."}),e.jsx(Oe,{className:"button-dark inline-block px-1 py-0.5 text-xs",to:"/",children:"Back to rover page"})]})})]})}export{Ge as default};
//# sourceMappingURL=FleetReportsApp-BH7qaqHr.js.map