From 5882e815f77ab14a65849ae0c51d2f7f0273152f Mon Sep 17 00:00:00 2001 From: Deyan Stamboliev Date: Thu, 30 Nov 2023 15:02:24 +0200 Subject: [PATCH] build: deploy dist for github pages --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index ddf8752..195ba2b 100644 --- a/index.js +++ b/index.js @@ -6,4 +6,4 @@ * @author Deyan 'stambolievv' Stamboliev * @license Apache-2.0 */ -var t,e,i,n,r,s,a,o=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},c=(t,e,i)=>(o(t,e,"read from private field"),i?i.call(t):e.get(t)),l=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},d=(t,e,i)=>(o(t,e,"access private method"),i);!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const i of t)if("childList"===i.type)for(const t of i.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerpolicy&&(e.referrerPolicy=t.referrerpolicy),"use-credentials"===t.crossorigin?e.credentials="include":"anonymous"===t.crossorigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();var u=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},h=x,p=y,f=function(t){return _(y(t))},m=_,v=A,g=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^()])+)\\))?|\\(((?:\\\\.|[^()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function y(t){for(var e,i=[],n=0,r=0,s="";null!=(e=g.exec(t));){var a=e[0],o=e[1],c=e.index;if(s+=t.slice(r,c),r=c+a.length,o)s+=o[1];else{s&&(i.push(s),s="");var l=e[2],d=e[3],u=e[4],h=e[5],p=e[6],f=e[7],m="+"===p||"*"===p,v="?"===p||"*"===p,y=l||"/",_=u||h||(f?".*":"[^"+y+"]+?");i.push({name:d||n++,prefix:l||"",delimiter:y,optional:v,repeat:m,pattern:$(_)})}}return r0){var n=this._window;N&&n.history.back(),this.len--}else t?setTimeout((function(){i.show(t,e)})):setTimeout((function(){i.show(i._getBase(),e)}))},L.prototype.redirect=function(t,e){var i=this;"string"==typeof t&&"string"==typeof e&&O.call(this,t,(function(t){setTimeout((function(){i.replace(e)}),0)})),"string"==typeof t&&void 0===e&&setTimeout((function(){i.replace(t)}),0)},L.prototype.replace=function(t,e,i,n){var r=new U(t,e,this),s=this.prevContext;return this.prevContext=r,this.current=r.path,r.init=i,r.save(),!1!==n&&this.dispatch(r,s),r},L.prototype.dispatch=function(t,e){var i=0,n=0,r=this;function s(){var e=r.callbacks[i++];if(t.path===r.current)return e?void e(t,s):T.call(r,t);t.handled=!1}e?function t(){var i=r.exits[n++];if(!i)return s();i(e,t)}():s()},L.prototype.exit=function(t,e){if("function"==typeof t)return this.exit("*",t);for(var i=new D(t,null,this),n=1;n-1)&&!(r?e.target.baseVal:e.target)&&(r||this.sameOrigin(e.href))){var a=r?e.href.baseVal:e.pathname+e.search+(e.hash||"");a="/"!==a[0]?"/"+a:a,I&&a.match(/^\/[a-zA-Z]:\//)&&(a=a.replace(/^\/[a-zA-Z]:\//,"/"));var o=a,c=this._getBase();0===a.indexOf(c)&&(a=a.substr(c.length)),this._hashbang&&(a=a.replace("#!","")),(!c||o!==a||R&&"file:"===this._window.location.protocol)&&(t.preventDefault(),this.show(o))}}}}},L.prototype._onpopstate=(k=!1,S?(E&&"complete"===document.readyState?k=!0:window.addEventListener("load",(function(){setTimeout((function(){k=!0}),0)})),function(t){if(k){var e=this;if(t.state){var i=t.state.path;e.replace(i,t.state)}else if(R){var n=e._window.location;e.show(n.pathname+n.search+n.hash,void 0,void 0,!1)}}}):function(){}),L.prototype._which=function(t){return null==(t=t||S&&this._window.event).which?t.button:t.which},L.prototype._toURL=function(t){var e=this._window;if("function"==typeof URL&&R)return new URL(t,e.location.toString());if(E){var i=e.document.createElement("a");return i.href=t,i}},L.prototype.sameOrigin=function(t){if(!t||!R)return!1;var e=this._toURL(t),i=this._window.location;return i.protocol===e.protocol&&i.hostname===e.hostname&&(i.port===e.port||""===i.port&&(80==e.port||443==e.port))},L.prototype._samePath=function(t){if(!R)return!1;var e=this._window.location;return t.pathname===e.pathname&&t.search===e.search},L.prototype._decodeURLEncodedURIComponent=function(t){return"string"!=typeof t?t:this._decodeURLComponents?decodeURIComponent(t.replace(/\+/g," ")):t},U.prototype.pushState=function(){var t=this.page,e=t._window,i=t._hashbang;t.len++,N&&e.history.pushState(this.state,this.title,i&&"/"!==this.path?"#!"+this.path:this.canonicalPath)},U.prototype.save=function(){var t=this.page;N&&t._window.history.replaceState(this.state,this.title,t._hashbang&&"/"!==this.path?"#!"+this.path:this.canonicalPath)},D.prototype.middleware=function(t){var e=this;return function(i,n){if(e.match(i.path,i.params))return i.routePath=e.path,t(i,n);n()}},D.prototype.match=function(t,e){var i=this.keys,n=t.indexOf("?"),r=~n?t.slice(0,n):t,s=this.regexp.exec(decodeURIComponent(r));if(!s)return!1;delete e[0];for(var a=1,o=s.length;at:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new J("string"==typeof t?t:t+"",void 0,z))(e)})(t):t;var Y;const G=window,K=G.trustedTypes,Z=K?K.emptyScript:"",X=G.reactiveElementPolyfillSupport,F={toAttribute(t,e){switch(e){case Boolean:t=t?Z:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(n){i=null}}return i}},Q=(t,e)=>e!==t&&(e==e||t==t),tt={attribute:!0,type:String,converter:F,reflect:!1,hasChanged:Q},et="finalized";class it extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=tt){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||tt}static finalize(){if(this.hasOwnProperty(et))return!1;this[et]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(W(t))}else void 0!==t&&e.push(W(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{q?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),n=V.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=tt){var n;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const s=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:F).toAttribute(e,i.type);this._$El=t,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,r=n._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=n.getPropertyOptions(r),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:F;this._$El=r,this[r]=s.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||Q)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(n){throw e=!1,this._$Ek(),n}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}var nt;it[et]=!0,it.elementProperties=new Map,it.elementStyles=[],it.shadowRootOptions={mode:"open"},null==X||X({ReactiveElement:it}),(null!==(Y=G.reactiveElementVersions)&&void 0!==Y?Y:G.reactiveElementVersions=[]).push("1.6.3");const rt=window,st=rt.trustedTypes,at=st?st.createPolicy("lit-html",{createHTML:t=>t}):void 0,ot="$lit$",ct=`lit$${(Math.random()+"").slice(9)}$`,lt="?"+ct,dt=`<${lt}>`,ut=document,ht=()=>ut.createComment(""),pt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,ft=Array.isArray,mt="[ \t\n\f\r]",vt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gt=/-->/g,yt=/>/g,_t=RegExp(`>|${mt}(?:([^\\s"'>=/]+)(${mt}*=${mt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),bt=/'/g,$t=/"/g,wt=/^(?:script|style|textarea|title)$/i,Ct=(St=1,(t,...e)=>({_$litType$:St,strings:t,values:e})),At=Symbol.for("lit-noChange"),xt=Symbol.for("lit-nothing"),kt=new WeakMap,Et=ut.createTreeWalker(ut,129,null,!1);var St;function Nt(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==at?at.createHTML(e):e}class It{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,s=0;const a=t.length-1,o=this.parts,[c,l]=((t,e)=>{const i=t.length-1,n=[];let r,s=2===e?"":"",a=vt;for(let o=0;o"===c[0]?(a=null!=r?r:vt,l=-1):void 0===c[1]?l=-2:(l=a.lastIndex-c[2].length,i=c[1],a=void 0===c[3]?_t:'"'===c[3]?$t:bt):a===$t||a===bt?a=_t:a===gt||a===yt?a=vt:(a=_t,r=void 0);const u=a===_t&&t[o+1].startsWith("/>")?" ":"";s+=a===vt?e+dt:l>=0?(n.push(i),e.slice(0,l)+ot+e.slice(l)+ct+u):e+ct+(-2===l?(n.push(void 0),o):u)}return[Nt(t,s+(t[i]||"")+(2===e?"":"")),n]})(t,e);if(this.el=It.createElement(c,i),Et.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=Et.nextNode())&&o.length0){n.textContent=st?st.emptyScript:"";for(let i=0;ift(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==xt&&pt(this._$AH)?this._$AA.nextSibling.data=t:this.$(ut.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:n}=t,r="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=It.createElement(Nt(n.h,n.h[0]),this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.v(i);else{const t=new Rt(r,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=kt.get(t.strings);return void 0===e&&kt.set(t.strings,e=new It(t)),e}T(t){ft(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const r of t)n===e.length?e.push(i=new Lt(this.k(ht()),this.k(ht()),this,this.options)):i=e[n],i._$AI(r),n++;n2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=xt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const r=this.strings;let s=!1;if(void 0===r)t=Pt(this,t,e,0),s=!pt(t)||t!==this._$AH&&t!==At,s&&(this._$AH=t);else{const n=t;let a,o;for(t=r[0],a=0;a{var n,r;const s=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let a=s._$litPart$;if(void 0===a){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=a=new Lt(e.insertBefore(ht(),t),t,void 0,null!=i?i:{})}return a._$AI(t),a};var qt,zt;class Bt extends it{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Vt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return At}}Bt.finalized=!0,Bt._$litElement$=!0,null===(qt=globalThis.litElementHydrateSupport)||void 0===qt||qt.call(globalThis,{LitElement:Bt});const Jt=globalThis.litElementPolyfillSupport;async function Wt(t,e){const i=new URL(t,"https://parseapi.back4app.com"),n=await fetch(i,e);if(!0!==n.ok){403===n.status&&await ye();const t=await n.json();throw new Error(`${t.error} Status: ${n.status}`,{cause:n})}return n.json()}function Yt(t,e){const i=new Headers({"X-Parse-Application-Id":"0oqWvkMylRfPgcnXNXtOUe8SWSqDZPiHktiLW9Np","X-Parse-REST-API-Key":"4YzVVeTWOVJyamwDNrNaafCLGzwC5qWnt7dw9aot"}),n=ve();return n&&i.append("X-Parse-Session-Token",n.token),e&&i.append("Content-Type","application/json"),{method:t,headers:i,...e?{body:JSON.stringify(e)}:{}}}null==Jt||Jt({LitElement:Bt}),(null!==(zt=globalThis.litElementVersions)&&void 0!==zt?zt:globalThis.litElementVersions=[]).push("3.3.3");const Gt=t=>Wt(t,Yt("GET")),Kt=(t,e)=>Wt(t,Yt("POST",e)),Zt=(t,e)=>Wt(t,Yt("PUT",e)),Xt=t=>Wt(t,Yt("DELETE"));function Ft(t){if(!t)return{};try{return decodeURIComponent(t).split("&").reduce(((t,e)=>{const[i,n]=e.split("=");return t[i.trim()]=(null==n?void 0:n.includes(","))?n.split(",").map(decodeURIComponent):decodeURIComponent(null==n?void 0:n.trim()),t}),{})}catch(e){return console.error(e),{}}}function Qt(t){if(!t)return"";try{return Object.entries(t).filter((([t,e])=>{const i="string"==typeof t&&t.trim().length>0,n="string"==typeof e?e.trim().length>0:Array.isArray(e)&&e.every((t=>"string"==typeof t&&t.trim().length>0));return i&&n})).map((([t,e])=>{const i=Array.isArray(e)?e.map((t=>encodeURIComponent(t.trim()))).join(","):encodeURIComponent(e.trim());return`${encodeURIComponent(t.trim())}=${i}`})).join("&")}catch(e){return console.error(e),""}}function te(t){const e=new FormData(t);return[Object.fromEntries(Array.from(e,(([t,e])=>[t,"string"==typeof e?e.trim():e]))),e=>Array.from(t.elements).forEach((t=>e?t.setAttribute("disabled","true"):t.removeAttribute("disabled")))]}function ee(){if(crypto&&crypto.randomUUID)return crypto.randomUUID();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const e=~~(16*Math.random());return("x"===t?e:3&e|8).toString(16)}))}function ie(t,e={}){const{parent:i,prepend:n=!1,attributes:r,children:s,style:a,...o}=e,c=document.createElement(t);if(void 0!==r)for(const l in r)c.setAttribute(l,r[l]);if(Array.isArray(s))for(const l of s)c.append(l);if(void 0!==a&&Object.assign(c.style,a),Object.assign(c,o),void 0!==i){const t="string"==typeof i?document.querySelector(i):i;t&&t[n?"prepend":"append"](c)}return c}t=new WeakMap;const ne=new class{constructor(e){var i,n,r,s;l(this,t,void 0),r=e,o(i=this,n=t,"write to private field"),s?s.call(i,r):n.set(i,r),this.supported||console.warn("Cache API is not supported in this environment"),!sessionStorage.getItem(`${c(this,t)}Initialized`)&&this.supported&&(sessionStorage.setItem(`${c(this,t)}Initialized`,"true"),this.deleteCache())}get supported(){return!!window.caches}get databaseName(){return c(this,t)}async getCacheData(e){if(!this.supported)return Promise.resolve(null);const i=await caches.open(c(this,t)),n=await i.match(new Request(e));return n&&n.ok?await n.json():Promise.resolve(null)}async updateCacheData(e,i){if(!this.supported)return Promise.resolve();return(await caches.open(c(this,t))).put(new Request(e),new Response(JSON.stringify(i)))}async clearCacheData(e){if(!this.supported)return Promise.resolve(!1);return(await caches.open(c(this,t))).delete(new Request(e))}async deleteCache(){return this.supported?caches.delete(c(this,t)):Promise.resolve(!1)}}("CarServiceCacheDatabase"),re="rgba(0 0 0 / 0.5)",se=3,ae={default:{icon:"",color:"#555555",backgroundColor:"#f2f2f2"},info:{icon:"info",color:"#217ca3",backgroundColor:"#cfe8f3"},success:{icon:"check_circle",color:"#45874a",backgroundColor:"#e5f6e4"},warning:{icon:"error",color:"#b0822f",backgroundColor:"#fef5dc"},error:{icon:"cancel",color:"#b23c3a",backgroundColor:"#f2dede"}};e=new WeakMap,i=new WeakSet,n=function(t,e){switch(t){case"cube-flip":return ie("div",{className:"notice-loading-cube-flip",style:{backgroundColor:e}});case"dots-zoom":return ie("div",{className:"notice-loading-dots-zoom",children:[ie("div",{className:"notice-loading-dots-zoom1",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-dots-zoom2",style:{backgroundColor:e}})]});case"line":return ie("div",{className:"notice-loading-line",children:[ie("div",{className:"notice-loading-line-rect1",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-line-rect2",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-line-rect3",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-line-rect4",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-line-rect5",style:{backgroundColor:e}})]});case"dots-spin":return ie("div",{className:"notice-loading-spin-dots",children:[ie("div",{className:"notice-loading-spin-dot1",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-spin-dot2",style:{backgroundColor:e}})]});case"dots":return ie("div",{className:"notice-loading-dots",children:[ie("div",{className:"notice-loading-dot1",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-dot2",style:{backgroundColor:e}}),ie("div",{style:{backgroundColor:e}})]});case"cube-zoom":return ie("div",{className:"notice-loading-cube-zoom",children:[ie("div",{className:"notice-loading-cube-zoom-1",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-cube-zoom-2",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-cube-zoom-3",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-cube-zoom-4",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-cube-zoom-5",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-cube-zoom-6",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-cube-zoom-7",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-cube-zoom-8",style:{backgroundColor:e}}),ie("div",{className:"notice-loading-cube-zoom-9",style:{backgroundColor:e}})]});default:return null}},r=new WeakSet,s=function(t,e,i,n){const r=ie("div",{className:"notice-modal-buttons"});switch(t){case"yes-no":return ie("button",{parent:r,attributes:{"data-button-type":"info"},textContent:"Да",onclick:t=>{e.remove(),"function"==typeof i&&i(t)}}),ie("button",{parent:r,attributes:{"data-button-type":"danger"},textContent:"Не",onclick:t=>{e.remove(),"function"==typeof n&&n(t)}}),r;case"ok":return ie("button",{parent:r,textContent:"Добре",onclick:t=>{e.remove(),"function"==typeof i&&i(t)}}),r;case"ok-cancel":return ie("button",{parent:r,textContent:"Добре",onclick:t=>{e.remove(),"function"==typeof i&&i(t)}}),ie("button",{parent:r,attributes:{"data-button-type":"danger"},textContent:"Отказ",onclick:t=>{e.remove(),"function"==typeof n&&n(t)}}),r;case"retry-cancel":return ie("button",{parent:r,attributes:{"data-button-type":"info"},textContent:"Нов опит",onclick:t=>{e.remove(),"function"==typeof i&&i(t)}}),ie("button",{parent:r,attributes:{"data-button-type":"danger"},textContent:"Отказ",onclick:t=>{e.remove(),"function"==typeof n&&n(t)}}),r;default:return null}};const oe=new class{constructor(){l(this,i),l(this,r),l(this,e,document.body)}showLoading(t={}){const{type:r="dots",color:s="white",autoClose:a,title:o,titleColor:l,maskColor:u=re}=t,h=ie("div",{parent:c(this,e),className:"notice-loading notice-flex-center notice-fixed-all-page",id:"notice-loading"});ie("div",{parent:h,className:"notice-mask notice-fixed-all-page",style:{backgroundColor:u}});const p=d(this,i,n).call(this,r,s)||d(this,i,n).call(this,"dots",s),f=ie("div",{parent:h,className:"notice-flex-center notice-loading-main",children:[p]});o&&ie("p",{parent:f,style:{color:l},textContent:o}),a&&setTimeout((()=>h.remove()),1e3*a)}hideLoading(){var t;null==(t=document.getElementById("notice-loading"))||t.remove()}showToast(t){const{text:i,type:n="default",autoClose:r=se,showClose:s=!0}=t;if(!i)return;const{icon:a,color:o,backgroundColor:l}=ae[n]||ae.default,d=document.getElementById("notice-toast")||ie("div",{parent:c(this,e),className:"notice-toast",id:"notice-toast"}),u=ie("div",{parent:d,className:"notice-toast-main notice-toast-main-active",id:`notice-toast-${ee()}`,style:{backgroundColor:l}}),h=ie("div",{parent:u,className:"notice-toast-container",children:[ie("p",{className:"notice-toast-text",style:{color:o},textContent:i})]});a&&ie("i",{parent:h,prepend:!0,className:"material-icons notice-toast-icon",style:{color:o},textContent:a}),(s||!r)&&ie("i",{parent:h,className:"material-icons notice-close-icon",textContent:"close",onclick:()=>f()});const p=!!Number(getComputedStyle(d).getPropertyValue("--_should-auto-close"));if(r||p){setTimeout((()=>f()),1e3*(r||se))}function f(){if(!u)return;const t=parseFloat(window.getComputedStyle(u).getPropertyValue("transition-duration"));u.classList.remove("notice-toast-main-active"),setTimeout((()=>{u&&u.remove(),d.children.length||d.remove()}),1e3*t)}}showModal(t={}){const{type:i="yes-no",color:n,backgroundColor:a,title:o,titleColor:l,message:u,messageColor:h,maskColor:p=re,onConfirm:f,onCancel:m}=t,v=ie("div",{parent:c(this,e),className:"notice-modal notice-flex-center notice-fixed-all-page",id:"notice-modal"});ie("div",{parent:v,className:"notice-mask notice-fixed-all-page",style:{backgroundColor:p}});const g=ie("div",{parent:v,className:"notice-flex-center notice-modal-main",style:{backgroundColor:a},children:[d(this,r,s).call(this,i,v,f,m)||d(this,r,s).call(this,"yes-no",v,f,m)]});u&&ie("p",{parent:g,prepend:!0,style:{color:h||n},textContent:u}),o&&ie("h2",{parent:g,prepend:!0,style:{color:l||n},textContent:o})}},ce=document.querySelectorAll(".user-navigation"),le=document.querySelectorAll(".guest-navigation");function de(){me()?(ce.forEach((t=>t.removeAttribute("hidden"))),le.forEach((t=>t.setAttribute("hidden","")))):(ce.forEach((t=>t.setAttribute("hidden",""))),le.forEach((t=>t.removeAttribute("hidden"))))}const ue={LOGIN:"/login",REGISTER:"/users",LOGOUT:"/logout"},he={CREATE_CAR:"/classes/Car",ALL_CARS:(t="")=>`/classes/Car?${Qt({order:"-createdAt",where:t})}`,CAR_BY_ID:t=>`/classes/Car/${t}`},pe={CREATE_REPAIR:"/classes/Repair",ALL_REPAIRS:t=>`/classes/Repair?${Qt({order:"-createdAt",where:t})}`,REPAIR_BY_ID:t=>`/classes/Repair/${t}`},fe="car-service-current-user-data";function me(){return!!localStorage.getItem(fe)}function ve(){var t;return JSON.parse(null!=(t=localStorage.getItem(fe))?t:"null")}async function ge(t){await ne.deleteCache().catch(console.error),localStorage.setItem(fe,JSON.stringify(t))}async function ye(){await ne.deleteCache().catch(console.error),localStorage.removeItem(fe)}const _e={itemsPerPage:10,relativePageLinks:3};async function be(t){const e="/cars",i=await ne.getCacheData(e),n=i&&i.find((e=>e.objectId===t));if(n)return n;const r=await Gt(he.CAR_BY_ID(t));if(i){const t=[r,...i].sort(((t,e)=>+new Date(e.createdAt)-+new Date(t.createdAt)));await ne.updateCacheData(e,JSON.parse(JSON.stringify(t)))}return r}async function $e(t){var e;const i=await Xt(he.CAR_BY_ID(t)),n="/cars",r=(null!=(e=await ne.getCacheData(n))?e:[]).filter((e=>e.objectId!==t));return await(r.length>0?ne.updateCacheData(n,JSON.parse(JSON.stringify(r))):ne.clearCacheData(n)),i}async function we(t,e){const i=JSON.stringify({car:{__type:"Pointer",className:"Car",objectId:t}}),n=`/cars/${t}/repairs`,r=await ne.getCacheData(n);let s;if(r?s=r:(({results:s}=await Gt(pe.ALL_REPAIRS(i))),await ne.updateCacheData(n,JSON.parse(JSON.stringify(s)))),!e)return{results:s,count:s.length};const a=10*(e-1),o=10*e;return{results:s.slice(a,o),count:s.length}}async function Ce(t,e){const i=`/cars/${t}/repairs`,n=await ne.getCacheData(i),r=n&&n.find((t=>t.objectId===e));if(r)return r;const s=await Gt(pe.REPAIR_BY_ID(e));if(n){const t=[s,...n].sort(((t,e)=>+new Date(e.createdAt)-+new Date(t.createdAt)));await ne.updateCacheData(i,JSON.parse(JSON.stringify(t)))}return s}async function Ae(t){const{results:e}=await we(t),i=e.map((({objectId:t})=>Xt(pe.REPAIR_BY_ID(t)))),n=`/cars/${t}/repairs`;return await ne.clearCacheData(n),Promise.all(i)}const xe=document.getElementById("site-content")||document.body,ke=document.querySelector("meta[name=viewport]"),Ee=["/user/login","/user/register"];function Se(t,e={}){const{container:i,...n}=e,r=i&&(i instanceof HTMLElement||i instanceof DocumentFragment)?i:"string"==typeof i?document.querySelector(i):null;return Vt(t,r||xe,n)}const Ne=(t,e)=>t.length>0?Ie(t,e):Ct`

Нямаш добавени автомобили!

`,Ie=(t,e)=>Ct`${t.map((t=>Pe(t,e)))}
РамаPегистрационен №Марка / МоделДвигателИме на клиентаРемонтиРедакцияИзтриване
`,Pe=(t,e)=>Ct`${t.vin}${t.registration}${t.make}${t.engine}${t.customerName}
`,Re=(t,e,i,n)=>{const r=(r,s)=>{const a=t===s||s<1||s>e,o="number"==typeof r&&t===s,c=a?"#":(t=>{const e=Qt({filter:i,query:n,page:t.toString()});return`${window.location.pathname}?${e}`})(s);return Ct`${r}`};const s=r(Ct`keyboard_double_arrow_left`,1),a=r(Ct`chevron_left`,t-1),o=function(){const i=Math.floor(_e.relativePageLinks/2),n=Math.min(Math.max(1,t-i),Math.max(1,e-_e.relativePageLinks+1)),r=Math.max(Math.min(e,t+i),Math.min(e,_e.relativePageLinks)),s=Math.min(r-n+1,e);return Array.from({length:s},((t,e)=>n+e))}().map((t=>r(t,t))),c=r(Ct`chevron_right`,t+1),l=r(Ct`keyboard_double_arrow_right`,e);return Ct`${s}${a}${o}${c}${l}`},Le=t=>t.length>0?Oe(t):Ct`

Нямаш завършени ремонти!

`,Oe=t=>Ct`${t.map(Te)}
Извършен наКилометриДетайли по ремонта
`,Te=t=>Ct`${t.date}${t.km}`,Ue=(t,e)=>{const i=(i,n)=>{const r=t===n||n<1||n>e,s="number"==typeof i&&t===n,a=r?"#":(t=>{const e=Qt({page:t.toString()});return`${window.location.pathname}?${e}`})(n);return Ct`${i}`};const n=i(Ct`keyboard_double_arrow_left`,1),r=i(Ct`chevron_left`,t-1),s=function(){const i=Math.floor(_e.relativePageLinks/2),n=Math.min(Math.max(1,t-i),Math.max(1,e-_e.relativePageLinks+1)),r=Math.max(Math.min(e,t+i),Math.min(e,_e.relativePageLinks)),s=Math.min(r-n+1,e);return Array.from({length:s},((t,e)=>n+e))}().map((t=>i(t,t))),a=i(Ct`chevron_right`,t+1),o=i(Ct`keyboard_double_arrow_right`,e);return Ct`${n}${r}${s}${a}${o}`};async function De(t){t.preventDefault();const e=t.target,[i,n]=te(e);try{n(!0),oe.showLoading({type:"cube-zoom"}),await async function(t){const e=await Kt(ue.LOGIN,t);return await ge({username:t.username,id:e.objectId,token:e.sessionToken}),de(),e}(i),H.redirect("/cars")}catch(r){const t=r instanceof Error?r.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:t,type:"error"})}finally{n(!1),oe.hideLoading(),e.reset()}}function je(t){t.preventDefault();const e=t.target,i=e.previousElementSibling,n="password"===i.type?"text":"password";i.setAttribute("type",n),e.textContent="password"===n?"visibility_off":"visibility"}async function He(t){t.preventDefault();const e=t.target,[{username:i,password:n,repass:r},s]=te(e);if(n===r)try{s(!0),oe.showLoading({type:"cube-zoom"}),await async function(t){const e=await Kt(ue.REGISTER,t);return await ge({username:t.username,id:e.objectId,token:e.sessionToken}),de(),e}({username:i,password:n}),H.redirect("/cars")}catch(a){const t=a instanceof Error?a.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:t,type:"error"})}finally{s(!1),oe.hideLoading(),e.reset()}else oe.showToast({text:"Паролите не съвпадат!",type:"warning"})}function Me(t){var e,i,n;t.preventDefault();const r=t.target,s=r.previousElementSibling,a=null==(n=null==(i=null==(e=r.parentElement)?void 0:e.parentElement)?void 0:i.nextElementSibling)?void 0:n.lastElementChild,o="password"===s.type?"text":"password";s.setAttribute("type",o),a.setAttribute("type",o),r.textContent="password"===o?"visibility_off":"visibility"}const Ve=2;class qe{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const ze=(t,e)=>{var i,n;const r=t._$AN;if(void 0===r)return!1;for(const s of r)null===(n=(i=s)._$AO)||void 0===n||n.call(i,e,!1),ze(s,e);return!0},Be=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===(null==i?void 0:i.size))},Je=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),Ge(e)}};function We(t){void 0!==this._$AN?(Be(this),this._$AM=t,Je(this)):this._$AM=t}function Ye(t,e=!1,i=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(n))for(let s=i;s{var e,i,n,r;t.type==Ve&&(null!==(e=(n=t)._$AP)&&void 0!==e||(n._$AP=Ye),null!==(i=(r=t)._$AQ)&&void 0!==i||(r._$AQ=We))};class Ke extends qe{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),Je(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,n;t!==this.isConnected&&(this.isConnected=t,t?null===(i=this.reconnected)||void 0===i||i.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),e&&(ze(this,t),Be(this))}setValue(t){if(void 0===this._$Ct.strings)this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class Ze{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}}class Xe{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){var t;null!==(t=this.Y)&&void 0!==t||(this.Y=new Promise((t=>this.Z=t)))}resume(){var t;null===(t=this.Z)||void 0===t||t.call(this),this.Y=this.Z=void 0}}const Fe=t=>{return!(e=t,null===e||"object"!=typeof e&&"function"!=typeof e||"function"!=typeof t.then);var e},Qe=1073741823;const ti=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends Ke{constructor(){super(...arguments),this._$C_t=Qe,this._$Cwt=[],this._$Cq=new Ze(this),this._$CK=new Xe}render(...t){var e;return null!==(e=t.find((t=>!Fe(t))))&&void 0!==e?e:At}update(t,e){const i=this._$Cwt;let n=i.length;this._$Cwt=e;const r=this._$Cq,s=this._$CK;this.isConnected||this.disconnected();for(let a=0;athis._$C_t);a++){const t=e[a];if(!Fe(t))return this._$C_t=a,t;a{for(;s.get();)await s.get();const i=r.deref();if(void 0!==i){const n=i._$Cwt.indexOf(t);n>-1&&noe.showModal({message:`Сигурен ли си, че искаш да изтриеш автомобила на ${e.customerName} - "${e.registration}"`,onConfirm:()=>t(!0),onCancel:()=>t(!1)}))))try{oe.showLoading(),await Promise.all([Ae(e.objectId),$e(e.objectId)]),oe.showToast({text:`Успешно изтрихте автомобила на ${e.customerName} - "${e.registration}"`,type:"info"})}catch(i){const t=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:t,type:"error"})}finally{oe.hideLoading(),H.redirect("/cars")}}async function ni(t){t.preventDefault();const e=t.target,[i,n]=te(e);try{n(!0),oe.showLoading(),await async function(t){var e;const{id:i}=ve(),n={owner:Object.freeze({__type:"Pointer",className:"_User",objectId:i})},r=Object.assign({},t,n),s=await Kt(he.CREATE_CAR,r),a="/cars",o=null!=(e=await ne.getCacheData(a))?e:[],c={...r,...s},l=[c,...o].sort(((t,e)=>+new Date(e.createdAt)-+new Date(t.createdAt)));return await ne.updateCacheData(a,JSON.parse(JSON.stringify(l))),c}(i),oe.showToast({text:`Успешно създадохте автомобил на ${i.customerName} - "${i.registration}"`,type:"success"})}catch(r){const t=r instanceof Error?r.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:t,type:"error"})}finally{n(!1),oe.hideLoading(),e.reset(),H.redirect("/cars")}}async function ri(t,e){t.preventDefault();const i=t.target,[n,r]=te(i);try{r(!0),oe.showLoading(),await async function(t,e){var i;const n=await Zt(he.CAR_BY_ID(t),e),r="/cars",s=null!=(i=await ne.getCacheData(r))?i:[],a=s.findIndex((e=>e.objectId===t)),o={...-1!==a?s.splice(a,1)[0]:{},...e,...n},c=[o,...s].sort(((t,e)=>+new Date(e.createdAt)-+new Date(t.createdAt)));return await ne.updateCacheData(r,JSON.parse(JSON.stringify(c))),o}(e.objectId,n),oe.showToast({text:`Успешно редактирахте ремонт на ${n.customerName} - "${n.registration}"`,type:"info"})}catch(s){const t=s instanceof Error?s.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:t,type:"error"})}finally{r(!1),oe.hideLoading(),i.reset(),H.redirect("/cars")}}async function si(t,e){t.preventDefault();const i=t.target,[n,r]=te(i);try{r(!0),oe.showLoading(),await async function(t,e){var i;const{id:n}=ve(),r={owner:Object.freeze({__type:"Pointer",className:"_User",objectId:n})},s={car:Object.freeze({__type:"Pointer",className:"Car",objectId:t})},a=Object.assign({},e,r,s),o=await Kt(pe.CREATE_REPAIR,a),c=`/cars/${t}/repairs`,l=null!=(i=await ne.getCacheData(c))?i:[],d={...a,...o},u=[d,...l].sort(((t,e)=>+new Date(e.createdAt)-+new Date(t.createdAt)));return await ne.updateCacheData(c,JSON.parse(JSON.stringify(u))),d}(e,n),oe.showToast({text:"Успешно добавихте ремонт",type:"success"})}catch(s){const t=s instanceof Error?s.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:t,type:"error"})}finally{r(!1),oe.hideLoading(),i.reset(),H.redirect(`/cars/${e}/repairs`)}}async function ai(t,e){t.preventDefault();if(await new Promise((t=>oe.showModal({message:`Сигурен ли си, че искаш да изтриеш ремонт от дата "${e.date}"`,onConfirm:()=>t(!0),onCancel:()=>t(!1)}))))try{oe.showLoading(),await async function(t,e){var i;const n=await Xt(pe.REPAIR_BY_ID(e)),r=`/cars/${t}/repairs`,s=(null!=(i=await ne.getCacheData(r))?i:[]).filter((t=>t.objectId!==e));return await(s.length>0?ne.updateCacheData(r,JSON.parse(JSON.stringify(s))):ne.clearCacheData(r)),n}(e.car.objectId,e.objectId),oe.showToast({text:"Успешно изтрихте ремонта",type:"info"})}catch(i){const t=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:t,type:"error"})}finally{oe.hideLoading(),H.redirect(`/cars/${e.car.objectId}/repairs`)}}async function oi(t,e){t.preventDefault();const i=t.target,[n,r]=te(i);try{r(!0),oe.showLoading(),await async function(t,e,i){var n;const r=await Zt(pe.REPAIR_BY_ID(e),i),s=`/cars/${t}/repairs`,a=null!=(n=await ne.getCacheData(s))?n:[],o=a.findIndex((t=>t.objectId===e)),c={...-1!==o?a.splice(o,1)[0]:{},...i,...r},l=[c,...a].sort(((t,e)=>+new Date(e.createdAt)-+new Date(t.createdAt)));return await ne.updateCacheData(s,JSON.parse(JSON.stringify(l))),c}(e.car.objectId,e.objectId,n),oe.showToast({text:`Успешно редактирахте ремонт от дата "${n.date}"`,type:"info"})}catch(s){const t=s instanceof Error?s.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:t,type:"error"})}finally{r(!1),oe.hideLoading(),i.reset(),H.redirect(`/cars/${e.car.objectId}/repairs/${e.objectId}`)}}null==(a=document.getElementById("logout-button"))||a.addEventListener("click",(async function(t){if(t.preventDefault(),await new Promise((t=>oe.showModal({message:"Сигурен ли си, че искаш да излезеш?",title:"Изход",onConfirm:()=>t(!0),onCancel:()=>t(!1)}))))try{oe.showLoading({type:"cube-zoom"}),await async function(){const t=await Kt(ue.LOGOUT,{});return await ye(),de(),t}(),H.redirect("/user/login")}catch(e){const t=e instanceof Error?e.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:t,type:"error"})}finally{oe.hideLoading()}})),H.base("/Car-Service"),H((function(t,e){de(),Object.assign(t,{root:xe,render:Se}),function(t){const{lastVisitedRoute:e,path:i}=t.state;if(e===i)return;t.init?t.state.lastVisitedRoute=void 0:t.state.lastVisitedRoute=window.location.pathname+window.location.search}(t),function(t){const{path:e}=t,i="interactive-widget=resizes-content";if(!ke){const t=document.createElement("meta");return t.name="viewport",t.content=i,void document.head.appendChild(t)}const n=ke.content.split(",").map((t=>t.trim()));Ee.includes(e)&&!n.includes(i)?n.push(i):!Ee.includes(e)&&n.includes(i)&&n.splice(n.indexOf(i),1);ke.content=n.join(", ")}(t),function(t){if(!t)return;if(!document.startViewTransition)return void t();document.startViewTransition(t)}((()=>{const i=me(),n=!i&&!Ee.includes(t.path),r=i&&Ee.includes(t.path);n?t.page.redirect(Ee[0]):r?window.history.back():e()}))})),H("/user/login",(function(t){t.render(Ct`
Вход
visibility_off
`)})),H("/user/register",(function(t){t.render(Ct`
Регистрация
visibility_off
`)})),H("/cars",(function(t){const{page:e="1",filter:i="",query:n=""}=Ft(t.querystring);t.render(ti((async()=>{const t=await async function(t,e,i){try{const{results:n,count:r}=await async function(t,e,i){const n=e&&i?JSON.stringify({[e]:{$regex:`(?i)${i}`}}):null,r="/cars",s=await ne.getCacheData(r);let a;if(n?({results:a}=await Gt(he.ALL_CARS(n))):(a=null!=s?s:(await Gt(he.ALL_CARS())).results,s||await ne.updateCacheData(r,a)),!t)return{results:a,count:a.length};const o=(t-1)*_e.itemsPerPage,c=t*_e.itemsPerPage;return{results:a.slice(o,c),count:a.length}}(t,e,i);return{cars:n,carsCount:r,pageNumber:t,searchCategory:e,searchQuery:i}}catch(n){const t=n instanceof Error?n.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:t,type:"error"}),H.redirect("/")}finally{oe.hideLoading()}}(Number(e)||1,i,n);if(t)return((t,e,i)=>{const{cars:n,carsCount:r,pageNumber:s,searchCategory:a,searchQuery:o}=t,c=Math.max(Math.ceil(r/_e.itemsPerPage),1);return Ct`
Всички автомобили${Ne(n,i)}
${Re(s,c,a,o)}
`})(t,ei,ii)})(),oe.showLoading()))})),H("/cars/create",(function(t){t.render(Ct`
Добави автомобил
Отказ
`)})),H("/cars/:carId/edit",(function(t){const{carId:e}=t.params;t.render(ti((async()=>{const t=await async function(t){try{return await be(t)}catch(e){const t=e instanceof Error?e.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:t,type:"error"}),H.redirect("/cars")}finally{oe.hideLoading()}}(e);var i,n;if(t)return n=ri,Ct`
n(t,i)} autocomplete="off">
Редактирай автомобил
Отказ
`})(),oe.showLoading()))})),H("/cars/:carId/repairs",(function(t){const{carId:e}=t.params,{page:i="1"}=Ft(t.querystring),{lastVisitedRoute:n="/cars"}=t.state;t.render(ti((async()=>{const t=await async function(t,e){try{const[{results:i,count:n},r]=await Promise.all([we(t,e),be(t)]);return{repairs:i,repairsCount:n,car:r,pageNumber:e}}catch(i){const t=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:t,type:"error"}),H.redirect("/cars")}finally{oe.hideLoading()}}(e,Number(i)||1);if(t)return(t=>{const{repairs:e,repairsCount:i,car:n,pageNumber:r,lastVisitedRoute:s}=t,a=Math.max(Math.ceil(i/_e.itemsPerPage),1);return Ct`
Всичките ремонти на ${n.customerName} - "${n.registration}"${Le(e)}
${Ue(r,a)}
`})({...t,lastVisitedRoute:n})})(),oe.showLoading()))})),H("/cars/:carId/repairs/create",(function(t){var e,i;t.render((e=t.params.carId,i=si,Ct`
i(t,e)} autocomplete="off">
Добави ремонт
Отказ
`))})),H("/cars/:carId/repairs/:repairId",(function(t){const{carId:e,repairId:i}=t.params;t.render(ti((async()=>{const t=await async function(t,e){try{return await Ce(t,e)}catch(i){const e=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:e,type:"error"}),H.redirect(`/cars/${t}/repairs`)}finally{oe.hideLoading()}}(e,i);var n,r;if(t)return r=ai,Ct`
Детайли по ремонта
Обща информация
Информация за ремонта
РедактирайНазад
`})(),oe.showLoading()))})),H("/cars/:carId/repairs/:repairId/edit",(function(t){const{carId:e,repairId:i}=t.params;t.render(ti((async()=>{const t=await async function(t,e){try{return await Ce(t,e)}catch(i){const e=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";oe.showToast({text:e,type:"error"}),H.redirect(`/cars/${t}/repairs`)}finally{oe.hideLoading()}}(e,i);var n,r;if(t)return r=oi,Ct`
r(t,n)} autocomplete="off">
Редактирай ремонт
Отказ
`})(),oe.showLoading()))})),H.start(); +var t,e,i,n,r,s,a,o=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},c=(t,e,i)=>(o(t,e,"read from private field"),i?i.call(t):e.get(t)),l=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},d=(t,e,i)=>(o(t,e,"access private method"),i);!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const i of t)if("childList"===i.type)for(const t of i.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerpolicy&&(e.referrerPolicy=t.referrerpolicy),"use-credentials"===t.crossorigin?e.credentials="include":"anonymous"===t.crossorigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();var u=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},h=x,p=y,f=function(t){return _(y(t))},m=_,g=A,v=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^()])+)\\))?|\\(((?:\\\\.|[^()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function y(t){for(var e,i=[],n=0,r=0,s="";null!=(e=v.exec(t));){var a=e[0],o=e[1],c=e.index;if(s+=t.slice(r,c),r=c+a.length,o)s+=o[1];else{s&&(i.push(s),s="");var l=e[2],d=e[3],u=e[4],h=e[5],p=e[6],f=e[7],m="+"===p||"*"===p,g="?"===p||"*"===p,y=l||"/",_=u||h||(f?".*":"[^"+y+"]+?");i.push({name:d||n++,prefix:l||"",delimiter:y,optional:g,repeat:m,pattern:$(_)})}}return r0){var n=this._window;N&&n.history.back(),this.len--}else t?setTimeout((function(){i.show(t,e)})):setTimeout((function(){i.show(i._getBase(),e)}))},T.prototype.redirect=function(t,e){var i=this;"string"==typeof t&&"string"==typeof e&&L.call(this,t,(function(t){setTimeout((function(){i.replace(e)}),0)})),"string"==typeof t&&void 0===e&&setTimeout((function(){i.replace(t)}),0)},T.prototype.replace=function(t,e,i,n){var r=new D(t,e,this),s=this.prevContext;return this.prevContext=r,this.current=r.path,r.init=i,r.save(),!1!==n&&this.dispatch(r,s),r},T.prototype.dispatch=function(t,e){var i=0,n=0,r=this;function s(){var e=r.callbacks[i++];if(t.path===r.current)return e?void e(t,s):O.call(r,t);t.handled=!1}e?function t(){var i=r.exits[n++];if(!i)return s();i(e,t)}():s()},T.prototype.exit=function(t,e){if("function"==typeof t)return this.exit("*",t);for(var i=new U(t,null,this),n=1;n-1)&&!(r?e.target.baseVal:e.target)&&(r||this.sameOrigin(e.href))){var a=r?e.href.baseVal:e.pathname+e.search+(e.hash||"");a="/"!==a[0]?"/"+a:a,I&&a.match(/^\/[a-zA-Z]:\//)&&(a=a.replace(/^\/[a-zA-Z]:\//,"/"));var o=a,c=this._getBase();0===a.indexOf(c)&&(a=a.substr(c.length)),this._hashbang&&(a=a.replace("#!","")),(!c||o!==a||R&&"file:"===this._window.location.protocol)&&(t.preventDefault(),this.show(o))}}}}},T.prototype._onpopstate=(k=!1,S?(E&&"complete"===document.readyState?k=!0:window.addEventListener("load",(function(){setTimeout((function(){k=!0}),0)})),function(t){if(k){var e=this;if(t.state){var i=t.state.path;e.replace(i,t.state)}else if(R){var n=e._window.location;e.show(n.pathname+n.search+n.hash,void 0,void 0,!1)}}}):function(){}),T.prototype._which=function(t){return null==(t=t||S&&this._window.event).which?t.button:t.which},T.prototype._toURL=function(t){var e=this._window;if("function"==typeof URL&&R)return new URL(t,e.location.toString());if(E){var i=e.document.createElement("a");return i.href=t,i}},T.prototype.sameOrigin=function(t){if(!t||!R)return!1;var e=this._toURL(t),i=this._window.location;return i.protocol===e.protocol&&i.hostname===e.hostname&&(i.port===e.port||""===i.port&&(80==e.port||443==e.port))},T.prototype._samePath=function(t){if(!R)return!1;var e=this._window.location;return t.pathname===e.pathname&&t.search===e.search},T.prototype._decodeURLEncodedURIComponent=function(t){return"string"!=typeof t?t:this._decodeURLComponents?decodeURIComponent(t.replace(/\+/g," ")):t},D.prototype.pushState=function(){var t=this.page,e=t._window,i=t._hashbang;t.len++,N&&e.history.pushState(this.state,this.title,i&&"/"!==this.path?"#!"+this.path:this.canonicalPath)},D.prototype.save=function(){var t=this.page;N&&t._window.history.replaceState(this.state,this.title,t._hashbang&&"/"!==this.path?"#!"+this.path:this.canonicalPath)},U.prototype.middleware=function(t){var e=this;return function(i,n){if(e.match(i.path,i.params))return i.routePath=e.path,t(i,n);n()}},U.prototype.match=function(t,e){var i=this.keys,n=t.indexOf("?"),r=~n?t.slice(0,n):t,s=this.regexp.exec(decodeURIComponent(r));if(!s)return!1;delete e[0];for(var a=1,o=s.length;at:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new J("string"==typeof t?t:t+"",void 0,z))(e)})(t):t;var G;const Y=window,K=Y.trustedTypes,Z=K?K.emptyScript:"",Q=Y.reactiveElementPolyfillSupport,F={toAttribute(t,e){switch(e){case Boolean:t=t?Z:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(n){i=null}}return i}},X=(t,e)=>e!==t&&(e==e||t==t),tt={attribute:!0,type:String,converter:F,reflect:!1,hasChanged:X},et="finalized";class it extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=tt){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||tt}static finalize(){if(this.hasOwnProperty(et))return!1;this[et]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(W(t))}else void 0!==t&&e.push(W(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{V?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),n=q.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=tt){var n;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const s=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:F).toAttribute(e,i.type);this._$El=t,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,r=n._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=n.getPropertyOptions(r),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:F;this._$El=r,this[r]=s.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||X)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(n){throw e=!1,this._$Ek(),n}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}var nt;it[et]=!0,it.elementProperties=new Map,it.elementStyles=[],it.shadowRootOptions={mode:"open"},null==Q||Q({ReactiveElement:it}),(null!==(G=Y.reactiveElementVersions)&&void 0!==G?G:Y.reactiveElementVersions=[]).push("1.6.3");const rt=window,st=rt.trustedTypes,at=st?st.createPolicy("lit-html",{createHTML:t=>t}):void 0,ot="$lit$",ct=`lit$${(Math.random()+"").slice(9)}$`,lt="?"+ct,dt=`<${lt}>`,ut=document,ht=()=>ut.createComment(""),pt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,ft=Array.isArray,mt="[ \t\n\f\r]",gt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,vt=/-->/g,yt=/>/g,_t=RegExp(`>|${mt}(?:([^\\s"'>=/]+)(${mt}*=${mt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),bt=/'/g,$t=/"/g,wt=/^(?:script|style|textarea|title)$/i,Ct=(St=1,(t,...e)=>({_$litType$:St,strings:t,values:e})),At=Symbol.for("lit-noChange"),xt=Symbol.for("lit-nothing"),kt=new WeakMap,Et=ut.createTreeWalker(ut,129,null,!1);var St;function Nt(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==at?at.createHTML(e):e}class It{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,s=0;const a=t.length-1,o=this.parts,[c,l]=((t,e)=>{const i=t.length-1,n=[];let r,s=2===e?"":"",a=gt;for(let o=0;o"===c[0]?(a=null!=r?r:gt,l=-1):void 0===c[1]?l=-2:(l=a.lastIndex-c[2].length,i=c[1],a=void 0===c[3]?_t:'"'===c[3]?$t:bt):a===$t||a===bt?a=_t:a===vt||a===yt?a=gt:(a=_t,r=void 0);const u=a===_t&&t[o+1].startsWith("/>")?" ":"";s+=a===gt?e+dt:l>=0?(n.push(i),e.slice(0,l)+ot+e.slice(l)+ct+u):e+ct+(-2===l?(n.push(void 0),o):u)}return[Nt(t,s+(t[i]||"")+(2===e?"":"")),n]})(t,e);if(this.el=It.createElement(c,i),Et.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=Et.nextNode())&&o.length0){n.textContent=st?st.emptyScript:"";for(let i=0;ift(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==xt&&pt(this._$AH)?this._$AA.nextSibling.data=t:this.$(ut.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:n}=t,r="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=It.createElement(Nt(n.h,n.h[0]),this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.v(i);else{const t=new Rt(r,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=kt.get(t.strings);return void 0===e&&kt.set(t.strings,e=new It(t)),e}T(t){ft(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const r of t)n===e.length?e.push(i=new Tt(this.k(ht()),this.k(ht()),this,this.options)):i=e[n],i._$AI(r),n++;n2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=xt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const r=this.strings;let s=!1;if(void 0===r)t=Pt(this,t,e,0),s=!pt(t)||t!==this._$AH&&t!==At,s&&(this._$AH=t);else{const n=t;let a,o;for(t=r[0],a=0;a{var n,r;const s=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let a=s._$litPart$;if(void 0===a){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=a=new Tt(e.insertBefore(ht(),t),t,void 0,null!=i?i:{})}return a._$AI(t),a};var Vt,zt;class Bt extends it{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=qt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return At}}Bt.finalized=!0,Bt._$litElement$=!0,null===(Vt=globalThis.litElementHydrateSupport)||void 0===Vt||Vt.call(globalThis,{LitElement:Bt});const Jt=globalThis.litElementPolyfillSupport;async function Wt(t,e){const i=new URL(t,"https://parseapi.back4app.com"),n=await fetch(i,e);if(!0!==n.ok){403===n.status&&await $e();const t=await n.json();throw new Error(`${t.error} Status: ${n.status}`,{cause:n})}return n.json()}function Gt(t,e){const i=new Headers({"X-Parse-Application-Id":"0oqWvkMylRfPgcnXNXtOUe8SWSqDZPiHktiLW9Np","X-Parse-REST-API-Key":"4YzVVeTWOVJyamwDNrNaafCLGzwC5qWnt7dw9aot"}),n=_e();return n&&i.append("X-Parse-Session-Token",n.token),e&&i.append("Content-Type","application/json"),{method:t,headers:i,...e?{body:JSON.stringify(e)}:{}}}null==Jt||Jt({LitElement:Bt}),(null!==(zt=globalThis.litElementVersions)&&void 0!==zt?zt:globalThis.litElementVersions=[]).push("3.3.3");const Yt=t=>Wt(t,Gt("GET")),Kt=(t,e)=>Wt(t,Gt("POST",e)),Zt=(t,e)=>Wt(t,Gt("PUT",e)),Qt=t=>Wt(t,Gt("DELETE"));function Ft(t){if(!t)return{};try{return decodeURIComponent(t).split("&").reduce(((t,e)=>{const[i,n]=e.split("=");return t[i.trim()]=(null==n?void 0:n.includes(","))?n.split(",").map(decodeURIComponent):decodeURIComponent(null==n?void 0:n.trim()),t}),{})}catch(e){return console.error(e),{}}}function Xt(t){if(!t)return"";try{return Object.entries(t).filter((([t,e])=>{const i="string"==typeof t&&t.trim().length>0,n="string"==typeof e?e.trim().length>0:Array.isArray(e)&&e.every((t=>"string"==typeof t&&t.trim().length>0));return i&&n})).map((([t,e])=>{const i=Array.isArray(e)?e.map((t=>encodeURIComponent(t.trim()))).join(","):encodeURIComponent(e.trim());return`${encodeURIComponent(t.trim())}=${i}`})).join("&")}catch(e){return console.error(e),""}}function te(t){const e=new FormData(t);return[Object.fromEntries(Array.from(e,(([t,e])=>[t,"string"==typeof e?e.trim():e]))),e=>Array.from(t.elements).forEach((t=>e?t.setAttribute("disabled","true"):t.removeAttribute("disabled")))]}function ee(){if(crypto&&crypto.randomUUID)return crypto.randomUUID();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const e=~~(16*Math.random());return("x"===t?e:3&e|8).toString(16)}))}function ie(t,e="bg-BG"){try{return Intl.DateTimeFormat(e).format(new Date(t))}catch{return t.toString()}}function ne(t){return`${t}T${function(t){const e=6e4*(new Date).getTimezoneOffset(),i=t&&Number(new Date(t).getTime()+e)||Date.now(),n=new Date(i-e).toISOString();return n.split("T")[1].slice(0,-5)}()}.000Z`}function re(t){const e=6e4*(new Date).getTimezoneOffset(),i=t&&Number(new Date(t).getTime()+e)||Date.now();return new Date(i-e).toISOString().split("T")[0]}function se(t,e={}){const{parent:i,prepend:n=!1,attributes:r,children:s,style:a,...o}=e,c=document.createElement(t);if(void 0!==r)for(const l in r)c.setAttribute(l,r[l]);if(Array.isArray(s))for(const l of s)c.append(l);if(void 0!==a&&Object.assign(c.style,a),Object.assign(c,o),void 0!==i){const t="string"==typeof i?document.querySelector(i):i;t&&t[n?"prepend":"append"](c)}return c}t=new WeakMap;const ae=new class{constructor(e){var i,n,r,s;l(this,t,void 0),r=e,o(i=this,n=t,"write to private field"),s?s.call(i,r):n.set(i,r),this.supported||console.warn("Cache API is not supported in this environment"),!sessionStorage.getItem(`${c(this,t)}Initialized`)&&this.supported&&(sessionStorage.setItem(`${c(this,t)}Initialized`,"true"),this.deleteCache())}get supported(){return!!window.caches}get databaseName(){return c(this,t)}async getCacheData(e){if(!this.supported)return Promise.resolve(null);const i=await caches.open(c(this,t)),n=await i.match(new Request(e));return n&&n.ok?await n.json():Promise.resolve(null)}async updateCacheData(e,i){if(!this.supported)return Promise.resolve();return(await caches.open(c(this,t))).put(new Request(e),new Response(JSON.stringify(i)))}async clearCacheData(e){if(!this.supported)return Promise.resolve(!1);return(await caches.open(c(this,t))).delete(new Request(e))}async deleteCache(){return this.supported?caches.delete(c(this,t)):Promise.resolve(!1)}}("CarServiceCacheDatabase"),oe="rgba(0 0 0 / 0.5)",ce=3,le={default:{icon:"",color:"#555555",backgroundColor:"#f2f2f2"},info:{icon:"info",color:"#217ca3",backgroundColor:"#cfe8f3"},success:{icon:"check_circle",color:"#45874a",backgroundColor:"#e5f6e4"},warning:{icon:"error",color:"#b0822f",backgroundColor:"#fef5dc"},error:{icon:"cancel",color:"#b23c3a",backgroundColor:"#f2dede"}};e=new WeakMap,i=new WeakSet,n=function(t,e){switch(t){case"cube-flip":return se("div",{className:"notice-loading-cube-flip",style:{backgroundColor:e}});case"dots-zoom":return se("div",{className:"notice-loading-dots-zoom",children:[se("div",{className:"notice-loading-dots-zoom1",style:{backgroundColor:e}}),se("div",{className:"notice-loading-dots-zoom2",style:{backgroundColor:e}})]});case"line":return se("div",{className:"notice-loading-line",children:[se("div",{className:"notice-loading-line-rect1",style:{backgroundColor:e}}),se("div",{className:"notice-loading-line-rect2",style:{backgroundColor:e}}),se("div",{className:"notice-loading-line-rect3",style:{backgroundColor:e}}),se("div",{className:"notice-loading-line-rect4",style:{backgroundColor:e}}),se("div",{className:"notice-loading-line-rect5",style:{backgroundColor:e}})]});case"dots-spin":return se("div",{className:"notice-loading-spin-dots",children:[se("div",{className:"notice-loading-spin-dot1",style:{backgroundColor:e}}),se("div",{className:"notice-loading-spin-dot2",style:{backgroundColor:e}})]});case"dots":return se("div",{className:"notice-loading-dots",children:[se("div",{className:"notice-loading-dot1",style:{backgroundColor:e}}),se("div",{className:"notice-loading-dot2",style:{backgroundColor:e}}),se("div",{style:{backgroundColor:e}})]});case"cube-zoom":return se("div",{className:"notice-loading-cube-zoom",children:[se("div",{className:"notice-loading-cube-zoom-1",style:{backgroundColor:e}}),se("div",{className:"notice-loading-cube-zoom-2",style:{backgroundColor:e}}),se("div",{className:"notice-loading-cube-zoom-3",style:{backgroundColor:e}}),se("div",{className:"notice-loading-cube-zoom-4",style:{backgroundColor:e}}),se("div",{className:"notice-loading-cube-zoom-5",style:{backgroundColor:e}}),se("div",{className:"notice-loading-cube-zoom-6",style:{backgroundColor:e}}),se("div",{className:"notice-loading-cube-zoom-7",style:{backgroundColor:e}}),se("div",{className:"notice-loading-cube-zoom-8",style:{backgroundColor:e}}),se("div",{className:"notice-loading-cube-zoom-9",style:{backgroundColor:e}})]});default:return null}},r=new WeakSet,s=function(t,e,i,n){const r=se("div",{className:"notice-modal-buttons"});switch(t){case"yes-no":return se("button",{parent:r,attributes:{"data-button-type":"info"},textContent:"Да",onclick:t=>{e.remove(),"function"==typeof i&&i(t)}}),se("button",{parent:r,attributes:{"data-button-type":"danger"},textContent:"Не",onclick:t=>{e.remove(),"function"==typeof n&&n(t)}}),r;case"ok":return se("button",{parent:r,textContent:"Добре",onclick:t=>{e.remove(),"function"==typeof i&&i(t)}}),r;case"ok-cancel":return se("button",{parent:r,textContent:"Добре",onclick:t=>{e.remove(),"function"==typeof i&&i(t)}}),se("button",{parent:r,attributes:{"data-button-type":"danger"},textContent:"Отказ",onclick:t=>{e.remove(),"function"==typeof n&&n(t)}}),r;case"retry-cancel":return se("button",{parent:r,attributes:{"data-button-type":"info"},textContent:"Нов опит",onclick:t=>{e.remove(),"function"==typeof i&&i(t)}}),se("button",{parent:r,attributes:{"data-button-type":"danger"},textContent:"Отказ",onclick:t=>{e.remove(),"function"==typeof n&&n(t)}}),r;default:return null}};const de=new class{constructor(){l(this,i),l(this,r),l(this,e,document.body)}showLoading(t={}){const{type:r="dots",color:s="white",autoClose:a,title:o,titleColor:l,maskColor:u=oe}=t,h=se("div",{parent:c(this,e),className:"notice-loading notice-flex-center notice-fixed-all-page",id:"notice-loading"});se("div",{parent:h,className:"notice-mask notice-fixed-all-page",style:{backgroundColor:u}});const p=d(this,i,n).call(this,r,s)||d(this,i,n).call(this,"dots",s),f=se("div",{parent:h,className:"notice-flex-center notice-loading-main",children:[p]});o&&se("p",{parent:f,style:{color:l},textContent:o}),a&&setTimeout((()=>h.remove()),1e3*a)}hideLoading(){var t;null==(t=document.getElementById("notice-loading"))||t.remove()}showToast(t){const{text:i,type:n="default",autoClose:r=ce,showClose:s=!0}=t;if(!i)return;const{icon:a,color:o,backgroundColor:l}=le[n]||le.default,d=document.getElementById("notice-toast")||se("div",{parent:c(this,e),className:"notice-toast",id:"notice-toast"}),u=se("div",{parent:d,className:"notice-toast-main notice-toast-main-active",id:`notice-toast-${ee()}`,style:{backgroundColor:l}}),h=se("div",{parent:u,className:"notice-toast-container",children:[se("p",{className:"notice-toast-text",style:{color:o},textContent:i})]});a&&se("i",{parent:h,prepend:!0,className:"material-icons notice-toast-icon",style:{color:o},textContent:a}),(s||!r)&&se("i",{parent:h,className:"material-icons notice-close-icon",textContent:"close",onclick:()=>f()});const p=!!Number(getComputedStyle(d).getPropertyValue("--_should-auto-close"));if(r||p){setTimeout((()=>f()),1e3*(r||ce))}function f(){if(!u)return;const t=parseFloat(window.getComputedStyle(u).getPropertyValue("transition-duration"));u.classList.remove("notice-toast-main-active"),setTimeout((()=>{u&&u.remove(),d.children.length||d.remove()}),1e3*t)}}showModal(t={}){const{type:i="yes-no",color:n,backgroundColor:a,title:o,titleColor:l,message:u,messageColor:h,maskColor:p=oe,onConfirm:f,onCancel:m}=t,g=se("div",{parent:c(this,e),className:"notice-modal notice-flex-center notice-fixed-all-page",id:"notice-modal"});se("div",{parent:g,className:"notice-mask notice-fixed-all-page",style:{backgroundColor:p}});const v=se("div",{parent:g,className:"notice-flex-center notice-modal-main",style:{backgroundColor:a},children:[d(this,r,s).call(this,i,g,f,m)||d(this,r,s).call(this,"yes-no",g,f,m)]});u&&se("p",{parent:v,prepend:!0,style:{color:h||n},textContent:u}),o&&se("h2",{parent:v,prepend:!0,style:{color:l||n},textContent:o})}},ue=document.querySelectorAll(".user-navigation"),he=document.querySelectorAll(".guest-navigation");function pe(){ye()?(ue.forEach((t=>t.removeAttribute("hidden"))),he.forEach((t=>t.setAttribute("hidden","")))):(ue.forEach((t=>t.setAttribute("hidden",""))),he.forEach((t=>t.removeAttribute("hidden"))))}const fe={LOGIN:"/login",REGISTER:"/users",LOGOUT:"/logout"},me={CREATE_CAR:"/classes/Car",ALL_CARS:(t="")=>`/classes/Car?${Xt({order:"-createdAt",where:t})}`,CAR_BY_ID:t=>`/classes/Car/${t}`},ge={CREATE_REPAIR:"/classes/Repair",ALL_REPAIRS:t=>`/classes/Repair?${Xt({order:"-date",where:t})}`,REPAIR_BY_ID:t=>`/classes/Repair/${t}`},ve="car-service-current-user-data";function ye(){return!!localStorage.getItem(ve)}function _e(){var t;return JSON.parse(null!=(t=localStorage.getItem(ve))?t:"null")}async function be(t){await ae.deleteCache().catch(console.error),localStorage.setItem(ve,JSON.stringify(t))}async function $e(){await ae.deleteCache().catch(console.error),localStorage.removeItem(ve)}const we={itemsPerPage:10,relativePageLinks:3};async function Ce(t){const e="/cars",i=await ae.getCacheData(e),n=i&&i.find((e=>e.objectId===t));if(n)return n;const r=await Yt(me.CAR_BY_ID(t));if(i){const t=[r,...i].sort(((t,e)=>+new Date(e.createdAt)-+new Date(t.createdAt)));await ae.updateCacheData(e,JSON.parse(JSON.stringify(t)))}return r}async function Ae(t){var e;const i=await Qt(me.CAR_BY_ID(t)),n="/cars",r=(null!=(e=await ae.getCacheData(n))?e:[]).filter((e=>e.objectId!==t));return await(r.length>0?ae.updateCacheData(n,JSON.parse(JSON.stringify(r))):ae.clearCacheData(n)),i}const xe=(t,e)=>{const i=Number(new Date(t.date))||Number(new Date(t.createdAt));return(Number(new Date(e.date))||Number(new Date(e.createdAt)))-i};async function ke(t,e){const i=JSON.stringify({car:{__type:"Pointer",className:"Car",objectId:t}}),n=`/cars/${t}/repairs`,r=await ae.getCacheData(n);let s;if(r?s=r:(({results:s}=await Yt(ge.ALL_REPAIRS(i))),await ae.updateCacheData(n,JSON.parse(JSON.stringify(s)))),!e)return{results:s,count:s.length};const a=10*(e-1),o=10*e;return{results:s.slice(a,o),count:s.length}}async function Ee(t,e){const i=`/cars/${t}/repairs`,n=await ae.getCacheData(i),r=n&&n.find((t=>t.objectId===e));if(r)return r;const s=await Yt(ge.REPAIR_BY_ID(e));if(n){const t=[s,...n].sort(xe);await ae.updateCacheData(i,JSON.parse(JSON.stringify(t)))}return s}async function Se(t){const{results:e}=await ke(t),i=e.map((({objectId:t})=>Qt(ge.REPAIR_BY_ID(t)))),n=`/cars/${t}/repairs`;return await ae.clearCacheData(n),Promise.all(i)}const Ne=document.getElementById("site-content")||document.body,Ie=document.querySelector("meta[name=viewport]"),Pe=["/user/login","/user/register"];function Re(t,e={}){const{container:i,...n}=e,r=i&&(i instanceof HTMLElement||i instanceof DocumentFragment)?i:"string"==typeof i?document.querySelector(i):null;return qt(t,r||Ne,n)}const Te=(t,e)=>t.length>0?Le(t,e):Ct`

Нямаш добавени автомобили!

`,Le=(t,e)=>Ct`${t.map((t=>Oe(t,e)))}
РамаPегистрационен №Марка / МоделДвигателИме на клиентаРемонтиРедакцияИзтриване
`,Oe=(t,e)=>Ct`${t.vin}${t.registration}${t.make}${t.engine}${t.customerName}
`,De=(t,e,i,n)=>{const r=(r,s)=>{const a=t===s||s<1||s>e,o="number"==typeof r&&t===s,c=a?"#":(t=>{const e=Xt({filter:i,query:n,page:t.toString()});return`${window.location.pathname}?${e}`})(s);return Ct`${r}`};const s=r(Ct`keyboard_double_arrow_left`,1),a=r(Ct`chevron_left`,t-1),o=function(){const i=Math.floor(we.relativePageLinks/2),n=Math.min(Math.max(1,t-i),Math.max(1,e-we.relativePageLinks+1)),r=Math.max(Math.min(e,t+i),Math.min(e,we.relativePageLinks)),s=Math.min(r-n+1,e);return Array.from({length:s},((t,e)=>n+e))}().map((t=>r(t,t))),c=r(Ct`chevron_right`,t+1),l=r(Ct`keyboard_double_arrow_right`,e);return Ct`${s}${a}${o}${c}${l}`},Ue=t=>t.length>0?je(t):Ct`

Нямаш завършени ремонти!

`,je=t=>Ct`${t.map(He)}
Извършен наКилометриДетайли по ремонта
`,He=t=>Ct`${ie(t.date)}${t.km}`,Me=(t,e)=>{const i=(i,n)=>{const r=t===n||n<1||n>e,s="number"==typeof i&&t===n,a=r?"#":(t=>{const e=Xt({page:t.toString()});return`${window.location.pathname}?${e}`})(n);return Ct`${i}`};const n=i(Ct`keyboard_double_arrow_left`,1),r=i(Ct`chevron_left`,t-1),s=function(){const i=Math.floor(we.relativePageLinks/2),n=Math.min(Math.max(1,t-i),Math.max(1,e-we.relativePageLinks+1)),r=Math.max(Math.min(e,t+i),Math.min(e,we.relativePageLinks)),s=Math.min(r-n+1,e);return Array.from({length:s},((t,e)=>n+e))}().map((t=>i(t,t))),a=i(Ct`chevron_right`,t+1),o=i(Ct`keyboard_double_arrow_right`,e);return Ct`${n}${r}${s}${a}${o}`};async function qe(t){t.preventDefault();const e=t.target,[i,n]=te(e);try{n(!0),de.showLoading({type:"cube-zoom"}),await async function(t){const e=await Kt(fe.LOGIN,t);return await be({username:t.username,id:e.objectId,token:e.sessionToken}),pe(),e}(i),H.redirect("/cars")}catch(r){const t=r instanceof Error?r.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:t,type:"error"})}finally{n(!1),de.hideLoading(),e.reset()}}function Ve(t){t.preventDefault();const e=t.target,i=e.previousElementSibling,n="password"===i.type?"text":"password";i.setAttribute("type",n),e.textContent="password"===n?"visibility_off":"visibility"}async function ze(t){t.preventDefault();const e=t.target,[{username:i,password:n,repass:r},s]=te(e);if(n===r)try{s(!0),de.showLoading({type:"cube-zoom"}),await async function(t){const e=await Kt(fe.REGISTER,t);return await be({username:t.username,id:e.objectId,token:e.sessionToken}),pe(),e}({username:i,password:n}),H.redirect("/cars")}catch(a){const t=a instanceof Error?a.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:t,type:"error"})}finally{s(!1),de.hideLoading(),e.reset()}else de.showToast({text:"Паролите не съвпадат!",type:"warning"})}function Be(t){var e,i,n;t.preventDefault();const r=t.target,s=r.previousElementSibling,a=null==(n=null==(i=null==(e=r.parentElement)?void 0:e.parentElement)?void 0:i.nextElementSibling)?void 0:n.lastElementChild,o="password"===s.type?"text":"password";s.setAttribute("type",o),a.setAttribute("type",o),r.textContent="password"===o?"visibility_off":"visibility"}const Je=2;class We{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const Ge=(t,e)=>{var i,n;const r=t._$AN;if(void 0===r)return!1;for(const s of r)null===(n=(i=s)._$AO)||void 0===n||n.call(i,e,!1),Ge(s,e);return!0},Ye=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===(null==i?void 0:i.size))},Ke=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),Fe(e)}};function Ze(t){void 0!==this._$AN?(Ye(this),this._$AM=t,Ke(this)):this._$AM=t}function Qe(t,e=!1,i=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(n))for(let s=i;s{var e,i,n,r;t.type==Je&&(null!==(e=(n=t)._$AP)&&void 0!==e||(n._$AP=Qe),null!==(i=(r=t)._$AQ)&&void 0!==i||(r._$AQ=Ze))};class Xe extends We{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),Ke(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,n;t!==this.isConnected&&(this.isConnected=t,t?null===(i=this.reconnected)||void 0===i||i.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),e&&(Ge(this,t),Ye(this))}setValue(t){if(void 0===this._$Ct.strings)this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class ti{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}}class ei{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){var t;null!==(t=this.Y)&&void 0!==t||(this.Y=new Promise((t=>this.Z=t)))}resume(){var t;null===(t=this.Z)||void 0===t||t.call(this),this.Y=this.Z=void 0}}const ii=t=>{return!(e=t,null===e||"object"!=typeof e&&"function"!=typeof e||"function"!=typeof t.then);var e},ni=1073741823;const ri=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends Xe{constructor(){super(...arguments),this._$C_t=ni,this._$Cwt=[],this._$Cq=new ti(this),this._$CK=new ei}render(...t){var e;return null!==(e=t.find((t=>!ii(t))))&&void 0!==e?e:At}update(t,e){const i=this._$Cwt;let n=i.length;this._$Cwt=e;const r=this._$Cq,s=this._$CK;this.isConnected||this.disconnected();for(let a=0;athis._$C_t);a++){const t=e[a];if(!ii(t))return this._$C_t=a,t;a{for(;s.get();)await s.get();const i=r.deref();if(void 0!==i){const n=i._$Cwt.indexOf(t);n>-1&&nde.showModal({message:`Сигурен ли си, че искаш да изтриеш автомобила на ${e.customerName} - "${e.registration}"`,onConfirm:()=>t(!0),onCancel:()=>t(!1)}))))try{de.showLoading(),await Promise.all([Se(e.objectId),Ae(e.objectId)]),de.showToast({text:`Успешно изтрихте автомобила на ${e.customerName} - "${e.registration}"`,type:"info"})}catch(i){const t=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:t,type:"error"})}finally{de.hideLoading(),H.redirect("/cars")}}async function oi(t){t.preventDefault();const e=t.target,[i,n]=te(e);try{n(!0),de.showLoading(),await async function(t){var e;const{id:i}=_e(),n={owner:Object.freeze({__type:"Pointer",className:"_User",objectId:i})},r=Object.assign({},t,n),s=await Kt(me.CREATE_CAR,r),a="/cars",o=null!=(e=await ae.getCacheData(a))?e:[],c={...r,...s},l=[c,...o].sort(((t,e)=>+new Date(e.createdAt)-+new Date(t.createdAt)));return await ae.updateCacheData(a,JSON.parse(JSON.stringify(l))),c}(i),de.showToast({text:`Успешно създадохте автомобил на ${i.customerName} - "${i.registration}"`,type:"success"})}catch(r){const t=r instanceof Error?r.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:t,type:"error"})}finally{n(!1),de.hideLoading(),e.reset(),H.redirect("/cars")}}async function ci(t,e){t.preventDefault();const i=t.target,[n,r]=te(i);try{r(!0),de.showLoading(),await async function(t,e){var i;const n=await Zt(me.CAR_BY_ID(t),e),r="/cars",s=null!=(i=await ae.getCacheData(r))?i:[],a=s.findIndex((e=>e.objectId===t)),o={...-1!==a?s.splice(a,1)[0]:{},...e,...n},c=[o,...s].sort(((t,e)=>+new Date(e.createdAt)-+new Date(t.createdAt)));return await ae.updateCacheData(r,JSON.parse(JSON.stringify(c))),o}(e.objectId,n),de.showToast({text:`Успешно редактирахте ремонт на ${n.customerName} - "${n.registration}"`,type:"info"})}catch(s){const t=s instanceof Error?s.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:t,type:"error"})}finally{r(!1),de.hideLoading(),i.reset(),H.redirect("/cars")}}async function li(t,e){t.preventDefault();const i=t.target,[n,r]=te(i);n.date=ne(n.date);try{r(!0),de.showLoading(),await async function(t,e){var i;const{id:n}=_e(),r={owner:Object.freeze({__type:"Pointer",className:"_User",objectId:n})},s={car:Object.freeze({__type:"Pointer",className:"Car",objectId:t})},a=Object.assign({},e,r,s),o=await Kt(ge.CREATE_REPAIR,a),c=`/cars/${t}/repairs`,l=null!=(i=await ae.getCacheData(c))?i:[],d={...a,...o},u=[d,...l].sort(xe);return await ae.updateCacheData(c,JSON.parse(JSON.stringify(u))),d}(e,n),de.showToast({text:"Успешно добавихте ремонт",type:"success"})}catch(s){const t=s instanceof Error?s.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:t,type:"error"})}finally{r(!1),de.hideLoading(),i.reset(),H.redirect(`/cars/${e}/repairs`)}}async function di(t,e){t.preventDefault();if(await new Promise((t=>de.showModal({message:`Сигурен ли си, че искаш да изтриеш ремонт от дата "${e.date}"`,onConfirm:()=>t(!0),onCancel:()=>t(!1)}))))try{de.showLoading(),await async function(t,e){var i;const n=await Qt(ge.REPAIR_BY_ID(e)),r=`/cars/${t}/repairs`,s=(null!=(i=await ae.getCacheData(r))?i:[]).filter((t=>t.objectId!==e));return await(s.length>0?ae.updateCacheData(r,JSON.parse(JSON.stringify(s))):ae.clearCacheData(r)),n}(e.car.objectId,e.objectId),de.showToast({text:"Успешно изтрихте ремонта",type:"info"})}catch(i){const t=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:t,type:"error"})}finally{de.hideLoading(),H.redirect(`/cars/${e.car.objectId}/repairs`)}}async function ui(t,e){t.preventDefault();const i=t.target,[n,r]=te(i);n.date=ne(n.date);try{r(!0),de.showLoading(),await async function(t,e,i){var n;const r=await Zt(ge.REPAIR_BY_ID(e),i),s=`/cars/${t}/repairs`,a=null!=(n=await ae.getCacheData(s))?n:[],o=a.findIndex((t=>t.objectId===e)),c={...-1!==o?a.splice(o,1)[0]:{},...i,...r},l=[c,...a].sort(xe);return await ae.updateCacheData(s,JSON.parse(JSON.stringify(l))),c}(e.car.objectId,e.objectId,n),de.showToast({text:`Успешно редактирахте ремонт от дата "${n.date}"`,type:"info"})}catch(s){const t=s instanceof Error?s.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:t,type:"error"})}finally{r(!1),de.hideLoading(),i.reset(),H.redirect(`/cars/${e.car.objectId}/repairs/${e.objectId}`)}}null==(a=document.getElementById("logout-button"))||a.addEventListener("click",(async function(t){if(t.preventDefault(),await new Promise((t=>de.showModal({message:"Сигурен ли си, че искаш да излезеш?",title:"Изход",onConfirm:()=>t(!0),onCancel:()=>t(!1)}))))try{de.showLoading({type:"cube-zoom"}),await async function(){const t=await Kt(fe.LOGOUT,{});return await $e(),pe(),t}(),H.redirect("/user/login")}catch(e){const t=e instanceof Error?e.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:t,type:"error"})}finally{de.hideLoading()}})),H.base("/Car-Service"),H((function(t,e){pe(),Object.assign(t,{root:Ne,render:Re}),console.warn(t.init),t.querystring&&(t.state.lastQuerystring=t.querystring),console.warn(t.state.lastQuerystring),function(t){const{path:e}=t,i="interactive-widget=resizes-content";if(!Ie){const t=document.createElement("meta");return t.name="viewport",t.content=i,void document.head.appendChild(t)}const n=Ie.content.split(",").map((t=>t.trim()));Pe.includes(e)&&!n.includes(i)?n.push(i):!Pe.includes(e)&&n.includes(i)&&n.splice(n.indexOf(i),1);Ie.content=n.join(", ")}(t),function(t){if(!t)return;if(!document.startViewTransition)return void t();document.startViewTransition(t)}((()=>{const i=ye(),n=!i&&!Pe.includes(t.path),r=i&&Pe.includes(t.path);n?t.page.redirect(Pe[0]):r?window.history.back():e()}))})),H("/user/login",(function(t){t.render(Ct`
Вход
visibility_off
`)})),H("/user/register",(function(t){t.render(Ct`
Регистрация
visibility_off
`)})),H("/cars",(function(t){const{page:e="1",filter:i="",query:n=""}=Ft(t.querystring);t.render(ri((async()=>{const t=await async function(t,e,i){try{const{results:n,count:r}=await async function(t,e,i){const n=e&&i?JSON.stringify({[e]:{$regex:`(?i)${i}`}}):null,r="/cars",s=await ae.getCacheData(r);let a;if(n?({results:a}=await Yt(me.ALL_CARS(n))):(a=null!=s?s:(await Yt(me.ALL_CARS())).results,s||await ae.updateCacheData(r,a)),!t)return{results:a,count:a.length};const o=(t-1)*we.itemsPerPage,c=t*we.itemsPerPage;return{results:a.slice(o,c),count:a.length}}(t,e,i);return{cars:n,carsCount:r,pageNumber:t,searchCategory:e,searchQuery:i}}catch(n){const t=n instanceof Error?n.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:t,type:"error"}),H.redirect("/")}finally{de.hideLoading()}}(Number(e)||1,i,n);if(t)return((t,e,i)=>{const{cars:n,carsCount:r,pageNumber:s,searchCategory:a,searchQuery:o}=t,c=Math.max(Math.ceil(r/we.itemsPerPage),1);return Ct`
Всички автомобили${Te(n,i)}
${De(s,c,a,o)}
`})(t,si,ai)})(),de.showLoading()))})),H("/cars/create",(function(t){t.render(Ct`
Добави автомобил
Отказ
`)})),H("/cars/:carId/edit",(function(t){const{carId:e}=t.params;t.render(ri((async()=>{const t=await async function(t){try{return await Ce(t)}catch(e){const t=e instanceof Error?e.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:t,type:"error"}),H.redirect("/cars")}finally{de.hideLoading()}}(e);var i,n;if(t)return n=ci,Ct`
n(t,i)} autocomplete="off">
Редактирай автомобил
Отказ
`})(),de.showLoading()))})),H("/cars/:carId/repairs",(function(t){const{carId:e}=t.params,{page:i="1"}=Ft(t.querystring),{lastVisitedRoute:n="/cars"}=t.state;t.render(ri((async()=>{const t=await async function(t,e){try{const[{results:i,count:n},r]=await Promise.all([ke(t,e),Ce(t)]);return{repairs:i,repairsCount:n,car:r,pageNumber:e}}catch(i){const t=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:t,type:"error"}),H.redirect("/cars")}finally{de.hideLoading()}}(e,Number(i)||1);if(t)return(t=>{const{repairs:e,repairsCount:i,car:n,pageNumber:r,lastVisitedRoute:s}=t,a=Math.max(Math.ceil(i/we.itemsPerPage),1);return Ct`
Всичките ремонти на ${n.customerName} - "${n.registration}"${Ue(e)}
${Me(r,a)}
`})({...t,lastVisitedRoute:n})})(),de.showLoading()))})),H("/cars/:carId/repairs/create",(function(t){var e,i;t.render((e=t.params.carId,i=li,Ct`
i(t,e)} autocomplete="off">
Добави ремонт
Отказ
`))})),H("/cars/:carId/repairs/:repairId",(function(t){const{carId:e,repairId:i}=t.params;t.render(ri((async()=>{const t=await async function(t,e){try{return await Ee(t,e)}catch(i){const e=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:e,type:"error"}),H.redirect(`/cars/${t}/repairs`)}finally{de.hideLoading()}}(e,i);var n,r;if(t)return r=di,Ct`
Детайли по ремонта
Обща информация
Информация за ремонта
РедактирайНазад
`})(),de.showLoading()))})),H("/cars/:carId/repairs/:repairId/edit",(function(t){const{carId:e,repairId:i}=t.params;t.render(ri((async()=>{const t=await async function(t,e){try{return await Ee(t,e)}catch(i){const e=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";de.showToast({text:e,type:"error"}),H.redirect(`/cars/${t}/repairs`)}finally{de.hideLoading()}}(e,i);var n,r;if(t)return r=ui,Ct`
r(t,n)} autocomplete="off">
Редактирай ремонт
Отказ
`})(),de.showLoading()))})),H.start();