PageSourceSearch

https://www.stam.nl/content/plugins/voorraad/next-dist/js/vehicleFavoriteService.js?ver=1790597457

js stam.nl collected 2026-10-08 09:18:47 UTC 5,958 bytes, 1 lines download raw bytes

1(()=>{"use strict";var e={8382(e,t,i){i.d(t,{A:()=>r});class r{async getSearchResults(e){return await this.getEspResults({payload:{...e,filters:"search"},method:"POST",pathName:"vm/v3"})}async getVehicleData(e){return Array.isArray(e)||(e=[e]),await this.getEspResults({payload:{voertuignr:e},method:"POST",pathName:"vm/v3/vehicles"})}async getEspResults(e){const t=new URL(this.getEndpoint());t.pathname=e.pathName;let i={...e.payload??{},key:this.getPkKey()};if("GET"===e.method){const r=new URLSearchParams(this.getArrayParametersFromRequestData(i));r.append("key",i.key),e.method="GET",i={},t.search="?"+r.toString()}let r=this.getHeaders(e.method??"POST");try{const o=await fetch(t.toString(),{method:e.method??"POST",body:"GET"!==e.method?JSON.stringify(i):void 0,headers:r});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return await o.json()}catch(e){console.error("Not able to retrieve results from ESP"),console.error(e)}}getArrayParametersFromRequestData(e){let t="";for(const i in e)if(e.hasOwnProperty(i)&&Array.isArray(e[i])){const r=e[i].map(e=>[i+"[]",e]);t+="&"+new URLSearchParams(r).toString()}return t}getPkKey(){if(!this.getSettings().key||""===this.getSettings().key)throw"No ESP settings key found";return this.getSettings().key}getEndpoint(){if(!this.getSettings().endpoint||""===this.getSettings().endpoint)throw"No ESP settings endpoint found";return this.getSettings().endpoint}getHeaders(e="POST"){const t={};"GET"!==e&&(t["Content-Type"]="application/json");const i=window.dtcVm?.vm_language;return i&&(t["X-Language"]=i),t}getSettings(){if(!window.dtcVm||!window.dtcVm.esp)throw"No ESP settings found";return window.dtcVm.esp??null}}window.dtcVm=window.dtcVm||{},window.dtcVm.espService=new r},8232(e,t){t.qg=function(e,t){const i=new a,r=e.length;if(r<2)return i;const o=t?.decode||p;let n=0;do{const t=h(e,n,r);if(-1===t)break;const s=d(e,n,r);if(t>s){n=e.lastIndexOf(";",t-1)+1;continue}const a=u(e,n,t);void 0===i[a]&&(i[a]=o(u(e,t+1,s))),n=s+1}while(n<r);return i},t.lK=c,t.lK=c;const i=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,r=/^[\u0021-\u003A\u003C-\u007E]*$/,o=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,n=/^[\u0020-\u003A\u003D-\u007E]*$/,s=Object.prototype.toString,a=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function c(e,t,a){const c="object"==typeof e?e:{...a,name:e,value:String(t)},d="object"==typeof t?t:a,h=d?.encode||encodeURIComponent;if(!i.test(c.name))throw new TypeError(`argument name is invalid: ${c.name}`);const u=c.value?h(c.value):"";if(!r.test(u))throw new TypeError(`argument val is invalid: ${c.value}`);let p=c.name+"="+u;if(void 0!==c.maxAge){if(!Number.isInteger(c.maxAge))throw new TypeError(`option maxAge is invalid: ${c.maxAge}`);p+="; Max-Age="+c.maxAge}if(c.domain){if(!o.test(c.domain))throw new TypeError(`option domain is invalid: ${c.domain}`);p+="; Domain="+c.domain}if(c.path){if(!n.test(c.path))throw new TypeError(`option path is invalid: ${c.path}`);p+="; Path="+c.path}if(c.expires){if(m=c.expires,"[object Date]"!==s.call(m)||!Number.isFinite(c.expires.valueOf()))throw new TypeError(`option expires is invali
1d: ${c.expires}`);p+="; Expires="+c.expires.toUTCString()}var m;if(c.httpOnly&&(p+="; HttpOnly"),c.secure&&(p+="; Secure"),c.partitioned&&(p+="; Partitioned"),c.priority)switch("string"==typeof c.priority?c.priority.toLowerCase():void 0){case"low":p+="; Priority=Low";break;case"medium":p+="; Priority=Medium";break;case"high":p+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${c.priority}`)}if(c.sameSite)switch("string"==typeof c.sameSite?c.sameSite.toLowerCase():c.sameSite){case!0:case"strict":p+="; SameSite=Strict";break;case"lax":p+="; SameSite=Lax";break;case"none":p+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${c.sameSite}`)}return p}function d(e,t,i){const r=e.indexOf(";",t);return-1===r?i:r}function h(e,t,i){const r=e.indexOf("=",t);return r<i?r:-1}function u(e,t,i){let r=t,o=i;do{const t=e.charCodeAt(r);if(32!==t&&9!==t)break}while(++r<o);for(;o>r;){const t=e.charCodeAt(o-1);if(32!==t&&9!==t)break;o--}return e.slice(r,o)}function p(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(t){return e}}}},t={};function i(r){var o=t[r];if(void 0!==o)return o.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,i),n.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var r=i(8232),o=i(8382);class n{constructor(e){this.cookieName=e,this.espService=new o.A,this.store=this.load()}add(e,t={}){this.has(e)||(this.store.push(e),this.sync(this.store,{action:"add",id:e,...t}))}remove(e,t={}){this.has(e)&&(this.store.splice(this.store.indexOf(e),1),this.sync(this.store,{action:"remove",id:e,...t}))}has(e){return-1!==this.getStoreItems().indexOf(e)}all(){return this.getStoreItems()}count(){return this.getStoreItems().length}sync(e,t={}){document.cookie=r.lK(this.cookieName,e.join(","),{expires:this.expiresAt(30),path:"/",encode:e=>e}),this.store=e,window.dispatchEvent(new CustomEvent("stockFavoriteUpdated",{detail:{cookieName:this.cookieName,store:this.store,...t}}))}load(){const e=r.qg(document.cookie)[this.cookieName]??null;return null!==e?e.split(","):[]}getStoreItems(){return Array.isArray(this.store)?this.store.filter(e=>""!==e):[]}async fetch(){return 0===this.count()?Promise.resolve(null):this.espService.getVehicleData(this.store)}expiresAt(e){const t=new Date;return t.setTime(t.getTime()+24*e*60*60*1e3),t}}class s extends n{static instances={};static getInstance(e="default"){if(void 0===s.instances[e]){const t="default"===e?"":`${e}-`;s.instances[e]=new s(`${t}ocmFavoriteVehicles`)}return s.instances[e]}}window.dtcVm=window.dtcVm||{},window.dtcVm.vehicleFavoriteService=s.getInstance(),window.dtcVm.vehicleFavoriteCookieService=s})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.