1"use strict";(self.webpackChunkaem_maven_archetype=self.webpackChunkaem_maven_archetype||[]).push([["components-nameplatevisualiser-models-nameplatevisualiserfeature-model-js","components-tabgroup-tabgroup-js","src_main_webpack_components_nameplatevisualiser_nameplatevisualiser_js"],{74897:function(e,t,i){i.r(t),i.d(t,{default:function(){return a}});var r=i(12285);function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function l(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var a=function(){return e=function e(t,i){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mountElement=t,this.element=i,this.items=Array.from((null===(r=this.element)||void 0===r?void 0:r.children)||[]),this.positionIndex=0,this.mountElement&&this.element&&this.items.length?(this.handleScrollableListBehaviour(),this.init()):console.error("Missing essential elements to use this control.")},t=[{key:"init",value:function(){this.isOverflowing()&&!this.mountElement.querySelector(".NameplateVisualiser__scrollable-list__cta-container")&&(this.mountElement.classList.add("NameplateVisualiser__scrollable-list-container"),this.element.classList.add("NameplateVisualiser__scrollable-list"),this.manageNavigation())}},{key:"handleScrollableListBehaviour",value:function(){var e=this,t=null;window.addEventListener("resize",function(){t&&cancelAnimationFrame(t),t=requestAnimationFrame(function(){e.isOverflowing()?e.init():e.destroyScrollableList()})})}},{key:"destroyScrollableList",value:function(){this.element.classList.contains("NameplateVisualiser__scrollable-list")&&(this.mountElement.classList.remove("NameplateVisualiser__scrollable-list-container"),this.element.classList.remove("NameplateVisualiser__scrollable-list"),this.mountElement.querySelectorAll(".NameplateVisualiser__scrollable-list__cta-container").forEach(function(e){return e.remove()}))}},{key:"isOverflowing",value:function(){return this.element.scrollWidth>this.element.clientWidth}},{key:"addNavigation",value:function(){var e=this,t=this.element.getAttribute("id"),i=t||"scrollElementId-".concat(uuid());t||this.element.setAttribute("id",i);var n=(0,r.Kp)("div",["NameplateVisualiser__scrollable-list__cta-container","NameplateVisualiser__scrollable-list__cta-container--prev"]),l=(0,r.Kp)("button",["NameplateVisualiser__scrollable-list__arrow","NameplateVisualiser__scrollable-list__arrow--prev"]),o=(0,r.Kp)("span",["icon-chevronleft-evo-jaguar"]),a=(0,r.Kp)("div",["NameplateVisualiser__scrollable-list__cta-container","NameplateVisualiser__scrollable-list__cta-container--next"]),s=(0,r.Kp)("button",["NameplateVisualiser__scrollable-list__arrow","NameplateVisualiser__scrollable-list__arrow--next"]),c=(0,r.Kp)("span",["icon-chevronright-evo-jaguar"]);l.appendChild(o),s.appendChild(c),l.addEventListener("click",function(){return e.stepScrollbar(-1)}),s.addEventListener("click",function(){return e.stepScrollbar(1)}),this.previousCtaContainer=n,this.nextCtaContainer=a,this.previousCtaContainer.appendChild(l),this.nextCtaContainer.appendChild(s),this.mountElement.appendChild(this.nextCtaContainer),this.mountElement.appendChild(this.previousCtaContainer)}},{key:"manageNavigation",value:function(){this.addNavigation(),this.addDragListener(),this.updateScrollPosition()}},{key:"normalizeIndex",value:function(e,t){return Math.min(Math.max(e,0),t.length-1)}},{key:"stepScrollbar",value:function(e){this.positionIndex=e<0?this.positionIndex-=1:this.positionIndex+=1;var t=this.normalizeIndex(this.positionIndex,this.items),i=(this.items[t].offsetWidth||70)+parseFloat(getComputedStyle(this.element).gap),r=this.element.scrollWidth-this.element.offsetWidth,n=this.element.scrollLeft+e*i;n<0&&(n=0),n>r&&(n=r),this.element.scrollTo({left:n,behavior:"smooth"})}},{key:"goToScrollPosition",value:function(e){this.positionIndex=1,this.element.scrollTo({left:e.offsetX,behavior:"smooth"})}},{key:"updateScrollPosition",value:function(){var e=this.element.scrollWidth-this.element.offsetWidth;this.element.scrollLeft<=0?(this.previousCtaContainer.classList.add("NameplateVisualiser__scrollable-list__cta-container--hidden"),this.mountElement.classList.add("NameplateVisualiser__scrollable-list-container--previous-hidden")):(this.previousCtaContainer.classList.remove("NameplateVisualiser__scrollable-list__cta-container--hidden"),this.mountElement.classList.remove("NameplateVisualiser__scrollable-list-container--previous-hidden")),this.element.scrollLeft>=e?(this.nextCtaContainer.classList.add("NameplateVisualiser__scrollable-list__cta-container--hidden"),this.mountElement.classList.add("NameplateVisualiser__scrollable-list-container--next-hidden")):(this.nextCtaContainer.classList.remove("NameplateVisualiser__scrollable-list__cta-container--hidden"),this.mountElement.classList.remove("NameplateVisualiser__scrollable-list-container--next-hidden"))}},{key:"hasScroll",value:function(){return this.element.scrollWidth-this.element.offsetWidth>0}},{key:"startThumbDrag",value:function(e){var t,i=this,r=e.pageX,n=parseFloat((null===(t=this.scrollbarThumb)||void 0===t?void 0:t.style.transform.replace("translateX(","").replace("px)",""))||"0")||0,l=function(e){if(i.scrollbarThumb&&i.element){var t=e.pageX-r,l=i.scrollbar.offsetWidth-i.scrollbarThumb.offsetWidth,o=Math.min(Math.max(0,n+t),l)/l;i.element.scrollLeft=o*(i.element.scrollWidth-i.element.offsetWidth)}},o=function(){document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",o)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",o)}},{key:"addDragListener",value:function(){var e,t,i=this;null===(e=this.element)||void 0===e||e.addEventListener("mousedown",function(e){var t;i.isDragging=!0,i.startX=e.pageX-((null===(t=i.element)||void 0===t?void 0:t.offsetLeft)||0),i.scrollLeft=i.element.scrollLeft}),null===(t=this.element)||void 0===t||t.addEventListener("mousemove",function(e){var t;if(i.isDragging){var r=1.5*(e.pageX-((null===(t=i.element)||void 0===t?void 0:t.offsetLeft)||0)-i.startX);i.element.scrollLeft=i.scrollLeft-r}}),document.addEventListener("mouseup",function(){i.isDragging=!1}),this.element.addEventListener("scroll",function(){return i.updateScrollPosition()})}}],t&&l(e.prototype,t),i&&l(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,i}()},16933:function(e,t,i){i.r(t),i.d(t,{default:function(){return V}});var r=i(78777),n=i(85924),l=i(32347),o=i(72242),a=i(45868),s=i(80607),c=["enabled"];function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function d(){var e,t,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",n=i.toStringTag||"@@toStringTag";function l(i,r,n,l){var s=r&&r.prototype instanceof a?r:a,c=Object.create(s.prototype);return h(c,"_invoke",function(i,r,n){var l,a,s,c=0,u=n||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,i){return l=t,a=0,s=e,h.n=i,o}};function p(i,r){for(a=i,s=r,t=0;!d&&c&&!n&&t<u.length;t++){var n,l=u[t],p=h.p,f=l[2];i>3?(n=f===r)&&(s=l[(a=l[4])?5:(a=3,3)],l[4]=l[5]=e):l[0]<=p&&((n=i<2&&p<l[1])?(a=0,h.v=r,h.n=l[1]):p<f&&(n=i<3||l[0]>r||r>f)&&(l[4]=i,l[5]=r,h.n=f,a=0))}if(n||i>1)return o;throw d=!0,r}return function(n,u,f){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),a=u,s=f;(t=a<2?e:s)||!d;){l||(a?a<3?(a>1&&(h.n=-1),p(a,s)):h.n=s:h.v=s);
1try{if(c=2,l){if(a||(n="next"),t=l[n]){if(!(t=t.call(l,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,a<2&&(a=0)}else 1===a&&(t=l.return)&&t.call(l),a<2&&(s=TypeError("The iterator does not provide a '"+n+"' method"),a=1);l=e}else if((t=(d=h.n<0)?s:i.call(r,h))!==o)break}catch(t){l=e,a=1,s=t}finally{c=1}}return{value:t,done:d}}}(i,n,l),!0),c}var o={};function a(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(h(t={},r,function(){return this}),t),p=c.prototype=a.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,h(e,n,"GeneratorFunction")),e.prototype=Object.create(p),e}return s.prototype=c,h(p,"constructor",c),h(c,"constructor",s),s.displayName="GeneratorFunction",h(c,n,"GeneratorFunction"),h(p),h(p,n,"Generator"),h(p,r,function(){return this}),h(p,"toString",function(){return"[object Generator]"}),(d=function(){return{w:l,m:f}})()}function h(e,t,i,r){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}h=function(e,t,i,r){if(t)n?n(e,t,{value:i,enumerable:!r,configurable:!r,writable:!r}):e[t]=i;else{var l=function(t,i){h(e,t,function(e){return this._invoke(t,i,e)})};l("next",0),l("throw",1),l("return",2)}},h(e,t,i,r)}function p(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function f(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?p(Object(i),!0).forEach(function(t){b(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):p(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function v(e,t,i,r,n,l,o){try{var a=e[l](o),s=a.value}catch(e){return void i(e)}a.done?t(s):Promise.resolve(s).then(r,n)}function y(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,m(r.key),r)}}function b(e,t,i){return(t=m(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function m(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}function g(e){return 1+(1.1-1)*e}var S=function(){function e(t){var i=t.getTrigger,r=t.progressTarget,n=t.onStart,l=t.onEnd;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),b(this,"getTrigger",void 0),b(this,"progressTarget",void 0),b(this,"onStart",void 0),b(this,"onEnd",void 0),b(this,"scrollTrigger",null),b(this,"animationState",null),b(this,"gsapModule",null),b(this,"lastProgress",0),b(this,"initPromise",null),b(this,"isPaused",!1),this.getTrigger=i,this.progressTarget=r,this.onStart=n,this.onEnd=l}return t=e,i=[{key:"init",value:function(){return this.initPromise||(this.initPromise=this.setupScrollExpansion()),this.initPromise}},{key:"sync",value:function(){var e,t=this;if(this.scrollTrigger){var i=this.scrollTrigger.progress;this.lastProgress=i,null===(e=this.animationState)||void 0===e||e.update(i),this.applyScaleToAllCanvases(i)}else this.init().then(function(){return t.applyScaleToAllCanvases(t.lastProgress)})}},{key:"pause",value:function(){var e;this.isPaused=!0,null===(e=this.scrollTrigger)||void 0===e||e.disable()}},{key:"resume",value:function(){var e;this.isPaused=!1,null===(e=this.scrollTrigger)||void 0===e||e.enable(!1,!0)}},{key:"destroy",value:function(){var e,t,i=this.getScaleTargets();if(null===(e=this.scrollTrigger)||void 0===e||e.kill(),this.scrollTrigger=null,null===(t=this.animationState)||void 0===t||t.reset(),this.animationState=null,this.initPromise=null,this.lastProgress=0,this.isPaused=!1,i.length){var r=function(e){e.set(i,{clearProps:"scale,transformOrigin"})};this.gsapModule?r(this.gsapModule.gsap):(0,o.aD)().then(function(e){return r(e.gsap)})}this.gsapModule=null}},{key:"getScaleTargets",value:function(){return this.progressTarget?Array.from(this.progressTarget.querySelectorAll(".CPlayer__innerdiv")):[]}}
1,{key:"applyScaleToAllCanvases",value:function(e){var t=this,i=this.getScaleTargets();if(i.length){var r=function(t){t.set(i,{scale:g(e),transformOrigin:"center center"})};this.gsapModule?r(this.gsapModule.gsap):(0,o.aD)().then(function(e){t.gsapModule=e,r(e.gsap)})}}},{key:"setupScrollExpansion",value:(n=d().m(function e(){var t,i,r,n=this;return d().w(function(e){for(;;)switch(e.n){case 0:if((t=this.getTrigger())&&this.progressTarget){e.n=1;break}return e.a(2);case 1:if(!(0,s.C)()){e.n=2;break}return e.a(2);case 2:return e.n=3,(0,o.aD)();case 3:this.gsapModule=e.v,i=this.gsapModule.ScrollTrigger,this.animationState=(0,a.J)({target:t,progressTarget:this.progressTarget,transitionClassPrefix:"image-expansion-animation",onStart:this.onStart?function(e){return n.onStart(f(f({},e),{},{trigger:t,progressTarget:n.progressTarget}))}:void 0,onEnd:this.onEnd?function(e){return n.onEnd(f(f({},e),{},{trigger:t,progressTarget:n.progressTarget}))}:void 0}),r=function(e){var t;n.lastProgress=e,null===(t=n.animationState)||void 0===t||t.update(e),n.applyScaleToAllCanvases(e)},this.scrollTrigger=i.create({trigger:t,start:"clamp(center bottom)",end:"clamp(center center)",scrub:!0,invalidateOnRefresh:!0,onUpdate:function(e){return r(e.progress)}}),this.isPaused&&this.scrollTrigger.disable(),r(this.scrollTrigger.progress);case 4:return e.a(2)}},e,this)}),l=function(){var e=this,t=arguments;return new Promise(function(i,r){var l=n.apply(e,t);function o(e){v(l,i,r,o,a,"next",e)}function a(e){v(l,i,r,o,a,"throw",e)}o(void 0)})},function(){return l.apply(this,arguments)})}],r=[{key:"create",value:function(t){if(!t.enabled)return null;t.enabled;var i=function(e,t){if(null==e)return{};var i,r,n=function(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)i=l[r],-1===t.indexOf(i)&&{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}(t,c);return new e(i)}}],i&&y(t.prototype,i),r&&y(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,i,r,n,l}(),w=i(27300),_=["carouselOnly","slides","useBackground","enableImageExpansionAnimation"];function C(e){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(e)}function A(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function E(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?A(Object(i),!0).forEach(function(t){T(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):A(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function T(e,t,i){return(t=O(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function L(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,O(r.key),r)}}function O(e){var t=function(e,t){if("object"!=C(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=C(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==C(t)?t:t+""}var I={exterior:"exterior",interior:"interior",wheels:"exterior"},V=function(){return e=function e(t){var i,r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.rootElement=t,this.panelContainer=this.rootElement.querySelector(".NameplateVisualiser__vehicleView-panelContainer");var l=n.carouselOnly,o=n.slides,a=n.useBackground,s=n.enableImageExpansionAnimation,c=function(e,t){if(null==e)return{};var i,r,n=function(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)i=l[r],-1===t.indexOf(i)&&{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}(n,_);this.currentSlideIndex=0,this.cplayerInitOptions=c,this.cplayerApiKey=this.cplayerInitOptions.apiKey,this.showCarouselOnly=l,this.useBackgroun
1d=null==a||a,this.slides=o,this.getDocument=null,this.selectedModelId=null,this.pagination=null,this.imageExpansion=S.create(E({enabled:null!=s&&s,getTrigger:function(){return r.rootElement.querySelector(".NameplateVisualiser__view-grid")},progressTarget:this.rootElement},(0,w.$)("nameplatevisualiser"))),null===(i=this.imageExpansion)||void 0===i||i.init()},t=[{key:"renderAll",value:function(e){var t;this.cplayerInitOptions.apiKey&&(this.selectedModelId=e,this.renderExteriorCplayer(),this.showCarouselOnly||(this.renderInteriorCplayer(),this.renderWheelsCplayer(),null===(t=this.imageExpansion)||void 0===t||t.sync()))}},{key:"init",value:function(e){if(this.cplayerInitOptions.apiKey){if("function"!=typeof this.getDocument&&"function"!=typeof e)throw new Error("You must provide a function that returns Rules Connect vehicle data in order to render CPlayer");this.getDocument=e}}},{key:"goToSlide",value:function(e){this.currentSlideIndex=e,this.cplayerGallery.goToSlide(e)}},{key:"renderExteriorCplayer",value:function(){var e,t=this,i=this.panelContainer.querySelector('section[aria-hidden="false"] [data-exterior-view]'),r={container:i,apiKey:this.cplayerApiKey,slides:this.slides,paginationType:"number",initialSlide:this.currentSlideIndex,analytics:l.default.analytics},o={container:i,frame:0,vehicle:this.getDocument(),view:"exterior",useBackground:this.useBackground,currentSlide:this.currentSlideIndex,onRenderCompleteCallback:function(){var e;null===(e=t.imageExpansion)||void 0===e||e.sync()}};this.cplayerGallery=new n.Ay(i,r);var a=this.cplayerGallery.getDxArrowNavigation();null==a||a.goToItem(this.currentSlideIndex),this.pagination=this.cplayerGallery.getDxPagination(),null===(e=this.pagination)||void 0===e||e.setSelectedIndex(this.currentSlideIndex),this.cplayerGallery.on("slideChange",function(e){var i=e.index;t.currentSlideIndex=i}),this.cplayerGallery.render(E({},o))}},{key:"renderView",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if("exterior"===e)return this.renderExteriorCplayer();var n=this.panelContainer.querySelector('section[aria-hidden="false"] [data-'.concat(e,"-view]")),l="".concat(this.selectedModelId,"-").concat(e),o={apiKey:this.cplayerApiKey,frame:i,vehicle:this.getDocument(),view:I[e],useBackground:!0},a=new r.A(n,o,l);a.on("renderComplete",function(){var e;null===(e=t.imageExpansion)||void 0===e||e.sync()}),a.render(o);var s=a.activeCplayer,c=a.outgoingCplayer;return s.classList.toggle("NameplateVisualiser__canvas-container",!0),s.toggleAttribute("data-".concat(e,"-cplayer"),!0),c.classList.toggle("NameplateVisualiser__outbound-canvas-container",!0),c.toggleAttribute("data-".concat(e,"-cplayer-outbound"),!0),a}},{key:"renderInteriorCplayer",value:function(){return this.renderView("interior")}},{key:"renderWheelsCplayer",value:function(){return this.renderView("wheels",1)}},{key:"setPaginationVisibility",value:function(e){this.pagination&&this.pagination.element.classList.toggle("DxPagination--hidden",!e)}}],t&&L(e.prototype,t),i&&L(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,i}()},97704:function(e,t,i){i.r(t),i.d(t,{default:function(){return a}});var r=i(40443);function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function l(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var a=function(){return e=function e(t,i,r,n,l,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.RCApi=i,this.setId(t),this.setTitle(t),this.setPrice(t),this.setImage(t),this.setErrorMessage(n),this.setCardId(r),this.setMoreInformationLabel(l),this.setSelected(!1),this.setContentList(t),this.setExtendedDescription(t),this.setHasAccessoryProperty(t),this.setAccessoriesDisclaimer(o)},(t=[{key:"setHasAccessoryProperty",value:function(e){this.accessoryPropertyValue=e.hasAccessoryProperty}},{key:"setAccessoriesDisclaimer",value:function(e){this.accessoriesDisclaimer=e}},{key:"setContentList",value:function(e){var t;null!=e&&null!==(t=e.property)&&void 0!==t&&t.ContentList?this.contentList=r.A.getPropertyContent(e.property.ContentList):this.contentList=null}},{key:"setExtendedDescription",value:function(e){var t;this.extendedDescription=null!=e&&null!==(t=e.property)&&void 0!==t&&t.ExtendedDescription?r.A.getPropertyContent(e.property.ExtendedDescription):""}},{key:"setSelected",value:function(e){this.selected=e}},{key:"setMoreInformationLabel",value:function(e){this.moreInformationLabel=e}},{key:"setErrorMessage",value:function(e){this.errorMessage='Authored Card ID "'.concat(this.getId(),'" doesn\'t exist for Nameplate ID "').concat(e,'".')}},{key:"setCardId",value:function(e){this.cardId="".concat(e,"-").concat(this.getId())}},{key:"setId",value:function(e){this.id=e.id}},{key:"setPrice",value:function(e){var t,i=null==e||null===(t=e.price)||void 0===t?void 0:t.GROSS;this.price=i?this.RCApi.getFormattedPrice(null==i?void 0:i.value,
1null==i?void 0:i.currency):""}},{key:"setTitle",value:function(e){this.title=r.A.getDescription(e.description)}},{key:"setImage",value:function(e){var t,i,r,n=null!==(t=null==e||null===(i=e.media)||void 0===i?void 0:i.findIndex(function(e){return"thumb"===e.purpose}))&&void 0!==t?t:0;this.image=null==e||null===(r=e.media)||void 0===r||null===(r=r[n])||void 0===r?void 0:r.url}},{key:"getTitle",value:function(){return this.title}},{key:"getImage",value:function(){return this.image}},{key:"getPrice",value:function(){return this.price}},{key:"getId",value:function(){return this.id}},{key:"getCardId",value:function(){return this.cardId}},{key:"getErrorMessage",value:function(){return this.errorMessage}},{key:"getMoreInformationLabel",value:function(){return this.moreInformationLabel}},{key:"getSelected",value:function(){return this.selected}},{key:"getExtendedDescription",value:function(){return this.extendedDescription}},{key:"getContentList",value:function(){return this.contentList}},{key:"getAccessoriesDisclaimer",value:function(){return this.accessoriesDisclaimer}},{key:"hasAccessoryProperty",value:function(){return this.accessoryPropertyValue}}])&&l(e.prototype,t),i&&l(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,i}()},31431:function(e,t,i){i.r(t),i.d(t,{default:function(){return Q}});var r=i(37380),n=i(40443),l=i(71202),o=i(19871),a=i(23684),s=i(32347),c=i(83889),u=i(74897),d=i(60841),h=i(16933),p=i(85444),f=i(51236),v=i(90150),y=i(16786);function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function m(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return g(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?g(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function S(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_(r.key),r)}}function w(e,t,i){return(t=_(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _(e){var t=function(e,t){if("object"!=b(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==b(t)?t:t+""}var C=function(){return e=function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),w(this,"rcApi",void 0),w(this,"currentlyViewingLabel",void 0),this.currentlyViewingLabel=i,this.rcApi=t},(t=[{key:"getCarouselCardClassNames",value:function(e,t){var i,r=["carousel-selector__card"];return t===(null===(i=e.data)||void 0===i?void 0:i.id)&&r.push("carousel-selector__card--selected"),r.join(" ")}},{key:"buildModelCurrentlyViewingLabel",value:function(e,t){return this.currentlyViewingLabel?'<span class="'.concat(["carousel-selector__card-content-currently-viewing"].join(" "),'">').concat(this.currentlyViewingLabel,"</span>"):""}},{key:"buildModelDescription",value:function(e){return e.description?'<h5 class="carousel-selector__card-content-description">'.concat(e.description,"</h5>"):""}},{key:"buildSvLogo",value:function(e){var t,i;return null!==(t=e.data)&&void 0!==t&&null!==(t=t.property)&&void 0!==t&&t.HaloType&&"SV"===(null===(i=e.data)||void 0===i||null===(i=i.property)||void 0===i?void 0:i.HaloType)?'<span class="icon icon-d
1x-svo carousel-selector__card-content-sv-logo"></span>':""}},{key:"buildModelPrice",value:function(e,t,i,r){var l,o,a,s,c;if(!r)return"";var u=n.A.getFeature("BODYSTYLE",this.rcApi.getDocument(),[t].filter(Boolean)),d=u&&u.length>0?u[0]:null,h=null!==(l=null==d||null===(o=d.property)||void 0===o||null===(o=o["HideRegisterCompatibility.PRODUCT"])||void 0===o?void 0:o.split(" "))&&void 0!==l?l:[],p=(null!==(a=null===(s=e.data)||void 0===s||null===(s=s.property)||void 0===s?void 0:s["HideRegisterCompatibility.PRODUCT"])&&void 0!==a?a:"").split(" ").map(function(e){return h.includes(e)?e:null}).filter(Boolean),f=n.A.getFeature("PRODUCT",this.rcApi.getDocument(),p.filter(Boolean)),v=null==f?void 0:f.map(function(e){var t,i=null===(t=e.price)||void 0===t||null===(t=t.RETAIL)||void 0===t?void 0:t.value;return i?Number(i):null}).filter(Boolean),b=0;return v&&(b=Number(Math.min.apply(Math,m(v)))),!b||Number.isNaN(b)?"":(b=Number(Number.isInteger(b)?b:Number(b).toFixed(2)),Number.isFinite(Number(b))?'<p class="carousel-selector__card-content-price">'.concat(i," ").concat((0,y.A)(b,null===(c=this.rcApi.resources)||void 0===c||null===(c=c.metadata)||void 0===c||null===(c=c.meta)||void 0===c?void 0:c["currency-format"]),"</p>"):"")}},{key:"buildCaveat",value:function(e,t){if(!t)return"";var i=this.getCompatibleEngineFeatureForCaveat(e);return i?'\n <p class="carousel-selector__card-content-caveat">'.concat(i,"</p>\n "):""}},{key:"buildModelFuelTypePill",value:function(e){return'\n <li class="carousel-selector__card-content-pill-container">\n <span class="carousel-selector__card-content-pill">'.concat(e,"</span>\n </li>\n ")}},{key:"getCommonFuelTypeKeys",value:function(e,t){var i=n.A.getFeature("BODYSTYLE",this.rcApi.getDocument(),[t].filter(Boolean)),r=i&&i.length>0?i[0]:null,l=r?n.A.getFeatureCompatibility(r,"FUEL_TYPE"):[],o=e.data?n.A.getFeatureCompatibility(e.data,"FUEL_TYPE"):[];return l.filter(function(e){return o.includes(e)})}},{key:"shouldRenderModelByPowertrain",value:function(e,t,i,r){if(!i)return!0;var n=this.getCommonFuelTypeKeys(e,t),l=(null!=r?r:[]).map(function(e){return e.toUpperCase()});return n.some(function(e){return l.includes(e)})}},{key:"buildModelFuelTypePills",value:function(e,t,i,r,n){var l=this;if(i)return"";var o=this.getCommonFuelTypeKeys(e,t);if(r){var a=(null!=n?n:[]).map(function(e){return e.toUpperCase()});o=o.filter(function(e){return a.includes(e)})}var s=o.sort(function(e,t){return"H"===e?-1:"H"===t?1:0});if(s.includes("D")&&s.includes("P")){var c=s.indexOf("D");s.splice(c,1);var u=s.indexOf("P");s.splice(u,1),s.push(["D","P"])}var d=s.map(function(e){return"string"==typeof e?l.rcApi.getFuelTypeLabel(e):"object"===b(e)&&Array.isArray(e)?e.map(function(e){return l.rcApi.getFuelTypeLabel(e)}).join("/"):null}).filter(Boolean);return d.length?'\n <ul class="carousel-selector__card-content-pills">\n '.concat(d.map(function(e){return l.buildModelFuelTypePill(e)}).join(""),"\n </ul>\n "):""}},{key:"buildModelImage",value:function(e){var t;return'\n <div class="carousel-selector__card-content-image carousel-selector__card-content-image__'.concat(null===(t=e.data)||void 0===t?void 0:t.id,'">\n <div class="carousel-selector__card-content-image--horizontal"></div>\n <div class="carousel-selector__card-content-image--rotated"></div>\n </div>\n ')}},{key:"buildModelFeaturesTrigger",value:function(e,t,i){var r,n;return null!==(r=e.data)&&void 0!==r&&r.id?'\n <a href="#" class="carousel-selector__card-features-trigger" aria-expanded="false" id="accordion-label-'.concat(null===(n=e.data)||void 0===n?void 0:n.id,'" role="button">\n <span class="carousel-selector__card-features-trigger-icon"></span>\n <span class="carousel-selector__card-features-trigger-text-onclose">').concat(t,'</span>\n <span class="carousel-selector__card-features-trigger-text-onopen">').concat(i,"</span>\n </a>\n "):""}},{key:"getFeaturesListFromModel",value:function(e){var t,i=null==e||null===(t=e.data)||void 0===t||null===(t=t.property)||void 0===t?void 0:t.ModelCardSummary;if(!i)return[];var r=Object.keys(i)[0];if(void 0===r)return[];var n=i[r],l=[];try{l=JSON.parse(n)}catch(e){l=[]}return l}},{key:"getPrevModelDescription",value:function(e,t,i){return i||t?!i&&t?"\n <p><strong>".concat(t,"</strong></p>\n "):null!=i&&i.description?"\n <p><strong>".concat(i.description).concat(e,"</strong></p>\n "):"":""}},{key:"getFeatureList",value:function(e,t){var i=this.getFeaturesListFromModel(e),r=this.getFeaturesListFromModel(t).map(function(e){return e.id});return i.filter(function(e){return!r.includes(e.id)})}},{key:"decodeEntities",value:function(e){var t=document.createElement("textarea");return t.innerHTML=null!=e?e:"",t.value}},{key:"buildModelFeaturesList",value:function(e,t,i,r){var n=this,l=this.getFeatureList(e,r);return l=l.filter(function(e){return e.title||e.extendedDescription}),'\n <div class="carousel-selector__card-features-content">\n '.concat(this.getPrevModelDescription(t,i,r),"\n ").concat(l.map(function(e){var t;return"<p>- ".concat(null!==(t=n.decodeEntities(e.title))&&void 0!==t?t:n.decodeEntities(e.extendedDescription),"</p>")}).join(""),"\n </div>\n ")}},{key:"buildModelCta",value:function(e,t,i){return'\n <li class="carousel-selector__card-features-cta carousel-selector__card-features-cta--'.concat(e,'">\n <a class="secondary-link" aria-label="').concat(t,'" href="').concat(null!=i?i:"#",'" target="_self" title="').concat(t,'">
1\n <span class="cta-content">').concat(t,"</span>\n </a>\n </li>\n ")}},{key:"generateCustomiseLink",value:function(e){var t,i=null===(t=e.data)||void 0===t||null===(t=t.query)||void 0===t?void 0:t.find(function(e){return"with"===e.type}),r=((null==i?void 0:i.href)||"").split("/").filter(Boolean),n=null==r?void 0:r[3],l=null==r?void 0:r[5];return this.rcApi.getVehicleURL(null,n,l)}},{key:"buildModelCtas",value:function(e,t,i){return'\n <ul class="carousel-selector__card-features-ctas">\n '.concat(this.buildModelCta("customise",e),"\n ").concat(this.buildModelCta("explore",t,i),"\n </ul>\n ")}},{key:"getCompatibleEngineFeatureForCaveat",value:function(e){var t,i,r,l,o=(null!==(t=null===(i=e.data)||void 0===i||null===(i=i.property)||void 0===i?void 0:i["HideRegisterCompatibility.ENGINE"])&&void 0!==t?t:"").split(" "),a=n.A.getFeature("ENGINE",this.rcApi.getDocument(),o.filter(Boolean)).find(function(e){var t;return Boolean(null==e||null===(t=e.property)||void 0===t?void 0:t.EngineCo2Description)});if(null==a||null===(r=a.property)||void 0===r||!r.EngineCo2Description)return"";var s=Object.keys(a.property.EngineCo2Description);return s.length>0?null===(l=a.property.EngineCo2Description)||void 0===l?void 0:l[s[0]]:""}},{key:"buildSlide",value:function(e){var t,i,r=e.model,n=e.previousModel,l=e.selectedId,o=e.pricePrefix,a=e.hideAccordionTitle,s=e.showAccordionTitle,c=e.featuresTitleSuffix,u=e.defaultSpecificationsTitle,d=e.customisationsTitle,h=e.exploreSpecificationsTitle,p=e.exploreSpecificationsLink,f=e.enableCo2Description,v=e.selectedBodystyleId,y=e.showPrice,b=e.powertrainFilterEnabled,m=e.powertrainIds;return'\n <div class="swiper-slide carousel-selector__slide">\n <div class="'.concat(this.getCarouselCardClassNames(r,l),'" data-carousel-selector-model-id="').concat(null===(t=r.data)||void 0===t?void 0:t.id,'">\n <button class="carousel-selector__card-button-top">\n ').concat(this.buildModelCurrentlyViewingLabel(r,l),'\n <div class="carousel-selector__card-content">\n <div class="carousel-selector__card-content-info">\n ').concat(this.buildModelDescription(r),"\n ").concat(this.buildSvLogo(r),"\n ").concat(this.buildModelPrice(r,v,o,y),"\n ").concat(this.buildModelFuelTypePills(r,v,f,b,m),"\n ").concat(this.buildCaveat(r,f),"\n </div>\n ").concat(this.buildModelImage(r),"\n </div>\n </button>\n ").concat(this.buildModelFeaturesTrigger(r,a,s),'\n <div class="carousel-selector__card-features" aria-labelledby="accordion-label-').concat(null===(i=r.data)||void 0===i?void 0:i.id,'">\n <div class="carousel-selector__card-features-inner">\n ').concat(this.buildModelImage(r),"\n ").concat(this.buildModelFuelTypePills(r,v,f,b,m),"\n ").concat(this.buildModelFeaturesList(r,c,u,n),"\n ").concat(this.buildModelCtas(d,h,p),"\n </div>\n </div>\n </div>\n </div>\n ")}}])&&S(e.prototype,t),i&&S(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,i}(),A=i(78777);function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function T(e){return function(e){if(Array.isArray(e))return L(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return L(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?L(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function O(){var e,t,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",n=i.toStringTag||"@@toStringTag";function l(i,r,n,l){var s=r&&r.prototype instanceof a?r:a,c=Object.create(s.prototype);return I(c,"_invoke",function(i,r,n){var l,a,s,c=0,u=n||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,i){return l=t,a=0,s=e,h.n=i,o}};function p(i,r){for(a=i,s=r,t=0;!d&&c&&!n&&t<u.length;t++){var n,l=u[t],p=h.p,f=l[2];i>3?(n=f===r)&&(s=l[(a=l[4])?5:(a=3,3)],l[4]=l[5]=e):l[0]<=p&&((n=i<2&&p<l[1])?(a=0,h.v=r,h.n=l[1]):p<f&&(n=i<3||l[0]>r||r>f)&&(l[4]=i,l[5]=r,h.n=f,a=0))}if(n||i>1)return o;throw d=!0,r}return function(n,u,f){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),a=u,s=f;(t=a<2?e:s)||!d;){l||(a?a<3?(a>1&&(h.n=-1),p(a,s)):h.n=s:h.v=s);
1try{if(c=2,l){if(a||(n="next"),t=l[n]){if(!(t=t.call(l,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,a<2&&(a=0)}else 1===a&&(t=l.return)&&t.call(l),a<2&&(s=TypeError("The iterator does not provide a '"+n+"' method"),a=1);l=e}else if((t=(d=h.n<0)?s:i.call(r,h))!==o)break}catch(t){l=e,a=1,s=t}finally{c=1}}return{value:t,done:d}}}(i,n,l),!0),c}var o={};function a(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(I(t={},r,function(){return this}),t),d=c.prototype=a.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,I(e,n,"GeneratorFunction")),e.prototype=Object.create(d),e}return s.prototype=c,I(d,"constructor",c),I(c,"constructor",s),s.displayName="GeneratorFunction",I(c,n,"GeneratorFunction"),I(d),I(d,n,"Generator"),I(d,r,function(){return this}),I(d,"toString",function(){return"[object Generator]"}),(O=function(){return{w:l,m:h}})()}function I(e,t,i,r){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}I=function(e,t,i,r){if(t)n?n(e,t,{value:i,enumerable:!r,configurable:!r,writable:!r}):e[t]=i;else{var l=function(t,i){I(e,t,function(e){return this._invoke(t,i,e)})};l("next",0),l("throw",1),l("return",2)}},I(e,t,i,r)}function V(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function k(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?V(Object(i),!0).forEach(function(t){D(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):V(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function P(e,t,i,r,n,l,o){try{var a=e[l](o),s=a.value}catch(e){return void i(e)}a.done?t(s):Promise.resolve(s).then(r,n)}function N(e){return function(){var t=this,i=arguments;return new Promise(function(r,n){var l=e.apply(t,i);function o(e){P(l,r,n,o,a,"next",e)}function a(e){P(l,r,n,o,a,"throw",e)}o(void 0)})}}function x(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,M(r.key),r)}}function D(e,t,i){return(t=M(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function M(e){var t=function(e,t){if("object"!=E(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==E(t)?t:t+""}var j=function(){return e=function e(t){var i=t.rootElement,r=t.modelCodes,n=t.rcApi,l=t.bodyStylesToDisplay,o=t.onChangeId,a=t.selectedBodystyleId,s=t.showPrice,c=t.currentlyViewingLabel,u=t.powertrainFilterEnabled,d=t.powertrainIds;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),D(this,"rcApi",void 0),D(this,"cPlayerApiKey",""),D(this,"selectedBodystyleId",void 0),D(this,"showPrice",void 0),D(this,"currentlyViewingLabel",void 0),D(this,"bodyStylesToDisplay",void 0),D(this,"viewBuilder",void 0),D(this,"selectors",{carouselSelector:".NameplateVisualiser__carousel-selector",carouselSelectorWrapper:".NameplateVisualiser__carousel-wrapper",carouselSelectorControls:".NameplateVisualiser__carousel-controls",carouselSelectorPrev:".NameplateVisualiser__carousel-prev",carouselSelectorNext:".NameplateVisualiser__carousel-next",root:".NameplateVisualiser",headline:".NameplateVisualiser__header",panel:".NameplateVisualiser__vehicleView-panelContainer"}),D(this,"rootElement",void 0),D(this,"modelCodes",null),D(this,"carouselSelector",null),D(this,"elements",{carouselSelector:null,carouselSelectorWrapper:null,carouselSelectorControls:null,carouselSelectorPrev:null,carouselSelectorNext:null,root:null,headline:null,panel:null}),D(this,"_wrapperVisible",!1),D(this,"wrapperVisibilityTimeout",null),D(this,"models",[]),D(this,"_selectedId",""),D(this,"onChangeId",void 0),D(this,"_scrollbarHandlerWidth",0),D(this,"_scrollbarHandlerOffsetX",0),D(this,"pricePrefix","Price From"),D(this,"showAccordionTitle","SHOW MORE"),D(this,"hideAccordionTitle","HIDE"),D(this,"featuresTitleSuffix"," features, plus:"),D(this,"defaultSpecificationsTitle","Includes:"),D(this,"customisationsTitle","CUSTOMISE"),D(this,"exploreSpecificationsTitle","EXPLORE SPECIFICATIONS"),D(this,"exploreSpecificationsLink",""),D(this,"enableCo2Description",!1),D(this,"powertrainFilterEnabled",!1),D(this,"powertrainIds",[]),D(this,"swiperOptions",{init:!1,watchSlidesProgress:!0,spaceBetween:8,allowTouchMove:!0,slidesPerView:1,slidesOffsetBefore:0,slidesOffsetAfter:0,scrollbar:{el:".NameplateVisualiser__carousel-scrollbar",dragClass:"NameplateVisualiser__carousel-scrollbar-drag",hide:!1,draggable:!0,enabled:!0},breakpoints:{768:{spaceBetween:12,slidesPerView:2},1280:{spaceBetween:24,slidesPerView:3}},modules:[v.Ze]}),D(this,"automaticallySelectFirst",!0),this.rootElement=i,this.rcApi=n,this.selectedBodystyleId=a,this.showPrice=s,this.currentlyViewingLabel=c,this.bodyStylesToDisplay=l,this.viewBuilder=new C(n,c),this.onChangeId=o,this.powertrainFilterEnabled=null!=u&&u,this.powertrainIds=null!=d?d:[],this.setupFeaturesAccordion=this.setupFeaturesAccordion.bind(this),this.setupSlidesVisibility=this.setupSlidesVisibility.bind(this),this.cPlayerApiKey=this.rootElement.dataset.cplayerApiKey||this.cPlayerApiKey,this.pricePrefix=this.rootElement.dataset.pricePrefix||this.pricePrefix,this.showAccordionTitle=this.rootElement.dataset.showAccordionTitle||this.showAccordionTitle,this.hideAccordionTitle=this.rootElement.dataset.hideAccordionTitle||this.hideAccordionTitle,this.featuresTitleSuffix=this.rootElement.dataset.featuresTitleSuffix||this.featuresTitleSuffix,this.defaultSpecificationsTitle=this.rootElement.dataset.defaultSpecificationsTitle||this.defaultSpecificationsTitle,this.customisationsTitle=this.rootElement.dataset.customisationsTitle||this.customisationsTitle,this.exploreSpecificationsTitle=this.rootElement.dataset.exploreSpecificationsTitle||this.exploreSpecificationsTitle,this.exploreSpecificationsLink=this.rootElement.dataset.exploreSpecificationsLink||this.exploreSpecificationsLink,this.enableCo2Description="true"===this.rootElement.dataset.enableCo2Description||this.enableCo2Description,this.run(r,a),this.initCarouselControls()},t=[{key:"scrollbarHandlerWidth",get:function(){return this._scrollbarHandlerWidth}
1,set:function(e){this._scrollbarHandlerWidth=e;var t=this.rootElement.querySelector(".carousel-selector__scrollbar");null==t||t.style.setProperty("--scrollbar-handler-width","".concat(e,"%"))}},{key:"scrollbarHandlerOffsetX",get:function(){return this._scrollbarHandlerOffsetX},set:function(e){this._scrollbarHandlerOffsetX=e;var t=this.rootElement.querySelector(".carousel-selector__scrollbar");null==t||t.style.setProperty("--scrollbar-handler-offset-x","".concat(this._scrollbarHandlerOffsetX,"%"))}},{key:"selectedId",get:function(){return this._selectedId},set:function(e){if(this._selectedId!==e){var t,i;this._selectedId=e;var r=null===(t=this.elements.carouselSelector)||void 0===t?void 0:t.querySelector(".carousel-selector__card--selected"),n=null===(i=this.elements.carouselSelectorWrapper)||void 0===i?void 0:i.querySelector('[data-carousel-selector-model-id="'.concat(e,'"]'));r&&r.classList.remove("carousel-selector__card--selected"),n&&n.classList.add("carousel-selector__card--selected"),this.onChangeId(e)}this.setupSlidesVisibility()}},{key:"wrapperVisible",get:function(){return this._wrapperVisible},set:function(e){var t;this._wrapperVisible=e,null===(t=this.elements.carouselSelectorWrapper)||void 0===t||t.classList.toggle("carousel-selector__wrapper--loading",!e)}},{key:"getVehiclesObj",value:(l=N(O().m(function e(t){var i,r,l,o,a,s,c,u=this;return O().w(function(e){for(;;)switch(e.n){case 0:if(l=t.useSelectedId,o=t.vehicle,a=t.selections,!l||!o){e.n=1;break}return e.a(2,D({},this.selectedId,o));case 1:return s=null!=o?o:null===(i=(r=this.rcApi).getDocument)||void 0===i?void 0:i.call(r),c={},e.n=2,Promise.all(this.models.map(function(){var e=N(O().m(function e(t){var i,r,l,d,h,p;return O().w(function(e){for(;;)switch(e.n){case 0:if(d=null===(i=t.data)||void 0===i?void 0:i.id){e.n=1;break}return e.a(2);case 1:if(!o||d!==u.selectedId){e.n=2;break}return c[d]=o,e.a(2);case 2:if(h=null!==(r=n.A.buildHrefWithSelections(s,k(k({},a),{},{MODEL:d})))&&void 0!==r?r:null===(l=t.data)||void 0===l||null===(l=l.query)||void 0===l||null===(l=l[0])||void 0===l?void 0:l.href){e.n=3;break}return e.a(2);case 3:return e.n=4,u.rcApi.loadJsonp(h,!1).catch(function(){});case 4:(p=e.v)&&(c[d]=p);case 5:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:return e.a(2,c)}},e,this)})),function(e){return l.apply(this,arguments)})},{key:"generateCanvases",value:(r=N(O().m(function e(t){var i,r,n,l,o,a=this;return O().w(function(e){for(;;)switch(e.n){case 0:return i=t.useSelectedId,r=t.vehicle,n=t.selections,l=i?[this.selectedId]:this.models.map(function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.id}).filter(function(e){return Boolean(e)}),e.n=1,this.getVehiclesObj({useSelectedId:i,vehicle:r,selections:n});case 1:o=e.v,l.forEach(function(e){if(null!=o&&o[e]){var t=["horizontal","rotated"],i=[1,0],r=["exterior","exterior"];["wheels","exterior"].forEach(function(n,l){var s="carousel-selector__card-content-image",c=".".concat(s,"__").concat(CSS.escape(e)," .").concat(s,"--").concat(t[l]),u=a.rootElement.querySelectorAll(c);Array.from(u).forEach(function(t){var n={apiKey:a.cPlayerApiKey,useBackground:!1,frame:i[l],view:r[l],vehicle:null==o?void 0:o[e]};t.cplayer=void 0,new A.A(t,n).render(n)})})}});case 2:return e.a(2)}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"run",value:function(e,t){var i,r,n,l=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=this.selectedBodystyleId!==t;if(this.selectedBodystyleId=t,!(null===(i=this.modelCodes)||void 0===i?void 0:i.every(function(t,i){return t===e[i]}))||!this.modelCodes||a){this.modelCodes=e,this.getModelsData(),this.models=this.getRenderableModels(this.models),this.populateElements();var s=this.models.length>0&&(null===(r=this.models[0].data)||void 0===r?void 0:r.id)||"";if(this.automaticallySelectFirst)this._selectedId=s;else{var c,u=null===(c=this.models.find(function(e){var t;return"selected"===(null===(t=e.data)||void 0===t?void 0:t.availability)}))||void 0===c||null===(c=c.data)||void 0===c?void 0:c.id;this._selectedId=null!=u?u:s}var d=null!==(n=this.models.findIndex(function(e){var t;return(null===(t=e.data)||void 0===t?void 0:t.id)===l.selectedId}))&&void 0!==n?n:0;this.scrollbarHandlerWidth=100/this.models.length,this.scrollbarHandlerOffsetX=100*d,this.carouselSelector&&this.carouselSelector.destroy(),this.carouselSelector=new f.A(this.selectors.carouselSelector,this.swiperOptions),setTimeout(function(){var e,t;(null===(e=l.carouselSelector)||void 0===e?void 0:e.slides.every(function(e){return e.classList.contains("carousel-selector__slide--fully-visible")}))||null===(t=l.carouselSelector)||void 0===t||t.slideTo(d)},100),this.setupCarouselControlsVisibility(),this.buildSlides(),this.initListeners(),this.generateCanvase
1s(k(k({},o),{},{useSelectedId:!1}))}}},{key:"handleWrapperAnimation",value:function(){var e=this;this.wrapperVisible=!1,this.wrapperVisibilityTimeout&&clearTimeout(this.wrapperVisibilityTimeout),this.wrapperVisibilityTimeout=setTimeout(function(){e.wrapperVisible=!0},1200)}},{key:"populateElements",value:function(){var e=this.rootElement.querySelector(this.selectors.root);this.elements={root:e,carouselSelector:this.rootElement.querySelector(this.selectors.carouselSelector),carouselSelectorWrapper:this.rootElement.querySelector(this.selectors.carouselSelectorWrapper),carouselSelectorControls:this.rootElement.querySelector(this.selectors.carouselSelectorControls),carouselSelectorPrev:this.rootElement.querySelector(this.selectors.carouselSelectorPrev),carouselSelectorNext:this.rootElement.querySelector(this.selectors.carouselSelectorNext),headline:(null==e?void 0:e.querySelector(this.selectors.headline))||null,panel:(null==e?void 0:e.querySelector(this.selectors.panel))||null}}},{key:"setupSlidesVisibility",value:function(){var e;null===(e=this.carouselSelector)||void 0===e||e.slides.forEach(function(e){var t=e.getBoundingClientRect(),i=t.left<0||t.left+t.width>window.innerWidth;e.classList.toggle("carousel-selector__slide--fully-visible",!i),e.querySelectorAll(".carousel-selector__card-features-cta a").forEach(function(e){return e.setAttribute("tabindex","-1")});var r=e.querySelector(".carousel-selector__card-features-trigger-text-onclose");null==r||r.setAttribute("inert","true")})}},{key:"handleControlsVisibility",value:function(){if(this.carouselSelector){var e,t,i=this.elements,r=i.carouselSelectorPrev,n=i.carouselSelectorNext,l=this.carouselSelector,o=l.isBeginning,a=l.isEnd,s="carousel-selector--fade";null==r||r.classList.toggle(s,o),null==n||n.classList.toggle(s,a);var c=null===(e=this.carouselSelector)||void 0===e?void 0:e.isLocked;null===(t=this.elements.carouselSelector)||void 0===t||t.classList.toggle("NameplateVisualiser__carousel-selector--locked",c)}}},{key:"setupCarouselControlsVisibility",value:function(){var e=this;this.carouselSelector&&(setTimeout(function(){e.setupSlidesVisibility(),e.handleControlsVisibility()},300),this.carouselSelector.off("reachEnd"),this.carouselSelector.off("reachBeginning"),this.carouselSelector.off("slideChange"),this.carouselSelector.off("slideChangeTransitionEnd"),this.carouselSelector.off("activeIndexChange"),this.carouselSelector.on("reachEnd",function(){setTimeout(function(){e.setupSlidesVisibility(),e.handleControlsVisibility()},300)}),this.carouselSelector.on("reachBeginning",function(){setTimeout(function(){e.setupSlidesVisibility(),e.handleControlsVisibility()},300)}),this.carouselSelector.on("slideChange",function(){setTimeout(function(){e.carouselSelector&&(e.scrollbarHandlerOffsetX=100*e.carouselSelector.realIndex),e.setupSlidesVisibility(),e.handleControlsVisibility()},300)}),this.carouselSelector.on("slideChangeTransitionEnd",function(){setTimeout(function(){e.setupSlidesVisibility(),e.handleControlsVisibility()},300)}),this.carouselSelector.on("activeIndexChange",function(){setTimeout(function(){e.setupSlidesVisibility(),e.handleControlsVisibility()},300)}))}},{key:"initCarouselControls",value:function(){var e,t,i=this;this.carouselSelector&&(null===(e=this.elements.carouselSelectorPrev)||void 0===e||e.addEventListener("click",function(){var e;null===(e=i.carouselSelector)||void 0===e||e.slidePrev()}),null===(t=this.elements.carouselSelectorNext)||void 0===t||t.addEventListener("click",function(){var e;null===(e=i.carouselSelector)||void 0===e||e.slideNext()}))}},{key:"initListeners",value:function(){var e,t,i=this,r=null===(e=this.elements.carouselSelectorWrapper)||void 0===e?void 0:e.querySelectorAll("[data-carousel-selector-model-id] .carousel-selector__card-button-top");null==r||r.forEach(function(e,t){var r;e.addEventListener("click",function(r){var n,l;r.stopPropagation(),null!==(n=e.parentElement)&&void 0!==n&&n.dataset.carouselSelectorModelId&&(i.selectedId=e.parentElement.dataset.carouselSelectorModelId);var o=e.getBoundingClientRect();(o.left<0||o.left+o.width>window.innerWidth)&&(null===(l=i.carouselSelector)||void 0===l||l.slideTo(t))}),null===(r=e.parentElement)||void 0===r||r.addEventListener("click",function(){return e.click()})});var n=null===(t=this.elements.carouselSelectorWrapper)||void 0===t?void 0:t.querySelectorAll(".carousel-selector__card-features-trigger");
1null==n||n.forEach(function(e){e.addEventListener("click",function(t){var r,n;t.preventDefault(),t.stopPropagation(),null===(r=i.elements.root)||void 0===r||r.classList.toggle("NameplateVisualiser--expanded");var l="true"===e.getAttribute("aria-expanded")?"false":"true",o="true"===l;e.setAttribute("aria-expanded",l);var a=null===(n=i.elements.root)||void 0===n?void 0:n.querySelectorAll(".carousel-selector__card-features-ctas .carousel-selector__card-features-cta a");(a?Array.from(a):[]).forEach(function(t){var i=e.querySelector(".carousel-selector__card-features-trigger-text-onclose"),r=e.querySelector(".carousel-selector__card-features-trigger-text-onopen");o?(t.removeAttribute("tabindex"),null==i||i.removeAttribute("inert"),null==r||r.setAttribute("inert","true")):(t.setAttribute("tabindex","-1"),null==i||i.setAttribute("inert","true"),null==r||r.removeAttribute("inert"))})})}),this.setupFeaturesAccordion(),window.addEventListener("resize",this.setupFeaturesAccordion),document.body.addEventListener("click",function(e){var t=e.target;if(Boolean(t.closest(".carousel-selector__card-features-cta--customise"))){e.preventDefault(),e.stopPropagation();var i=document.querySelector(".NameplateVisualiser__vehicleView-panelContainer");null==i||i.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}})}},{key:"setupFeaturesAccordion",value:function(){var e,t,i=this,r=null===(e=this.elements.carouselSelectorWrapper)||void 0===e?void 0:e.querySelectorAll(".carousel-selector__card-features"),n=null===(t=this.elements.carouselSelectorWrapper)||void 0===t?void 0:t.querySelectorAll(".carousel-selector__card-features-inner"),l=Array.from(null!=n?n:[]).map(function(e){return i.calculateFeatureInner(e)}),o=Math.max.apply(Math,T(l));null==r||r.forEach(function(e){e.style.setProperty("--features-max-height",o+20+"px")})}},{key:"calculateFeatureInner",value:function(e){var t=e.querySelector(".carousel-selector__card-content-image"),i=(null==t?void 0:t.getBoundingClientRect().height)||0,r=e.querySelector(".carousel-selector__card-content-pills"),n=(null==r?void 0:r.getBoundingClientRect().height)||0,l=r&&window.getComputedStyle(r).marginTop?Number.parseInt(window.getComputedStyle(r).marginTop,10):0,o=e.querySelectorAll(".carousel-selector__card-features-content p"),a=Array.from(o).reduce(function(e,t){var i=t&&window.getComputedStyle(t).marginTop?Number.parseInt(window.getComputedStyle(t).marginTop,10):0;return e+t.getBoundingClientRect().height+i},0),s=e.querySelector(".carousel-selector__card-features-ctas");return i+n+l+a+((null==s?void 0:s.getBoundingClientRect().height)||0)+(s&&window.getComputedStyle(s).marginTop?Number.parseInt(window.getComputedStyle(s).marginTop,10):0)}},{key:"getModelsData",value:function(){var e,t,i=this;this.models=null!==(e=null===(t=this.modelCodes)||void 0===t?void 0:t.map(function(e){var t=i.rcApi.getModel(e);return{isHidden:i.rcApi.isHidden(t),data:t,description:i.rcApi.getDescription(null==t?void 0:t.description)}}))&&void 0!==e?e:[]}},{key:"getRenderableModels",value:function(e){var t=this;return e.filter(function(e){return t.viewBuilder.shouldRenderModelByPowertrain(e,t.selectedBodystyleId,t.powertrainFilterEnabled,t.powertrainIds)})}},{key:"buildSlides",value:function(){var e,t=this;this.elements.carouselSelectorWrapper&&(this.elements.carouselSelectorWrapper.innerHTML="");var i={customisationsTitle:this.customisationsTitle,exploreSpecificationsTitle:this.exploreSpecificationsTitle,exploreSpecificationsLink:this.exploreSpecificationsLink,featuresTitleSuffix:this.featuresTitleSuffix,defaultSpecificationsTitle:this.defaultSpecificationsTitle,hideAccordionTitle:this.hideAccordionTitle,showAccordionTitle:this.showAccordionTitle,pricePrefix:this.pricePrefix,selectedId:this.selectedId,enableCo2Description:this.enableCo2Description,selectedBodystyleId:this.selectedBodystyleId,showPrice:this.showPrice,powertrainFilterEnabled:this.powertrainFilterEnabled,powertrainIds:this.powertrainIds};this.models.forEach(function(e,r){var n,l,o,a=t.viewBuilder.buildSlide(k(k({},i),{},{model:e,previousModel:r>0?t.models[r-1]:void 0})),s=(l=a,(o=document.createElement("div")).innerHTML=l.trim(),o.firstChild);s&&(null===(n=t.elements.carouselSelectorWrapper)||void 0===n||n.appendChild(s))}
1),null===(e=this.carouselSelector)||void 0===e||e.init(),this.setupSlidesVisibility()}}],t&&x(e.prototype,t),i&&x(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,i,r,l}(),R=i(97704),B=i(74621);function q(e){return q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(e)}function F(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function G(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?F(Object(i),!0).forEach(function(t){U(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):F(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function U(e,t,i){return(t=$(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function H(){var e,t,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",n=i.toStringTag||"@@toStringTag";function l(i,r,n,l){var s=r&&r.prototype instanceof a?r:a,c=Object.create(s.prototype);return W(c,"_invoke",function(i,r,n){var l,a,s,c=0,u=n||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,i){return l=t,a=0,s=e,h.n=i,o}};function p(i,r){for(a=i,s=r,t=0;!d&&c&&!n&&t<u.length;t++){var n,l=u[t],p=h.p,f=l[2];i>3?(n=f===r)&&(s=l[(a=l[4])?5:(a=3,3)],l[4]=l[5]=e):l[0]<=p&&((n=i<2&&p<l[1])?(a=0,h.v=r,h.n=l[1]):p<f&&(n=i<3||l[0]>r||r>f)&&(l[4]=i,l[5]=r,h.n=f,a=0))}if(n||i>1)return o;throw d=!0,r}return function(n,u,f){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),a=u,s=f;(t=a<2?e:s)||!d;){l||(a?a<3?(a>1&&(h.n=-1),p(a,s)):h.n=s:h.v=s);try{if(c=2,l){if(a||(n="next"),t=l[n]){if(!(t=t.call(l,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,a<2&&(a=0)}else 1===a&&(t=l.return)&&t.call(l),a<2&&(s=TypeError("The iterator does not provide a '"+n+"' method"),a=1);l=e}else if((t=(d=h.n<0)?s:i.call(r,h))!==o)break}catch(t){l=e,a=1,s=t}finally{c=1}}return{value:t,done:d}}}(i,n,l),!0),c}var o={};function a(){}function s(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(W(t={},r,function(){return this}),t),d=c.prototype=a.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,W(e,n,"GeneratorFunction")),e.prototype=Object.create(d),e}return s.prototype=c,W(d,"constructor",c),W(c,"constructor",s),s.displayName="GeneratorFunction",W(c,n,"GeneratorFunction"),W(d),W(d,n,"Generator"),W(d,r,function(){return this}),W(d,"toString",function(){return"[object Generator]"}),(H=function(){return{w:l,m:h}})()}function W(e,t,i,r){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}W=function(e,t,i,r){if(t)n?n(e,t,{value:i,enumerable:!r,configurable:!r,writable:!r}):e[t]=i;else{var l=function(t,i){W(e,t,function(e){return this._invoke(t,i,e)})};l("next",0),l("throw",1),l("return",2)}},W(e,t,i,r)}function K(e){return function(e){if(Array.isArray(e))return X(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return X(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?X(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function Y(e,t,i,r,n,l,o){try{var a=e[l](o),s=a.value}catch(e){return void i(e)}a.done?t(s):Promise.resolve(s).then(r,n)}function z(e){return function(){var t=this,i=arguments;return new Promise(function(r,n){var l=e.apply(t,i);function o(e){Y(l,r,n,o,a,"next",e)}function a(e){Y(l,r,n,o,a,"throw",e)}o(void 0)})}}function J(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,$(r.key),r)}}function $(e){var t=function(e,t){if("object"!=q(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=q(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==q(t)?t:t+""}var Z={lrdx:"lr",jdx:"jag"},Q=function(){return e=function e(t){var i,n,l,o,a,s,c,u,d,f,v,y,b,m,g=this,S=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.element=t,this.configBaseUrl=t.getAttribute("data-configurator-base-url"),this.rulesEngineBaseUrl=t.getAttribute("data-rules-engine-base-url"),this.brand=t.getAttribute("data-brand"),this.cplayerApiKey=t.getAttribute("data-cplayer-api-key"),this.nameplate_code=t.getAttribute("data-nameplate-id"),this.locale=t.getAttribute("data-locale"),this.showPrice="true"===t.getAttribute("data-show-price"),this.currentlyViewingLabel=t.getAttribute("data-currently-viewing-label"),this.bodystyle_ids=null!==(i=null===(n=t.getAttribute("data-body-style-ids"))||void 0===n?void 0:n.split(",").map(function(e){return e.toUpperCase()}))&&void 0!==i?i:[],this.selectedBodystyleId=null!==(l=null===(o=this.bodystyle_ids)||void 0===o?void 0:o[0])&&void 0!==l?l:null,this.useBodyStyles=t.hasAttribute("data-use-body-styles"),this.model_info=JSON.parse(this.element.getAttribute("data-models-info"))||null,this.model_codes=[],this.selectedModelId=null,this.moreInformationLabel=t.getAttribute("data-more-information-label"),this.closeLabel=t.getAttribute("data-modal-close-label"),this.enableImageExpansionAnimation=null===(a=t.parentElement)||void 0===a?void 0:a.classList.contains("image-expansion-animation"),this.powertrainFilterEnabled="true"===t.getAttribute("data-powertrain-filter"),this.powertrainIds=null!==(s=null===(c=t.getAttribute("data-powertrain-ids"))||void 0===c?void 0:c.split(",").map(function(e){return e.toUpperCase()}))&&void 0!==s?s:[],this.exteriorTabLabel=this.element.getAttribute("data-exterior-tab-label"),this.interiorTabLabel=this.element.getAttribute("data-interior-tab-label"),this.wheelsTabLabel=this.element.getAttribute("data-wheels-tab-label"),this.wrapper=t.querySelector(".NameplateVisualiser"),this.panelContainer=t.querySelector(".NameplateVisualiser__vehicleView-panelC
1ontainer"),this.vehicleViewnew=t.querySelector(".NameplateVisualiser__vehicleView"),this.vehicle=null,this.modalCountLabel=t.getAttribute("data-modal-count-label"),this.exteriorColourCodes=this.element.getAttribute("data-exterior-paint-colour-ids"),this.interiorColourCodes=this.element.getAttribute("data-interior-trim-ids"),this.wheelCodes=this.element.getAttribute("data-wheels-ids"),this.modelLimit=parseInt(this.element.getAttribute("data-model-limit"),10),Number.isNaN(this.modelLimit)&&(this.modelLimit=1/0),this.swatchLimit=parseInt(this.element.getAttribute("data-swatch-limit"),10),Number.isNaN(this.swatchLimit)&&(this.swatchLimit=8),null!==(u=this.model_info)&&void 0!==u&&u.length&&(this.model_codes=this.model_info.map(function(e){return e.modelId})),this.enableModelVisualiser="true"===(null===(d=this.element)||void 0===d?void 0:d.dataset.enableModelVisualiser),this.enableSwatchThumnailsBorder=null===(f=this.element)||void 0===f?void 0:f.dataset.swatchThumbnailBorderEnabled,this.nameplateVisualiserInfoOverlay=new p.default(this.element,this.closeLabel,this.showPrice),this.swatchIdSettings={ACCESSORIES:{renderSwatch:!1,showSwatchLabel:!1,showAdditionalLabel:!1,showOverlayButton:!1},PACKS:{renderSwatch:!1,showSwatchLabel:!1,showAdditionalLabel:!1,showOverlayButton:!1},WHEELS:{renderSwatch:!0,showSwatchLabel:!0,showAdditionalLabel:!1,showOverlayButton:!0},INTERIOR:{renderSwatch:!0,showSwatchLabel:!0,showAdditionalLabel:!1,showOverlayButton:!0},EXTERIOR:{renderSwatch:!0,showSwatchLabel:!0,showAdditionalLabel:!0,showOverlayButton:!1}},this.getDocumentFunc=function(){return g.vehicle},this.resetController=new AbortController,this.slidesOverride=["exterior-0","exterior-1","exterior-2"],this.features=this.constructFeatures(JSON.parse(this.element.getAttribute("data-additional-features"))||null),S.isEmbedded&&(this.isEmbedded=!0,this.wrapper.classList.toggle("NameplateVisualiser--embedded",!0),this.configureEmbedded(S.embedOptions),this.getDocumentFunc=null!==(m=S.embedOptions.getDocument)&&void 0!==m?m:this.getDocumentFunc),this.appendDynamicSection(),this.showCarouselOnly&&this.wrapper.classList.toggle("NameplateVisualiser--carouselOnly",!0),this.isAuthoring=this.element.hasAttribute("data-log-error"),this.selectedSwatchTab=null===(v=this.features[0])||void 0===v?void 0:v.featureType,this.exteriorViewCPlayer=null,this.cplayerInitOptions={apiKey:this.cplayerApiKey,debug:!1,carouselOnly:this.showCarouselOnly,slides:this.slidesOverride,useBackground:this.cplayerUseBackground,enableImageExpansionAnimation:this.enableImageExpansionAnimation},this.isEmbedded&&null!==(y=S.embedOptions)&&void 0!==y&&y.RCApi||(this.RCApi=null!==(b=window.RCApi)&&void 0!==b?b:window.RCApi=r.A),this.cplayer=new h.default(this.element,this.cplayerInitOptions),this.modelsSelector=null,this.lastSelections={},this.featureCardList=[],this.isEmbedded||this.init()},t=[{key:"configureEmbedded",value:function(e){var t,i,r,n,l,o,a,s,c;if(!e)throw new Error("Options are required for embedded nameplate visualiser");if(this.configBaseUrl=e.configBaseUrl,this.rulesEngineBaseUrl=e.rulesEngineBaseUrl,this.brand=e.brand,this.nameplate_code=e.nameplateCode,this.locale=e.locale,e.RCApi&&(this.RCApi=e.RCApi),!e.modelOptions)throw new Error("Model options are required for embedded nameplate visualiser");if(this.bodystyle_ids=e.modelOptions.bodystyleIds,this.useBodyStyles=e.modelOptions.useBodyStyles,this.model_codes=e.modelOptions.modelCodes,this.selectedModel=e.modelOptions.selectedModel,this.shouldHideUnsupportedModels=e.modelOptions.shouldHideUnsupportedModels,this.validModelCodes=null!==(t=null===(i=e.modelOptions.validModelCodes)||void 0===i?void 0:i.map(function(e){return e.toUpperCase()}))&&void 0!==t?t:[],this.modelLimit=null!==(r=e.modelOptions.modelLimit)&&void 0!==r?r:1/0,!e.swatchOptions)throw new Error("Swatch options are required for embedded nameplate visualiser");if(this.exteriorTabLabel=null!==(n=e.swatchOptions.exteriorTabLabel)&&void 0!==n?n:this.exteriorTabLabel,this.interiorTabLabel=null!==(l=e.swatchOptions.interiorTabLabel)&&void 0!==l?l:this.interiorTabLabel,this.wheelsTabLabel=null!==(o=e.swatchOptions.wheelsTabLabel)&&void 0!==o?o:this.wheelsTabLabel,this.features=null!==(a=e.swatchOptions.features)&&void 0!==a?a:this.features,this.swatchLimit=null!==(s=e.swatchOptions.swatchLimit)&&void 0!==s?s:8,this.defaultSwatchAlwaysFirst=e.swatchOptions.defaultSwatchAlwaysFirst,this.defaultSelectedSwatches={exterior:e.swatchOptions.defaultExteriorSwatch,interior:e.swatchOptions.defaultInteriorSwatch,wheels:e.swatchOptions.defaultWheelsSwatch},!e.cplayerOptions)throw new Error("CPlayer API key is required for embedded nameplate visualiser");this.cplayerApiKey=e.cplayerOptions.cplayerApiKey,this.showCarouselOnly=e.cplayerOptions.carouselOnly,this.slidesOverride=null===(c=e.cplayerOptions.carouselOptions)||void 0===c?void 0:c.slides,this.cplayerUseBackgroun
1d=e.cplayerOptions.useBackground}},{key:"getFirstAuthored",value:function(e){var t;return"string"==typeof e&&null!=e&&null!==(t=e.includes)&&void 0!==t&&t.call(e,",")?e.split(",")[0]:""}},{key:"getFirstAvailableOption",value:function(e){var t;return"string"!=typeof(null==e?void 0:e.featureIds)?"":null===(t=e.featureIds)||void 0===t?void 0:t.split(",")[0]}},{key:"init",value:(A=z(H().m(function e(){var t;return H().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,this.brand&&Z[this.brand]?this.RCApi.brand=Z[this.brand]:this.RCApi.brand=this.brand,this.RCApi.base_url=this.rulesEngineBaseUrl,this.RCApi.configBaseUrl=this.configBaseUrl,this.RCApi.nameplate_code=this.nameplate_code.toString(),this.RCApi.model_codes=K(this.model_codes),this.RCApi.locale=this.locale,this.defaultSelectedSwatches={exterior:this.getFirstAuthored(this.exteriorColourCodes)||this.getFirstAvailableOption(this.features[0]),interior:this.getFirstAuthored(this.interiorColourCodes)||this.getFirstAvailableOption(this.features[1]),wheels:this.getFirstAuthored(this.wheelCodes)||this.getFirstAvailableOption(this.features[2])},e.n=1,this.setVehicle();case 1:if(!this.useBodyStyles){e.n=2;break}return e.n=2,this.renderBodyStyleList();case 2:if(!this.useBodyStyles||!this.isEmbedded||1!==this.bodystyle_ids.length){e.n=3;break}return e.n=3,this.setCompatibleModels(this.RCApi.getBodyStyle(this.bodystyle_ids[0]));case 3:this.runModelsSelector(),this.initTabs(),this.useBodyStyles&&this.handleIncompatibleModelTabs(),this.bindEvents(),e.n=6;break;case 4:if(e.p=4,t=e.v,this.isAuthoring){e.n=5;break}return e.a(2);case 5:this.element.querySelector(".NameplateVisualiser__error").classList.add("NameplateVisualiser__error--visible"),this.element.querySelector(".NameplateVisualiser__error-message").textContent=t;case 6:return e.a(2)}},e,this,[[0,4]])})),function(){return A.apply(this,arguments)})},{key:"setVehicle",value:(C=z(H().m(function e(t){var i,r,l,o,a,s,c,u;return H().w(function(e){for(;;)switch(e.n){case 0:return t||(a=Object.values(this.defaultSelectedSwatches).filter(function(e){return e}),o=new URL("/rc/".concat(this.RCApi.brand,"/").concat(this.RCApi.locale,"/").concat(this.RCApi.nameplate_code,"/_/").concat(this.selectedModel||"_","/").concat(a.join("_"),".jsonp?view=personalise"),this.rulesEngineBaseUrl)),e.n=1,this.RCApi.loadJsonp(null!=t?t:null===(i=o)||void 0===i?void 0:i.toString());case 1:s=e.v,this.vehicle=s,this.lastVehicleUrl=null!=t?t:null===(r=o)||void 0===r?void 0:r.toString(),this.setAccessoriesDisclaimerMessage(this.RCApi.getClientResources()),(c=this.element.querySelector(".NameplateVisualiser")).classList.remove("NameplateVisualiser--loading"),this.fetchVehicle(),u=this.RCApi.getVehicleDetails(),c.setAttribute("data-selected-brand",null==u||null===(l=u.property)||void 0===l?void 0:l.BrandFamily),this.models=n.A.getModels(this.vehicle,[]),this.showPrice&&this.renderFromPrice();case 2:return e.a(2)}},e,this)})),function(e){return C.apply(this,arguments)})},{key:"fetchVehicle",value:function(){var e=this,t=this.RCApi.getExteriorColours()||[],i=this.RCApi.getInteriorColours()||[],r=this.RCApi.getWheels()||[],l=n.A.getAccessories(this.vehicle)||[],o=n.A.getPacksInformation(this.vehicle)||[];this.vehicleDetails={exterior:t,interior:i,wheels:r,accessories:l,packs:o},this.defaultSwatchAlwaysFirst&&(this.vehicleDetails.exterior=t.sort(function(t){return e.defaultAvailable(t)?-1:1}),this.vehicleDetails.interior=i.sort(function(t){return e.defaultAvailable(t)?-1:1}),this.vehicleDetails.wheels=r.sort(function(t){return e.defaultAvailable(t)?-1:1}),this.vehicleDetails.accessories=l.sort(function(t){return e.defaultAvailable(t)?-1:1}),this.vehicleDetails.packs=o.sort(function(t){return e.defaultAvailable(t)?-1:1}))}},{key:"fetchSwatchData",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=this.vehicleDetails[e.toLowerCase()],n=r&&r.filter(function(e){return!t.RCApi.isHidden(e)});return i?n.find(function(e){return(null==e?void 0:e.id)===i}):n}},{key:"initSelectedTab",value:function(){var e;this.panelContainer=this.element.querySelector(".NameplateVisualiser__vehicleView-panelC
1ontainer"),this.cplayer.renderAll(this.selectedModelId),null===(e=this.modelsSelector)||void 0===e||e.generateCanvases({vehicle:this.vehicle,useSelectedId:!0})}},{key:"handleBodyStyleResult",value:function(e){return e?Array.isArray(e)?e:[e[0]]:[]}},{key:"renderBodyStyleList",value:(_=z(H().m(function e(){var t,i,r,n,l,a,s,c,u,d,h,p,f=this;return H().w(function(e){for(;;)switch(e.n){case 0:if(t=this.handleBodyStyleResult(this.RCApi.getBodyStyles(this.bodystyle_ids)),i=null,i=null==t?void 0:t.filter(function(e){return f.RCApi.getCompatibleModels(e.compatibility,f.model_codes).length>0}),r=this.bodystyle_ids.filter(function(e){return!t.some(function(t){var i;return(null===(i=t.id)||void 0===i?void 0:i.toUpperCase())===(null==e?void 0:e.toUpperCase())})}).map(function(e){return{id:e,description:e}}),this.bodyStylesToDisplay=this.isAuthoring?[].concat(K(t),K(r)):i,0!==t.length){e.n=1;break}throw new Error("No valid bodystyles provided for nameplate ID ".concat(this.nameplate_code));case 1:if(this.bodyStylesToDisplay.length&&(this.model_codes.length||0!==this.modelLimit)){e.n=2;break}return null==(n=this.element.querySelector(".bodyStyleSelector"))||n.classList.add("bodyStyleSelector--hidden"),e.a(2);case 2:if(1!==this.bodyStylesToDisplay.length){e.n=5;break}if(this.RCApi.bodystyleId=i[0].id,null==(l=this.element.querySelector(".bodyStyleSelector"))||l.classList.add("bodyStyleSelector--hidden"),a=this.RCApi.getBodyStyle(i[0].id)){e.n=3;break}return e.a(2);case 3:return e.n=4,this.setCompatibleModels(a);case 4:e.n=7;break;case 5:if(c=this.element.querySelector(".bodyStyleDropdown"),u=this.element.querySelector(".bodyStyleRadioGroup"),c&&(this.bodyStyleSelect=new o.A(c,{name:"nameplate-bodystyle-select"}),this.bodyStyleSelect.on("change",function(e){var t=f.RCApi.getBodyStyle(e.value);t&&f.handleBodyStyleSelect(t)},{signal:this.resetController.signal})),this.bodyStylesToDisplay.forEach(function(e){var t,n,l=f.RCApi.getDescription(null==e?void 0:e.description),o=null===(t=e.id)||void 0===t?void 0:t.toUpperCase();null===(n=f.bodyStyleSelect)||void 0===n||n.createOption(l,o);var a=document.createElement("div");a.style.position="relative";var s=document.createElement("input"),c=document.createElement("label");return a.classList.add("form-control","form-control--inline"),s.setAttribute("type","radio"),s.setAttribute("name","bodystyle"),s.setAttribute("id","bodystyle-radio-".concat(e.id)),c.setAttribute("for","bodystyle-radio-".concat(e.id)),c.innerText=l.toUpperCase(),a.appendChild(s),a.appendChild(c),null==u||u.appendChild(a),f.isAuthoring&&r.some(function(t){return t.id===e.id})?(s.setAttribute("disabled",!0),void(0,B.createErrorTooltipForElement)(a,'Bodystyle ID "'.concat(e.id,' is not a valid bodystyle for Nameplate ID "').concat(f.nameplate_code,'".'),{placement:"start"})):f.isAuthoring&&!i.some(function(t){var i,r;return(null===(i=t.id)||void 0===i?void 0:i.toUpperCase())===(null===(r=e.id)||void 0===r?void 0:r.toUpperCase())})?(s.setAttribute("disabled",!0),void(0,B.createErrorTooltipForElement)(a,'No valid models found for bodystyle ID "'.concat(e.id,'".'),{placement:"start"})):void s.addEventListener("click",function(){f.handleBodyStyleSelect(f.RCApi.getBodyStyle(e.id))},{signal:f.resetController.signal})}),d=this.RCApi.getSelectedFeature("BODYSTYLE"),h=i.some(function(e){return e.id===d.id}),p=h?d:this.RCApi.getBodyStyle(null===(s=i[0])||void 0===s?void 0:s.id)){e.n=6;break}return e.a(2);case 6:return e.n=7,this.handleBodyStyleSelect(p);case 7:return e.a(2)}},e,this)})),function(){return _.apply(this,arguments)})},{key:"setCompatibleModels",value:(w=z(H().m(function e(t){var i,r,l,o,a,s=this;return H().w(function(e){for(;;)switch(e.n){case 0:return l=null==t||null===(i=t.query)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.href,e.n=1,this.setVehicle(l);case 1:this.compatibleModels=n.A.getCompatibleItems(this.vehicle,"MODEL",{BODYSTYLE:[null==t?void 0:t.id]}).map(function(e){return e.id}),o=null===(r=this.RCApi.getFeature("PRODUCT"))||void 0===r?void 0:r.feature,a=[],this.compatibleModels.forEach(function(e){var i=K(new Set(o.map(function(i){var r,n,l,o=new RegExp("\\b".concat(e,"\\b")).test(null==i||null===(r=i.property)||void 0===r?void 0:r.definition),a=new RegExp("\\b".concat(t.id,"\\b")).test(null==i||null===(n=i.property)||void 0===n?void 0:n.definition),s=o&&a,c="hidden"===(null==i||null===(l=i.property)||void 0===l?void 0:l.HideRegister);return s&&!c?e:null}).filter(function(e){return null!=e})));a.push.apply(a,K(i))}),this.compatibleModels=a,this.isAuthoring&&(this.compatibleModels=[].concat(K(this.compatibleModels),K(this.getIncorrectlyAuthoredModelIds()))),this.isEmbedded&&this.validModelCodes&&(this.compatibleModels=this.validModelCodes.filter(function(e){return s.compatibleModels.includes(e)}));case 2:return e.a(2)}},e,this)})),function(e){return w.apply(this,arguments)})},{key:"handleIncompatibleModelTabs",value:function(){var e,t=this;if(this.vehicleViewTabGroup&&this.compatibleModels){var i=this.modelLimit,r=null;this.vehicleViewTabGroup.disableAllTabs({hide:!this.isEmbedded||this.shouldHideUnsupportedModels});var n=Array.from(this.vehicleViewTabGroup.tabs).filter(function(e){var r=e.getAttribute("id").replace("-tab","");return!t.model_codes.length&&t.compatibleModels.includes(r.toUpperCase())&&(i-=1),t.compatibleModels.includes(r.toUpperCase())&&i>=0});if(n.forEach(function(e){var i=e.getAttribute("id").replace("-tab","");t.isEmbedded&&t.selectedModel&&i===t.selectedModel&&(r=e),t.vehicleViewTabGroup.enableTab(e)}),0!==n.length){var l=n.find(function(e){return e.parentElement.classList.contains("TabGroup__tab--active")}),o=null!==(e=null!=r?r:l)&&void 0!==e?e:null==n?void 0:n[0];this.vehicleViewTabGroup.setTabSelected(o,{ignoreActiveTabCheck:!0,shouldFocus:!this.isEmbedded,triggerEvent:!1});var a=o.getAttribute("id").replace("-tab","");this.handleModelSelect(a)}}}},{key:"handleBodyStyleSelect",value:(S=z(H().m(function e(t){var i,r,n,l,o;return H().w(function(e){for(;;)switch(e.n){case 0:return null===(i=this.modelsSelector)||void 0===i||i.handleWrapperAnimation(),this.selectedBodystyleId=t.id,e.n=1,this.setCompatibleModels(t);case 1:this.handleIncompatibleModelTabs(),o=this.element.querySelector("#bodystyle-radio-".concat(null===(r=t.id)||void 0===r?void 0:r.toUpperCase())),null===(n=this.bodyStyleSelect)||void 0===n||n.selectOption(null===(l=t.id)||void 0===l?void 0:l.toUpperCase()),o&&(o.checked=!0);case 2:return e.a(2)}},e,this)})),function(e){return S.apply(this,arguments)})},{key:"getVehicleWithRcHref",value:function(){var e,t,i,r=[null===(e=n.A.getVehicleDetails(this.vehicle))||void 0===e?void 0:e.href,null===(t=this.vehicle)||void 0===t?void 0:t.href,null===(i=this.vehicle)||void 0===i||null===(i=i.metadata)||void 0===i?void 0:i.url,this.lastVehicleUrl].find(function(e){return"string"==typeof e&&e.includes("/r
1c/")});return r?G(G({},this.vehicle),{},{href:r}):this.vehicle}},{key:"handleModelSelect",value:(g=z(H().m(function e(t){var i,r,o,a,s,c,u,d;return H().w(function(e){for(;;)switch(e.n){case 0:if(r=t.replace(/-panel$/,""),this.selectedModelId=r,o="".concat(r,"-panel"),a=n.A.getFeatureById("MODEL",this.vehicle,r),s=n.A.buildHrefWithSelections(this.getVehicleWithRcHref(),G({MODEL:r},this.lastSelections)),c=null!=s&&s.includes("/rc/")?s:null==a||null===(i=a.query)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.href,u=this.element.querySelector("#".concat(o))){e.n=1;break}return e.a(2);case 1:if(this.exteriorView=u.querySelector("[data-exterior-view]"),this.interiorView=u.querySelector("[data-interior-view]"),this.wheelsView=u.querySelector("[data-wheels-view]"),this.handleUpdateFocusableElements(),!c){e.n=2;break}return e.n=2,this.setVehicle(c);case 2:this.cplayer.init(this.getDocumentFunc),null==(d=u.querySelector(".NameplateVisualiser__swatchContainer"))||d.classList.add("NameplateVisualiser__swatchContainer--loading"),d&&this.initSwatchTabs(u),this.runModelsSelector(),this.initSelectedTab(),d&&this.renderSwatchTabs(r),null==d||d.classList.remove("NameplateVisualiser__swatchContainer--loading"),this.updateCallToActions(),(0,l.le)(this.element,B.NAMEPLATEVISUALISER_EVENTS.MODEL_CHANGED,r);case 3:return e.a(2)}},e,this)})),function(e){return g.apply(this,arguments)})},{key:"updateSwatchTabs",value:function(){var e=this,t=this.panelContainer.querySelector('section[aria-hidden="false"] > .NameplateVisualiser__swatchContainer');
1t.swatchTabGroup.tabs.forEach(function(i){var r=i.getAttribute("id").replace("-tab",""),n=r.split("-").pop();e.renderSwatchItems(n,t.querySelector("#".concat(r,"-panel")))}),this.panelContainer.querySelectorAll(".NameplateVisualiser__swatchContainer").forEach(function(t){if(t.swatchTabGroup){var i,r=t.getAttribute("data-model-id"),n=t.querySelector("#".concat(r,"-").concat(e.selectedSwatchTab.toUpperCase(),"-tab"));n&&(null===(i=t.swatchTabGroup)||void 0===i||i.setTabSelected(n,{shouldFocus:!e.isEmbedded,triggerEvent:!1}))}})}},{key:"handleSwatchTabSelect",value:(m=z(H().m(function e(t){var i,r,n,l,o,a,s,c=arguments;return H().w(function(e){for(;;)switch(e.n){case 0:if(r=c.length>1&&void 0!==c[1]?c[1]:void 0,n=c.length>2&&void 0!==c[2]?c[2]:400,l=t.getAttribute("id").replace("-tab",""),o=null===(i=l.split("-").pop())||void 0===i?void 0:i.toLowerCase(),a=r?0:n,this.selectedSwatchTab=o,this.updateSwatchTabs(),this.updateCallToActions(),!this.showCarouselOnly){e.n=1;break}return this.handleEmbeddedSwatchTabSelect(o),e.a(2);case 1:s=r,e.n="hide"===s?2:"show"===s?3:5;break;case 2:return this.closeOverlay(this.panelContainer,a),e.a(3,8);case 3:if(this.swatchIdSettings[o.toUpperCase()].showOverlayButton){e.n=4;break}return e.a(3,8);case 4:case 7:return this.openOverlay(this.panelContainer,o,a),e.a(3,8);case 5:return e.n=6,this.closeOverlay(this.panelContainer,a);case 6:if(this.swatchIdSettings[o.toUpperCase()].showOverlayButton){e.n=7;break}return e.a(3,8);case 8:return e.a(2)}},e,this)})),function(e){return m.apply(this,arguments)})},{key:"openOverlay",value:function(e,t,i){var r;s.default.trackOverlayAnalytics(t,"open"),this.cplayer.setPaginationVisibility(!1),null===(r=this.cplayer.imageExpansion)||void 0===r||r.pause(),(0,B.showTabOverlays)(e,t,i)}},{key:"closeOverlay",value:(b=z(H().m(function e(t,i){var r;return H().w(function(e){for(;;)switch(e.n){case 0:return t.classList.contains("overlay-active")&&s.default.trackOverlayAnalytics(this.selectedSwatchTab,"close"),this.cplayer.setPaginationVisibility(!0),e.n=1,(0,B.hideTabOverlays)(t,i);case 1:null===(r=this.cplayer.imageExpansion)||void 0===r||r.resume();case 2:return e.a(2)}},e,this)})),function(e,t){return b.apply(this,arguments)})},{key:"getModelTabs",value:function(e){var t=this,i=this.element.querySelector("#example-vehicle-panel");return e.map(function(e){var r,n=document.createElement("li");n.setAttribute("id","".concat(e,"-tab")),n.classList.add("TabGroup__tab");var l=document.createElement("span");l.setAttribute("data-id","#".concat(e)),l.classList.add("TabGroup__tab-text"),n.appendChild(l);var o=i.cloneNode(!0),a="".concat(e,"-panel");o.setAttribute("id",a),o.setAttribute("data-model-id",e),o.setAttribute("aria-labelledby","".concat(e,"-tab"));var s=t.RCApi.getModel(e),c=null===(r=t.model_info)||void 0===r||null===(r=r.find(function(t){return t.modelId===e}))||void 0===r?void 0:r.modelName;return{tab:n,tabId:e,tabPanel:o,isHidden:t.RCApi.isHidden(s),modelData:s,altTabName:c}})}},{key:"runModelsSelector",value:function(){var e=this;if(this.enableModelVisualiser){var t=n.A.getModels(this.vehicle,this.compatibleModels).map(function(e){return e.id});if(0===t.length||!this.compatibleModels.length&&0===this.modelLimit)throw new Error("No valid models provided for nameplate ID ".concat(this.nameplate_code));this.useBodyStyles&&this.bodystyle_ids.length>0&&this.isEmbedded&&0===(t=t.filter(function(t){return e.compatibleModels.includes(t)})).length&&(t=this.compatibleModels);var i,r=(this.model_codes.length?this.model_codes:t).filter(function(e){return t.includes(e)});this.modelsSelector?this.modelsSelector.run(r,this.selectedBodystyleId,{vehicle:this.getVehicleWithRcHref(),selections:this.lastSelections}):this.modelsSelector=new j({rootElement:this.element,modelCodes:r,rcApi:this.RCApi,selectedBodystyleId:this.selectedBodystyleId,bodyStylesToDisplay:this.bodyStylesToDisplay,onChangeId:(i=z(H().m(function e(t){return H().w(function(e){for(;;)switch(e.n){case 0:document.querySelector('.NameplateVisualiser__vehicleView-tabContainer .TabGroup ul.TabGroup__tablist li[id="'.concat(t,'-tab"]')).click();case 1:return e.a(2)}},e)})),function(e){return i.apply(this,arguments)}),showPrice:this.showPrice,currentlyViewingLabel:this.currentlyViewingLabel,powertrainFilterEnabled:this.powertrainFilterEnabled,powertrainIds:this.powertrainIds})}}},{key:"initTabs",value:function(){var e=this,t=n.A.getModels(this.vehicle,this.model_codes).map(function(e){return e.id});if(0===t.length||!this.model_codes.length&&0===this.modelLimit)throw new Error("No valid models provided for nameplate ID ".concat(this.nameplate_code));this.useBodyStyles&&this.bodystyle_ids.length>0&&this.isEmbedded&&0===(t=t.filter(function(t){return e.compatibleModels.includes(t)})).length&&(t=this.compatibleModels),this.vehicleViewTabContainer=this.element.querySelector(".NameplateVisualiser__vehicleView"),this.vehicleViewTabGroup&&(this.resetController.abort(),this.resetController=new AbortController,this.vehicleViewTabGroup.destroy(),this.vehicleViewTabGroup.tabs.forEac
1h(function(t){return e.vehicleViewTabGroup.removeTab(t)})),this.vehicleViewTabGroup=new a.TabGroup(this.vehicleViewTabContainer,{showUnderline:!1,panelContainer:this.panelContainer});var i=this.model_codes.length?this.model_codes:t,r=this.getModelTabs(this.isAuthoring?i:t),l=this.RCApi.getVehicleDetails(),o=this.RCApi.getDescription(l.description),c=this.modelLimit;if(r.forEach(function(t,i){var n;e.vehicleViewTabGroup.addTab(t.tab,t.tabPanel);var l=(t.altTabName||e.RCApi.getDescription(null===(n=t.modelData)||void 0===n?void 0:n.description)).toUpperCase().replace(o.toUpperCase(),"").trim();r[i].tab.querySelector(".TabGroup__tab-text").textContent=l||t.tabId,r[i].tab.setAttribute("aria-controls","".concat(t.tabId,"-panel")),e.isAuthoring&&!e.handleIncorrectlyAuthoredModelTab(t.tab)||e.modelLimit&&!e.model_codes.length&&c<=0&&e.vehicleViewTabGroup.disableTab(t.tab,{hide:!e.isEmbedded}),c-=1,t.isHidden&&e.vehicleViewTabGroup.removeTab(t.tab)}),this.vehicleViewTabGroup.init(),!this.useBodyStyles||this.isEmbedded){var u=Array.from(this.vehicleViewTabGroup.tabs).find(function(t){return t.getAttribute("id")==="".concat(e.selectedModel,"-tab")});this.handleModelSelect((null!=u?u:this.vehicleViewTabGroup.tabs[0]).getAttribute("aria-controls"))}this.vehicleViewTabContainer.addEventListener("TabGroup:tabSelected",function(t){var i=t.detail;if(i.closest(".NameplateVisualiser__vehicleView-tabContainer")){var r=i.getAttribute("id").replace("-tab","");e.handleModelSelect(r),s.default.trackTabSelected(i)}},{signal:this.resetController.signal}),this.exteriorView=this.panelContainer.querySelector('section[aria-hidden="false"] [data-exterior-view]')}},{key:"getSwatchData",value:function(e){var t,i,r,n=this,l=null==e?void 0:e.toLowerCase(),o={};return null===(t=this.features)||void 0===t||t.forEach(function(e){n.featureIsVisible(e)&&(o[e.featureType]={label:e.tabLabel,swatches:e.featureIds})}),e?null!==(i=null===(r=o[l])||void 0===r?void 0:r.swatches)&&void 0!==i?i:{}:o}},{key:"defaultAvailable",value:function(e){return"default"===e.availability||"selected"===e.availability||"included"===e.availability}},{key:"getResolvedSwatch",value:function(e){var t,i,r,n,l=this;if(null===(t=this.swatchIdSettings[e])||void 0===t||!t.renderSwatch)return null;var o=null!==(i=this.fetchSwatchData(e))&&void 0!==i?i:[];return null!==(r=null!==(n=o.find(function(e){return"selected"===e.availability}))&&void 0!==n?n:o.find(function(e){return l.defaultAvailable(e)}))&&void 0!==r?r:null}},{key:"handleDefaultOrSelected",value:function(e,t,i,r){var n,l=this.getResolvedSwatch(i),o=l?l.id===(null==t?void 0:t.id):this.defaultAvailable(t);null===(n=this.featureCardList[i.toLowerCase()])||void 0===n||null===(n=n.find(function(e){return e.getId()===(null==t?void 0:t.id)}))||void 0===n||n.setSelected(o),null!=e&&e.classList.contains("NameplateVisualiser__swatch")&&(e.classList.toggle("NameplateVisualiser__swatch--selected",o),e.setAttribute("aria-current",o),e.setAttribute("aria-label",this.RCApi.getDescription(null==t?void 0:t.description))),o&&(r.setAttribute("data-selected-swatch",t.id),this.swatchIdSettings[i].showSwatchLabel&&this.renderSwatchLabel(t,r),this.swatchIdSettings[i].showAdditionalLabel&&this.renderAdditionalSwatchLabel(t,r))}},{key:"handleCardSelect",value:(y=z(H().m(function e(t,i,r){var n,o,a,s,c,u,d,h,p,f=this;return H().w(function(e){for(;;)switch(e.n){case 0:if(s=this.fetchSwatchData(i,t),c=null==s||null===(n=s.query)||void 0===n||null===(n=n[0])||void 0===n?void 0:n.href){e.n=1;break}return e.a(2);case 1:return this.lastSelections[i.toUpperCase()]=t,e.n=2,this.setVehicle(c);case 2:null===(o=this.modelsSelector)||void 0===o||o.generateCanvases({vehicle:this.getVehicleWithRcHref(),selections:this.lastSelections}),this.cplayer.renderAll(this.selectedModelId),u=Array.from(r.querySelector(".NameplateVisualiser__swatches-inner").childNodes),d=this.vehicleDetails[i.toLowerCase()],u.map(function(e){return d.some(function(t){var i;return null==e||null===(i=e.id)||void 0===i?void 0:i.includes(t.id)})}).every(Boolean)||this.renderSwatchItems(i,r),h=r.getAttribute("id").replace("-panel",""),u.forEach(function(e){var t=e.getAttribute("data-item-id"),n=f.fetchSwatchData(i,t),l=f.element.querySelector("#".concat(h,"-").concat(t));f.handleDefaultOrSelected(l,n,i,r)}),this.element.dispatchEvent(new CustomEvent("".concat(B.NAMEPLATEVISUALISER_EVENTS.BASE_EVENT).concat(B.NAMEPLATEVISUALISER_EVENTS.FEATURES_SELECTION_CHANGED),{detail:{featureCardList:this.featureCardList[i.toLowerCase()]}})),this.updateCallToActions(!0),p=this.RCApi.getOptionsPrice()||(null==s||null===(a=s.price)||void 0===a?void 0:a.GROSS),(0,l.le)(this.element,B.NAMEPLATEVISUALISER_EVENTS.SWATCH_CHANGED,{type:i,id:t,price:p});case 3:return e.a(2)}},e,this)})),function(e,t,i){return y.apply(this,arguments)})},{key:"handleSwatchSelect",value:(v=z(H().m(function e(t,i,r){var n,o,a,c,u,d,h,p,f,v=arguments;return H().w(function(e){for(;;)switch(e.n){case 0:if(c=!(v.length>3&&void 0!==v[3])||v[3],u=this.fetchSwatchData(i,t),d=null==u||null===(n=u.query)||void 0===n||null===(n=n[0])||void 0===n?void 0:n.href){e.n=1;break}return e.a(2);case 1:return s.default.trackSwatchSelected(u),c&&(this.lastSelections[i.toUpperCase()]=t),e.n=2,this.setVehicle(d);case 2:null===(o=this.modelsSelector)||void 0===o||o.generateCanvase
1s({vehicle:this.getVehicleWithRcHref(),selections:G(G({},this.lastSelections),{},U({},i.toUpperCase(),t))}),this.cplayer.renderAll(this.selectedModelId),h=Array.from(r.querySelector(".NameplateVisualiser__swatches-inner").childNodes),p=this.vehicleDetails[i.toLowerCase()],h.map(function(e){return p.some(function(t){var i;return null==e||null===(i=e.id)||void 0===i?void 0:i.includes(t.id)})}).every(Boolean)||this.renderSwatchItems(i,r),this.updateSwatchItems(i,r,u),this.updateCallToActions(!0),f=this.RCApi.getOptionsPrice()||(null==u||null===(a=u.price)||void 0===a?void 0:a.GROSS),(0,l.le)(this.element,B.NAMEPLATEVISUALISER_EVENTS.SWATCH_CHANGED,{type:i,id:t,price:f});case 3:return e.a(2)}},e,this)})),function(e,t,i){return v.apply(this,arguments)})},{key:"renderFromPrice",value:function(){var e=n.A.getGrossPrice(this.vehicle),t=e?this.RCApi.getFormattedFromPrice(null==e?void 0:e.value,e.currency):"";this.panelContainer.querySelectorAll(".NameplateVisualiser__from-price").forEach(function(e){e.innerHTML=t})}},{key:"renderSwatchLabel",value:function(e,t){var i=t.querySelector(".NameplateVisualiser__swatch-label"),r=this.RCApi.getDescription(e.description);i.innerHTML=r}},{key:"renderAdditionalSwatchLabel",value:function(e,t){var i,r=t.querySelector(".NameplateVisualiser__swatch-label-additional"),n=null==e||null===(i=e.property)||void 0===i?void 0:i.Group,l=this.RCApi.getPaintType(n);r.textContent=l}},{key:"injectConfigAppUrl",value:function(e){var t=this.RCApi.getVehicleURL();e.setAttribute("href",t)}},{key:"renderSwatchItems",value:(f=z(H().m(function e(t,i,r){var n,l,o,a,s,c,u,d,h,p,f,v,y,b,m=this;return H().w(function(e){for(;;)switch(e.n){case 0:if(o=this.fetchSwatchData(t),a=null===(n=this.getSwatchData(t))||void 0===n||null===(l=n.split)||void 0===l?void 0:l.call(n,","),o){e.n=1;break}return e.a(2,!1);case 1:if(s=o,!a){e.n=6;break}if(s=s.filter(function(e){var t;return a.map(function(e){return e.toLowerCase()}).includes(null==e||null===(t=e.id)||void 0===t?void 0:t.toLowerCase())}),!this.isAuthoring){e.n=5;break}if(null===(c=this.allModelsData)||void 0===c){e.n=2;break}b=c,e.n=4;break;case 2:return e.n=3,this.RCApi.getAllModels(this.model_codes);case 3:b=e.v;case 4:this.allModelsData=b,u=(0,B.getAllValidSwatchIds)(this.allModelsData,t),d=a.filter(function(e){return!u.map(function(e){return e.toLowerCase()}).includes(e.toLowerCase())}),h=d.map(function(e){return{id:e}}),s=s.concat(h);case 5:s.sort(function(e,t){return a.indexOf(e.id)-a.indexOf(t.id)});case 6:if(s=this.getSwatchItemsAccordingToLimit(t,s),(p=this.getResolvedSwatch(t))&&!s.some(function(e){return(null==e?void 0:e.id)===p.id})&&(s=[].concat(K(s.slice(0,-1)),[p])),f=i){e.n=7;break}return e.a(2,!1);case 7:v=f.getAttribute("id").replace("-panel",""),(y=f.querySelector(".NameplateVisualiser__swatches-inner")).innerHTML="",this.swatchIdSettings[t].renderSwatch?(s.forEach(function(e){var i,r="".concat(v,"-").concat(e.id),n=document.createElement("button");if(n.setAttribute("type","button"),n.setAttribute("id",r),n.classList.add("NameplateVisualiser__swatch"),y.appendChild(n),!e.media&&m.isAuthoring)return n.classList.add("NameplateVisualiser__swatch--error"),void(0,B.createErrorTooltipForElement)(n,'Authored Swatch ID "'.concat(e.id,'" doesn\'t exist for Nameplate ID "').concat(m.nameplate_code,'".'));var l=null==e?void 0:e.media.findIndex(function(e){return"thumb"===e.purpose}),o=null==e||null===(i=e.media)||void 0===i||null===(i=i[l])||void 0===i?void 0:i.url;if(o){var a=document.createElement("img");a.classList.add("NameplateVisualiser__swatch-thumbnail"),"true"===m.enableSwatchThumnailsBorder&&a.classList.add("NameplateVisualiser__swatch-thumbnail--border"),a.src=o,n.appendChild(a)}n.addEventListener("click",function(){m.handleSwatchSelect(e.id,t,f)},{signal:m.resetController.signal}),m.handleDefaultOrSelected(n,e,t,f)}),f.querySelector(".NameplateVisualiser__swatch--selected")||!s.length||this.lastSelections[t.toUpperCase()]||this.handleSwatchSelect(s[0].id,t,f,!1),this.handleTabAccordingToErrorsOnCards(f,i,"NameplateVisualiser__swatch")):this.constructCardSwatches(v,s,y,t,f,i),this.resizeTabsContent(),window.addEventListener("resize",this.resizeTabsContent.bind(this));case 8:return e.a(2)}},e,this)})),function(e,t,i){return f.apply(this,arguments)})},{key:"constructCardSwatches",value:function(e,t,i,r,n,l){var o=this;this.featureCardList[r.toLowerCase()]=[],t.forEach(function(t){var a=new R.default(t,o.RCApi,e,o.nameplate_code,o.moreInformationLabel,o.accessoriesDisclaimerMessage),u=new R.default(t,o.RCApi,"info",o.nameplate_code,o.moreInformationLabel,o.accessoriesDisclaimerMessage);o.featureCardList[r.toLowerCase()].push(u);var h=new d.default(a,o.isAuthoring,o.element,o.showPrice),p=h.buildElement();i.appendChild(p),h.on(B.NAMEPLATEVISUALISER_EVENTS.INFO_CTA_CLICKED_EVENT,function(){o.nameplateVisualiserInfoOverlay.render(a,!o.element.querySelector("#".concat(a.getCardId())).classList.contains("NameplateVisualiser__swatch--selected"),a.getCardId(),"bottom-to-top"),s.default.pushInfoIconCtaEvent(a.getTitle()),o.nameplateVisualiserInfoOverlay.on("".concat(B.NAMEPLATEVISUALISER_EVENTS.INFO_MODA
1L_CLOSED),function(){var e;return null===(e=o.element.querySelector("#".concat(a.getCardId()," .NameplateVisualiser__card-info")))||void 0===e?void 0:e.focus()}),o.nameplateVisualiserInfoOverlay.on("".concat(B.NAMEPLATEVISUALISER_EVENTS.INFO_MODAL_SELECTED),function(){return o.handleCardSelect(a.getId(),r,n)})}),h.on(B.NAMEPLATEVISUALISER_EVENTS.CHECKBOX_CLICKED_EVENT,function(){o.handleCardSelect(t.id,r,n)}),h.on(B.NAMEPLATEVISUALISER_EVENTS.CARD_CLICKED_EVENT,function(){var e=new c.default(o.element,o.featureCardList[o.selectedSwatchTab],o.element.querySelector("#".concat(l.getAttribute("aria-labelledby"))).textContent,o.modalCountLabel,o.showPrice);e.on(B.NAMEPLATEVISUALISER_EVENTS.CARD_OVERLAY_CLICKED_EVENT,function(e){o.handleCardSelect(e.detail.featureId,r,n)}),e.render()}),o.handleDefaultOrSelected(p,t,r,n),o.element.dispatchEvent(new CustomEvent("".concat(B.NAMEPLATEVISUALISER_EVENTS.BASE_EVENT).concat(B.NAMEPLATEVISUALISER_EVENTS.FEATURES_SELECTION_CHANGED),{detail:{featureCardList:o.featureCardList[r.toLowerCase()]}}))}),this.handleTabAccordingToErrorsOnCards(n,l,"NameplateVisualiser__card"),l.querySelector(".NameplateVisualiser__swatches-inner").children.length>0&&new u.default(n.querySelector(".NameplateVisualiser__swatches-list"),n.querySelector(".NameplateVisualiser__swatches-inner"))}},{key:"handleTabAccordingToErrorsOnCards",value:function(e,t,i){var r;if(e){var n=e.querySelectorAll(".".concat(i)).length,l=e.querySelectorAll(".".concat(i,"--error")).length,o=e.getAttribute("aria-labelledby"),a=this.element.querySelector("#".concat(o)),s=null===(r=t.closest(".NameplateVisualiser__swatchContainer"))||void 0===r?void 0:r.swatchTabGroup,c=n===l;l&&this.isAuthoring&&a.classList.add("TabGroup__tab-link--error"),c&&!this.isAuthoring&&(s.disableTab(a,{hide:!0}),a===s.getSelectedTab()&&s.setTabSelected(s.element.querySelector(".TabGroup__tab--first-element .TabGroup__tab-text")))}}},{key:"resizeTabsContent",value:function(){var e,t,i,r=(null===(e=this.element.querySelector(".NameplateVisualiser__view-grid-wheels"))||void 0===e?void 0:e.getBoundingClientRect().width)||0,n=((null===(t=this.element.querySelector(".NameplateVisualiser__view-grid"))||void 0===t?void 0:t.getBoundingClientRect().width)||0)-((null===(i=this.element.querySelector(".NameplateVisualiser__swatchContainer-panel .TabGroup__tabpanel--active"))||void 0===i?void 0:i.getBoundingClientRect().width)||0);this.element.querySelectorAll(".NameplateVisualiser__ctas").forEach(function(e){var t=r-n/2;e.style.width=t?"".concat(t,"px"):null})}},{key:"updateSwatchItems",value:function(e,t,i){var r,n,l=t.querySelector(".NameplateVisualiser__swatch--selected");l&&l.classList.remove("NameplateVisualiser__swatch--selected");var o=t.getAttribute("id").replace("-panel",""),a=null!==(r=this.getResolvedSwatch(e))&&void 0!==r?r:i,s=document.getElementById("".concat(o,"-").concat(a.id)),c=null!==(n=this.fetchSwatchData(e,a.id))&&void 0!==n?n:a;this.handleDefaultOrSelected(s,c,e,t)}},{key:"initSwatchTabs",value:function(e){var t,i,r,n=this,l=e.querySelector(".NameplateVisualiser__swatchContainer"),o=e.querySelector(".NameplateVisualiser__view-grid");l.swatchTabGroup=null!==(t=l.swatchTabGroup)&&void 0!==t?t:new a.TabGroup(l);var c=this.getSwatchData(),d=Object.keys(c).map(function(e){return e.toUpperCase()}),h=e.getAttribute("id").replace("-panel","");l.setAttribute("data-model-id",h),o.setAttribute("data-model-id",h),null===(i=this.features)||void 0===i||i.forEach(function(e,t){var i;if(null===(i=l.swatchTabGroup)||void 0===i||null===(i=i.element)||void 0===i||!i.querySelector('[id*="'.concat(e.featureType.toUpperCase(),'-tab"]')))if(n.featureIsVisible(e)){var r=l.swatchTabGroup.createTab(e.featureType.toUpperCase(),e.tabLabel);l.swatchTabGroup.addTab(r,n.element.querySelector("#example-".concat(e.featureType.toUpperCase(),"-panel")))}else if(0===t&&n.selectedSwatchTab===e.featureType){var o=t+1<n.features.length;n.selectedSwatchTab=o?n.features[t+1].featureType:""}}),this.setupExpandButtons(l.swatchTabGroup);for(var p=l.swatchTabGroup.tabs,f=null,v=0;v<p.length;v+=1){var y,b,m=p[v];m.setAttribute("id","".concat(h,"-").concat(d[v],"-tab"));var g=e.querySelector("#example-".concat(d[v],"-panel")),S=null===(y=c[d[v].toLowerCase()])||void 0===y?void 0:y.label;m.firstElementChild.textContent=null!=S?S:d[v],g&&(g.setAttribute("id","".concat(h,"-").concat(d[v],"-panel")),g.setAttribute("aria-labelledby","".concat(h,"-").concat(d[v],"-tab")));var w=m.getAttribute("id").replace("-tab","");if((null===(b=w.split("-").pop())||void 0===b?void 0:b.toLowerCase())===this.selectedSwatchTab&&(f=m),0!==w.length){var _=w.includes(h)?w:"".concat(h,"-").concat(w);m.setAttribute("id","".concat(_,"-tab")),m.setAttribute("aria-controls","".concat(_))}}l.swatchTabGroup.init();var C=null!=f?f:p[0];if(C){var A=null===(r=C.getAttribute("id").replace("-tab","").split("-").pop())||void 0===r?void 0:r.toLowerCase();A&&(this.selectedSwatchTab=A),l.swatchTabGroup.setTabSelected(C,{shouldFocus:!this.isEmbedded}),l.addEventListener("TabGroup:tabSelected",function(e){var t=e.detail,i=n.panelContainer.classList.contains("overlay-active")?void 0:"hide";(0,B.isMobileDevice)()&&(i=void 0),n.handleSwatchTabSelect(t,i,(0,B.isMobileDevice)()?0:400),new u.default(n.element.querySelector("#".concat(t.getAttribute("aria-controls")," .NameplateVisualiser__swatches-list")),n.element.querySelector("#".concat(t.getAttribute("aria-controls")," .NameplateVisualiser__swatches-inner"))),s.default.trackTabSelected(t)},{signal:this.resetController.signal})}}},{key:"renderSwatchTabs",value:function(e){var t,i=this,r=this.panelContainer.querySelector('section[aria-hidden="false"] .NameplateVisualiser__swatchContainer');if(null!=r&&r.swatchTabGroup){var n=r.getAttribute("data-model-id");if(n===e){var l;
1r.swatchTabGroup.tabs.forEach(function(e){var t=e.getAttribute("id").replace("-tab","");if(0!==t.length){var l=t.includes(n)?t:"".concat(n,"-").concat(t),o=r.querySelector("#".concat(l,"-panel"));i.renderSwatchItems(t.replace("".concat(n,"-"),""),o,r)}}),l=this.isSingleVehicleView()&&"exterior"!==this.selectedSwatchTab?"show":"hide";var o=this.panelContainer.querySelector("#".concat(e,"-").concat(this.selectedSwatchTab.toUpperCase(),"-tab"));if(o){this.showCarouselOnly||this.handleSwatchTabSelect(o,l);var a="#".concat(o.getAttribute("aria-controls"));(null===(t=r.querySelector("".concat(a," .NameplateVisualiser__swatches-inner")))||void 0===t?void 0:t.children.length)>0&&new u.default(r.querySelector("".concat(a," .NameplateVisualiser__swatches-list")),r.querySelector("".concat(a," .NameplateVisualiser__swatches-inner")))}}}}},{key:"setupExpandButtons",value:function(e){var t=this,i=this.interiorView.querySelector(".NameplateVisualiser__overlay-close-button"),r=this.wheelsView.querySelector(".NameplateVisualiser__overlay-expand-button"),n=this.interiorView.querySelector(".NameplateVisualiser__overlay-expand-button"),l=this.panelContainer.querySelector(".NameplateVisualiser__overlay"),o=Array.from(e.tabs),a=o.filter(function(e){return e.getAttribute("id").includes("INTERIOR")})[0],s=o.filter(function(e){return e.getAttribute("id").includes("WHEELS")})[0];l.addEventListener("click",function(){return t.closeOverlay(t.panelContainer)},{signal:this.resetController.signal}),i.addEventListener("click",function(){return t.closeOverlay(t.panelContainer)},{signal:this.resetController.signal}),i.addEventListener("keydown",function(e){"Escape"!==e.key&&"Esc"!==e.key&&27!==e.keyCode||t.closeOverlay(t.panelContainer)},{signal:this.resetController.signal}),r.addEventListener("click",function(){return t.handleSwatchTabSelect(s)},{signal:this.resetController.signal}),n.addEventListener("click",function(){return t.handleSwatchTabSelect(a)},{signal:this.resetController.signal})}},{key:"handleUpdateFocusableElements",value:function(){var e=this.panelContainer.querySelectorAll('section[aria-hidden="false"] * button, section[aria-hidden="false"] * [role="button"]'),t=this.panelContainer.querySelectorAll('section[aria-hidden="true"] * button, section[aria-hidden="true"] * [role="button"]');Array.from(t).forEach(function(e){e.classList.contains("TabGroup__tab")&&!e.classList.contains("TabGroup__tab--active")||e.setAttribute("tabindex","-1")}),Array.from(e).forEach(function(e){e.classList.contains("TabGroup__tab")&&!e.classList.contains("TabGroup__tab--active")||e.setAttribute("tabindex","0")})}},{key:"updateCallToActions",value:function(){var e,t=this,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.element.getAttribute("data-primary-cta-alternate-label");Array.from(this.element.querySelectorAll('a[data-origin-type="buildYourOwn"]')).forEach(function(e){var n=e;t.injectConfigAppUrl(n),i&&e.classList.contains("icon-ignite-configure")&&(n.textContent=r)}),null!==(e=this.vehicle)&&void 0!==e&&null!==(e=e.metadata)&&void 0!==e&&e.url&&this.element.querySelectorAll('.NameplateVisualiser__cta[target="pageEvent"]').forEach(function(e){e.dataset.vehicleUrl=t.vehicle.metadata.url})}},{key:"handleIncorrectlyAuthoredModelTab",value:function(e){var t=e.getAttribute("id").replace("-tab",""),i=this.RCApi.getModel(t);return i||(this.isAuthoring?(0,B.createErrorTooltipForElement)(e,'Authored Model ID "'.concat(e.textContent.trim(),'" doesn\'t exist for Nameplate ID "').concat(this.nameplate_code,'."')):this.vehicleViewTabGroup.removeTab(e)),Boolean(i)}},{key:"getIncorrectlyAuthoredModelIds",value:function(){var e=this;return(this.model_codes.length?this.model_codes:[]).filter(function(t){return!e.RCApi.getModel(t)}).map(function(e){return e.toUpperCase()})}},{key:"handleEmbeddedSwatchTabSelect",value:function(e){var t=0;"exterior"===e||"interior"===e?t=this.slidesOverride.findIndex(function(t){return t.includes(e)}):"wheels"===e&&(t=this.slidesOverride.findIndex(function(e){return"exterior-1"===e})),this.cplayer.goToSlide(t)}},{key:"appendDynamicSection",value:function(){var e,t=this;this.features&&(null===(e=this.features)||void 0===e||e.forEach(function(e){if(t.element.querySelector("#NameplateVisualiserSectionExample")){var i=e.featureType.toUpperCase(),r=t.element.querySelector("#NameplateVisualiserSectionExample").content.cloneNode(!0),n=r.querySelector("section");n.id=n.id.replace("{TAB}",i),n.setAttribute("aria-labelledby",i);var l=r.querySelector(".NameplateVisualiser__swatches-inner");l.id=l.id.replace("{TAB}",i),t.element.querySelector(".NameplateVisualiser__swatchContainer-panel").appendChild(n)}}))}},{key:"setAccessoriesDisclaimerMessage",value:function(e){var t;e&&(this.accessoriesDisclaimerMessage=null!==(t=e["ipr.accessoriesDisclaimer"])&&void 0!==t?t:"")}},{key:"getSwatchItemsAccordingToLimit",value:function(e,t){var i,r=this.swatchLimit,n=null===(i=this.features)||void 0===i?void 0:i.find(function(t){return t.featureType.toUpperCase()===e});return n&&null!=n&&n.featureSwatchLimit&&(r=parseInt(n.featureSwatchLimit,10)),0!==r?t.slice(0,r):t}},{key:"constructFeatures",value:function(e){var t=null==e?void 0:e.find(function(e){return"exterior"===e.featureType}),i=null==e?void 0:e.find(function(e){return"interior"===e.featureType}),r=null==e?void 0:e.find(function(e){return"wheels"===e.featureType}),n=[];return this.exteriorTabLabel&&!t&&n.push({featureType:"exterior",tabLabel:this.exteriorTabLabel,featureIds:this.exterior
1ColourCodes,featureSwatchLimit:null}),this.interiorTabLabel&&!i&&n.push({featureType:"interior",tabLabel:this.interiorTabLabel,featureIds:this.interiorColourCodes,featureSwatchLimit:null}),this.wheelsTabLabel&&!r&&n.push({featureType:"wheels",tabLabel:this.wheelsTabLabel,featureIds:this.wheelCodes,featureSwatchLimit:null}),e&&n.push.apply(n,K(e)),n}},{key:"isSingleVehicleView",value:function(){return this.panelContainer.classList.contains("overlay-active")||(0,B.isMobileDevice)()}},{key:"featureIsVisible",value:function(e){var t,i=this.vehicleDetails[e.featureType].some(function(t){var i,r;return"string"==typeof e.featureIds&&(null===(i=e.featureIds)||void 0===i||null===(i=i.toLowerCase())||void 0===i?void 0:i.split(",").includes(null===(r=t.id)||void 0===r?void 0:r.toLowerCase()))});return(null===(t=this.vehicleDetails[e.featureType])||void 0===t?void 0:t.length)>0&&(!e.featureIds||i)}},{key:"bindEvents",value:function(){var e,t=this;window.matchMedia("(min-width: 769px)").addEventListener("change",function(e){e.matches&&t.closeOverlay(t.panelContainer)}.bind(this)),null===(e=document.querySelectorAll(".NameplateVisualiser__cta"))||void 0===e||e.forEach(function(e){return e.addEventListener("click",function(e){var t=e.target.hasAttribute("data-origin-type")?e.target:e.target.parentElement;"buildYourOwn"===t.getAttribute("data-origin-type")&&s.default.pushBuildYourOwnCtaEvent(t)})})}}],t&&J(e.prototype,t),i&&J(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,i,f,v,y,b,m,g,S,w,_,C,A}()},23684:function(e,t,i){i.r(t),i.d(t,{TabGroup:function(){return r.p}});var r=i(23055)},16786:function(e,t,i){var r=i(71221);t.A=function(e,t){var i={metadata:{meta:{}}};t&&(t=t.replace(/'? ?'?/g," ")),i.metadata.meta["currency-format"]=t;var n=new r.W;return n.readCurrencyFormats(i),n.getFormattedPrice(e,t)}}}]);
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.