/*! maintenance_supporter frontend 2.58.0 */ import"/maintenance_supporter_panelfiles/panel-chunks/chunk-7UOPU2CL.js";import{b as Qt,c as ue}from"/maintenance_supporter_panelfiles/panel-chunks/chunk-6LSK7BBU.js";import{a as E}from"/maintenance_supporter_panelfiles/panel-chunks/chunk-F567KB5W.js";import{a as Gt,c as ce,d as It,e as vt,f as Ht,g as de,h as pe,i as he}from"/maintenance_supporter_panelfiles/panel-chunks/chunk-RBNIB2OT.js";import{a as _e}from"/maintenance_supporter_panelfiles/panel-chunks/chunk-2TYYX7JG.js";import{a as _,b as A,c as n,d as z,f as d,g as D,h as oe,i as T,j as g,k as Dt,l as Ct,m as Lt,n as a,o as B,p as Ot,q as K,r as Rt,s as G,t as Pt,u as mt,w as Tt,x as ft,y as le,z as zt}from"/maintenance_supporter_panelfiles/panel-chunks/chunk-5LZFNUMR.js";function rt(r){return!!r&&/^https?:\/\//i.test(r)}var qe=["assignee_pool","required_completion_fields","checklist","labels","history"],We=["checklist_progress"],Ye=["tasks","parts"],Ke=["manual_docs","battery_fleet_excluded"];function Zt(r,o,t=[]){for(let e of o)r[e]===void 0&&(r[e]=[]);for(let e of t)r[e]===void 0&&(r[e]={})}function Ge(r){let o=r;Zt(o,Ye),o.object&&typeof o.object=="object"&&Zt(o.object,Ke);for(let t of o.tasks)Zt(t,qe,We);return r}function jt(r){for(let o of r)Ge(o);return r}function Qe(r,o){if(o.objects)return o.objects;let t=o.delta||[],e=o.removed||[];if(!t.length&&!e.length)return null;let i=new Map(r.map(s=>[s.entry_id,s]));for(let s of t)i.set(s.entry_id,s);for(let s of e)i.delete(s);return[...i.values()]}function ge(r,o){return o.objects&&jt(o.objects),o.delta&&jt(o.delta),Qe(r,o)}var Ft="2.58.0";function me(r,o=Ft){return!r||!o||o==="dev"?!1:r!==o}var O={overviewTab:"msp-overview-tab",collapsedSections:"msp-collapsed-sections",chartRange:"msp-chart-range",chartHideOutliers:"msp-chart-hide-outliers",taskSort:"maintenance_supporter_sort",objectSort:"maintenance_supporter_object_sort",groupBy:"maintenance_supporter_groupby",objectView:"maintenance_supporter_object_view",objectsCache:"msp-objects-cache",gettingStartedDismissed:"msp-gs-dismissed",batteryRosterSort:"ms_bf_roster_sort"};function X(r){try{return localStorage.getItem(r)}catch{return null}}function Y(r,o){try{localStorage.setItem(r,o)}catch{}}var Ze=168*3600*1e3;function ve(){try{let r=X(O.objectsCache);if(!r)return null;let o=JSON.parse(r);return o.v!==Ft||!Number.isFinite(o.at)||Date.now()-o.at>Ze||!Array.isArray(o.objects)||o.objects.length===0?null:{objects:o.objects,stats:o.stats??null}}catch{return null}}function Xt(r,o){if(!(!Array.isArray(r)||r.length===0))try{let t={v:Ft,at:Date.now(),objects:r,stats:o};Y(O.objectsCache,JSON.stringify(t))}catch{}}var Xe={days:1,weeks:7,months:30.4368,years:365.25};function Jt(r,o){return!r||r<=0?0:r*(Xe[o||"days"]??1)}function Bt(r,o,t){let e=Jt(r,t);if(e<=0||o==null)return{pct:0,overflow:!1};let i=(e-o)/e*100;return{pct:Math.max(0,Math.min(100,i)),overflow:i>100}}function L(r){return String(r??"").replace(/[&<>"']/g,o=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[o])}function be(r,o,t,e,i,s){let l=[[t.manufacturer,r.manufacturer],[t.model,r.model],[t.serial,r.serial_number],[t.installed,r.installation_date?e(r.installation_date):null],[t.warranty,r.warranty_expiry?e(r.warranty_expiry):null]].filter(([,h])=>!!h),p=o.map(h=>{let u=t.scheduleLabel(h);return` ${L(h.name)} ${L(t.typeLabel(h.type))} ${L(t.statusLabel(h.status))} ${L(u)} ${L(h.last_performed?e(h.last_performed):t.none)} ${L(h.next_due?e(h.next_due):t.none)} ${h.times_performed??0} ${(h.total_cost??0).toFixed(2)} ${L(i)} `}).join(""),c=o.reduce((h,u)=>h+(u.total_cost??0),0);return` ${L(t.title)} \u2014 ${L(r.name)}

${L(r.name)}

${L(t.title)} \xB7 ${L(t.generated)}: ${L(e(s))}

${l.length?`
${l.map(([h,u])=>`
${L(h)}
${L(u)}
`).join("")}
`:""}

${L(t.tasksHeading)} (${o.length})

${p||``}
${L(t.colTask)}${L(t.colType)}${L(t.colStatus)} ${L(t.colSchedule)}${L(t.colLastDone)}${L(t.colNextDue)} ${L(t.colTimes)}${L(t.colCost)}
${L(t.none)}
${L(t.totalCost)}${c.toFixed(2)} ${L(i)}
${r.notes?`
${L(t.notes)}: ${L(r.notes)}
`:""} `}function te(r,o=new Date){if(!r)return{kind:"none",days:null,date:null};let t=new Date(`${r}T00:00:00`);if(isNaN(t.getTime()))return{kind:"none",days:null,date:null};let e=Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()),i=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()),s=Math.round((i-e)/864e5);return s<0?{kind:"expired",days:s,date:r}:s<=60?{kind:"expiring",days:s,date:r}:{kind:"valid",days:s,date:r}}var I=r=>String(r??"").replace(/[&<>"']/g,o=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[o]);function fe(r,o,t,e,i,s,l,p,c,h=[]){let u=[[t.object,I(o)],[t.type,I(t.typeLabel(r.type))],[t.interval,I(i(r))],[t.nextDue,r.next_due?I(e(r.next_due)):"\u2014"],[t.lastDone,r.last_performed?I(e(r.last_performed)):I(t.never)]];r.priority&&r.priority!=="normal"&&u.push([t.priority,I(r.priority)]);let m=(r.checklist||[]).map(b=>`
  • ${I(b)}
  • `).join(""),v=(b,x)=>b?`
    ${I(x)}
    `:"";return` ${I(r.name)} \u2014 ${I(t.title)}

    ${I(r.name)}

    ${I(o)}
    ${v(s,t.scanView)} ${v(l,t.scanComplete)}
    ${u.map(([b,x])=>``).join("")}
    ${I(b)}${x}
    ${m?`

    ${I(t.checklist)}

    `:""} ${h.length?`

    ${I(t.parts)}

    `:""} ${r.notes?`

    ${I(t.notes)}

    ${I(r.notes)}
    `:""} ${p?`

    ${I(t.manualExcerpt)}

    ${I(p.title)} \u2014 ${I(t.pages)} ${p.startPage}\u2013${p.endPage}: PDF
    ${p.vendorBase?`