diff --git a/404.html b/404.html index e2daf6d..eeab01f 100644 --- a/404.html +++ b/404.html @@ -1 +1 @@ -Car Service
\ No newline at end of file +Car Service
\ No newline at end of file diff --git a/index.html b/index.html index e2daf6d..eeab01f 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -Car Service
\ No newline at end of file +Car Service
\ No newline at end of file diff --git a/index.js b/index.js index e1f0b89..af3b97c 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)}))},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=(E=!1,k?(S&&"complete"===document.readyState?E=!0:window.addEventListener("load",(function(){setTimeout((function(){E=!0}),0)})),function(t){if(E){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||k&&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(S){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 W;const G=window,Y=G.trustedTypes,Z=Y?Y.emptyScript:"",F=G.reactiveElementPolyfillSupport,X={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:X,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(K(t))}else void 0!==t&&e.push(K(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:X).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:X;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==F||F({ReactiveElement:it}),(null!==(W=G.reactiveElementVersions)&&void 0!==W?W: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=(kt=1,(t,...e)=>({_$litType$:kt,strings:t,values:e})),At=Symbol.for("lit-noChange"),xt=Symbol.for("lit-nothing"),Et=new WeakMap,St=ut.createTreeWalker(ut,129,null,!1);var kt;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),St.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=St.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=Et.get(t.strings);return void 0===e&&Et.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 Kt(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 Wt(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 Gt=t=>Kt(t,Wt("GET")),Yt=(t,e)=>Kt(t,Wt("POST",e)),Zt=(t,e)=>Kt(t,Wt("PUT",e)),Ft=t=>Kt(t,Wt("DELETE"));function Xt(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="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}const ae={storageKeys:{userService:"car-service-current-user-data",memoization:"car-service-cache-initialized"},itemsPerPage:10,relativePageLinks:3};t=new WeakMap;const oe=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(ae.storageKeys.memoization)&&this.supported&&(sessionStorage.setItem(ae.storageKeys.memoization,"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"),ce="rgba(0 0 0 / 0.5)",le=3,de={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 ue=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=ce}=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=le,showClose:s=!0}=t;if(!i)return;const{icon:a,color:o,backgroundColor:l}=de[n]||de.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||le))}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=ce,onConfirm:f,onCancel:m}=t,v=se("div",{parent:c(this,e),className:"notice-modal notice-flex-center notice-fixed-all-page",id:"notice-modal"});se("div",{parent:v,className:"notice-mask notice-fixed-all-page",style:{backgroundColor:p}});const g=se("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&&se("p",{parent:g,prepend:!0,style:{color:h||n},textContent:u}),o&&se("h2",{parent:g,prepend:!0,style:{color:l||n},textContent:o})}},he=document.querySelectorAll(".user-navigation"),pe=document.querySelectorAll(".guest-navigation");function fe(){ye()?(he.forEach((t=>t.removeAttribute("hidden"))),pe.forEach((t=>t.setAttribute("hidden","")))):(he.forEach((t=>t.setAttribute("hidden",""))),pe.forEach((t=>t.removeAttribute("hidden"))))}const me={LOGIN:"/login",REGISTER:"/users",LOGOUT:"/logout"},ve={CREATE_CAR:"/classes/Car",ALL_CARS:(t="")=>`/classes/Car?${Qt({order:"-createdAt",where:t})}`,CAR_BY_ID:t=>`/classes/Car/${t}`},ge={CREATE_REPAIR:"/classes/Repair",ALL_REPAIRS:t=>`/classes/Repair?${Qt({order:"-date",where:t})}`,REPAIR_BY_ID:t=>`/classes/Repair/${t}`};function ye(){return!!sessionStorage.getItem(ae.storageKeys.userService)}function _e(){var t;return JSON.parse(null!=(t=sessionStorage.getItem(ae.storageKeys.userService))?t:"null")}async function be(t){await oe.deleteCache().catch(console.error),sessionStorage.setItem(ae.storageKeys.userService,JSON.stringify(t))}async function $e(){await oe.deleteCache().catch(console.error),sessionStorage.removeItem(ae.storageKeys.userService)}async function we(t){const e="/cars",i=await oe.getCacheData(e),n=i&&i.find((e=>e.objectId===t));if(n)return n;const r=await Gt(ve.CAR_BY_ID(t));if(i){const t=[r,...i].sort(((t,e)=>+new Date(e.createdAt)-+new Date(t.createdAt)));await oe.updateCacheData(e,JSON.parse(JSON.stringify(t)))}return r}async function Ce(t){var e;const i=await Ft(ve.CAR_BY_ID(t)),n="/cars",r=(null!=(e=await oe.getCacheData(n))?e:[]).filter((e=>e.objectId!==t));return await(r.length>0?oe.updateCacheData(n,JSON.parse(JSON.stringify(r))):oe.clearCacheData(n)),i}const Ae=(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 xe(t,e){const i=JSON.stringify({car:{__type:"Pointer",className:"Car",objectId:t}}),n=`/cars/${t}/repairs`,r=await oe.getCacheData(n);let s;if(r?s=r:(({results:s}=await Gt(ge.ALL_REPAIRS(i))),await oe.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 oe.getCacheData(i),r=n&&n.find((t=>t.objectId===e));if(r)return r;const s=await Gt(ge.REPAIR_BY_ID(e));if(n){const t=[s,...n].sort(Ae);await oe.updateCacheData(i,JSON.parse(JSON.stringify(t)))}return s}async function Se(t){const{results:e}=await xe(t),i=e.map((({objectId:t})=>Ft(ge.REPAIR_BY_ID(t)))),n=`/cars/${t}/repairs`;return await oe.clearCacheData(n),Promise.all(i)}const ke=document.getElementById("site-content")||document.body,Ne=document.querySelector("meta[name=viewport]"),Ie=["/user/login","/user/register"],Pe=["/cars","/repairs"];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||ke,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=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(ae.relativePageLinks/2),n=Math.min(Math.max(1,t-i),Math.max(1,e-ae.relativePageLinks+1)),r=Math.max(Math.min(e,t+i),Math.min(e,ae.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(Me)}
Извършен наКилометриДетайли по ремонта
`,Me=t=>Ct`${ie(t.date)}${t.km}`,He=(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(ae.relativePageLinks/2),n=Math.min(Math.max(1,t-i),Math.max(1,e-ae.relativePageLinks+1)),r=Math.max(Math.min(e,t+i),Math.min(e,ae.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),ue.showLoading({type:"cube-zoom"}),await async function(t){const e=await Yt(me.LOGIN,t);return await be({username:t.username,id:e.objectId,token:e.sessionToken}),fe(),e}(i),M.redirect("/cars")}catch(r){const t=r instanceof Error?r.message:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:t,type:"error"})}finally{n(!1),ue.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),ue.showLoading({type:"cube-zoom"}),await async function(t){const e=await Yt(me.REGISTER,t);return await be({username:t.username,id:e.objectId,token:e.sessionToken}),fe(),e}({username:i,password:n}),M.redirect("/cars")}catch(a){const t=a instanceof Error?a.message:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:t,type:"error"})}finally{s(!1),ue.hideLoading(),e.reset()}else ue.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 Ke{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 We=(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),We(s,e);return!0},Ge=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))},Ye=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),Xe(e)}};function Ze(t){void 0!==this._$AN?(Ge(this),this._$AM=t,Ye(this)):this._$AM=t}function Fe(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=Fe),null!==(i=(r=t)._$AQ)&&void 0!==i||(r._$AQ=Ze))};class Qe extends Ke{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),Ye(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&&(We(this,t),Ge(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 Qe{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&&nue.showModal({message:`Сигурен ли си, че искаш да изтриеш автомобила на ${e.customerName} - "${e.registration}"`,onConfirm:()=>t(!0),onCancel:()=>t(!1)}))))try{ue.showLoading(),await Promise.all([Se(e.objectId),Ce(e.objectId)]),ue.showToast({text:`Успешно изтрихте автомобила на ${e.customerName} - "${e.registration}"`,type:"info"})}catch(i){const t=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:t,type:"error"})}finally{ue.hideLoading(),M.redirect("/cars")}}async function oi(t){t.preventDefault();const e=t.target,[i,n]=te(e);try{n(!0),ue.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 Yt(ve.CREATE_CAR,r),a="/cars",o=null!=(e=await oe.getCacheData(a))?e:[],c={...r,...s},l=[c,...o].sort(((t,e)=>+new Date(e.createdAt)-+new Date(t.createdAt)));return await oe.updateCacheData(a,JSON.parse(JSON.stringify(l))),c}(i),ue.showToast({text:`Успешно създадохте автомобил на ${i.customerName} - "${i.registration}"`,type:"success"})}catch(r){const t=r instanceof Error?r.message:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:t,type:"error"})}finally{n(!1),ue.hideLoading(),e.reset(),M.redirect("/cars")}}null==(a=document.getElementById("logout-button"))||a.addEventListener("click",(async function(t){if(t.preventDefault(),await new Promise((t=>ue.showModal({message:"Сигурен ли си, че искаш да излезеш?",title:"Изход",onConfirm:()=>t(!0),onCancel:()=>t(!1)}))))try{ue.showLoading({type:"cube-zoom"}),await async function(){const t=await Yt(me.LOGOUT,{});return await $e(),fe(),t}(),M.redirect("/user/login")}catch(e){const t=e instanceof Error?e.message:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:t,type:"error"})}finally{ue.hideLoading()}})),M.base("/Car-Service"),M((function(t,e){fe(),Object.assign(t,{root:ke,render:Re}),function(t){const{origin:e,pathname:i,search:n}=window.location,r=e+t.pathname;Pe.some((t=>i.endsWith(t)))&&r!==e+i&&(t.state.prev=i+n)}(t),function(t){const{path:e}=t,i="interactive-widget=resizes-content";if(!Ne){const t=document.createElement("meta");return t.name="viewport",t.content=i,void document.head.appendChild(t)}const n=Ne.content.split(",").map((t=>t.trim()));Ie.includes(e)&&!n.includes(i)?n.push(i):!Ie.includes(e)&&n.includes(i)&&n.splice(n.indexOf(i),1);Ne.content=n.join(", ")}(t),function(t){if(!t)return;if(!document.startViewTransition)return void t();document.startViewTransition(t)}((()=>{const i=ye(),n=!i&&!Ie.includes(t.path),r=i&&Ie.includes(t.path);n?t.page.redirect(Ie[0]):r?window.history.back():e()}))})),M("/user/login",(function(t){t.render(Ct`
Вход
visibility_off
`)})),M("/user/register",(function(t){t.render(Ct`
Регистрация
visibility_off
`)})),M("/cars",(function(t){const{page:e="1",filter:i="",query:n=""}=Xt(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 oe.getCacheData(r);let a;if(n?({results:a}=await Gt(ve.ALL_CARS(n))):(a=null!=s?s:(await Gt(ve.ALL_CARS())).results,s||await oe.updateCacheData(r,a)),!t)return{results:a,count:a.length};const o=(t-1)*ae.itemsPerPage,c=t*ae.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:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:t,type:"error"}),M.redirect("/")}finally{ue.hideLoading()}}(Number(e)||1,i,n);if(t)return(t=>{const{cars:e,carsCount:i,pageNumber:n,searchCategory:r,searchQuery:s,onSearch:a,onDelete:o}=t,c=Math.max(Math.ceil(i/ae.itemsPerPage),1);return Ct`
Всички автомобили${Te(e,o)}
${De(n,c,r,s)}
`})({...t,onSearch:si,onDelete:ai})})(),ue.showLoading()))})),M("/cars/create",(function(t){const{prev:e=`${M.base()}/cars`}=t.state;t.render((t=>{const{prev:e,onSubmit:i}=t;return Ct`
Добави автомобил
Отказ
`})({prev:e,onSubmit:oi}))})),M("/cars/:carId/edit",(function(t){const{carId:e}=t.params,{prev:i=`${M.base()}/cars`}=t.state;t.render(ri((async()=>{const t=await async function(t){try{return await we(t)}catch(e){const t=e instanceof Error?e.message:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:t,type:"error"}),M.redirect("/cars")}finally{ue.hideLoading()}}(e);if(t)return(t=>{const{car:e,prev:i,onSubmit:n}=t;return Ct`
Редактирай автомобил
Отказ
`})({car:t,prev:i,onSubmit:e=>async function(t,e){t.preventDefault();const i=t.target,[n,r]=te(i);try{r(!0),ue.showLoading(),await async function(t,e){var i;const n=await Zt(ve.CAR_BY_ID(t),e),r="/cars",s=null!=(i=await oe.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 oe.updateCacheData(r,JSON.parse(JSON.stringify(c))),o}(e.objectId,n),ue.showToast({text:`Успешно редактирахте ремонт на ${n.customerName} - "${n.registration}"`,type:"info"})}catch(s){const t=s instanceof Error?s.message:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:t,type:"error"})}finally{r(!1),ue.hideLoading(),i.reset(),M.redirect("/cars")}}(e,t)})})(),ue.showLoading()))})),M("/cars/:carId/repairs",(function(t){const{carId:e}=t.params,{page:i="1"}=Xt(t.querystring),{prev:n=`${M.base()}/cars`}=t.state;t.render(ri((async()=>{const t=await async function(t,e){try{const[{results:i,count:n},r]=await Promise.all([xe(t,e),we(t)]);return{repairs:i,repairsCount:n,car:r,pageNumber:e}}catch(i){const t=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:t,type:"error"}),M.redirect("/cars")}finally{ue.hideLoading()}}(e,Number(i)||1);if(t)return(t=>{const{repairs:e,repairsCount:i,car:n,pageNumber:r,prev:s}=t,a=Math.max(Math.ceil(i/ae.itemsPerPage),1);return Ct`
Всичките ремонти на ${n.customerName} - "${n.registration}"${Ue(e)}
${He(r,a)}
`})({...t,prev:n})})(),ue.showLoading()))})),M("/cars/:carId/repairs/create",(function(t){const{carId:e}=t.params,{prev:i=`${M.base()}/cars/${e}/repairs`}=t.state;t.render((t=>{const{prev:e,onSubmit:i}=t;return Ct`
Добави ремонт
Отказ
`})({prev:i,onSubmit:t=>async function(t,e){t.preventDefault();const i=t.target,[n,r]=te(i);n.date=ne(n.date);try{r(!0),ue.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 Yt(ge.CREATE_REPAIR,a),c=`/cars/${t}/repairs`,l=null!=(i=await oe.getCacheData(c))?i:[],d={...a,...o},u=[d,...l].sort(Ae);return await oe.updateCacheData(c,JSON.parse(JSON.stringify(u))),d}(e,n),ue.showToast({text:"Успешно добавихте ремонт",type:"success"})}catch(s){const t=s instanceof Error?s.message:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:t,type:"error"})}finally{r(!1),ue.hideLoading(),i.reset(),M.redirect(`/cars/${e}/repairs`)}}(t,e)}))})),M("/cars/:carId/repairs/:repairId",(function(t){const{carId:e,repairId:i}=t.params,{prev:n=`${M.base()}/cars/${e}/repairs`}=t.state;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:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:e,type:"error"}),M.redirect(`/cars/${t}/repairs`)}finally{ue.hideLoading()}}(e,i);if(t)return(t=>{const{repair:e,prev:i,onDelete:n}=t;return Ct`
Детайли по ремонта
Обща информация
Информация за ремонта
`})({repair:t,prev:n,onDelete:e=>async function(t,e){t.preventDefault();if(!(await new Promise((t=>ue.showModal({message:`Сигурен ли си, че искаш да изтриеш ремонт от дата "${e.date}"`,onConfirm:()=>t(!0),onCancel:()=>t(!1)})))))return;try{ue.showLoading(),await async function(t,e){var i;const n=await Ft(ge.REPAIR_BY_ID(e)),r=`/cars/${t}/repairs`,s=(null!=(i=await oe.getCacheData(r))?i:[]).filter((t=>t.objectId!==e));return await(s.length>0?oe.updateCacheData(r,JSON.parse(JSON.stringify(s))):oe.clearCacheData(r)),n}(e.car.objectId,e.objectId),ue.showToast({text:"Успешно изтрихте ремонта",type:"info"})}catch(i){const t=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:t,type:"error"})}finally{ue.hideLoading(),M.redirect(`/cars/${e.car.objectId}/repairs`)}}(e,t)})})(),ue.showLoading()))})),M("/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:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:e,type:"error"}),M.redirect(`/cars/${t}/repairs`)}finally{ue.hideLoading()}}(e,i);if(t)return(t=>{const{repair:e,onSubmit:i}=t;return Ct`
Редактирай ремонт
Отказ
`})({repair:t,onSubmit:e=>async function(t,e){t.preventDefault();const i=t.target,[n,r]=te(i);n.date=ne(n.date);try{r(!0),ue.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 oe.getCacheData(s))?n:[],o=a.findIndex((t=>t.objectId===e)),c={...-1!==o?a.splice(o,1)[0]:{},...i,...r},l=[c,...a].sort(Ae);return await oe.updateCacheData(s,JSON.parse(JSON.stringify(l))),c}(e.car.objectId,e.objectId,n),ue.showToast({text:`Успешно редактирахте ремонт от дата "${n.date}"`,type:"info"})}catch(s){const t=s instanceof Error?s.message:"Възникна грешка, моля опитайте по-късно";ue.showToast({text:t,type:"error"})}finally{r(!1),ue.hideLoading(),i.reset(),M.redirect(`/cars/${e.car.objectId}/repairs/${e.objectId}`)}}(e,t)})})(),ue.showLoading()))})),M.start(); +var e,t,a,r,o,n,i,s=(e,t,a)=>{if(!t.has(e))throw TypeError("Cannot "+a)},c=(e,t,a)=>(s(e,t,"read from private field"),a?a.call(e):t.get(e)),l=(e,t,a)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,a)},d=(e,t,a)=>(s(e,t,"access private method"),a);import{D as u,x as p,p as m,m as f}from"./vendor.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const a of e)if("childList"===a.type)for(const e of a.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerpolicy&&(t.referrerPolicy=e.referrerpolicy),"use-credentials"===e.crossorigin?t.credentials="include":"anonymous"===e.crossorigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();function g(e){if(!e)return{};try{return decodeURIComponent(e).split("&").reduce(((e,t)=>{const[a,r]=t.split("=");return e[a.trim()]=(null==r?void 0:r.includes(","))?r.split(",").map(decodeURIComponent):decodeURIComponent(null==r?void 0:r.trim()),e}),{})}catch(t){return console.error(t),{}}}function b(e){if(!e)return"";try{return Object.entries(e).filter((([e,t])=>{const a="string"==typeof e&&e.trim().length>0,r="string"==typeof t?t.trim().length>0:Array.isArray(t)&&t.every((e=>"string"==typeof e&&e.trim().length>0));return a&&r})).map((([e,t])=>{const a=Array.isArray(t)?t.map((e=>encodeURIComponent(e.trim()))).join(","):encodeURIComponent(t.trim());return`${encodeURIComponent(e.trim())}=${a}`})).join("&")}catch(t){return console.error(t),""}}function y(e){const t=new FormData(e);return[Object.fromEntries(Array.from(t,(([e,t])=>[e,"string"==typeof t?t.trim():t]))),t=>Array.from(e.elements).forEach((e=>t?e.setAttribute("disabled","true"):e.removeAttribute("disabled")))]}function h(){if(crypto&&crypto.randomUUID)return crypto.randomUUID();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=~~(16*Math.random());return("x"===e?t:3&t|8).toString(16)}))}function v(e,t={}){const{parent:a,prepend:r=!1,attributes:o,children:n,style:i,...s}=t,c=document.createElement(e);if(void 0!==o)for(const l in o)c.setAttribute(l,o[l]);if(Array.isArray(n))for(const l of n)c.append(l);if(void 0!==i&&Object.assign(c.style,i),Object.assign(c,s),void 0!==a){const e="string"==typeof a?document.querySelector(a):a;e&&e[r?"prepend":"append"](c)}return c}function w(e,t="bg-BG"){try{const a=6e4*(new Date).getTimezoneOffset(),r=Number(new Date(e))+a;return Intl.DateTimeFormat(t).format(r)}catch{return e.toString()}}function _(e){return`${e}T${function(e){const t=6e4*(new Date).getTimezoneOffset(),a=e&&Number(new Date(e).getTime()+t)||Date.now(),r=new Date(a-t).toISOString();return r.split("T")[1].slice(0,-5)}()}.000Z`}function C(e){const t=6e4*(new Date).getTimezoneOffset(),a=e?Number(new Date(e).getTime()+t):Date.now();return new Date(a-t).toISOString().split("T")[0]}const $={storageKeys:{userService:"car-service-current-user-data",memoization:"car-service-cache-initialized"},catalogsTable:{rowsPerPage:10},pagination:{relativePageLinks:3}},x=$.storageKeys.memoization;e=new WeakMap;const k=new class{constructor(t){var a,r,o,n;l(this,e,void 0),o=t,s(a=this,r=e,"write to private field"),n?n.call(a,o):r.set(a,o),this.supported||console.warn("Cache API is not supported in this environment"),this.supported&&!sessionStorage.getItem(x)&&(sessionStorage.setItem(x,"true"),this.deleteCache())}get supported(){return!!window.caches}get databaseName(){return c(this,e)}async getCacheData(t){if(!this.supported)return Promise.resolve(null);const a=await caches.open(c(this,e)),r=await a.match(new Request(t));return r&&r.ok?await r.json():Promise.resolve(null)}async updateCacheData(t,a){if(!this.supported)return Promise.resolve();return(await caches.open(c(this,e))).put(new Request(t),new Response(JSON.stringify(a)))}async clearCacheData(t){if(!this.supported)return Promise.resolve(!1);return(await caches.open(c(this,e))).delete(new Request(t))}async deleteCache(){return this.supported?caches.delete(c(this,e)):Promise.resolve(!1)}}("CarServiceCacheDatabase"),N="rgba(0 0 0 / 0.5)",I=3,D={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"}};t=new WeakMap,a=new WeakSet,r=function(e,t){switch(e){case"cube-flip":return v("div",{className:"notice-loading-cube-flip",style:{backgroundColor:t}});case"dots-zoom":return v("div",{className:"notice-loading-dots-zoom",children:[v("div",{className:"notice-loading-dots-zoom1",style:{backgroundColor:t}}),v("div",{className:"notice-loading-dots-zoom2",style:{backgroundColor:t}})]});case"line":return v("div",{className:"notice-loading-line",children:[v("div",{className:"notice-loading-line-rect1",style:{backgroundColor:t}}),v("div",{className:"notice-loading-line-rect2",style:{backgroundColor:t}}),v("div",{className:"notice-loading-line-rect3",style:{backgroundColor:t}}),v("div",{className:"notice-loading-line-rect4",style:{backgroundColor:t}}),v("div",{className:"notice-loading-line-rect5",style:{backgroundColor:t}})]});case"dots-spin":return v("div",{className:"notice-loading-spin-dots",children:[v("div",{className:"notice-loading-spin-dot1",style:{backgroundColor:t}}),v("div",{className:"notice-loading-spin-dot2",style:{backgroundColor:t}})]});case"dots":return v("div",{className:"notice-loading-dots",children:[v("div",{className:"notice-loading-dot1",style:{backgroundColor:t}}),v("div",{className:"notice-loading-dot2",style:{backgroundColor:t}}),v("div",{style:{backgroundColor:t}})]});case"cube-zoom":return v("div",{className:"notice-loading-cube-zoom",children:[v("div",{className:"notice-loading-cube-zoom-1",style:{backgroundColor:t}}),v("div",{className:"notice-loading-cube-zoom-2",style:{backgroundColor:t}}),v("div",{className:"notice-loading-cube-zoom-3",style:{backgroundColor:t}}),v("div",{className:"notice-loading-cube-zoom-4",style:{backgroundColor:t}}),v("div",{className:"notice-loading-cube-zoom-5",style:{backgroundColor:t}}),v("div",{className:"notice-loading-cube-zoom-6",style:{backgroundColor:t}}),v("div",{className:"notice-loading-cube-zoom-7",style:{backgroundColor:t}}),v("div",{className:"notice-loading-cube-zoom-8",style:{backgroundColor:t}}),v("div",{className:"notice-loading-cube-zoom-9",style:{backgroundColor:t}})]});default:return null}},o=new WeakSet,n=function(e,t,a,r){const o=v("div",{className:"notice-modal-buttons"});switch(e){case"yes-no":return v("button",{parent:o,attributes:{"data-button-type":"info"},textContent:"Да",onclick:e=>{t.remove(),"function"==typeof a&&a(e)}}),v("button",{parent:o,attributes:{"data-button-type":"danger"},textContent:"Не",onclick:e=>{t.remove(),"function"==typeof r&&r(e)}}),o;case"ok":return v("button",{parent:o,textContent:"Добре",onclick:e=>{t.remove(),"function"==typeof a&&a(e)}}),o;case"ok-cancel":return v("button",{parent:o,textContent:"Добре",onclick:e=>{t.remove(),"function"==typeof a&&a(e)}}),v("button",{parent:o,attributes:{"data-button-type":"danger"},textContent:"Отказ",onclick:e=>{t.remove(),"function"==typeof r&&r(e)}}),o;case"retry-cancel":return v("button",{parent:o,attributes:{"data-button-type":"info"},textContent:"Нов опит",onclick:e=>{t.remove(),"function"==typeof a&&a(e)}}),v("button",{parent:o,attributes:{"data-button-type":"danger"},textContent:"Отказ",onclick:e=>{t.remove(),"function"==typeof r&&r(e)}}),o;default:return null}};const S=new class{constructor(){l(this,a),l(this,o),l(this,t,document.body)}showLoading(e={}){const{type:o="dots",color:n="white",autoClose:i,title:s,titleColor:l,maskColor:u=N}=e,p=v("div",{parent:c(this,t),className:"notice-loading notice-flex-center notice-fixed-all-page",id:"notice-loading"});v("div",{parent:p,className:"notice-mask notice-fixed-all-page",style:{backgroundColor:u}});const m=d(this,a,r).call(this,o,n)||d(this,a,r).call(this,"dots",n),f=v("div",{parent:p,className:"notice-flex-center notice-loading-main",children:[m]});s&&v("p",{parent:f,style:{color:l},textContent:s}),i&&setTimeout((()=>p.remove()),1e3*i)}hideLoading(){var e;null==(e=document.getElementById("notice-loading"))||e.remove()}showToast(e){const{text:a,type:r="default",autoClose:o=I,showClose:n=!0}=e;if(!a)return;const{icon:i,color:s,backgroundColor:l}=D[r]||D.default,d=document.getElementById("notice-toast")||v("div",{parent:c(this,t),className:"notice-toast",id:"notice-toast"}),u=v("div",{parent:d,className:"notice-toast-main notice-toast-main-active",id:`notice-toast-${h()}`,style:{backgroundColor:l}}),p=v("div",{parent:u,className:"notice-toast-container",children:[v("p",{className:"notice-toast-text",style:{color:s},textContent:a})]});i&&v("i",{parent:p,prepend:!0,className:"material-icons notice-toast-icon",style:{color:s},textContent:i}),(n||!o)&&v("i",{parent:p,className:"material-icons notice-close-icon",textContent:"close",onclick:()=>f()});const m=!!Number(getComputedStyle(d).getPropertyValue("--_should-auto-close"));if(o||m){setTimeout((()=>f()),1e3*(o||I))}function f(){if(!u)return;const e=parseFloat(window.getComputedStyle(u).getPropertyValue("transition-duration"));u.classList.remove("notice-toast-main-active"),setTimeout((()=>{u&&u.remove(),d.children.length||d.remove()}),1e3*e)}}showModal(e={}){const{type:a="yes-no",color:r,backgroundColor:i,title:s,titleColor:l,message:u,messageColor:p,maskColor:m=N,onConfirm:f,onCancel:g}=e,b=v("div",{parent:c(this,t),className:"notice-modal notice-flex-center notice-fixed-all-page",id:"notice-modal"});v("div",{parent:b,className:"notice-mask notice-fixed-all-page",style:{backgroundColor:m}});const y=v("div",{parent:b,className:"notice-flex-center notice-modal-main",style:{backgroundColor:i},children:[d(this,o,n).call(this,a,b,f,g)||d(this,o,n).call(this,"yes-no",b,f,g)]});u&&v("p",{parent:y,prepend:!0,style:{color:p||r},textContent:u}),s&&v("h2",{parent:y,prepend:!0,style:{color:l||r},textContent:s})}},A=document.querySelectorAll(".user-navigation"),E=document.querySelectorAll(".guest-navigation");function T(){B()?(A.forEach((e=>e.removeAttribute("hidden"))),E.forEach((e=>e.setAttribute("hidden","")))):(A.forEach((e=>e.setAttribute("hidden",""))),E.forEach((e=>e.removeAttribute("hidden"))))}async function L(e,t){const a=new URL(e,"https://parseapi.back4app.com"),r=await fetch(a,t);if(!0!==r.ok){r.status>=400&&r.status<500&&(await W(),T());const{message:e,error:t}=await r.json();throw new Error(`${e||t} Status: ${r.status}`,{cause:r})}return r.json()}function P(e,t){const a=new Headers({"X-Parse-Application-Id":"0oqWvkMylRfPgcnXNXtOUe8SWSqDZPiHktiLW9Np","X-Parse-REST-API-Key":"4YzVVeTWOVJyamwDNrNaafCLGzwC5qWnt7dw9aot"}),r=U();return r&&a.append("X-Parse-Session-Token",r.token),t&&a.append("Content-Type","application/json"),{method:e,headers:a,...t?{body:JSON.stringify(t)}:{}}}const R=e=>L(e,P("GET")),j=(e,t)=>L(e,P("POST",t)),O=(e,t)=>L(e,P("PUT",t)),q=e=>L(e,P("DELETE")),V={LOGIN:"/login",REGISTER:"/users",LOGOUT:"/logout"},z={CREATE_CAR:"/classes/Car",ALL_CARS:(e="")=>`/classes/Car?${b({order:"-createdAt",where:e})}`,CAR_BY_ID:e=>`/classes/Car/${e}`},J={CREATE_REPAIR:"/classes/Repair",ALL_REPAIRS_BY_CAR:e=>`/classes/Repair?${b({order:"-date",where:e})}`,REPAIR_BY_ID:e=>`/classes/Repair/${e}`},M=$.storageKeys.userService;function B(){return!!sessionStorage.getItem(M)}function U(){var e;const t=$.storageKeys.userService;return JSON.parse(null!=(e=sessionStorage.getItem(t))?e:"null")}async function Y(e){await k.deleteCache().catch(console.error),sessionStorage.setItem(M,JSON.stringify(e))}async function W(){await k.deleteCache().catch(console.error),sessionStorage.removeItem(M)}const G=$.catalogsTable.rowsPerPage;async function H(e){const t="/cars",a=await k.getCacheData(t),r=a&&a.find((t=>t.objectId===e));if(r)return r;const o=await R(z.CAR_BY_ID(e));if(a){const e=[o,...a].sort(((e,t)=>+new Date(t.createdAt)-+new Date(e.createdAt)));await k.updateCacheData(t,JSON.parse(JSON.stringify(e)))}return o}async function K(e){var t;const a=await q(z.CAR_BY_ID(e)),r="/cars",o=(null!=(t=await k.getCacheData(r))?t:[]).filter((t=>t.objectId!==e));return await(o.length>0?k.updateCacheData(r,JSON.parse(JSON.stringify(o))):k.clearCacheData(r)),a}const X=(e,t)=>{const a=Number(new Date(e.date))||Number(new Date(e.createdAt));return(Number(new Date(t.date))||Number(new Date(t.createdAt)))-a};async function F(e,t){const a=JSON.stringify({car:{__type:"Pointer",className:"Car",objectId:e}}),r=`/cars/${e}/repairs`,o=await k.getCacheData(r);let n;if(o?n=o:(({results:n}=await R(J.ALL_REPAIRS_BY_CAR(a))),await k.updateCacheData(r,JSON.parse(JSON.stringify(n)))),!t)return{results:n,count:n.length};const i=10*(t-1),s=10*t;return{results:n.slice(i,s),count:n.length}}async function Q(e,t){const a=`/cars/${e}/repairs`,r=await k.getCacheData(a),o=r&&r.find((e=>e.objectId===t));if(o)return o;const n=await R(J.REPAIR_BY_ID(t));if(r){const e=[n,...r].sort(X);await k.updateCacheData(a,JSON.parse(JSON.stringify(e)))}return n}async function Z(e){const{results:t}=await F(e),a=t.map((({objectId:e})=>q(J.REPAIR_BY_ID(e)))),r=`/cars/${e}/repairs`;return await k.clearCacheData(r),Promise.all(a)}const ee=document.getElementById("site-content")||document.body,te=document.querySelector("meta[name=viewport]"),ae=["/user/login","/user/register"],re=["/cars","/repairs"];function oe(e,t={}){const{container:a,...r}=t,o=a&&(a instanceof HTMLElement||a instanceof DocumentFragment)?a:"string"==typeof a?document.querySelector(a):null;return u(e,o||ee,r)}const ne=$.pagination.relativePageLinks;function ie(e,t,a){const r=(r,o)=>{const n=e===o||o<1||o>t,i="number"==typeof r&&e===o,s=n?"#":function(e,t){const a=b({...g(window.location.search.slice(1)),...t,page:e.toString()});return`${window.location.pathname}?${a}`}(o,a);return p`${r}`},o=r(p`keyboard_double_arrow_left`,1),n=r(p`chevron_left`,e-1),i=function(e,t){const a=Math.floor(ne/2),r=Math.min(Math.max(1,e-a),Math.max(1,t-ne+1)),o=Math.max(Math.min(t,e+a),Math.min(t,ne));return Array.from({length:Math.min(o-r+1,t)},((e,t)=>r+t))}(e,t).map((e=>r(e,e))),s=r(p`chevron_right`,e+1),c=r(p`keyboard_double_arrow_right`,t);return p`
${o}${n}${i}${s}${c}
`}const se=$.catalogsTable.rowsPerPage,ce=(e,t)=>e.length>0?le(e,t):p`

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

`,le=(e,t)=>p`${e.map((e=>de(e,t)))}
РамаPегистрационен №Марка / МоделДвигателИме на клиентаРемонтиРедакцияИзтриване
`,de=(e,t)=>p`${e.vin}${e.registration}${e.make}${e.engine}${e.customerName}
`,ue=$.catalogsTable.rowsPerPage,pe=(e,t)=>e.length>0?me(e,t):p`

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

`,me=(e,t)=>p`${e.map((e=>fe(e,t)))}
Извършен наКилометриДетайли по ремонтаИзтриване
`,fe=(e,t)=>p`${w(e.date)}${e.km}
`;async function ge(e){e.preventDefault();const t=e.target,[a,r]=y(t);try{r(!0),S.showLoading({type:"cube-zoom"}),await async function(e){const t=await j(V.LOGIN,e);return await Y({username:e.username,id:t.objectId,token:t.sessionToken}),T(),t}(a),m.redirect("/cars")}catch(o){const e=o instanceof Error?o.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:e,type:"error"})}finally{r(!1),S.hideLoading(),t.reset()}}function be(e){e.preventDefault();const t=e.target,a=t.previousElementSibling,r="password"===a.type?"text":"password";a.setAttribute("type",r),t.textContent="password"===r?"visibility_off":"visibility"}async function ye(e){e.preventDefault();const t=e.target,[{username:a,password:r,repass:o},n]=y(t);if(r===o)try{n(!0),S.showLoading({type:"cube-zoom"}),await async function(e){const t=await j(V.REGISTER,e);return await Y({username:e.username,id:t.objectId,token:t.sessionToken}),T(),{username:e.username,updatedAt:t.createdAt,...t}}({username:a,password:r}),m.redirect("/cars")}catch(i){const e=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:e,type:"error"})}finally{n(!1),S.hideLoading(),t.reset()}else S.showToast({text:"Паролите не съвпадат!",type:"warning"})}function he(e){var t,a,r;e.preventDefault();const o=e.target,n=o.previousElementSibling,i=null==(r=null==(a=null==(t=o.parentElement)?void 0:t.parentElement)?void 0:a.nextElementSibling)?void 0:r.lastElementChild,s="password"===n.type?"text":"password";n.setAttribute("type",s),i.setAttribute("type",s),o.textContent="password"===s?"visibility_off":"visibility"}function ve(e){e.preventDefault();const t=document.getElementById("search-options").value.trim(),a=document.getElementById("search-input").value.trim();t&&a?m.redirect(`/cars?${b({filter:t,query:a})}`):m.redirect("/cars")}async function we(e,t){e.preventDefault();if(await new Promise((e=>S.showModal({message:`Сигурен ли си, че искаш да изтриеш автомобила на ${t.customerName} - "${t.registration}"`,onConfirm:()=>e(!0),onCancel:()=>e(!1)}))))try{S.showLoading(),await Promise.all([Z(t.objectId),K(t.objectId)]),S.showToast({text:`Успешно изтрихте автомобила на ${t.customerName} - "${t.registration}"`,type:"info"})}catch(a){const e=a instanceof Error?a.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:e,type:"error"})}finally{S.hideLoading(),m.redirect("/cars")}}async function _e(e){e.preventDefault();const t=e.target,[a,r]=y(t);try{r(!0),S.showLoading(),await async function(e){var t;const{id:a}=U(),r={owner:Object.freeze({__type:"Pointer",className:"_User",objectId:a})},o=Object.assign({},e,r),n=await j(z.CREATE_CAR,o),i="/cars",s=null!=(t=await k.getCacheData(i))?t:[],c={...o,...n},l=[c,...s].sort(((e,t)=>+new Date(t.createdAt)-+new Date(e.createdAt)));return await k.updateCacheData(i,JSON.parse(JSON.stringify(l))),c}(a),S.showToast({text:`Успешно създадохте автомобил на ${a.customerName} - "${a.registration}"`,type:"success"})}catch(o){const e=o instanceof Error?o.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:e,type:"error"})}finally{r(!1),S.hideLoading(),t.reset(),m.redirect("/cars")}}async function Ce(e,t){e.preventDefault();if(await new Promise((e=>S.showModal({message:`Сигурен ли си, че искаш да изтриеш ремонта от дата ${w(t.date)}`,onConfirm:()=>e(!0),onCancel:()=>e(!1)}))))try{S.showLoading(),await async function(e,t){var a;const r=await q(J.REPAIR_BY_ID(t)),o=`/cars/${e}/repairs`,n=(null!=(a=await k.getCacheData(o))?a:[]).filter((e=>e.objectId!==t));return await(n.length>0?k.updateCacheData(o,JSON.parse(JSON.stringify(n))):k.clearCacheData(o)),r}(t.car.objectId,t.objectId),S.showToast({text:"Успешно изтрихте ремонта",type:"info"})}catch(a){const e=a instanceof Error?a.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:e,type:"error"})}finally{S.hideLoading(),m.redirect(`/cars/${t.car.objectId}/repairs`)}}null==(i=document.getElementById("logout-button"))||i.addEventListener("click",(async function(e){if(e.preventDefault(),await new Promise((e=>S.showModal({message:"Сигурен ли си, че искаш да излезеш от профила си?",title:"Изход",onConfirm:()=>e(!0),onCancel:()=>e(!1)}))))try{S.showLoading({type:"cube-zoom"}),await async function(){const e=await j(V.LOGOUT,{});return await W(),T(),e}(),m.redirect("/user/login")}catch(t){const e=t instanceof Error?t.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:e,type:"error"})}finally{S.hideLoading()}})),m.base("/Car-Service"),m((function(e,t){const a=Object.assign(e,{root:ee,render:oe});!function(e){const{origin:t,pathname:a,search:r}=window.location,o=t+e.pathname;re.some((e=>a.endsWith(e)))&&o!==t+a&&(e.state.prev=a+r)}(a),function(e){if(!te)return;const t="interactive-widget=resizes-content",a=te.content.split(",").map((e=>e.trim())),r=a.includes(t),o=ae.includes(e.path);if(o&&!r)a.push(t);else if(!o&&r){const e=a.indexOf(t);a.splice(e,1)}te.content=a.join(", ")}(a),T(),function(e){if(!e)return;if(!document.startViewTransition)return void e();document.startViewTransition(e)}((()=>{const a=B(),r=!a&&!ae.includes(e.path),o=a&&ae.includes(e.path);r?e.page.redirect(ae[0]):o?window.history.back():t()}))})),m("/user/login",(function(e){e.render(p`
Вход
visibility_off
`)})),m("/user/register",(function(e){e.render(p`
Регистрация
visibility_off
`)})),m("/cars",(function(e){const{page:t="1",filter:a="",query:r=""}=g(e.querystring);e.render(f((async()=>{const e=await async function(e,t,a){try{const{results:r,count:o}=await async function(e,t,a){const r=t&&a?JSON.stringify({[t]:{$regex:`(?i)${a}`}}):null,o="/cars",n=await k.getCacheData(o);let i;if(r?({results:i}=await R(z.ALL_CARS(r))):(i=null!=n?n:(await R(z.ALL_CARS())).results,n||await k.updateCacheData(o,i)),!e)return{results:i,count:i.length};const s=(e-1)*G,c=e*G;return{results:i.slice(s,c),count:i.length}}(e,t,a);return{cars:r,carsCount:o,pageNumber:e,searchCategory:t,searchQuery:a}}catch(r){const e=r instanceof Error?r.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:e,type:"error"}),m.redirect("/")}finally{S.hideLoading()}}(Number(t)||1,a,r);if(e)return(e=>{const{cars:t,carsCount:a,pageNumber:r,searchCategory:o,searchQuery:n,onSearch:i,onDelete:s}=e,c=Math.max(Math.ceil(a/se),1);return p`
Всички автомобили${ce(t,s)}${ie(r,c,{filter:o,query:n})}
`})({...e,onSearch:ve,onDelete:we})})(),S.showLoading()))})),m("/cars/create",(function(e){const{prev:t=`${m.base()}/cars`}=e.state;e.render((e=>{const{prev:t,onSubmit:a}=e;return p`
Добави автомобил
Отказ
`})({prev:t,onSubmit:_e}))})),m("/cars/:carId/edit",(function(e){const{carId:t}=e.params,{prev:a=`${m.base()}/cars`}=e.state;e.render(f((async()=>{const e=await async function(e){try{return await H(e)}catch(t){const e=t instanceof Error?t.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:e,type:"error"}),m.redirect("/cars")}finally{S.hideLoading()}}(t);if(e)return(e=>{const{car:t,prev:a,onSubmit:r}=e;return p`
Редактирай автомобил
Отказ
`})({car:e,prev:a,onSubmit:t=>async function(e,t){e.preventDefault();const a=e.target,[r,o]=y(a);try{o(!0),S.showLoading(),await async function(e,t){var a;const r=await O(z.CAR_BY_ID(e),t),o="/cars",n=null!=(a=await k.getCacheData(o))?a:[],i=n.findIndex((t=>t.objectId===e)),s={...-1!==i?n.splice(i,1)[0]:{},...t,...r},c=[s,...n].sort(((e,t)=>+new Date(t.createdAt)-+new Date(e.createdAt)));return await k.updateCacheData(o,JSON.parse(JSON.stringify(c))),s}(t.objectId,r),S.showToast({text:`Успешно редактирахте ремонт на ${r.customerName} - "${r.registration}"`,type:"info"})}catch(n){const e=n instanceof Error?n.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:e,type:"error"})}finally{o(!1),S.hideLoading(),a.reset(),m.redirect("/cars")}}(t,e)})})(),S.showLoading()))})),m("/cars/:carId/repairs",(function(e){const{carId:t}=e.params,{page:a="1"}=g(e.querystring),{prev:r=`${m.base()}/cars`}=e.state;e.render(f((async()=>{const e=await async function(e,t){try{const[{results:a,count:r},o]=await Promise.all([F(e,t),H(e)]);return{repairs:a,repairsCount:r,car:o,pageNumber:t}}catch(a){const e=a instanceof Error?a.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:e,type:"error"}),m.redirect("/cars")}finally{S.hideLoading()}}(t,Number(a)||1);if(e)return(e=>{const{repairs:t,repairsCount:a,car:r,pageNumber:o,prev:n,onDelete:i}=e,s=Math.max(Math.ceil(a/ue),1);return p`
Всички ремонти на ${r.customerName} - рег. № "${r.registration}"${pe(t,i)}${ie(o,s)}
`})({...e,prev:r,onDelete:Ce})})(),S.showLoading()))})),m("/cars/:carId/repairs/create",(function(e){const{carId:t}=e.params,{prev:a=`${m.base()}/cars/${t}/repairs`}=e.state;e.render((e=>{const{prev:t,onSubmit:a}=e;return p`
Добави ремонт
Отказ
`})({prev:a,onSubmit:e=>async function(e,t){e.preventDefault();const a=e.target,[r,o]=y(a);r.date=_(r.date);try{o(!0),S.showLoading(),await async function(e,t){var a;const{id:r}=U(),o={owner:Object.freeze({__type:"Pointer",className:"_User",objectId:r})},n={car:Object.freeze({__type:"Pointer",className:"Car",objectId:e})},i=Object.assign({},t,o,n),s=await j(J.CREATE_REPAIR,i),c=`/cars/${e}/repairs`,l=null!=(a=await k.getCacheData(c))?a:[],d={...i,...s},u=[d,...l].sort(X);return await k.updateCacheData(c,JSON.parse(JSON.stringify(u))),d}(t,r),S.showToast({text:"Успешно добавихте ремонт",type:"success"})}catch(n){const e=n instanceof Error?n.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:e,type:"error"})}finally{o(!1),S.hideLoading(),a.reset(),m.redirect(`/cars/${t}/repairs`)}}(e,t)}))})),m("/cars/:carId/repairs/:repairId",(function(e){const{carId:t,repairId:a}=e.params,{prev:r=`${m.base()}/cars/${t}/repairs`}=e.state;e.render(f((async()=>{const e=await async function(e,t){try{return await Q(e,t)}catch(a){const t=a instanceof Error?a.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:t,type:"error"}),m.redirect(`/cars/${e}/repairs`)}finally{S.hideLoading()}}(t,a);if(e)return(e=>{const{repair:t,prev:a}=e;return p`
Детайли по ремонта
Обща информация
Информация за ремонта
`})({repair:e,prev:r})})(),S.showLoading()))})),m("/cars/:carId/repairs/:repairId/edit",(function(e){const{carId:t,repairId:a}=e.params;e.render(f((async()=>{const e=await async function(e,t){try{return await Q(e,t)}catch(a){const t=a instanceof Error?a.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:t,type:"error"}),m.redirect(`/cars/${e}/repairs`)}finally{S.hideLoading()}}(t,a);if(e)return(e=>{const{repair:t,onSubmit:a}=e;return p`
Редактирай ремонт
Отказ
`})({repair:e,onSubmit:t=>async function(e,t){e.preventDefault();const a=e.target,[r,o]=y(a),n=r.date;r.date=_(r.date);try{o(!0),S.showLoading(),await async function(e,t,a){var r;const o=await O(J.REPAIR_BY_ID(t),a),n=`/cars/${e}/repairs`,i=null!=(r=await k.getCacheData(n))?r:[],s=i.findIndex((e=>e.objectId===t)),c={...-1!==s?i.splice(s,1)[0]:{},...a,...o},l=[c,...i].sort(X);return await k.updateCacheData(n,JSON.parse(JSON.stringify(l))),c}(t.car.objectId,t.objectId,r),S.showToast({text:`Успешно редактирахте ремонт от дата "${n}"`,type:"info"})}catch(i){const e=i instanceof Error?i.message:"Възникна грешка, моля опитайте по-късно";S.showToast({text:e,type:"error"})}finally{o(!1),S.hideLoading(),a.reset(),m.redirect(`/cars/${t.car.objectId}/repairs/${t.objectId}`)}}(t,e)})})(),S.showLoading()))})),m.start(); diff --git a/vendor.js b/vendor.js new file mode 100644 index 0000000..9052f50 --- /dev/null +++ b/vendor.js @@ -0,0 +1 @@ +var t=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},e=f,i=h,n=function(t){return a(h(t))},s=a,o=u,r=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^()])+)\\))?|\\(((?:\\\\.|[^()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function h(t){for(var e,i=[],n=0,s=0,o="";null!=(e=r.exec(t));){var h=e[0],a=e[1],l=e.index;if(o+=t.slice(s,l),s=l+h.length,a)o+=a[1];else{o&&(i.push(o),o="");var d=e[2],p=e[3],u=e[4],f=e[5],v=e[6],_=e[7],$="+"===v||"*"===v,g="?"===v||"*"===v,m=d||"/",y=u||f||(_?".*":"[^"+m+"]+?");i.push({name:p||n++,prefix:d||"",delimiter:m,optional:g,repeat:$,pattern:c(y)})}}return s0){var n=this._window;g&&n.history.back(),this.len--}else t?setTimeout((function(){i.show(t,e)})):setTimeout((function(){i.show(i._getBase(),e)}))},w.prototype.redirect=function(t,e){var i=this;"string"==typeof t&&"string"==typeof e&&b.call(this,t,(function(t){setTimeout((function(){i.replace(e)}),0)})),"string"==typeof t&&void 0===e&&setTimeout((function(){i.replace(t)}),0)},w.prototype.replace=function(t,e,i,n){var s=new C(t,e,this),o=this.prevContext;return this.prevContext=s,this.current=s.path,s.init=i,s.save(),!1!==n&&this.dispatch(s,o),s},w.prototype.dispatch=function(t,e){var i=0,n=0,s=this;function o(){var e=s.callbacks[i++];if(t.path===s.current)return e?void e(t,o):E.call(s,t);t.handled=!1}e?function t(){var i=s.exits[n++];if(!i)return o();i(e,t)}():o()},w.prototype.exit=function(t,e){if("function"==typeof t)return this.exit("*",t);for(var i=new x(t,null,this),n=1;n-1)&&!(s?e.target.baseVal:e.target)&&(s||this.sameOrigin(e.href))){var r=s?e.href.baseVal:e.pathname+e.search+(e.hash||"");r="/"!==r[0]?"/"+r:r,m&&r.match(/^\/[a-zA-Z]:\//)&&(r=r.replace(/^\/[a-zA-Z]:\//,"/"));var h=r,a=this._getBase();0===r.indexOf(a)&&(r=r.substr(a.length)),this._hashbang&&(r=r.replace("#!","")),(!a||h!==r||A&&"file:"===this._window.location.protocol)&&(t.preventDefault(),this.show(h))}}}}},w.prototype._onpopstate=(v=!1,$?(_&&"complete"===document.readyState?v=!0:window.addEventListener("load",(function(){setTimeout((function(){v=!0}),0)})),function(t){if(v){var e=this;if(t.state){var i=t.state.path;e.replace(i,t.state)}else if(A){var n=e._window.location;e.show(n.pathname+n.search+n.hash,void 0,void 0,!1)}}}):function(){}),w.prototype._which=function(t){return null==(t=t||$&&this._window.event).which?t.button:t.which},w.prototype._toURL=function(t){var e=this._window;if("function"==typeof URL&&A)return new URL(t,e.location.toString());if(_){var i=e.document.createElement("a");return i.href=t,i}},w.prototype.sameOrigin=function(t){if(!t||!A)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))},w.prototype._samePath=function(t){if(!A)return!1;var e=this._window.location;return t.pathname===e.pathname&&t.search===e.search},w.prototype._decodeURLEncodedURIComponent=function(t){return"string"!=typeof t?t:this._decodeURLComponents?decodeURIComponent(t.replace(/\+/g," ")):t},C.prototype.pushState=function(){var t=this.page,e=t._window,i=t._hashbang;t.len++,g&&e.history.pushState(this.state,this.title,i&&"/"!==this.path?"#!"+this.path:this.canonicalPath)},C.prototype.save=function(){var t=this.page;g&&t._window.history.replaceState(this.state,this.title,t._hashbang&&"/"!==this.path?"#!"+this.path:this.canonicalPath)},x.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()}},x.prototype.match=function(t,e){var i=this.keys,n=t.indexOf("?"),s=~n?t.slice(0,n):t,o=this.regexp.exec(decodeURIComponent(s));if(!o)return!1;delete e[0];for(var r=1,h=o.length;rt:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new T("string"==typeof t?t:t+"",void 0,O))(e)})(t):t;var L;const M=window,j=M.trustedTypes,I=j?j.emptyScript:"",B=M.reactiveElementPolyfillSupport,z={toAttribute(t,e){switch(e){case Boolean:t=t?I: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}},D=(t,e)=>e!==t&&(e==e||t==t),V={attribute:!0,type:String,converter:z,reflect:!1,hasChanged:D},q="finalized";class K 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=V){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 s=this[t];this[e]=n,this.requestUpdate(t,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||V}static finalize(){if(this.hasOwnProperty(q))return!1;this[q]=!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(N(t))}else void 0!==t&&e.push(N(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)=>{k?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),n=R.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=V){var n;const s=this.constructor._$Ep(t,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:z).toAttribute(e,i.type);this._$El=t,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,s=n._$Ev.get(t);if(void 0!==s&&this._$El!==s){const t=n.getPropertyOptions(s),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:z;this._$El=s,this[s]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||D)(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 Z;K[q]=!0,K.elementProperties=new Map,K.elementStyles=[],K.shadowRootOptions={mode:"open"},null==B||B({ReactiveElement:K}),(null!==(L=M.reactiveElementVersions)&&void 0!==L?L:M.reactiveElementVersions=[]).push("1.6.3");const G=window,W=G.trustedTypes,Y=W?W.createPolicy("lit-html",{createHTML:t=>t}):void 0,J="$lit$",Q=`lit$${(Math.random()+"").slice(9)}$`,F="?"+Q,X=`<${F}>`,tt=document,et=()=>tt.createComment(""),it=t=>null===t||"object"!=typeof t&&"function"!=typeof t,nt=Array.isArray,st="[ \t\n\f\r]",ot=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,rt=/-->/g,ht=/>/g,at=RegExp(`>|${st}(?:([^\\s"'>=/]+)(${st}*=${st}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),lt=/'/g,ct=/"/g,dt=/^(?:script|style|textarea|title)$/i,pt=($t=1,(t,...e)=>({_$litType$:$t,strings:t,values:e})),ut=Symbol.for("lit-noChange"),ft=Symbol.for("lit-nothing"),vt=new WeakMap,_t=tt.createTreeWalker(tt,129,null,!1);var $t;function gt(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Y?Y.createHTML(e):e}class mt{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let s=0,o=0;const r=t.length-1,h=this.parts,[a,l]=((t,e)=>{const i=t.length-1,n=[];let s,o=2===e?"":"",r=ot;for(let h=0;h"===a[0]?(r=null!=s?s:ot,l=-1):void 0===a[1]?l=-2:(l=r.lastIndex-a[2].length,i=a[1],r=void 0===a[3]?at:'"'===a[3]?ct:lt):r===ct||r===lt?r=at:r===rt||r===ht?r=ot:(r=at,s=void 0);const d=r===at&&t[h+1].startsWith("/>")?" ":"";o+=r===ot?e+X:l>=0?(n.push(i),e.slice(0,l)+J+e.slice(l)+Q+d):e+Q+(-2===l?(n.push(void 0),h):d)}return[gt(t,o+(t[i]||"")+(2===e?"":"")),n]})(t,e);if(this.el=mt.createElement(a,i),_t.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=_t.nextNode())&&h.length0){n.textContent=W?W.emptyScript:"";for(let i=0;int(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!==ft&&it(this._$AH)?this._$AA.nextSibling.data=t:this.$(tt.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:n}=t,s="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=mt.createElement(gt(n.h,n.h[0]),this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===s)this._$AH.v(i);else{const t=new At(s,this),e=t.u(this.options);t.v(i),this.$(e),this._$AH=t}}_$AC(t){let e=vt.get(t.strings);return void 0===e&&vt.set(t.strings,e=new mt(t)),e}T(t){nt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const s of t)n===e.length?e.push(i=new wt(this.k(et()),this.k(et()),this,this.options)):i=e[n],i._$AI(s),n++;n2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=ft}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const s=this.strings;let o=!1;if(void 0===s)t=yt(this,t,e,0),o=!it(t)||t!==this._$AH&&t!==ut,o&&(this._$AH=t);else{const n=t;let r,h;for(t=s[0],r=0;r{var n,s;const o=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let r=o._$litPart$;if(void 0===r){const t=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:null;o._$litPart$=r=new wt(e.insertBefore(et(),t),t,void 0,null!=i?i:{})}return r._$AI(t),r};var kt,Ot;class Ht extends K{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=Rt(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 ut}}Ht.finalized=!0,Ht._$litElement$=!0,null===(kt=globalThis.litElementHydrateSupport)||void 0===kt||kt.call(globalThis,{LitElement:Ht});const Tt=globalThis.litElementPolyfillSupport;null==Tt||Tt({LitElement:Ht}),(null!==(Ot=globalThis.litElementVersions)&&void 0!==Ot?Ot:globalThis.litElementVersions=[]).push("3.3.3");const Nt=2;class Lt{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 Mt=(t,e)=>{var i,n;const s=t._$AN;if(void 0===s)return!1;for(const o of s)null===(n=(i=o)._$AO)||void 0===n||n.call(i,e,!1),Mt(o,e);return!0},jt=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))},It=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),Dt(e)}};function Bt(t){void 0!==this._$AN?(jt(this),this._$AM=t,It(this)):this._$AM=t}function zt(t,e=!1,i=0){const n=this._$AH,s=this._$AN;if(void 0!==s&&0!==s.size)if(e)if(Array.isArray(n))for(let o=i;o{var e,i,n,s;t.type==Nt&&(null!==(e=(n=t)._$AP)&&void 0!==e||(n._$AP=zt),null!==(i=(s=t)._$AQ)&&void 0!==i||(s._$AQ=Bt))};class Vt extends Lt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),It(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&&(Mt(this,t),jt(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 qt{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}}class Kt{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 Zt=t=>{return!(e=t,null===e||"object"!=typeof e&&"function"!=typeof e||"function"!=typeof t.then);var e},Gt=1073741823;const Wt=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends Vt{constructor(){super(...arguments),this._$C_t=Gt,this._$Cwt=[],this._$Cq=new qt(this),this._$CK=new Kt}render(...t){var e;return null!==(e=t.find((t=>!Zt(t))))&&void 0!==e?e:ut}update(t,e){const i=this._$Cwt;let n=i.length;this._$Cwt=e;const s=this._$Cq,o=this._$CK;this.isConnected||this.disconnected();for(let r=0;rthis._$C_t);r++){const t=e[r];if(!Zt(t))return this._$C_t=r,t;r{for(;o.get();)await o.get();const i=s.deref();if(void 0!==i){const n=i._$Cwt.indexOf(t);n>-1&&n