Initial commit
This commit is contained in:
commit
b6014c6ffc
47 files changed
+4329
No files matched your search
@@ -0,0 +1,11 @@
|
||||
var ks=Object.defineProperty;var da=e=>{throw TypeError(e)};var Ss=(e,t,r)=>t in e?ks(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ne=(e,t,r)=>Ss(e,typeof t!="symbol"?t+"":t,r),$n=(e,t,r)=>t.has(e)||da("Cannot "+r);var E=(e,t,r)=>($n(e,t,"read from private field"),r?r.call(e):t.get(e)),re=(e,t,r)=>t.has(e)?da("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ae=(e,t,r,n)=>($n(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),ge=(e,t,r)=>($n(e,t,"access private method"),r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(i){if(i.ep)return;i.ep=!0;const a=r(i);fetch(i.href,a)}})();const go=!1;var Wi=Array.isArray,Cs=Array.prototype.indexOf,Un=Array.prototype.includes,Qn=Array.from,po=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,mo=Object.getOwnPropertyDescriptors,As=Object.prototype,Ts=Array.prototype,Qi=Object.getPrototypeOf,va=Object.isExtensible;function rn(e){return typeof e=="function"}const $t=()=>{};function Is(e){return e()}function Mi(e){for(var t=0;t<e.length;t++)e[t]()}function _o(){var e,t,r=new Promise((n,i)=>{e=n,t=i});return{promise:r,resolve:e,reject:t}}const qe=2,Ur=4,Cn=8,bo=1<<24,mt=16,ft=32,jt=64,Pi=128,ct=512,Fe=1024,Le=2048,bt=4096,Ye=8192,nt=16384,Wr=32768,ha=1<<25,tr=65536,Hn=1<<17,Ms=1<<18,Qr=1<<19,yo=1<<20,kt=1<<25,pr=65536,zn=1<<21,Nr=1<<22,er=1<<23,Ft=Symbol("$state"),wo=Symbol("legacy props"),Ps=Symbol(""),Dn=Symbol("attributes"),Ri=Symbol("class"),Rs=Symbol("style"),on=Symbol("text"),Bn=Symbol("form reset"),An=new class extends Error{constructor(){super(...arguments);Ne(this,"name","StaleReactionError");Ne(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var fo;const Ns=!!((fo=globalThis.document)!=null&&fo.contentType)&&globalThis.document.contentType.includes("xml");function Ls(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Ds(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Bs(e,t,r){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Fs(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Os(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function qs(e){throw new Error("https://svelte.dev/e/effect_orphan")}function js(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Us(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Hs(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function zs(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Vs(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Ks(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Ys=1,Gs=2,xo=4,Js=8,Ws=16,Qs=1,Zs=2,Xs=4,$s=8,el=16,tl=1,rl=2,De=Symbol("uninitialized"),nl="http://www.w3.org/1999/xhtml";function il(){console.warn("https://svelte.dev/e/derived_inert")}function al(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function ol(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Eo(e){return e===this.v}function ko(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function So(e){return!ko(e,this.v)}let Zr=!1,sl=!1;function ll(){Zr=!0}let Te=null;function Hr(e){Te=e}function Se(e,t=!1,r){Te={p:Te,i:!1,c:null,e:null,s:e,x:null,r:ve,l:Zr&&!t?{s:null,u:null,$:[]}:null}}function Ce(e){var t=Te,r=t.e;if(r!==null){t.e=null;for(var n of r)Go(n)}return t.i=!0,Te=t.p,{}}function Tn(){return!Zr||Te!==null&&Te.l===null}let ar=[];function Co(){var e=ar;ar=[],Mi(e)}function St(e){if(ar.length===0&&!dn){var t=ar;queueMicrotask(()=>{t===ar&&Co()})}ar.push(e)}function ul(){for(;ar.length>0;)Co()}function Ao(e){var t=ve;if(t===null)return de.f|=er,e;if((t.f&Wr)===0&&(t.f&Ur)===0)throw e;Qt(e,t)}function Qt(e,t){if(!(t!==null&&(t.f&nt)!==0)){for(;t!==null;){if((t.f&Pi)!==0){if((t.f&Wr)===0)throw e;try{t.b.error(e);return}catch(r){e=r}}t=t.parent}throw e}}const cl=-7169;function Me(e,t){e.f=e.f&cl|t}function Zi(e){(e.f&ct)!==0||e.deps===null?Me(e,Fe):Me(e,bt)}function To(e){if(e!==null)for(const t of e)(t.f&qe)===0||(t.f&pr)===0||(t.f^=pr,To(t.deps))}function Io(e,t,r){(e.f&Le)!==0?t.add(e):(e.f&bt)!==0&&r.add(e),To(e.deps),Me(e,Fe)}function Mo(e,t,r){if(e==null)return t(void 0),$t;const n=ir(()=>e.sLine truncated
|
||||
${l(r)==="overdue"?"bg-red-600 text-white":"bg-amber-500 text-white"}`),z(D,l(r)==="overdue"?"Overdue":"Due soon")}),L(p,x)};V(u,p=>{l(r)&&p(c)})}var f=_(i,2),m=h(f),d=h(m);ca(d,{get rego(){return t.car.rego},size:"sm"});var g=_(d,2);{var b=p=>{var x=Xu(),D=h(x);U(()=>z(D,`${t.car.year??""??""} ${t.car.make??""??""}`)),L(p,x)};V(g,p=>{(t.car.year||t.car.make)&&p(b)})}var C=_(m,2);{var k=p=>{var x=$u(),D=h(x);U(()=>z(D,t.car.model)),L(p,x)};V(C,p=>{t.car.model&&p(k)})}var S=_(C,2),I=h(S),M=h(I),R=_(I,2),A=h(R);U((p,x)=>{Ge(n,"href",`#/cars/${t.car.id??""}`),O(n,1,`${Xn} group block overflow-hidden transition-all hover:-translate-y-0.5 hover:shadow-lg`),z(M,`Rego: ${p??""}`),z(A,`WoF: ${x??""}`)},[()=>It(t.car.regoExpiry),()=>It(t.car.wofExpiry)]),L(e,n),Ce()}var rc=q('<div class="fixed inset-0 z-50 flex items-start justify-center overflow-y-auto p-4 sm:items-center sm:p-6"><button type="button" aria-label="Close" class="fixed inset-0 bg-stone-900/60 backdrop-blur-sm"></button> <div><div class="flex items-center justify-between border-b border-stone-100 px-5 py-4"><h3 class="text-base font-semibold text-stone-900"> </h3> <button type="button" aria-label="Close" class="rounded-md p-1 text-stone-400 hover:bg-stone-100 hover:text-stone-600"><!></button></div> <div class="max-h-[75vh] overflow-y-auto p-5"><!></div></div></div>');function yt(e,t){Se(t,!0);let r=Be(t,"wide",3,!1);function n(b){var C;b.key==="Escape"&&((C=t.onClose)==null||C.call(t))}var i=rc();br("keydown",Hi,n);var a=h(i),o=_(a,2),s=h(o),u=h(s),c=h(u),f=_(u,2),m=h(f);_e(m,{name:"x",class:"h-5 w-5"});var d=_(s,2),g=h(d);su(g,()=>t.children??$t),U(()=>{O(o,1,`relative my-8 w-full ${r()?"max-w-2xl":"max-w-lg"} rounded-lg border border-stone-200 bg-white shadow-xl sm:my-0`),z(c,t.title)}),se("click",a,()=>{var b;return(b=t.onClose)==null?void 0:b.call(t)}),se("click",f,()=>{var b;return(b=t.onClose)==null?void 0:b.call(t)}),L(e,i),Ce()}ze(["click"]);var nc=q("<option> </option>"),ic=q('<div><label for="reminder-label">Label *</label> <input id="reminder-label" placeholder="Spark plugs"/></div>'),ac=q('<p class="text-sm text-red-600"> </p>'),oc=q('<form class="space-y-4"><div><label for="reminder-type">Type</label> <select id="reminder-type"></select></div> <!> <div class="grid grid-cols-2 gap-4"><div><label for="reminder-due-date">Due date</label> <input id="reminder-due-date" type="date"/></div> <div><label for="reminder-due-odometer">Due odometer (km)</label> <input id="reminder-due-odometer" type="number"/></div></div> <div><label for="reminder-notes">Notes</label> <textarea id="reminder-notes" rows="2"></textarea></div> <!> <div class="flex justify-end gap-2 pt-2"><button type="button">Cancel</button> <button type="submit"> </button></div></form>');function Ra(e,t){var oe,X,J,$,ue,Z;Se(t,!0);let r=Be(t,"reminder",3,null);const n=[{value:"service",label:"Service"},{value:"wheel_rotation",label:"Wheel rotation"},{value:"alignment",label:"Alignment"},{value:"custom",label:"Custom…"}];let i=B(ne(((oe=r())==null?void 0:oe.reminderType)??"service")),a=B(ne(((X=r())==null?void 0:X.label)??"")),o=B(ne((($=(J=r())==null?void 0:J.dueDate)==null?void 0:$.slice(0,10))??"")),s=B(ne(((ue=r())==null?void 0:ue.dueOdometer)??"")),u=B(ne(((Z=r())==null?void 0:Z.notes)??"")),c=B(!1),f=B("");async function m(Y){var le;if(Y.preventDefault(),l(i)==="custom"&&!l(a).trim()){v(f,"Label is required for a custom reminder");return}if(!l(o)&&!l(s)){v(f,"Set a due date or a due odometer reading");return}v(c,!0),v(f,"");const ie={reminderType:l(i),label:l(i)==="custom"?l(a).trim():null,dueDate:l(o)||null,dueOdometer:l(s)?Number(l(s)):null,notes:l(u)||null};try{r()?await en(`/reminders/${r().id}`,ie):await wr(`/cars/${t.carId}/reminders`,ie),(le=t.onSaved)==null||le.call(t)}catch(fe){v(f,fe.message,!0)}finally{v(c,!1)}}var d=oc(),g=h(d),b=h(g),C=_(b,2);zt(C,21,()=>n,Y=>Y.value,(Y,ie)=>{var le=nc(),fe=h(le),he={};U(()=>{z(fe,l(ie).label),he!==(he=l(ie).value)&&(le.value=(le.__value=l(ie).value)??"")}),L(Y,le)});var k=_(g,2);{var S=Y=>{var ie=ic(),le=h(ie),fe=_(le,2);U(()=>{O(le,1,j(ye)),O(fe,1,j(be))}),Ee(fe,()=>l(a),he=>v(a,he)),L(Y,ie)};V(k,Y=>{l(i)==="custom"&&Y(S)})}var I=_(k,2),M=h(I),R=h(M),A=_(R,2),p=_(M,2),x=h(p),D=_(x,2),y=_(I,2),w=h(y),T=_(w,2),N=_(y,2);{var F=Y=>{var ie=ac(),le=h(ie);U(()=>z(le,l(f))),L(Y,ie)};V(N,Y=>{l(f)&&Y(F)})}var P=_(N,2),H=h(P),G=_(H,2),Q=h(G);U(()=>{O(b,1,j(ye)),O(C,1,j(be)),O(R,1,j(ye)),O(A,1,j(be)),O(x,1,j(ye)),O(D,1,j(be)),O(w,1,j(ye)),O(T,1,j(be)),O(H,1,j(rr)),G.disabled=l(c),O(G,1,j(Ht)),z(Q,l(c)?"Saving…":r()?"Save changes":"Add reminder")}),br("submit",d,m),fu(C,()=>l(i),Y=>v(i,Y)),Ee(A,()=>l(o),Y=>v(o,Y)),Ee(D,()=>l(s),Y=>v(s,Y)),Ee(T,()=>l(u),Y=>v(u,Y)),se("click",H,()=>{var Y;return(Y=t.onCancel)==null?void 0:Y.call(t)}),L(e,d),Ce()}ze(["click"]);var sc=q('<p class="text-sm text-stone-400">Loading…</p>'),lc=q('<p class="text-sm text-red-600"> </p>'),uc=q('<p class="text-sm text-stone-400"> </p>'),cc=q('<span class="rounded-full
Line truncated
|
||||
]))+`;wt.KANJI=new RegExp(r,"g"),wt.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),wt.BYTE=new RegExp(n,"g"),wt.NUMERIC=new RegExp(e,"g"),wt.ALPHANUMERIC=new RegExp(t,"g");const i=new RegExp("^"+r+"$"),a=new RegExp("^"+e+"$"),o=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return wt.testKanji=function(u){return i.test(u)},wt.testNumeric=function(u){return a.test(u)},wt.testAlphanumeric=function(u){return o.test(u)},wt}var Ga;function kr(){return Ga||(Ga=1,(function(e){const t=_s(),r=bs();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(a,o){if(!a.ccBits)throw new Error("Invalid mode: "+a);if(!t.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?a.ccBits[0]:o<27?a.ccBits[1]:a.ccBits[2]},e.getBestModeForData=function(a){return r.testNumeric(a)?e.NUMERIC:r.testAlphanumeric(a)?e.ALPHANUMERIC:r.testKanji(a)?e.KANJI:e.BYTE},e.toString=function(a){if(a&&a.id)return a.id;throw new Error("Invalid mode")},e.isValid=function(a){return a&&a.bit&&a.ccBits};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+i)}}e.from=function(a,o){if(e.isValid(a))return a;try{return n(a)}catch{return o}}})(_i)),_i}var Ja;function jc(){return Ja||(Ja=1,(function(e){const t=Er(),r=ms(),n=fa(),i=kr(),a=_s(),o=7973,s=t.getBCHDigit(o);function u(d,g,b){for(let C=1;C<=40;C++)if(g<=e.getCapacity(C,b,d))return C}function c(d,g){return i.getCharCountIndicator(d,g)+4}function f(d,g){let b=0;return d.forEach(function(C){const k=c(C.mode,g);b+=k+C.getBitsLength()}),b}function m(d,g){for(let b=1;b<=40;b++)if(f(d,b)<=e.getCapacity(b,g,i.MIXED))return b}e.from=function(g,b){return a.isValid(g)?parseInt(g,10):b},e.getCapacity=function(g,b,C){if(!a.isValid(g))throw new Error("Invalid QR Code version");typeof C>"u"&&(C=i.BYTE);const k=t.getSymbolTotalCodewords(g),S=r.getTotalCodewordsCount(g,b),I=(k-S)*8;if(C===i.MIXED)return I;const M=I-c(C,g);switch(C){case i.NUMERIC:return Math.floor(M/10*3);case i.ALPHANUMERIC:return Math.floor(M/11*2);case i.KANJI:return Math.floor(M/13);case i.BYTE:default:return Math.floor(M/8)}},e.getBestVersionForData=function(g,b){let C;const k=n.from(b,n.M);if(Array.isArray(g)){if(g.length>1)return m(g,k);if(g.length===0)return 1;C=g[0]}else C=g;return u(C.mode,C.getLength(),k)},e.getEncodedBits=function(g){if(!a.isValid(g)||g<7)throw new Error("Invalid QR Code version");let b=g<<12;for(;t.getBCHDigit(b)-s>=0;)b^=o<<t.getBCHDigit(b)-s;return g<<12|b}})(mi)),mi}var yi={},Wa;function Uc(){if(Wa)return yi;Wa=1;const e=Er(),t=1335,r=21522,n=e.getBCHDigit(t);return yi.getEncodedBits=function(a,o){const s=a.bit<<3|o;let u=s<<10;for(;e.getBCHDigit(u)-n>=0;)u^=t<<e.getBCHDigit(u)-n;return(s<<10|u)^r},yi}var wi={},xi,Qa;function Hc(){if(Qa)return xi;Qa=1;const e=kr();function t(r){this.mode=e.NUMERIC,this.data=r.toString()}return t.getBitsLength=function(n){return 10*Math.floor(n/3)+(n%3?n%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(n){let i,a,o;for(i=0;i+3<=this.data.length;i+=3)a=this.data.substr(i,3),o=parseInt(a,10),n.put(o,10);const s=this.data.length-i;s>0&&(a=this.data.substr(i),o=parseInt(a,10),n.put(o,s*3+1))},xi=t,xi}var Ei,Za;function zc(){if(Za)return Ei;Za=1;const e=kr(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function r(n){this.mode=e.ALPHANUMERIC,this.data=n}return r.getBitsLength=function(i){return 11*Math.floor(i/2)+6*(i%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(i){let a;for(a=0;a+2<=this.data.length;a+=2){let o=t.indexOf(this.data[a])*45;o+=t.indexOf(this.data[a+1]),i.put(o,11)}this.data.length%2&&i.put(t.indexOf(this.data[a]),6)},Ei=r,Ei}var ki,Xa;function Vc(){if(Xa)return ki;Xa=1;const e=kr();function t(r){this.mode=e.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return t.getBitsLength=function(n){return n*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){for(let n=0,i=this.data.length;n<i;n++)r.put(this.data[n],8)},ki=t,ki}var Si,$a;function Kc(){if($a)return Si;$a=1;const e=kr(),t=Er();function r(n){this.mode=e.KANJI,this.data=n}return r.getBitsLength=function(i){return i*13},r.prototype.getLength=function(){return this.data.length},r.prototype.g
Line truncated
|
||||
Make sure your charset is UTF-8`);a=(a>>>8&255)*192+(a&255),n.put(a,13)}},Si=r,Si}var Ci={exports:{}},eo;function Yc(){return eo||(eo=1,(function(e){var t={single_source_shortest_paths:function(r,n,i){var a={},o={};o[n]=0;var s=t.PriorityQueue.make();s.push(n,0);for(var u,c,f,m,d,g,b,C,k;!s.empty();){u=s.pop(),c=u.value,m=u.cost,d=r[c]||{};for(f in d)d.hasOwnProperty(f)&&(g=d[f],b=m+g,C=o[f],k=typeof o[f]>"u",(k||C>b)&&(o[f]=b,s.push(f,b),a[f]=c))}if(typeof i<"u"&&typeof o[i]>"u"){var S=["Could not find a path from ",n," to ",i,"."].join("");throw new Error(S)}return a},extract_shortest_path_from_predecessor_list:function(r,n){for(var i=[],a=n;a;)i.push(a),r[a],a=r[a];return i.reverse(),i},find_path:function(r,n,i){var a=t.single_source_shortest_paths(r,n,i);return t.extract_shortest_path_from_predecessor_list(a,i)},PriorityQueue:{make:function(r){var n=t.PriorityQueue,i={},a;r=r||{};for(a in n)n.hasOwnProperty(a)&&(i[a]=n[a]);return i.queue=[],i.sorter=r.sorter||n.default_sorter,i},default_sorter:function(r,n){return r.cost-n.cost},push:function(r,n){var i={value:r,cost:n};this.queue.push(i),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Ci)),Ci.exports}var to;function Gc(){return to||(to=1,(function(e){const t=kr(),r=Hc(),n=zc(),i=Vc(),a=Kc(),o=bs(),s=Er(),u=Yc();function c(S){return unescape(encodeURIComponent(S)).length}function f(S,I,M){const R=[];let A;for(;(A=S.exec(M))!==null;)R.push({data:A[0],index:A.index,mode:I,length:A[0].length});return R}function m(S){const I=f(o.NUMERIC,t.NUMERIC,S),M=f(o.ALPHANUMERIC,t.ALPHANUMERIC,S);let R,A;return s.isKanjiModeEnabled()?(R=f(o.BYTE,t.BYTE,S),A=f(o.KANJI,t.KANJI,S)):(R=f(o.BYTE_KANJI,t.BYTE,S),A=[]),I.concat(M,R,A).sort(function(x,D){return x.index-D.index}).map(function(x){return{data:x.data,mode:x.mode,length:x.length}})}function d(S,I){switch(I){case t.NUMERIC:return r.getBitsLength(S);case t.ALPHANUMERIC:return n.getBitsLength(S);case t.KANJI:return a.getBitsLength(S);case t.BYTE:return i.getBitsLength(S)}}function g(S){return S.reduce(function(I,M){const R=I.length-1>=0?I[I.length-1]:null;return R&&R.mode===M.mode?(I[I.length-1].data+=M.data,I):(I.push(M),I)},[])}function b(S){const I=[];for(let M=0;M<S.length;M++){const R=S[M];switch(R.mode){case t.NUMERIC:I.push([R,{data:R.data,mode:t.ALPHANUMERIC,length:R.length},{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.ALPHANUMERIC:I.push([R,{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.KANJI:I.push([R,{data:R.data,mode:t.BYTE,length:c(R.data)}]);break;case t.BYTE:I.push([{data:R.data,mode:t.BYTE,length:c(R.data)}])}}return I}function C(S,I){const M={},R={start:{}};let A=["start"];for(let p=0;p<S.length;p++){const x=S[p],D=[];for(let y=0;y<x.length;y++){const w=x[y],T=""+p+y;D.push(T),M[T]={node:w,lastCount:0},R[T]={};for(let N=0;N<A.length;N++){const F=A[N];M[F]&&M[F].node.mode===w.mode?(R[F][T]=d(M[F].lastCount+w.length,w.mode)-d(M[F].lastCount,w.mode),M[F].lastCount+=w.length):(M[F]&&(M[F].lastCount=w.length),R[F][T]=d(w.length,w.mode)+4+t.getCharCountIndicator(w.mode,I))}}A=D}for(let p=0;p<A.length;p++)R[A[p]].end=0;return{map:R,table:M}}function k(S,I){let M;const R=t.getBestModeForData(S);if(M=t.from(I,R),M!==t.BYTE&&M.bit<R.bit)throw new Error('"'+S+'" cannot be encoded with mode '+t.toString(M)+`.
|
||||
Suggested mode is: `+t.toString(R));switch(M===t.KANJI&&!s.isKanjiModeEnabled()&&(M=t.BYTE),M){case t.NUMERIC:return new r(S);case t.ALPHANUMERIC:return new n(S);case t.KANJI:return new a(S);case t.BYTE:return new i(S)}}e.fromArray=function(I){return I.reduce(function(M,R){return typeof R=="string"?M.push(k(R,null)):R.data&&M.push(k(R.data,R.mode)),M},[])},e.fromString=function(I,M){const R=m(I,s.isKanjiModeEnabled()),A=b(R),p=C(A,M),x=u.find_path(p.map,"start","end"),D=[];for(let y=1;y<x.length-1;y++)D.push(p.table[x[y]].node);return e.fromArray(g(D))},e.rawSplit=function(I){return e.fromArray(m(I,s.isKanjiModeEnabled()))}})(wi)),wi}var ro;function Jc(){if(ro)return li;ro=1;const e=Er(),t=fa(),r=Rc(),n=Nc(),i=Lc(),a=Dc(),o=Bc(),s=ms(),u=qc(),c=jc(),f=Uc(),m=kr(),d=Gc();function g(p,x){const D=p.size,y=a.getPositions(x);for(let w=0;w<y.length;w++){const T=y[w][0],N=y[w][1];for(let F=-1;F<=7;F++)if(!(T+F<=-1||D<=T+F))for(let P=-1;P<=7;P++)N+P<=-1||D<=N+P||(F>=0&&F<=6&&(P===0||P===6)||P>=0&&P<=6&&(F===0||F===6)||F>=2&&F<=4&&P>=2&&P<=4?p.set(T+F,N+P,!0,!0):p.set(T+F,N+P,!1,!0))}}function b(p){const x=p.size;for(let D=8;D<x-8;D++){const y=D%2===0;p.set(D,6,y,!0),p.set(6,D,y,!0)}}function C(p,x){const D=i.getPositions(x);for(let y=0;y<D.length;y++){const w=D[y][0],T=D[y][1];for(let N=-2;N<=2;N++)for(let F=-2;F<=2;F++)N===-2||N===2||F===-2||F===2||N===0&&F===0?p.set(w+N,T+F,!0,!0):p.set(w+N,T+F,!1,!0)}}function k(p,x){const D=p.size,y=c.getEncodedBits(x);let w,T,N;for(let F=0;F<18;F++)w=Math.floor(F/3),T=F%3+D-8-3,N=(y>>F&1)===1,p.set(w,T,N,!0),p.set(T,w,N,!0)}function S(p,x,D){const y=p.size,w=f.getEncodedBits(x,D);let T,N;for(T=0;T<15;T++)N=(w>>T&1)===1,T<6?p.set(T,8,N,!0):T<8?p.set(T+1,8,N,!0):p.set(y-15+T,8,N,!0),T<8?p.set(8,y-T-1,N,!0):T<9?p.set(8,15-T-1+1,N,!0):p.set(8,15-T-1,N,!0);p.set(y-8,8,1,!0)}function I(p,x){const D=p.size;let y=-1,w=D-1,T=7,N=0;for(let F=D-1;F>0;F-=2)for(F===6&&F--;;){for(let P=0;P<2;P++)if(!p.isReserved(w,F-P)){let H=!1;N<x.length&&(H=(x[N]>>>T&1)===1),p.set(w,F-P,H),T--,T===-1&&(N++,T=7)}if(w+=y,w<0||D<=w){w-=y,y=-y;break}}}function M(p,x,D){const y=new r;D.forEach(function(P){y.put(P.mode.bit,4),y.put(P.getLength(),m.getCharCountIndicator(P.mode,p)),P.write(y)});const w=e.getSymbolTotalCodewords(p),T=s.getTotalCodewordsCount(p,x),N=(w-T)*8;for(y.getLengthInBits()+4<=N&&y.put(0,4);y.getLengthInBits()%8!==0;)y.putBit(0);const F=(N-y.getLengthInBits())/8;for(let P=0;P<F;P++)y.put(P%2?17:236,8);return R(y,p,x)}function R(p,x,D){const y=e.getSymbolTotalCodewords(x),w=s.getTotalCodewordsCount(x,D),T=y-w,N=s.getBlocksCount(x,D),F=y%N,P=N-F,H=Math.floor(y/N),G=Math.floor(T/N),Q=G+1,oe=H-G,X=new u(oe);let J=0;const $=new Array(N),ue=new Array(N);let Z=0;const Y=new Uint8Array(p.buffer);for(let Ie=0;Ie<N;Ie++){const K=Ie<P?G:Q;$[Ie]=Y.slice(J,J+K),ue[Ie]=X.encode($[Ie]),J+=K,Z=Math.max(Z,K)}const ie=new Uint8Array(y);let le=0,fe,he;for(fe=0;fe<Z;fe++)for(he=0;he<N;he++)fe<$[he].length&&(ie[le++]=$[he][fe]);for(fe=0;fe<oe;fe++)for(he=0;he<N;he++)ie[le++]=ue[he][fe];return ie}function A(p,x,D,y){let w;if(Array.isArray(p))w=d.fromArray(p);else if(typeof p=="string"){let H=x;if(!H){const G=d.rawSplit(p);H=c.getBestVersionForData(G,D)}w=d.fromString(p,H||40)}else throw new Error("Invalid data");const T=c.getBestVersionForData(w,D);if(!T)throw new Error("The amount of data is too big to be stored in a QR Code");if(!x)x=T;else if(x<T)throw new Error(`
|
||||
The chosen QR Code version cannot contain this amount of data.
|
||||
Minimum version required to store current data is: `+T+`.
|
||||
`);const N=M(x,D,w),F=e.getSymbolSize(x),P=new n(F);return g(P,x),b(P),C(P,x),S(P,D,0),x>=7&&k(P,x),I(P,N),isNaN(y)&&(y=o.getBestMask(P,S.bind(null,P,D))),o.applyMask(y,P),S(P,D,y),{modules:P,version:x,errorCorrectionLevel:D,maskPattern:y,segments:w}}return li.create=function(x,D){if(typeof x>"u"||x==="")throw new Error("No input text");let y=t.M,w,T;return typeof D<"u"&&(y=t.from(D.errorCorrectionLevel,t.M),w=c.from(D.version),T=o.from(D.maskPattern),D.toSJISFunc&&e.setToSJISFunction(D.toSJISFunc)),A(x,w,y,T)},li}var Ai={},Ti={},no;function ys(){return no||(no=1,(function(e){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(a){return[a,a]}))),n.length===6&&n.push("F","F");const i=parseInt(n.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+n.slice(0,6).join("")}}e.getOptions=function(n){n||(n={}),n.color||(n.color={});const i=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,a=n.width&&n.width>=21?n.width:void 0,o=n.scale||4;return{width:a,scale:a?4:o,margin:i,color:{dark:t(n.color.dark||"#000000ff"),light:t(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},e.getScale=function(n,i){return i.width&&i.width>=n+i.margin*2?i.width/(n+i.margin*2):i.scale},e.getImageWidth=function(n,i){const a=e.getScale(n,i);return Math.floor((n+i.margin*2)*a)},e.qrToImageData=function(n,i,a){const o=i.modules.size,s=i.modules.data,u=e.getScale(o,a),c=Math.floor((o+a.margin*2)*u),f=a.margin*u,m=[a.color.light,a.color.dark];for(let d=0;d<c;d++)for(let g=0;g<c;g++){let b=(d*c+g)*4,C=a.color.light;if(d>=f&&g>=f&&d<c-f&&g<c-f){const k=Math.floor((d-f)/u),S=Math.floor((g-f)/u);C=m[s[k*o+S]?1:0]}n[b++]=C.r,n[b++]=C.g,n[b++]=C.b,n[b]=C.a}}})(Ti)),Ti}var io;function Wc(){return io||(io=1,(function(e){const t=ys();function r(i,a,o){i.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.height=o,a.width=o,a.style.height=o+"px",a.style.width=o+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(a,o,s){let u=s,c=o;typeof u>"u"&&(!o||!o.getContext)&&(u=o,o=void 0),o||(c=n()),u=t.getOptions(u);const f=t.getImageWidth(a.modules.size,u),m=c.getContext("2d"),d=m.createImageData(f,f);return t.qrToImageData(d.data,a,u),r(m,c,f),m.putImageData(d,0,0),c},e.renderToDataURL=function(a,o,s){let u=s;typeof u>"u"&&(!o||!o.getContext)&&(u=o,o=void 0),u||(u={});const c=e.render(a,o,u),f=u.type||"image/png",m=u.rendererOpts||{};return c.toDataURL(f,m.quality)}})(Ai)),Ai}var Ii={},ao;function Qc(){if(ao)return Ii;ao=1;const e=ys();function t(i,a){const o=i.a/255,s=a+'="'+i.hex+'"';return o<1?s+" "+a+'-opacity="'+o.toFixed(2).slice(1)+'"':s}function r(i,a,o){let s=i+a;return typeof o<"u"&&(s+=" "+o),s}function n(i,a,o){let s="",u=0,c=!1,f=0;for(let m=0;m<i.length;m++){const d=Math.floor(m%a),g=Math.floor(m/a);!d&&!c&&(c=!0),i[m]?(f++,m>0&&d>0&&i[m-1]||(s+=c?r("M",d+o,.5+g+o):r("m",u,0),u=0,c=!1),d+1<a&&i[m+1]||(s+=r("h",f),f=0)):u++}return s}return Ii.render=function(a,o,s){const u=e.getOptions(o),c=a.modules.size,f=a.modules.data,m=c+u.margin*2,d=u.color.light.a?"<path "+t(u.color.light,"fill")+' d="M0 0h'+m+"v"+m+'H0z"/>':"",g="<path "+t(u.color.dark,"stroke")+' d="'+n(f,c,u.margin)+'"/>',b='viewBox="0 0 '+m+" "+m+'"',k='<svg xmlns="http://www.w3.org/2000/svg" '+(u.width?'width="'+u.width+'" height="'+u.width+'" ':"")+b+' shape-rendering="crispEdges">'+d+g+`</svg>
|
||||
`;return typeof s=="function"&&s(null,k),k},Ii}var oo;function Zc(){if(oo)return Mr;oo=1;const e=Pc(),t=Jc(),r=Wc(),n=Qc();function i(a,o,s,u,c){const f=[].slice.call(arguments,1),m=f.length,d=typeof f[m-1]=="function";if(!d&&!e())throw new Error("Callback required as last argument");if(d){if(m<2)throw new Error("Too few arguments provided");m===2?(c=s,s=o,o=u=void 0):m===3&&(o.getContext&&typeof c>"u"?(c=u,u=void 0):(c=u,u=s,s=o,o=void 0))}else{if(m<1)throw new Error("Too few arguments provided");return m===1?(s=o,o=u=void 0):m===2&&!o.getContext&&(u=s,s=o,o=void 0),new Promise(function(g,b){try{const C=t.create(s,u);g(a(C,o,u))}catch(C){b(C)}})}try{const g=t.create(s,u);c(null,a(g,o,u))}catch(g){c(g)}}return Mr.create=t.create,Mr.toCanvas=i.bind(null,r.render),Mr.toDataURL=i.bind(null,r.renderToDataURL),Mr.toString=i.bind(null,function(a,o,s){return n.render(a,s)}),Mr}var Xc=Zc();const $c=Mc(Xc);var ef=q("<button> </button>"),tf=q('<img alt="QR code for share link" class="h-48 w-48"/>'),rf=q('<div class="flex flex-col items-center gap-3 rounded-lg border border-stone-200 p-4"><!> <div class="flex w-full items-center gap-2"><input readonly="" class="flex-1 rounded-md border border-stone-300 bg-stone-50 px-2 py-1.5 text-xs text-stone-600"/> <button> </button></div></div> <div class="flex gap-2"><button>Regenerate link</button> <button>Turn off sharing</button></div>',1),nf=q('<p class="text-sm text-red-600"> </p>'),af=q('<div class="space-y-4"><p class="text-sm text-stone-500"> </p> <!> <!></div>');function of(e,t){Se(t,!0);let r=B(ne(t.car.shareToken)),n=B(""),i=B(!1),a=B(!1),o=B(""),s=Ct(()=>l(r)?`${window.location.origin}/#/share/${l(r)}`:"");it(()=>{if(!l(s)){v(n,"");return}$c.toDataURL(l(s),{width:220,margin:1}).then(R=>v(n,R,!0))});async function u(){var R;v(i,!0),v(o,"");try{const A=await wr(`/cars/${t.car.id}/share`,{});v(r,A.shareToken,!0),(R=t.onUpdated)==null||R.call(t,A)}catch(A){v(o,A.message,!0)}finally{v(i,!1)}}async function c(){confirm("Regenerate the link? The current QR code/link will stop working.")&&await u()}async function f(){var R;if(confirm("Turn off sharing? The current link/QR code will stop working.")){v(i,!0),v(o,"");try{await xr(`/cars/${t.car.id}/share`),v(r,null),(R=t.onUpdated)==null||R.call(t,{...t.car,shareToken:null})}catch(A){v(o,A.message,!0)}finally{v(i,!1)}}}async function m(){await navigator.clipboard.writeText(l(s)),v(a,!0),setTimeout(()=>v(a,!1),1500)}var d=af(),g=h(d),b=h(g),C=_(g,2);{var k=R=>{var A=ef(),p=h(A);U(()=>{A.disabled=l(i),O(A,1,j(Ht)),z(p,l(i)?"Generating…":"Turn on sharing")}),se("click",A,u),L(R,A)},S=R=>{var A=rf(),p=Pe(A),x=h(p);{var D=G=>{var Q=tf();U(()=>Ge(Q,"src",l(n))),L(G,Q)};V(x,G=>{l(n)&&G(D)})}var y=_(x,2),w=h(y),T=_(w,2),N=h(T),F=_(p,2),P=h(F),H=_(P,2);U(()=>{gu(w,l(s)),O(T,1,j(rr)),z(N,l(a)?"Copied!":"Copy"),P.disabled=l(i),O(P,1,j(rr)),H.disabled=l(i),O(H,1,j(vs))}),se("click",T,m),se("click",P,c),se("click",H,f),L(R,A)};V(C,R=>{l(r)?R(S,-1):R(k)})}var I=_(C,2);{var M=R=>{var A=nf(),p=h(A);U(()=>z(p,l(o))),L(R,A)};V(I,R=>{l(o)&&R(M)})}U(()=>z(b,`Share a read-only view of ${t.car.rego??""}'s service history (including attached docs) — no login required. Handy for
|
||||
a QR code in the glovebox, or a link when selling the car.`)),L(e,d),Ce()}ze(["click"]);var sf=q('<p class="text-sm text-red-600"> </p>'),lf=q('<form class="space-y-4"><div><label for="kb-title">Title *</label> <input id="kb-title" placeholder="Coolant type" required=""/></div> <div><label for="kb-body">Details</label> <textarea id="kb-body" rows="8" placeholder="e.g. Toyota Super Long Life Coolant, pink, diluted 50/50. Bleed via the top-left nipple with the heater on full."></textarea></div> <!> <div class="flex justify-end gap-2 pt-2"><button type="button">Cancel</button> <button type="submit"> </button></div></form>');function so(e,t){var A,p;Se(t,!0);let r=Be(t,"entry",3,null),n=B(ne(((A=r())==null?void 0:A.title)??"")),i=B(ne(((p=r())==null?void 0:p.body)??"")),a=B(!1),o=B("");async function s(x){var y;if(x.preventDefault(),!l(n).trim()){v(o,"Title is required");return}v(a,!0),v(o,"");const D={title:l(n).trim(),body:l(i)};try{r()?await en(`/knowledge/${r().id}`,D):await wr(`/cars/${t.carId}/knowledge`,D),(y=t.onSaved)==null||y.call(t)}catch(w){v(o,w.message,!0)}finally{v(a,!1)}}var u=lf(),c=h(u),f=h(c),m=_(f,2),d=_(c,2),g=h(d),b=_(g,2),C=_(d,2);{var k=x=>{var D=sf(),y=h(D);U(()=>z(y,l(o))),L(x,D)};V(C,x=>{l(o)&&x(k)})}var S=_(C,2),I=h(S),M=_(I,2),R=h(M);U(()=>{O(f,1,j(ye)),O(m,1,j(be)),O(g,1,j(ye)),O(b,1,j(be)),O(I,1,j(rr)),M.disabled=l(a),O(M,1,j(Ht)),z(R,l(a)?"Saving…":r()?"Save changes":"Add entry")}),br("submit",u,s),Ee(m,()=>l(n),x=>v(n,x)),Ee(b,()=>l(i),x=>v(i,x)),se("click",I,()=>{var x;return(x=t.onCancel)==null?void 0:x.call(t)}),L(e,u),Ce()}ze(["click"]);var uf=q('<p class="text-sm text-stone-400">Loading…</p>'),cf=q('<p class="text-sm text-red-600"> </p>'),ff=q('<p class="text-sm text-stone-400">No knowledgebase entries yet — document procedures, common problems, or reference info like coolant type.</p>'),df=q('<button type="button" class="flex w-full items-center justify-between gap-2 py-3 text-left hover:text-teal-700"><span class="min-w-0"><span class="block truncate font-medium text-stone-900"> </span> <span class="text-xs text-stone-400"> </span></span> <!></button>'),vf=q("<button><!> </button>"),hf=q('<div class="divide-y divide-stone-100"></div> <!>',1),gf=q('<p class="whitespace-pre-wrap text-sm text-stone-700"> </p> <div class="mt-4 flex items-center justify-between border-t border-stone-100 pt-3"><span class="text-xs text-stone-400"> </span> <div class="flex gap-1"><button aria-label="Edit entry"><!></button> <button aria-label="Delete entry"><!></button></div></div>',1),pf=q("<!> <button><!> Add knowledge</button> <!> <!> <!>",1);function mf(e,t){Se(t,!0);const r=20;let n=B(ne([])),i=B(!1),a=B(!0),o=B(!1),s=B(""),u=B(null),c=B(!1),f=B(null);async function m(){v(a,!0),v(s,"");try{const P=await He(`/cars/${t.carId}/knowledge?limit=${r}&offset=0`);v(n,P.items,!0),v(i,P.hasMore,!0)}catch(P){v(s,P.message,!0)}finally{v(a,!1)}}async function d(){v(o,!0);try{const P=await He(`/cars/${t.carId}/knowledge?limit=${r}&offset=${l(n).length}`);v(n,[...l(n),...P.items],!0),v(i,P.hasMore,!0)}catch(P){v(s,P.message,!0)}finally{v(o,!1)}}it(()=>{t.carId,m()});async function g(P){confirm(`Delete "${P.title}"?`)&&(await xr(`/knowledge/${P.id}`),v(u,null),m())}function b(){v(c,!1),v(f,null),m()}function C(P){v(u,null),v(f,P,!0)}var k=pf(),S=Pe(k);{var I=P=>{var H=uf();L(P,H)},M=P=>{var H=cf(),G=h(H);U(()=>z(G,l(s))),L(P,H)},R=P=>{var H=ff();L(P,H)},A=P=>{var H=hf(),G=Pe(H);zt(G,21,()=>l(n),X=>X.id,(X,J)=>{var $=df(),ue=h($),Z=h(ue),Y=h(Z),ie=_(Z,2),le=h(ie),fe=_(ue,2);_e(fe,{name:"chevronRight",class:"h-4 w-4 shrink-0 text-stone-400"}),U(he=>{z(Y,l(J).title),z(le,`Updated ${he??""}`)},[()=>It(l(J).updatedAt)]),se("click",$,()=>v(u,l(J),!0)),L(X,$)});var Q=_(G,2);{var oe=X=>{var J=vf(),$=h(J);_e($,{name:"chevronDown",class:"h-4 w-4"});var ue=_($);U(()=>{J.disabled=l(o),O(J,1,`${nr} mt-3 disabled:opacity-50`),z(ue,` ${l(o)?"Loading…":"Load more"}`)}),se("click",J,d),L(X,J)};V(Q,X=>{l(i)&&X(oe)})}L(P,H)};V(S,P=>{l(a)?P(I):l(s)?P(M,1):l(n).length===0?P(R,2):P(A,-1)})}var p=_(S,2),x=h(p);_e(x,{name:"plus",class:"h-4 w-4"});var D=_(p,2);{var y=P=>{yt(P,{get title(){return l(u).title},onClose:()=>v(u,null),wide:!0,children:(H,G)=>{var Q=gf(),oe=Pe(Q),X=h(oe),J=_(oe,2),$=h(J),ue=h($),Z=_($,2),Y=h(Z),ie=h(Y);_e(ie,{name:"pencil",class:"h-4 w-4"});var le=_(Y,2),fe=h(le);_e(fe,{name:"trash",class:"h-4 w-4"}),U(he=>{z(X,l(u).body),z(ue,`Updated ${he??""}`),O(Y,1,j(qt)),O(le,1,`${qt} hover:text-red-600`)},[()=>It(l(u).updatedAt)]),se("click",Y,()=>C(l(u))),se("click",le,()=>g(l(u))),L(H,Q)},$$slots:{default:!0}})};V(D,P=>{l(u)&&P(y)})}var w=_(D,2);{var T=P=>{yt(P,{title:"Add knowledge entry",onClose:()=>v(c,!1),children:(H,G)=>{so(H,{get carId(){return t.carId},onSaved:b,onCancel:()=>v(c,!1)})},$$slots:{default:!0}})};V(w,P=>{l(c)&&P(T)})}var N=_(w,2);{var F=P=>{yt(P,{title:"Edit knowledge entry",onClose:()=>v(f,null),children:(H,G)=>{so(H,{get carId(){return t.carId},get entry(){return l(f)},onSaved:
Line truncated
|
||||
${l(c)===l(me).key?"border-teal-700 text-teal-700":"border-transparent text-stone-500 hover:border-stone-300 hover:text-stone-900"}`),z(Pt,` ${l(me).label??""}`)}),se("click",Ae,()=>v(c,l(me).key,!0)),L(ee,Ae)});var le=_(ie,2),fe=h(le);{var he=ee=>{ps(ee,{get carId(){return l(r)}})},Ie=ee=>{mf(ee,{get carId(){return l(r)}})},K=ee=>{Tf(ee,{get carId(){return l(r)}})},ce=ee=>{jf(ee,{get carId(){return l(r)}})};V(fe,ee=>{l(c)==="reminders"?ee(he):l(c)==="knowledge"?ee(Ie,1):l(c)==="service"?ee(K,2):l(c)==="fuel"&&ee(ce,3)})}var pe=_(R,2);{var $e=ee=>{yt(ee,{get title(){return`Share ${l(n).rego??""}`},onClose:()=>v(o,!1),children:(me,Ae)=>{of(me,{get car(){return l(n)},onUpdated:Oe=>v(n,Oe,!0)})},$$slots:{default:!0}})};V(pe,ee=>{l(o)&&ee($e)})}var Ue=_(pe,2);{var vt=ee=>{yt(ee,{title:"Mileage",onClose:()=>v(s,!1),children:(me,Ae)=>{Zf(me,{get carId(){return l(r)},get odometer(){return l(n).odometer},onUpdated:f})},$$slots:{default:!0}})};V(Ue,ee=>{l(s)&&ee(vt)})}U((ee,me)=>{z(w,`${ee??""}${l(n).color?` · ${l(n).color}`:""}`),z(Q,me),O(X,1,j(rr)),Ge($,"href",`#/cars/${l(r)??""}/edit`),O($,1,j(rr)),O(Z,1,j(vs)),O(le,1,j(hs))},[()=>[l(n).year,l(n).make,l(n).model].filter(Boolean).join(" "),()=>l(n).odometer?`${l(n).odometer.toLocaleString()} km`:"Set odometer"]),se("click",G,()=>v(s,!0)),se("click",X,()=>v(o,!0)),se("click",Z,m),L(I,M)};V(b,I=>{l(i)?I(C):l(a)?I(k,1):l(n)&&I(S,2)})}L(e,g),Ce()}ze(["click"]);var nd=q('<p class="text-sm text-red-600"> </p>'),id=q('<form class="space-y-4"><div><label for="car-rego">Rego *</label> <input id="car-rego" required=""/></div> <div class="grid grid-cols-2 gap-4"><div><label for="car-make">Make</label> <input id="car-make"/></div> <div><label for="car-model">Model</label> <input id="car-model"/></div></div> <div class="grid grid-cols-3 gap-4"><div><label for="car-year">Year</label> <input id="car-year" type="number"/></div> <div><label for="car-color">Color</label> <input id="car-color"/></div> <div><label for="car-odometer">Odometer</label> <input id="car-odometer" type="number"/></div></div> <div class="grid grid-cols-2 gap-4"><div><label for="car-rego-expiry">Rego expiry</label> <input id="car-rego-expiry" type="date"/></div> <div><label for="car-wof-expiry">WoF expiry</label> <input id="car-wof-expiry" type="date"/></div></div> <div><span>Service interval (optional)</span> <p class="mb-1.5 -mt-1 text-xs text-stone-400">Whichever comes first triggers a reminder, counted from the last entry marked "full service".</p> <div class="grid grid-cols-2 gap-4"><div><label for="car-service-km" class="sr-only">Every (km)</label> <input id="car-service-km" type="number" placeholder="Every (km)"/></div> <div><label for="car-service-months" class="sr-only">Every (months)</label> <input id="car-service-months" type="number" placeholder="Every (months)"/></div></div></div> <!> <button type="submit"> </button></form>');function ws(e,t){var Oe,Pt,Ve,te,Re,Je,Vt,Kt,Sr,tn;Se(t,!0);let r=Be(t,"car",3,null),n=B(ne(((Oe=r())==null?void 0:Oe.rego)??"")),i=B(ne(((Pt=r())==null?void 0:Pt.make)??"")),a=B(ne(((Ve=r())==null?void 0:Ve.model)??"")),o=B(ne(((te=r())==null?void 0:te.year)??"")),s=B(ne(((Re=r())==null?void 0:Re.color)??"")),u=B(ne(((Je=r())==null?void 0:Je.odometer)??"")),c=B(ne((Vt=r())!=null&&Vt.regoExpiry?r().regoExpiry.slice(0,10):"")),f=B(ne((Kt=r())!=null&&Kt.wofExpiry?r().wofExpiry.slice(0,10):"")),m=B(ne(((Sr=r())==null?void 0:Sr.serviceIntervalKm)??"")),d=B(ne(((tn=r())==null?void 0:tn.serviceIntervalMonths)??"")),g=B(!1),b=B("");async function C(xe){var Cr;if(xe.preventDefault(),!l(n).trim()){v(b,"Rego is required");return}v(g,!0),v(b,"");const Rt={rego:l(n).trim(),make:l(i)||null,model:l(a)||null,year:l(o)?Number(l(o)):null,color:l(s)||null,odometer:l(u)?Number(l(u)):null,regoExpiry:l(c)||null,wofExpiry:l(f)||null,serviceIntervalKm:l(m)?Number(l(m)):null,serviceIntervalMonths:l(d)?Number(l(d)):null};try{const Ar=r()?await en(`/cars/${r().id}`,Rt):await wr("/cars",Rt);(Cr=t.onSave)==null||Cr.call(t,Ar)}catch(Ar){v(b,Ar.message,!0)}finally{v(g,!1)}}var k=id(),S=h(k),I=h(S),M=_(I,2),R=_(S,2),A=h(R),p=h(A),x=_(p,2),D=_(A,2),y=h(D),w=_(y,2),T=_(R,2),N=h(T),F=h(N),P=_(F,2),H=_(N,2),G=h(H),Q=_(G,2),oe=_(H,2),X=h(oe),J=_(X,2),$=_(T,2),ue=h($),Z=h(ue),Y=_(Z,2),ie=_(ue,2),le=h(ie),fe=_(le,2),he=_($,2),Ie=h(he),K=_(Ie,4),ce=h(K),pe=_(h(ce),2),$e=_(ce,2),Ue=_(h($e),2),vt=_(he,2);{var ee=xe=>{var Rt=nd(),Cr=h(Rt);U(()=>z(Cr,l(b))),L(xe,Rt)};V(vt,xe=>{l(b)&&xe(ee)})}var me=_(vt,2),Ae=h(me);U(()=>{O(I,1,j(ye)),O(M,1,j(be)),O(p,1,j(ye)),O(x,1,j(be)),O(y,1,j(ye)),O(w,1,j(be)),O(F,1,j(ye)),O(P,1,j(be)),O(G,1,j(ye)),O(Q,1,j(be)),O(X,1,j(ye)),O(J,1,j(be)),O(Z,1,j(ye)),O(Y,1,j(be)),O(le,1,j(ye)),O(fe,1,j(be)),O(Ie,1,j(ye)),O(pe,1,j(be)),O(Ue,1,j(be)),me.disabled=l(g),O(me,1,j(Ht)),z(Ae,l(g)?"Saving…":r()?"Save changes":"Create car")}),br("submit",k,C),Ee(M,()=>l(n),xe=>v(n,xe)),Ee(x,()=>l(i),xe=>v(i,xe)),Ee(w,()=>l(a),xe=>v(a,xe)),Ee(P,()=>l(o),xe=>v(o,xe)),Ee(Q,()=>l(s),xe=>v(s,xe))
Line truncated
|
||||
Reference in new issue
Block a user