1(()=>{"use strict";var e={105(e,t,r){r.d(t,{A:()=>o,r:()=>a});var s=r(308);let i="js-offcanvas-singleton";class n{constructor(){this.$emitter=new s.A}open(e,t,r,s,i,n,a){this._removeExistingOffCanvas();let o=this._createOffCanvas(r,n,a,s);this.setContent(e,i),this._openOffcanvas(o,t)}setContent(e,t){let r=this.getOffCanvas();r[0]&&(r[0].innerHTML=e,this._registerEvents(t),this._setAriaAttrs())}setAdditionalClassName(e){this.getOffCanvas()[0].classList.add(e)}getOffCanvas(){return document.querySelectorAll(`.${i}`)}close(e){let t=this.getOffCanvas();t.forEach(e=>{bootstrap.Offcanvas.getInstance(e).hide()}),setTimeout(()=>{this.$emitter.publish("onCloseOffcanvas",{offCanvasContent:t})},e)}goBackInHistory(){window.history.back()}exists(){return this.getOffCanvas().length>0}_openOffcanvas(e,t){window.focusHandler.saveFocusState("offcanvas"),window.focusHandler._addFocusTrapGuard(e),n.bsOffcanvas.show(),window.history.pushState("offcanvas-open",""),"function"==typeof t&&t()}_registerEvents(e){let t=this.getOffCanvas();t.forEach(r=>{let s=()=>{setTimeout(()=>{r.remove(),window.focusHandler._removeFocusTrapGuard(),window.focusHandler.resumeFocusState("offcanvas"),this.$emitter.publish("onCloseOffcanvas",{offCanvasContent:t})},e),r.removeEventListener("hide.bs.offcanvas",s)};r.addEventListener("hide.bs.offcanvas",s)}),window.addEventListener("popstate",this.close.bind(this,e),{once:!0}),document.querySelectorAll(".js-offcanvas-close").forEach(t=>{t.addEventListener("click",this.close.bind(this,e))})}_setAriaAttrs(){let e=this.getOffCanvas()[0],t="off-canvas-headline",r=e.querySelector(`[data-id="${t}"]`);r&&!e.hasAttribute("aria-labelledby")&&(r.setAttribute("id",t),e.setAttribute("aria-labelledby",t))}_removeExistingOffCanvas(){this.getOffCanvas().forEach(e=>{let t=bootstrap.Offcanvas.getInstance(e);t&&"function"==typeof t.dispose&&t.dispose(),e.remove(),window.focusHandler._removeFocusTrapGuard()}),n.bsOffcanvas=null}_getPositionClass(e){return"left"===e?"offcanvas-start":"right"===e?"offcanvas-end":`offcanvas-${e}`}_createOffCanvas(e,t,r,s){let a=document.createElement("div");if(a.classList.add("offcanvas",i),a.classList.add(this._getPositionClass(e)),a.setAttribute("tabindex","-1"),!0===t&&a.classList.add("is-fullwidth"),r){let e=typeof r;if("string"===e)a.classList.add(r);else if(Array.isArray(r))r.forEach(e=>{a.classList.add(e)});else throw Error(`The type "${e}" is not supported. Please pass an array or a string.`)}return document.body.appendChild(a),n.bsOffcanvas=new bootstrap.Offcanvas(a,{backdrop:!1!==s||"static"}),a}}let a=Object.freeze(new n);class o{static open(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"left",s=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,n=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"";a.open(e,t,r,s,i,n,o)}static setContent(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:350;a.setContent(e,t,r)}static setAdditionalClassName(e){a.setAdditionalClassName(e)}static close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:350;a.close(e)}static exists(){return a.exists()}static getOffCanvas(){return a.getOffCanvas()}static REMOVE_OFF_CANVAS_DELAY(){return 350}}},156(e){var t=function(e){var t;return!!e&&"object"==typeof e&&"[object RegExp]"!==(t=Object.prototype.toString.call(e))&&"[object Date]"!==t&&e.$$typeof!==r},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function s(e,t){return!1!==t.clone&&t.isMergeableObject(e)?o(Array.isArray(e)?[]:{},e,t):e}function i(e,t,r){return e.concat(t).map(function(e){return s(e,r)})}function n(e){return Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[])}function a(e,t){try{return t in e}catch(e){return!1}}function o(e,r,l){(l=l||{}).arrayMerge=l.arrayMerge||i,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=s;var u,h,d=Array.isArray(r);
1return d!==Array.isArray(e)?s(r,l):d?l.arrayMerge(e,r,l):(h={},(u=l).isMergeableObject(e)&&n(e).forEach(function(t){h[t]=s(e[t],u)}),n(r).forEach(function(t){(!a(e,t)||Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))&&(a(e,t)&&u.isMergeableObject(r[t])?h[t]=(function(e,t){if(!t.customMerge)return o;var r=t.customMerge(e);return"function"==typeof r?r:o})(t,u)(e[t],r[t],u):h[t]=s(r[t],u))}),h)}o.all=function(e,t){if(!Array.isArray(e))throw Error("first argument should be an array");return e.reduce(function(e,r){return o(e,r,t)},{})},e.exports=o},220(e,t,r){r.d(t,{A:()=>o});var s=r(156),i=r.n(s),n=r(707),a=r(308);class o{constructor(e,t={},r=!1){if(!(e instanceof Node)){console.warn(`There is no valid element given while trying to create a plugin instance for "${r}".`);return}this.el=e,this.$emitter=new a.A(this.el),this._pluginName=this._getPluginName(r),this.options=this._mergeOptions(t),this._initialized=!1,this._registerInstance(),this._init()}init(){console.warn(`The "init" method for the plugin "${this._pluginName}" is not defined. The plugin will not be initialized.`)}update(){}_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(e){let t=[this.constructor.options,this.options,e];return t.push(this._getConfigFromDataAttribute()),t.push(this._getOptionsFromDataAttribute()),i().all(t.filter(e=>e instanceof Object&&!(e instanceof Array)).map(e=>e||{}))}_getConfigFromDataAttribute(){let e={};if("function"!=typeof this.el.getAttribute)return e;let t=n.A.toDashCase(this._pluginName),r=this.el.getAttribute(`data-${t}-config`);return r?window.PluginConfigManager.get(this._pluginName,r):e}_getOptionsFromDataAttribute(){let e={};if("function"!=typeof this.el.getAttribute)return e;let t=n.A.toDashCase(this._pluginName),r=this.el.getAttribute(`data-${t}-options`);if(r)try{return JSON.parse(r)}catch(e){console.error(`The data attribute "data-${t}-options" could not be parsed to json: ${e.message}`)}return e}_registerInstance(){window.PluginManager.getPluginInstancesFromElement(this.el).set(this._pluginName,this),window.PluginManager.getPlugin(this._pluginName,!1).get("instances").push(this)}_getPluginName(e){return e||(e=this.constructor.name),e}}},308(e,t,r){r.d(t,{A:()=>s});class s{constructor(e=document){this._el=e,e.$emitter=this,this._listeners=[]}publish(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=new CustomEvent(e,{detail:t,cancelable:r});return this.el.dispatchEvent(s),s}subscribe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=this,i=e.split("."),n=r.scope?t.bind(r.scope):t;if(r.once&&!0===r.once){let t=n;n=function(r){s.unsubscribe(e),t(r)}}return this.el.addEventListener(i[0],n),this.listeners.push({splitEventName:i,opts:r,cb:n}),!0}unsubscribe(e){let t=e.split(".");return this.listeners=this.listeners.reduce((e,r)=>([...r.splitEventName].sort().toString()===t.sort().toString()?this.el.removeEventListener(r.splitEventName[0],r.cb):e.push(r),e),[]),!0}reset(){return this.listeners.forEach(e=>{this.el.removeEventListener(e.splitEventName[0],e.cb)}),this.listeners=[],!0}get el(){return this._el}set el(e){this._el=e}get listeners(){return this._listeners}set listeners(e){this._listeners=e}}},341(e,t,r){function s(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function i(e){return s(e)?e:{}}r.d(t,{q:()=>i,u:()=>s})},683(e,t,r){r.d(t,{A:()=>n});let s="loader",i={BEFORE:"before",INNER:"inner"};class n{constructor(e,t=i.BEFORE){this.parent=e instanceof Element?e:document.body.querySelector(e),this.position=t}create(){if(!this.exists()){if(this.position===i.INNER){this._previousHTML=this.parent.innerHTML,this.parent.innerHTML=n.getTemplate();return}this.parent.insertAdjacentHTML(this._getPosition(),n.getTemplate())}}remove(){if(this.position===i.INNER){this.parent.innerHTML=this._previousHTML;return}this.parent.querySelectorAll(`.${s}`).forEach(e=>e.remove())}exists(){return this.parent.querySelectorAll(`.${s}`).length>0}_getPosition(){return this.position===i.BEFORE?"afterbegin":"beforeend"}static getTemplate(){return`<div class="${s}" role="status">
2 <span class="visually-hidden">Loading...</span> 3 </div>`}static SELECTOR_CLASS(){return s}}},707(e,t,r){r.d(t,{A:()=>s});class s{static ucFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}static lcFirst(e){return e.charAt(0).toLowerCase()+e.slice(1)}static toDashCase(e){return e.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(e,t){let r=s.toUpperCamelCase(e,t);return s.lcFirst(r)}static toUpperCamelCase(e,t){return t?e.split(t).map(e=>s.ucFirst(e.toLowerCase())).join(""):s.ucFirst(e.toLowerCase())}static parsePrimitive(e){try{return/^\d+(.|,)\d+$/.test(e)&&(e=e.replace(",",".")),JSON.parse(e)}catch(t){return e.toString()}}}},724(e,t,r){r.d(t,{A:()=>n});var s=r(683);let i="element-loader-backdrop";class n extends s.A{static create(e){e.classList.add("has-element-loader"),n.exists(e)||(n.appendLoader(e),setTimeout(()=>{let t=e.querySelector(`.${i}`);t&&t.classList.add("element-loader-backdrop-open")},1))}static remove(e){e.classList.remove("has-element-loader");let t=e.querySelector(`.${i}`);t&&t.remove()}static exists(e){return e.querySelectorAll(`.${i}`).length>0}static getTemplate(){return` 4 <div class="${i}"> 5 <div class="loader" role="status"> 6 <span class="visually-hidden">Loading...</span> 7 </div> 8 </div> 9 `}static appendLoader(e){e.insertAdjacentHTML("beforeend",n.getTemplate())}}},795(e,t,r){r.d(t,{A:()=>i});var s=r(707);class i{static isNode(e){return"object"==typeof e&&null!==e&&(e===document||e===window||e instanceof Node)}static hasAttribute(e,t){if(!i.isNode(e))throw Error("The element must be a valid HTML Node!");return"function"==typeof e.hasAttribute&&e.hasAttribute(t)}static getAttribute(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!1===i.hasAttribute(e,t))throw Error(`The required property "${t}" does not exist!`);if("function"!=typeof e.getAttribute){if(r)throw Error("This node doesn't support the getAttribute function!");return}return e.getAttribute(t)}static getDataAttribute(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=t.replace(/^data(|-)/,""),a=s.A.toLowerCamelCase(n,"-");if(!i.isNode(e)){if(r)throw Error("The passed node is not a valid HTML Node!");return}if(void 0===e.dataset){if(r)throw Error("This node doesn't support the dataset attribute!");return}let o=e.dataset[a];if(void 0===o){if(r)throw Error(`The required data attribute "${t}" does not exist on ${e}!`);return o}return s.A.parsePrimitive(o)}static querySelector(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!i.isNode(e))throw Error("The parent node is not a valid HTML Node!");let s=e.querySelector(t)||!1;if(r&&!1===s)throw Error(`The required element "${t}" does not exist in parent node!`);return s}static querySelectorAll(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!i.isNode(e))throw Error("The parent node is not a valid HTML Node!");let s=e.querySelectorAll(t);if(0===s.length&&(s=!1),r&&!1===s)throw Error(`At least one item of "${t}" must exist in parent node!`);return s}static getFocusableElements(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body,t=` 10 input:not([tabindex^="-"]):not([disabled]):not([type="hidden"]), 11 select:not([tabindex^="-"]):not([disabled]), 12 textarea:not([tabindex^="-"]):not([disabled]), 13 button:not([tabindex^="-"]):not([disabled]), 14 a[href]:not([tabindex^="-"]):not([disabled]), 15 [tabindex]:not([tabindex^="-"]):not([disabled]) 16 `;return e.querySelectorAll(t)}static getFirstFocusableElement(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return this.getFocusableElements(e)[0]}static getLastFocusableElement(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=this.getFocusableElements(e);return t[t.length-1]}}},808(e,t,r){r.r(t),r.d(t,{SOURCE_HISTORY_IDS_FIELD:()=>n,default:()=>o});var s=r(220),i=r(341);let n="_sourceHistoryIds",a={historyChangeFallback:"Updated",historyDiscountAbsolute:"Absolute %value%",historyDiscountRelative:"Relative %value%%",historyOrderCreated:"Order created",historySentQuoteValue:"Quote #%quoteNumber%",merchantComment:"Merchant",customerComment:"You"};class o extends s.A{static #e=this.options={currencyIsoCode:"EUR",dateTimeLocale:void 0,dateTimeTimeZone:void 0,quoteSummary:null,statusLabels:{},unreadHistoryIds:[],historyItemBagSelector:"[data-quote-history-item-bag]",snippets:a};init(){this.renderOptions=this.options}setRenderOptions(e){this.renderOptions={...this.renderOptions,...e,statusLabels:{...this.renderOptions.statusLabels,...e.statusLabels},snippets:{...this.renderOptions.snippets,...e.snippets}}}render(e,t,r){let s=this.getStatusChange(e),i=this.hasDetailChanges(e)||this.isQuoteSummaryStatusChange(e)||!!this.getComment(e);
16if(s&&this.shouldRenderMerchantSentArticle(e,s,r)){let t=this.renderMerchantSentHistoryEntry(e);return[this.renderStatusHistoryEntry(e,s,!t),t].filter(e=>null!==e)}if(s&&i){let r=this.renderDetailHistoryEntry(e,t),i=this.renderStatusHistoryEntry(e,s,!1);return(this.isWithdrawStatus(s)?[r,i]:[i,r]).filter(e=>null!==e)}if(s){let t=this.renderStatusHistoryEntry(e,s);return t?[t]:[]}let n=this.renderDetailHistoryEntry(e,t);return n?[n]:[]}mergeMerchantHistories(e){let t=e.map(e=>({...e})),r=new Set;return this.mergeMerchantDetailChangeHistories(t,r),this.mergeMerchantCommentHistories(t,r),this.mergeAddedStatusCommentHistories(t,r),t.filter((e,t)=>!r.has(t))}mergeMerchantDetailChangeHistories(e,t){e.forEach((r,s)=>{if(!t.has(s)&&this.isMergeableMerchantDetailChangeHistory(r))for(let r=s+1;r<e.length;r+=1){if(t.has(r))continue;let i=e[r];this.canMergeMerchantDetailChangeEntries(e[s],i)&&(e[s]=this.mergeChangesIntoHistoryEntry(e[s],i),t.add(r))}})}mergeMerchantCommentHistories(e,t){e.forEach((r,s)=>{if(t.has(s))return;let i=this.findMerchantCommentMergeTargetIndex(e,s,t);if(null===i)return;let n=e[i];e[i]=this.mergeCommentIntoHistoryEntry(n,r),t.add(s)})}findMerchantCommentMergeTargetIndex(e,t,r){let s=e[t];if(!this.isMerchantCommentOnlyEntry(s))return null;let i=this.getMerchantMergeTimestamp(s);if(null===i)return null;for(let[s,n,a,o]of[[t+1,e.length,1,e=>this.isMerchantDetailChangeHistory(e)],[t+1,e.length,1,e=>this.isMerchantMergeTarget(e)],[t-1,-1,-1,e=>this.isMerchantDetailChangeHistory(e)],[t-1,-1,-1,e=>this.isMerchantMergeTarget(e)]]){let t=this.findMerchantMergeTargetIndex(e,i,s,n,a,r,o);if(null!==t)return t}return null}findMerchantMergeTargetIndex(e,t,r,s,i,n,a){for(let o=r;o!==s;o+=i){if(n.has(o))continue;let r=e[o];if(this.isWithinMergeWindow(this.getMerchantMergeTimestamp(r),t)&&a(r)&&!this.getComment(r))return o}return null}mergeAddedStatusCommentHistories(e,t){let r=[];e.forEach((e,s)=>{!t.has(s)&&null!==this.getCreatedAtMergeTimestamp(e)&&this.isAddedStatusHistory(e)&&r.push(s)}),e.forEach((s,i)=>{if(t.has(i))return;let n=this.findAddedStatusCommentMergeTargetIndex(e,i,r,t);if(null===n)return;let a=e[n];this.getComment(a)||(e[n]=this.mergeCommentIntoHistoryEntry(a,s),t.add(i))})}findAddedStatusCommentMergeTargetIndex(e,t,r,s){let i=e[t];if(!this.isRequestCommentOnlyEntry(i))return null;let n=this.getCreatedAtMergeTimestamp(i);return null===n?null:r.reduce((r,i)=>{if(i===t||s.has(i))return r;let a=e[i],o=this.getCreatedAtMergeTimestamp(a);if(null===o||this.getComment(a))return r;let l=Math.abs(o-n);return l>15e3||l>=r.distance?r:{index:i,distance:l}},{index:null,distance:Number.POSITIVE_INFINITY}).index}canMergeMerchantDetailChangeEntries(e,t){return this.isMergeableMerchantDetailChangeHistory(t)&&this.isWithinMergeWindow(this.getMerchantMergeTimestamp(e),this.getMerchantMergeTimestamp(t))&&!this.hasOverlappingDisplayChangeFields(e,t)}isMergeableMerchantDetailChangeHistory(e){return this.isMerchantDetailChangeHistory(e)&&!this.getComment(e)}hasOverlappingDisplayChangeFields(e,t){let r=new Set(this.getDisplayChangeFields(e));return this.getDisplayChangeFields(t).some(e=>r.has(e))}getDisplayChangeFields(e){let t=(0,i.q)(e.changes);return Object.keys((0,i.q)(t.new)).filter(e=>!["stateId","displayState","storefrontState"].includes(e))}mergeChangesIntoHistoryEntry(e,t){let r=(0,i.q)(e.changes),s=(0,i.q)(t.changes),a=(0,i.q)(r.old),o=(0,i.q)(s.old),l=(0,i.q)(r.new),u=(0,i.q)(s.new);return{...e,updatedAt:e.updatedAt??t.updatedAt,createdById:e.createdById??t.createdById,createdBy:e.createdBy??t.createdBy,changes:{...r,...s,old:{...a,...o},new:{...l,...u}},[n]:Array.from(new Set([...this.getSourceHistoryIds(e),...this.getSourceHistoryIds(t)]))}}mergeCommentIntoHistoryEntry(e,t){return{...e,comment:t.comment,commentId:e.commentId??t.commentId,commentVersionId:e.commentVersionId??t.commentVersionId,customerId:e.customerId??t.customerId,customer:e.customer??t.customer,employeeId:e.employeeId??t.employeeId,employee:e.employee??t.employee,createdById:e.createdById??t.createdById,createdBy:e.createdBy??t.createdBy,[n]:Array.from(new Set([...this.get
16SourceHistoryIds(e),...this.getSourceHistoryIds(t)]))}}renderDetailHistoryEntry(e,t){let r=this.getActor(e),s=this.formatDate(this.getHistoryDate(e)),i=this.renderChangeItems(e,t),n=this.renderComment(e),a=i||n?null:this.renderActionFallback(e),o=[i,n,a].filter(e=>null!==e);if(0===o.length)return null;let l=this.renderItemElement(r,s,o);return this.shouldMoveMerchantSentSummaryToNextChange(t,e)&&l?.classList.add("quote-detail-history__item--merchant-sent"),this.markUnreadHistoryElement(l,e),l}renderMerchantSentHistoryEntry(e){let t=this.getMerchantActor(),r=this.formatDate(this.getHistoryDate(e)),s=[this.renderQuoteSummaryItems(e),this.renderComment(e)].filter(e=>null!==e);if(0===s.length)return null;let i=this.renderItemElement(t,r,s);return i?.classList.add("quote-detail-history__item--merchant-sent"),this.markUnreadHistoryElement(i,e),i}renderItemElement(e,t,r){let s=this.cloneTemplate("[data-quote-history-item-template]");if(!s)return null;let i=s.querySelector("[data-quote-history-actor-initials]"),n=s.querySelector("[data-quote-history-actor-name]"),a=s.querySelector("[data-quote-history-created-at]"),o=s.querySelector("[data-quote-history-item-content]");return i&&(i.textContent=e.initials,i.classList.toggle("quote-detail-history__avatar--customer",e.isCustomer)),n&&(n.textContent=e.name),a&&(a.textContent=t),o?.replaceChildren(...r),s}renderStatusHistoryEntry(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],s=this.cloneTemplate("[data-quote-history-status-template]");if(!s)return null;let i=this.formatDate(this.getHistoryDate(e)),n=this.formatValue(t),a=s.querySelector("[data-status]"),o=s.querySelector("[data-quote-history-created-at]");return a&&(a.className=`badge badge-lg quote-item-status-badge quote-item-status-badge-${n}`,a.dataset.status=n,a.textContent=this.getStatusLabel(n)),o&&(o.textContent=i),r&&this.markUnreadHistoryElement(s,e),s}markUnreadHistoryElement(e,t){if(!e||!this.isUnreadMerchantHistory(t))return;let r=this.getRepresentativeHistoryId(t);r&&(e.dataset.historyId=r,e.dataset.unseen="true",e.querySelector(this.renderOptions.historyItemBagSelector)?.classList.remove("d-none"))}isUnreadMerchantHistory(e){let t=this.renderOptions.unreadHistoryIds;return Array.isArray(t)&&this.getSourceHistoryIds(e).some(e=>t.includes(e))}getSourceHistoryIds(e){let t=e[n];if(Array.isArray(t))return t.filter(e=>"string"==typeof e);let r=this.getRepresentativeHistoryId(e);return r?[r]:[]}getRepresentativeHistoryId(e){return"string"==typeof e.id?e.id:""}renderQuoteSummaryItems(e){let t=(this.renderOptions.quoteSummary?.items??[]).map(t=>{if(!this.shouldRenderSummaryItem(t,e))return null;let r=this.resolveSummaryItemValue(t,e);return t.label&&r?this.renderSummaryChangeItem(t.label,r):null}).filter(e=>null!==e);return 0===t.length?null:this.renderChangesContainer(t)}shouldRenderSummaryItem(e,t){if("discount"!==e.formatter)return!0;let r=e.valuePath?this.getChangeFieldFromValuePath(e.valuePath):"";return"discount"!==r||this.hasNewChangeField(t,r)}resolveSummaryItemValue(e,t){if(e.valuePath){let r=this.getValueByPath(t,e.valuePath);return null==r?null:this.formatConfiguredValue(r,e.formatter)||null}return this.formatConfiguredValue(e.value,e.formatter)||this.formatValue(e.value)||null}renderSummaryChangeItem(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=document.createElement("span");if(s.className="quote-detail-history__change",e){let t=document.createElement("span");t.className="quote-detail-history__change-label",t.textContent=e,s.append(t)}let i=document.createElement("span");if(i.className="quote-detail-history__change-value",r){let e=document.createElement("a");e.className="value col-6 quote-order-number",e.textContent=`${t}->`,e.href=r,i.append(e)}else i.textContent=t;return s.append(i),s}renderChangeItems(e,t){if(this.isQuoteSummaryStatusChange(e))return this.renderQuoteSummaryStatusChange(e);let r=(0,i.q)(e.changes),s=Object.entries((0,i.q)(r.new)).filter(e=>{let[t]=e;return!["stateId","displayState","storefrontState"].includes(t)}).map(t=>{let[r,s]=t,i=this.getSummaryItemByChangeField(r),n=this.formatChangeLabel(r,i),a=this.formatHistoryChangeValue(r,
16s,i,e);return a?this.renderSummaryChangeItem(n,a,this.getHistoryChangeValueUrl(r)):null}),n=[this.renderMerchantSentSummaryChangeItem(e,t),...s].filter(e=>null!==e);return 0===n.length?null:this.renderChangesContainer(n)}renderMerchantSentSummaryChangeItem(e,t){if(!this.shouldMoveMerchantSentSummaryToNextChange(t,e))return null;let r=this.renderOptions.quoteSummary?.items?.[0],s=r?this.resolveSummaryItemValue(r,e):"";return r?.label&&s?this.renderSummaryChangeItem(r.label,s):null}formatChangeLabel(e,t){return"orderId"===e?this.getSnippet("historyOrderCreated"):t?.label??this.formatLabel(e)}getHistoryChangeValueUrl(e){return"orderId"===e?this.formatValue(this.renderOptions.quoteSummary?.orderUrl):""}formatHistoryChangeValue(e,t,r,s){return"orderId"===e?this.formatValue(this.renderOptions.quoteSummary?.orderNumber)||this.formatChangeValue(e,t):r?.valuePath?this.resolveSummaryItemValue(r,s):this.formatChangeValue(e,t)}renderQuoteSummaryStatusChange(e){let t=this.getQuoteSummaryStatusChangeValue(e);return t?this.renderChangesContainer([this.renderSummaryChangeItem(this.getQuoteSummaryStatusChangeLabel(e),t)]):null}renderChangesContainer(e){let t=document.createElement("div");return t.className="quote-detail-history__changes",t.replaceChildren(...e),t}getStatusChange(e){let t=(0,i.q)(e.changes),r=(0,i.q)(t.new);return this.getStorefrontState(r)}getStorefrontState(e){let t=(0,i.q)(e.displayState);return this.formatValue(t.storefrontState??e.storefrontState)}isQuoteSummaryStatusChange(e){let t=(0,i.q)(e.changes),r=(0,i.q)(t.new),s=this.getStorefrontState(r);return!!this.isWithdrawStatus(s)||this.isDraftToRequestSentStatusChange(e)}isDraftToRequestSentStatusChange(e){let t=(0,i.q)(e.changes),r=(0,i.q)(t.old),s=(0,i.q)(t.new);return"draft"===this.getStorefrontState(r)&&"request_sent"===this.getStorefrontState(s)}hasDetailChanges(e){let t=(0,i.q)(e.changes);return Object.entries((0,i.q)(t.new)).some(e=>{let[t,r]=e;return!["stateId","displayState","storefrontState"].includes(t)&&this.formatChangeValue(t,r)})}hasNewChangeField(e,t){let r=(0,i.q)(e.changes),s=(0,i.q)(r.new);return Object.prototype.hasOwnProperty.call(s,t)}hasHistoryChanges(e){let t=(0,i.q)(e.changes),r=(0,i.q)(t.old),s=(0,i.q)(t.new);return Object.keys(r).length>0||Object.keys(s).length>0}shouldRenderMerchantSentArticle(e,t,r){return!this.shouldMoveMerchantSentSummaryToNextChange(e,r)&&this.isMerchantSentStatus(t)&&this.isMerchantChangeHistory(e)}shouldMoveMerchantSentSummaryToNextChange(e,t){return!!e&&!!t&&this.isWithinMergeWindow(this.getMerchantMergeTimestamp(e),this.getMerchantMergeTimestamp(t))&&this.isOpenOfferStatusHistory(e)&&this.isMerchantDetailChangeHistory(t)}isMerchantChangeHistory(e){return!this.isCustomerOrEmployeeHistory(e)&&this.hasHistoryChanges(e)}isMerchantSentStatusHistory(e){let t=this.getStatusChange(e);return!!t&&this.isMerchantSentStatus(t)&&this.isMerchantChangeHistory(e)}isOpenOfferStatusHistory(e){return"open_offer"===this.getStatusChange(e)&&this.isMerchantChangeHistory(e)}isMerchantDetailChangeHistory(e){return!this.getStatusChange(e)&&!this.isCustomerOrEmployeeHistory(e)&&this.hasDetailChanges(e)}isMerchantMergeTarget(e){let t=this.getStatusChange(e);return!!(t&&this.isMerchantSentStatus(t))||!this.isCustomerOrEmployeeHistory(e)&&this.hasDetailChanges(e)}isMerchantCommentOnlyEntry(e){return this.isCommentOnlyEntry(e)&&!this.isCustomerOrEmployeeHistory(e)}isCommentOnlyEntry(e){return!!this.getComment(e)&&!this.getStatusChange(e)&&!this.hasDetailChanges(e)}isRequestCommentOnlyEntry(e){return"request"===this.formatValue(e.action)&&this.isCommentOnlyEntry(e)}isAddedStatusHistory(e){return"state_change"===this.formatValue(e.action)&&this.isDraftToRequestSentStatusChange(e)}isMerchantSentStatus(e){let t=this.renderOptions.quoteSummary?.sentStatuses??[],r=e.toLowerCase();return t.some(e=>e.toLowerCase()===r)}renderComment(e){let t=this.getComment(e);if(!t)return null;let r=document.createElement("p");return r.className="quote-detail-history__comment",r.textContent=t,r}renderActionFallback(e){let t=this.formatValue(e.action)||this.getSnippet("historyChangeFallback");return this.renderChangesContainer([this.renderSummaryChangeItem(null,t)])}getComment(e){if("string"==typeof e.comment)return e.comment;let t=(0,i.q)(e.comment);return this.formatValue(t.comment??t.text??t.content)}getActor(e){let t=(0,i.q)(e.employee),r=(0,i.q)(e.customer),s=(0,i.q)(e.createdBy),n=Object.keys(t).length>0,a=Object.keys(r).length>
160,o=a||e.customerId?this.getSnippet("customerComment"):this.getSnippet("merchantComment"),l=this.getName(n?t:a?r:s)||o;return{name:l,initials:this.getInitials(l),isCustomer:a||!!e.customerId}}getHistoryDate(e){return this.isCustomerOrEmployeeHistory(e)?e.createdAt??e.sentAt:e.sentAt??e.createdAt}getMerchantMergeTimestamp(e){return this.getTimestamp(e.sentAt)}getCreatedAtMergeTimestamp(e){return this.getTimestamp(e.createdAt)}getTimestamp(e){let t=this.formatValue(e);if(!t)return null;let r=new Date(t).getTime();return Number.isNaN(r)?null:r}isWithinMergeWindow(e,t){return null!==e&&null!==t&&15e3>=Math.abs(e-t)}isCustomerOrEmployeeHistory(e){let t=(0,i.q)(e.customer),r=(0,i.q)(e.employee);return!!(e.customerId||e.employeeId||Object.keys(t).length||Object.keys(r).length)}getName(e){return[this.formatValue(e.firstName),this.formatValue(e.lastName)].filter(Boolean).join(" ")||this.formatValue(e.name)}getInitials(e){return e.split(" ").filter(Boolean).slice(0,2).map(e=>e.charAt(0)).join("").toUpperCase()}formatDate(e){let t=this.formatValue(e);if(!t)return"";let r=new Date(t);if(Number.isNaN(r.getTime()))return t;let s={dateStyle:"short",timeStyle:"short"};return this.renderOptions.dateTimeTimeZone&&(s.timeZone=this.renderOptions.dateTimeTimeZone),new Intl.DateTimeFormat(this.renderOptions.dateTimeLocale||document.documentElement.lang||void 0,s).format(r)}formatLabel(e){return e.replace(/([A-Z])/g," $1").replace(/[_-]/g," ").replace(/\s+/g," ").trim().replace(/^./,e=>e.toUpperCase())||this.getSnippet("historyChangeFallback")}formatStatusLabel(e){return this.formatLabel(e)}getStatusLabel(e){let t=this.renderOptions.statusLabels?.[e];return t&&t!==`quoteManagement.details.${e}`?t:this.formatStatusLabel(e)}formatChangeValue(e,t){if(["storefrontState","lineItems"].includes(e)){let e=this.formatValue(t);return e?this.formatStatusLabel(e):""}if("discount"===e)return this.formatDiscount(t);let r=(0,i.q)(t);return this.formatCurrency(r.totalPrice)||this.formatValue(t)}formatConfiguredValue(e,t){if("currency"===t)return this.formatCurrency(e);if("discount"===t)return this.formatDiscount(e);if("datetime"===t)return this.formatDateTimeValue(e);if("label"===t){let t=this.formatValue(e);return t?this.formatStatusLabel(t):""}return this.formatValue(e)}formatDateTimeValue(e){let t=this.formatValue(e);if(!t)return"";let r=new Date(t.replace(" ","T"));if(Number.isNaN(r.getTime()))return t;let s={year:"2-digit",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!0};this.renderOptions.dateTimeTimeZone&&(s.timeZone=this.renderOptions.dateTimeTimeZone);let i=new Intl.DateTimeFormat(this.renderOptions.dateTimeLocale||document.documentElement.lang||void 0,s).formatToParts(r).reduce((e,t)=>(e[t.type]=t.value,e),{});return`${i.day}/${i.month}/${i.year} ${i.hour}:${i.minute} ${i.dayPeriod?.toLowerCase()??""}`.trim()}formatDiscount(e){let t=(0,i.q)(e),r=this.formatValue(t.type),s=t.value;return r&&null!=s?"absolute"===r?this.getSnippet("historyDiscountAbsolute").replace("%value%",this.formatCurrency(Number(s))):this.getSnippet("historyDiscountRelative").replace("%value%",this.formatValue(s)):this.formatValue(e)}formatCurrency(e){if("number"!=typeof e)return"";try{return new Intl.NumberFormat(document.documentElement.lang||void 0,{style:"currency",currency:this.renderOptions.currencyIsoCode||"EUR"}).format(e)}catch{return this.formatValue(e)}}formatValue(e){if(null==e)return"";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return String(e);let t=(0,i.q)(e),r=(0,i.q)(t.translated);return this.formatValue(r.name??r.label??t.name??t.label??t.value)}getValueByPath(e,t){return t.split(".").reduce((e,t)=>(0,i.q)(e)[t],e)}getQuoteSummaryStatusChangeValue(e){let t=this.renderOptions.quoteSummary?.items?.[0],r=t?this.resolveSummaryItemValue(t,e):"",s=this.formatValue(e.quoteId);return r||this.formatQuoteSummaryValue(s)}formatQuoteSummaryValue(e){return e?this.getSnippet("historySentQuoteValue").replace("%quoteNumber%",e):""}getQuoteSummaryStatusChangeLabel(e){let t=this.getStatusChange(e);return this.isWithdrawStatus(t)?this.renderOptions.quoteSummary?.statusChangeLabels?.withdraw??this.get
16StatusLabel("withdrawn"):this.isDraftToRequestSentStatusChange(e)?this.renderOptions.quoteSummary?.statusChangeLabels?.added??"Added":this.renderOptions.quoteSummary?.statusChangeLabels?.sent??this.renderOptions.quoteSummary?.items?.[0]?.label??""}getSummaryItemByChangeField(e){return this.renderOptions.quoteSummary?.items?.find(t=>t.valuePath&&this.getChangeFieldFromValuePath(t.valuePath)===e)}getChangeFieldFromValuePath(e){let t="changes.new.";return e.startsWith(t)?e.slice(t.length).split(".")[0]??"":""}isWithdrawStatus(e){let t=e.toLowerCase();return"withdrawn"===t||"withdraw"===t}cloneTemplate(e){let t=this.el.querySelector(e),r=t?.content.firstElementChild?.cloneNode(!0);return r instanceof HTMLElement?r:null}getSnippet(e){return this.renderOptions.snippets?.[e]??a[e]}getMerchantActor(){let e=this.getSnippet("merchantComment");return{name:e,initials:this.getInitials(e),isCustomer:!1}}constructor(...e){super(...e),this.renderOptions=o.options}}},900(e,t,r){r.d(t,{F:()=>i});let s="b2b-quote-bootstrap-toast-container";function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e instanceof Error?e.message.trim():"string"==typeof e?e.trim():"";if(!r)return;let i=function(e,t){let r=document.createElement("div");r.className=`toast align-items-center text-bg-${t} border-0`,r.setAttribute("role","danger"===t?"alert":"status"),r.setAttribute("aria-live","danger"===t?"assertive":"polite"),r.setAttribute("aria-atomic","true");let s=document.createElement("div");s.className="d-flex";let i=document.createElement("div");i.className="toast-body",i.textContent=e;let n=document.createElement("button");return n.type="button",n.className=["warning","light"].includes(t)?"btn-close me-2 m-auto":"btn-close btn-close-white me-2 m-auto",n.setAttribute("data-bs-dismiss","toast"),n.setAttribute("aria-label","Close"),s.append(i,n),r.append(s),r}(r,t.variant||"danger"),n=t.delay||8e3;if((function(){let e=document.getElementById(s);if(e)return e;let t=document.createElement("div");return t.id=s,t.className="toast-container position-fixed top-0 end-0 p-3",t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),document.body.append(t),t})().append(i),"undefined"==typeof bootstrap||!bootstrap.Toast){i.classList.add("show"),i.querySelector('[data-bs-dismiss="toast"]')?.addEventListener("click",()=>{i.remove()},{once:!0}),window.setTimeout(()=>i.remove(),n);return}let a=bootstrap.Toast.getOrCreateInstance?.(i,{delay:n})||new bootstrap.Toast(i,{delay:n});i.addEventListener("hidden.bs.toast",()=>{i.remove()},{once:!0}),a.show()}}},t={};function r(s){var i=t[s];if(void 0!==i)return i.exports;var n=t[s]={exports:{}};return e[s](n,n.exports,r),n.exports}r.m=e,r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((t,s)=>(r.f[s](e,t),t),[])),r.u=e=>"./js/quote-management/"+({12379:"quote-management.quote-manage-line-items.plugin.ts",14604:"quote-management.quote-search.plugin.ts",21044:"quote-management.offcanvas-cart.plugin.ts",21528:"quote-management.quote-document-search.plugin.ts",44059:"quote-management.quote-info-banner.plugin.ts",53185:"quote-management.quick-search-quote-line-item.plugin.ts",77450:"quote-management.quote-history-read-tracker.plugin.ts",80208:"quote-management.quote-manage-line-items-history.plugin.ts",83247:"quote-management.quote-request.plugin.ts",86504:"quote-management.quote-notification-employees-multiple-selection.plugin.ts",90160:"quote-management.quote-trigger-confirm-modal.plugin.ts",92854:"quote-management.remove-promotion-confirm.plugin.ts",94615:"quote-management.confirm-modal.plugin.ts"})[e]+"."+({12379:"fbefb5",14604:"942886",21044:"bf4a44",21528:"bc614e",44059:"f4140d",53185:"447f07",77450:"9dfb2b",80208:"3d05e5",83247:"aacd66",86504:"abffe4",90160:"5b145f",92854:"17e2bb",94615:"74c368"})[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}
16}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={};r.l=(t,s,i,n)=>{if(e[t]){e[t].push(s);return}if(void 0!==i)for(var a,o,l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var h=l[u];if(h.getAttribute("src")==t){a=h;break}}a||(o=!0,(a=document.createElement("script")).charset="utf-8",r.nc&&a.setAttribute("nonce",r.nc),a.src=t),e[t]=[s];var d=(r,s)=>{a.onerror=a.onload=null,clearTimeout(m);var i=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach(e=>e(s)),r)return r(s)},m=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),o&&document.head.appendChild(a)}})(),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{r.g.importScripts&&(e=r.g.location+"");var e,t=r.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var s=t.getElementsByTagName("script");if(s.length)for(var i=s.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=s[i--].src}if(!e)throw Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e+"../../"})(),(()=>{var e={2991:0};r.f.j=(t,s)=>{var i=r.o(e,t)?e[t]:void 0;if(0!==i){if(i)s.push(i[2]);else{var n=new Promise((r,s)=>i=e[t]=[r,s]);s.push(i[2]=n);var a=r.p+r.u(t),o=Error();r.l(a,s=>{if(r.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var n=s&&("load"===s.type?"missing":s.type),a=s&&s.target&&s.target.src;o.message="Loading chunk "+t+" failed.\n("+n+": "+a+")",o.name="ChunkLoadError",o.type=n,o.request=a,i[1](o)}},"chunk-"+t,t)}}};var t=(t,s)=>{var i,n,[a,o,l]=s,u=0;if(a.some(t=>0!==e[t])){for(i in o)r.o(o,i)&&(r.m[i]=o[i]);l&&l(r)}for(t&&t(s);u<a.length;u++)n=a[u],r.o(e,n)&&e[n]&&e[n][0](),e[n]=0},s=self.webpackChunk=self.webpackChunk||[];s.forEach(t.bind(null,0)),s.push=t.bind(null,s.push.bind(s))})();var s=r(220);class i extends s.A{init(){this._expirationDate=this.el.querySelector(this.options.selectors.expirationDate),this._status=this.el.querySelector(this.options.selectors.status),this._expiredStatus=this.el.querySelector(this.options.selectors.expiredStatus),this.renderExpiredLabel()}renderExpiredLabel(){let e=this._expirationDate?.attributes[this.options.attributes.dataExpiration]?.value;if(e&&new Date(e)<Date.now()&&this._expiredStatus){this._expiredStatus.classList.remove("d-none"),this._status?.classList.add("d-none");return}}}var n=r(900);class a extends s.A{static #e=this.options={selectors:{expirationDate:".quote-expiration-date",status:"[data-status]",expiredStatus:".quote-item-status-badge-expired:not([data-status])",declinedButton:"#btn-quote-decline",requestChangesButton:"#btn-quote-request-changes",checkoutButton:"#btn-quote-checkout",manageLineItemsModal:".quote-manage-line-items-modal",hiddenSubmitButton:"[data-hidden-quote-manage-line-items-submit-button]",manageLineItemsPlugin:"[data-b2b-quote-manage-line-items-plugin]",quoteDetailReloadForm:"[data-b2b-quote-detail-reload-form]",quoteDetailTableContainer:".quote-detail-line-items-table-container",quoteDetailTableForm:".quote-detail-line-items-table-container__form",quoteLineItemEditAction:'[data-b2b-quote-line-item-action="edit"]',quoteLineItemAddCommentAction:'[data-b2b-quote-line-item-action="comment"]',quoteManageLineItemButton:".btn-quote-manage-line-items"},attributes:{dataExpiration:"data-expiration"},events:{historyReadSucceeded:"b2b-quote-history-read-succeeded",quoteDetailReload:"b2b-quote-detail-reload",quoteLineItemDeleteConfirmed:"b2b-quote-manage-line-item-delete-confirmed"}};init(){this.syncState(),this._boundHandleClick=this._handleClick.bind(this),this._boundHandleHistoryReadSucceeded=this._handleHistoryReadSucceeded.bind(this),this._boundHandleReloadQuoteDetail=this._handleReloadQuoteDetail.bind(this),this._boundHandleQuoteLineItemDeleteConfirmed=this._handleQuoteLineItemDeleteConfirmed.bind(this),this.renderExpiredLabel(),this._registerEvents(),this._triggerQuoteDetailLineItemsInitialLoad()}update(){this.syncState()}syncState(){this._expirationDate=this.el.querySelector(this.options.selectors.expirationDate),this._status=this.el.querySelector(this.options.selectors.status),this._expiredStatus=this.el.querySelector(this.options.selectors.expiredStatus),this._declinedButton=this.el.querySelector(this.options.selectors.declinedButton),this._requestChangesButton=this.el.querySelector(this.options.selectors.requestChangesButton),this._checkoutButton=this.el.querySelector(this.options.selectors.checkoutButton),this._manageLineItemsModal=this.el.querySelector(this.options.selectors.manageLineItemsModal),this._quoteDetailReloadForm=this.el.querySelector(this.options.selectors.quoteDetailReloadForm),this._quoteDetailTableForm=this.el.querySelector(this.options.selectors.quoteDetailTableForm),this._hiddenSubmitButton=this.el.querySelector(this.options.selectors.hiddenSubmitButton),this._quoteManageLineItemButton=this.el.querySelector(this.options.selectors.quoteManageLineItemButton)}renderExpiredLabel(){let e=this._expirationDate?.attributes[this.options.attributes.dataExpiration]?.value;if(e&&new Date(e).getTime()<Date.now()){this._expiredStatus&&(this._expiredStatus.classList.remove("d-none"),this._status?.classList.add("d-none")),this._declinedButton?.setAttribute("disabled","true"),this._requestChangesButton?.setAttribute("disabled","true"),this._checkoutButton?.classList.add("disabled");return}}_registerEvents(){this.el.addEventListener("click",this._boundHandleClick),document.addEventListener(this.options.events.historyReadSucceeded,this._boundHandleHistoryReadSucceeded),this.el.addEventListener(this.options.events.quoteDetailReload,this._boundHandleReloadQuoteDetail),this.el.addEventListener(this.options.events.quoteLineItemDeleteConfirmed,this._boundHandleQuoteLineItemDeleteConfirmed)}_handleClick(e){let t=e.target;if(!(t instanceof Element))return;let r=t.closest(this.options.selectors.quoteLineItemEditAction),s=t.closest(this.options.selectors.quoteLineItemAddCommentAction);if(!r&&!s)return;e.preventDefault();let i=r?.dataset.lineItemId||s?.dataset.lineItemId,n=r?"edit":"comment";this._copyQuoteDetailTableParamsToManageLineItemsForm(i,n),this._quoteManageLineItemButton?.click()}_copyQuoteDetailTableParamsToManageLineItemsForm(e,t){if(!this._quoteDetailTableForm||!this._hiddenSubmitButton)return;let r=this._readQuoteDetailTableParams();this._applyParamsToManageLineItemsForm(r,e,t)}_readQuoteDetailTableParams(){let e=this._quoteDetailTableForm,t=new URLSearchParams;if(!e)return t;let r=this._getCopiedQuoteDetailTableParamNames(),s=new URL(e.getAttribute("action")||window.location.href,window.location.origin),i=new FormData(e);
16return r.forEach(e=>{s.searchParams.has(e)&&t.set(e,s.searchParams.get(e)||"");let r=i.get(e);"string"==typeof r&&t.set(e,r.trim())}),t}_applyParamsToManageLineItemsForm(e,t,r){let s=this._hiddenSubmitButton;if(!s)return;let i=s.dataset.formAction;if(!i)return;let n=new URL(i,window.location.origin);this._getCopiedQuoteDetailTableParamNames().forEach(t=>{let r=e.get(t);if(null===r||""===r){n.searchParams.delete(t);return}n.searchParams.set(t,r)}),s.dataset.formAction=`${n.pathname}${n.search}${n.hash}`,t&&this._manageLineItemsModal&&(this._manageLineItemsModal.dataset.focusLineItemId=t,this._manageLineItemsModal.dataset.initialAction=r)}_getCopiedQuoteDetailTableParamNames(){return["limit","p","order","term"]}_triggerQuoteDetailLineItemsInitialLoad(){this._quoteDetailTableForm?.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}))}_handleReloadQuoteDetail(){this._quoteDetailReloadForm?.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}))}_handleHistoryReadSucceeded(){this._triggerQuoteDetailLineItemsInitialLoad()}_handleQuoteLineItemDeleteConfirmed(e){let t=e.detail||{};this._submitQuoteLineItemDelete(t).catch(e=>{(0,n.F)(e)})}async _submitQuoteLineItemDelete(e){let t=this._getStringFromUnknown(e.context?.removeUrl);t&&(await fetch(t,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","X-Requested-With":"XMLHttpRequest"}})).ok&&this._handleReloadQuoteDetail()}_getStringFromUnknown(e){return"string"==typeof e?e.trim():""}}var o=r(795);class l extends s.A{static #e=this.options={messageTextareaSelector:".quote-detail-comment__textarea",messageInputSelector:".quote-detail-comment__input",collapseElementSelector:"#sendComment"};init(){let e=o.A.querySelector(document,this.options.collapseElementSelector,!1),t=o.A.querySelector(this.el,this.options.messageInputSelector),r=o.A.querySelector(this.el,this.options.messageTextareaSelector);t.addEventListener("focus",()=>{new bootstrap.Collapse(this.options.collapseElementSelector).show()}),e&&(e.addEventListener("hidden.bs.collapse",()=>{r.value=""}),e.addEventListener("shown.bs.collapse",()=>{r.focus()}))}}var u=r(105),h=r(724),d=r(341),m=r(808);let c=new Map,g=new Map;class y extends s.A{static #e=this.options={contentSelector:"[data-off-canvas-message-content], [data-b2b-quote-offcanvas-message-content]",messageFormSelector:"[data-quote-history-message-form]",offcanvasHistory:".quote-detail-offcanvas-history",historyItemPluginSelector:"[data-b2b-quote-history-item-plugin]",historyListSelector:"[data-quote-history-list]",historyLoadingSelector:"[data-quote-history-loading]",historyEmptySelector:"[data-quote-history-empty]",historyErrorSelector:"[data-quote-history-error]",historyViewportSelector:".quote-detail-offcanvas__body, .offcanvas-body",messageTextareaSelector:"textarea",messageSubmitButtonSelector:'button[type="submit"]',historyUrl:null,historyReadUrl:null,currencyIsoCode:"EUR",quoteSummary:null,statusLabels:{},snippets:{historyChangeFallback:"Updated",historyDiscountAbsolute:"Absolute %value%",historyDiscountRelative:"Relative %value%%",historyOrderCreated:"Order created",historySentQuoteValue:"Quote #%quoteNumber%",merchantComment:"Merchant",customerComment:"You",quoteMessageSendError:"Could not send quote message.",quoteHistoryMissingUrlError:"Missing quote history URL.",quoteHistoryLoadError:"Could not load quote history.",quoteHistoryReadError:"Could not mark quote history as seen."}};static #t=this.unregisterHistoryReadOnClose=null;init(){this.seenHistoryIds=new Set,this._registerEventListeners(),this._loadUnreadHistoryBadge()}_registerEventListeners(){this.el.addEventListener("click",this._onClickOffCanvasMessage.bind(this))}_onClickOffCanvasMessage(){let e=document.querySelector(this.options.contentSelector);e&&u.A.open(e.innerHTML,async()=>{await window.PluginManager.initializePlugins(),this._registerOffCanvasEvents(),this._registerHistoryReadOnClose(),this._registerHistoryViewportTracking(),this._loadHistory()},"end",!0,u.A.REMOVE_OFF_CANVAS_DELAY(),!1,"quote-detail-offcanvas-history")}_registerOffCanvasEvents(){this.offCanvasHistory=document.querySelector(this.options.offcanvasHistory),this._registerHistoryElements();let e=this.offCanvasHistory?.querySelector(this.options.messageFormSelector),t=e?.querySelector("fieldset");this.offCanvasHistory&&e&&t&&(this.activeMessageForm=t,this._updateMessageSubmitButton(),this.activeMessageFormElement!==e&&(this.activeMessageFormElement=e,window.PluginManager.getPluginInstanceFromElement(e,"FormAjaxSubmit")?.$emitter.subscribe("onAfterAjaxSubmit",this._afterAjaxSubmitMessage.bind(this)),e.addEventListener("input",this._updateMessageSubmitButton.bind(this))))}_registerHistoryElements(){this.historyList=this.offCanvasHistory?.querySelector(this.options.historyListSelector),this.historyLoading=this.offCanvasHistory?.querySelector(this.options.historyLoadingSelector),this.historyEmpty=this.offCanvasHistory?.querySelector(this.options.historyEmptySelector),this.historyError=this.offCanvasHistory?.querySelector(this.options.historyErrorSelector)}_afterAjaxSubmitMessage(){let e=this.activeMessageForm?.querySelector(this.options.messageTextareaSelector);e&&(e.value="",this._updateMessageSubmitButton(),this._loadHistory(!0),this._handleMessageFormState(),this._registerOffCanvasEvents())}_handleMessageFormState(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.activeMessageForm&&(this.activeMessageForm.disabled=e)}_updateMessageSubmitButton(){let e=this.activeMessageForm?.querySelector(this.options.messageTextareaSelector),t=this.activeMessageForm?.querySelector(this.options.messageSubmitButtonSelector);t&&e&&(t.disabled=!e.value.trim())}_getSnippet(e){return this.options.snippets?.[e]??y.options.snippets?.[e]??""}_loadUnreadHistoryBadge(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.options.historyUrl?this._loadHistoryPayload(e).then(e=>{this.unreadHistoryIds=e.unreadHistoryIds,this._updateHistoryBadge(this.unreadHistoryIds.length)}).catch(()=>{}):(this._updateHistoryBadge(),Promise.resolve())}_loadHistory(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._setHistoryState("loading"),!this.options.historyUrl){this._setHistoryState("empty");return}this._loadHistoryPayload(e).then(e=>{this._renderHistory(e)}).catch(e=>{(0,n.F)(e),this._setHistoryState("error")}).finally(()=>{this._removeHistoryLoading()})}_loadHistoryPayload(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.options.historyUrl)return Promise.reject(Error(this._getSnippet("quoteHistoryMissingUrlError")));let t=this.options.historyUrl,r=g.get(t),s=c.get(t);if(!e&&r)return r;if(!e&&s)return this.cachedHistoryPayload=s,Promise.resolve(s);if(!e&&this.historyPayloadPromise)return this.historyPayloadPromise;if(!e&&this.cachedHistoryPayload)return Promise.resolve(this.cachedHistoryPayload);let i=fetch(t,{headers:{"X-Requested-With":"XMLHttpRequest"}}).then(e=>{if(!e.ok)throw Error(this._getSnippet("quoteHistoryLoadError"));return e.json()}).then(e=>{let r=this._extractHistoryPayload(e);return this.historyPayloadPromise===i&&(this.cachedHistoryPayload=r),c.set(t,r),r}).finally(()=>{this.historyPayloadPromise===i&&(this.historyPayloadPromise=null),g.get(t)===i&&g.delete(t)});return this.historyPayloadPromise=i,g.set(t,i),i}_renderHistory(e){if(this.historyList)try{let t=this._getHistoryItemPlugin();if(!t){this._setHistoryState("error");return}t.setRenderOptions({...this.options,unreadHistoryIds:e.unreadHistoryIds});let r=t.mergeMerchantHistories(e.histories),s=r.flatMap((e,s)=>t.render(e,r[s-1],r[s+1]));this.mergedHistoryIds=this._extendMergedHistoryIds(r,e.mergedHistoryIds),this.unreadHistoryIds=e.unreadHistoryIds,this.historyList.replaceChildren(...s),this._setHistoryState(r.length>0?"ready":"empty"),this._markVisibleUnreadHistoryItems()}catch{this._setHistoryState("error")}}_getHistoryItemPlugin(){let e=this.offCanvasHistory?.querySelector(this.options.historyItemPluginSelector);if(!e)return null;let t=window.PluginManager.getPluginInstanceFromElement(e,"B2bQuoteHistoryItemPlugin");return t&&"function"==typeof t.render&&"function"==typeof t.mergeMerchantHistories&&"function"==typeof t.setRenderOptions?(t.setRenderOptions(this.options),t):null}_registerHistoryReadOnClose(){y.unregisterHistoryReadOnClose?.();let e=!1,t=()=>{this.offCanvasHistory?.removeEventListener("hide.bs.offcanvas",r),this.offCanvasHistory?.removeEventListener("hidden.bs.offcanvas",s),window.removeEventListener("pagehide",r),y.unregisterHistoryReadOnClose===t&&(y.unregisterHistoryReadOnClose=null)},r=s=>{e||(e=!0,this._markQuoteHistoryAsSeen(),this.offCanvasHistory?.removeEventListener("hide.bs.offcanvas",r),window.removeEventListener("pagehide",r),s?.type==="pagehide"&&t())},s=()=>{this.seenHistoryIds.clear(),t()};y.unregisterHistoryReadOnClose=t,this.offCanvasHistory?.addEventListener("hide.bs.offcanvas",r),this.offCanvasHistory?.addEventListener("hidden.bs.offcanvas",s),window.addEventListener("pagehide",r)}_markQuoteHistoryAsSeen(){let e=this._getUnreadHistoryIdsForRead();if(!this.options.historyReadUrl||0===e.length)return;
16e.forEach(e=>{this.readHistoryIds.add(e)});let t=new FormData;e.forEach(e=>{t.append("historyIds[]",e)}),fetch(this.options.historyReadUrl,{method:"post",body:t,headers:{"X-Requested-With":"XMLHttpRequest"}}).then(e=>{if(!e.ok)throw Error(this._getSnippet("quoteHistoryReadError"))}).then(()=>this._loadUnreadHistoryBadge(!0)).catch(t=>{(0,n.F)(t),e.forEach(e=>{this.readHistoryIds.delete(e)})})}_getUnreadHistoryIdsForRead(){let e=new Set(this.unreadHistoryIds);return Array.from(new Set(Array.from(this.seenHistoryIds).flatMap(t=>{let r=[t,...this.mergedHistoryIds[t]??[]];return r.some(t=>e.has(t))?r:[]}))).filter(e=>!this.readHistoryIds.has(e))}_extendMergedHistoryIds(e,t){return e.reduce((e,t)=>{let r=this._getRepresentativeHistoryId(t);if(!r)return e;let s=this._getSourceHistoryIds(t).flatMap(t=>e[t]??[t]);return e[r]=Array.from(new Set([r,...e[r]??[],...s])),e},{...t})}_getSourceHistoryIds(e){let t=e[m.SOURCE_HISTORY_IDS_FIELD];if(Array.isArray(t))return t.filter(e=>"string"==typeof e);let r=this._getRepresentativeHistoryId(e);return r?[r]:[]}_getRepresentativeHistoryId(e){return"string"==typeof e.id?e.id:""}_registerHistoryViewportTracking(){if(!this.offCanvasHistory)return;let e=this._getHistoryViewport(),t=()=>{this._markVisibleUnreadHistoryItems()};e?.addEventListener("scroll",t,{passive:!0}),this.offCanvasHistory?.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t),this.offCanvasHistory?.addEventListener("hide.bs.offcanvas",()=>{e?.removeEventListener("scroll",t),this.offCanvasHistory?.removeEventListener("scroll",t),window.removeEventListener("resize",t)},{once:!0})}_markVisibleUnreadHistoryItems(){let e=this._getHistoryViewportRect();this.offCanvasHistory?.querySelectorAll('[data-unseen="true"][data-history-id]').forEach(t=>{let r=t.dataset.historyId;r&&this._isElementInsideViewport(t,e)&&this.seenHistoryIds.add(r)})}_getHistoryViewportRect(){let e=this._getHistoryViewport();return e?e.getBoundingClientRect():{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0}}_getHistoryViewport(){return this.offCanvasHistory?.querySelector(this.options.historyViewportSelector)}_isElementInsideViewport(e,t){let r=e.getBoundingClientRect(),s=r.top+11;return s>=t.top&&s+8<=t.bottom&&r.right>t.left&&r.left<t.right}_updateHistoryBadge(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.el.classList.toggle("hide-badge",e<=0)}_extractHistoryPayload(e){return{histories:this._extractHistories(e),mergedHistoryIds:this._extractMergedHistoryIds(e),unreadHistoryIds:this._extractUnreadHistoryIds(e)}}_extractMergedHistoryIds(e){let t=(0,d.q)(e),r=(0,d.q)(t.data),s=(0,d.q)(t.object);return Object.entries((0,d.q)(t.mergedHistoryIds??r.mergedHistoryIds??s.mergedHistoryIds)).reduce((e,t)=>{let[r,s]=t;return Array.isArray(s)&&(e[r]=s.filter(e=>"string"==typeof e)),e},{})}_extractUnreadHistoryIds(e){let t=(0,d.q)(e),r=(0,d.q)(t.data),s=(0,d.q)(t.object),i=t.unreadHistoryIds??r.unreadHistoryIds??s.unreadHistoryIds;return Array.isArray(i)?i.filter(e=>"string"==typeof e):[]}_extractHistories(e){let t=(0,d.q)(e),r=(0,d.q)(t.data),s=(0,d.q)(t.object),i=t.histories??r.histories??s.histories??t.elements;return this._collectionToArray(i)}_collectionToArray(e){if(Array.isArray(e))return e.filter(e=>(0,d.u)(e));let t=(0,d.q)(e),r=t.elements??t.entities;return Array.isArray(r)?r.filter(e=>(0,d.u)(e)):(0,d.u)(r)?Object.values(r).filter(e=>(0,d.u)(e)):(0,d.u)(e)?Object.values(e).filter(e=>(0,d.u)(e)&&this._isHistoryEntry(e)):[]}_setHistoryState(e){if((this.historyList||this.historyLoading||this.historyEmpty||this.historyError)&&(this.historyList?.classList.toggle("d-none","ready"!==e),this.historyLoading?.classList.toggle("d-none","loading"!==e),this.historyEmpty?.classList.toggle("d-none","empty"!==e),this.historyError?.classList.toggle("d-none","error"!==e),this.historyLoading)){if("loading"===e){h.A.create(this.historyLoading);return}h.A.remove(this.historyLoading)}}_removeHistoryLoading(){this.historyLoading&&(this.historyLoading.classList.add("d-none"),h.A.remove(this.historyLoading))}_isHistoryEntry(e){return["comment","changes","action","createdAt","sentAt"].some(t=>t in e)}constructor(...e){super(...e),this.activeMessageForm=null,this.activeMessageFormElement=null,this.offCanvasHistory=null,this.historyList=null,this.historyLoading=null,this.historyEmpty=null,this.historyError=null,this.readHistoryIds=new Set,this.seenHistoryIds=new Set,this.mergedHistoryIds={},this.unreadHistoryIds=[],this.cachedHistoryPayload=null,this.historyPayloadPromise=null}}let f=window.PluginManager;f.register("B2bQuoteItemPlugin",i,"[data-b2b-quote-item-plugin]"),f.register("B2bQuoteDetailPlugin",a,"[data-b2b-quote-detail-plugin]"),f.register("B2bQuoteManageLineItemsPlugin",()=>r.e(12379).then(r.bind(r,379)),"[data-b2b-quote-manage-line-items-plugin]"),f.register("B2bQuoteManageLineItemsHistory",()=>r.e(80208).then(r.bind(r,208)),"[data-b2b-quote-manage-line-items-history]"),f.register("B2bQuoteHistoryReadTracker",()=>r.e(77450).then(r.bind(r,450)),"[data-b2b-quote-history-read-tracker]"),f.register("B2bQuickSearchQuoteLineItem",()=>r.e(53185).then(r.bind(r,185)),"[data-b2b-quick-search-quote-line-item]"),f.register("B2bQuoteMessage",l,"[data-b2b-quote-message]"),f.register("B2bQuoteOffCanvasMessage",y,"[data-off-canvas-message], [data-b2b-quote-offcanvas-message]"),f.register("B2bQuoteHistoryItemPlugin",()=>Promise.resolve().then(r.bind(r,808)),"[data-b2b-quote-history-item-plugin]"),f.register("B2bQuoteNotificationEmployeesMultipleSelection",()=>r.e(86504).then(r.bind(r,504)),"[data-b2b-quote-notification-employees-multiple-selection]"),f.register("B2bQuoteRequestPlugin",()=>r.e(83247).then(r.bind(r,247)),"[data-b2b-quote-request-plugin]"),f.register("B2bQuoteRemovePromotionConfirmPlugin",()=>r.e(92854).then(r.bind(r,854)),"[data-b2b-quote-remove-promotion-confirm-plugin]"),f.override("OffCanvasCart",()=>r.e(21044).then(r.bind(r,44)),"[data-off-canvas-cart]"),f.register("B2bQuoteSearchPlugin",()=>r.e(14604).then(r.bind(r,604)),"[data-b2b-quote-search-plugin]"),f.register("B2bQuoteDocumentSearchPlugin",()=>r.e(21528).then(r.bind(r,528)),"[data-b2b-quote-document-search-plugin]"),f.register("B2bQuoteConfirmModal",()=>r.e(94615).then(r.bind(r,615)),"[data-b2b-quote-confirm-modal]"),f.register("B2bQuoteTriggerConfirmModal",()=>r.e(90160).then(r.bind(r,160)),"[data-b2b-quote-trigger-confirm-modal]"),f.register("B2bQuoteInfoBannerPlugin",()=>r.e(44059).then(r.bind(r,440)),"[data-b2b-quote-info-banner-plugin]")})();
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.