expedite-components 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,7 @@
25
25
  * vue-router-lwc v1.0.4
26
26
  * (c) 2024 Eduardo San Martin Morote
27
27
  * @license MIT
28
- */var Sc;(function(e){e.pop="pop",e.push="push"})(Sc||(Sc={}));var Ic;(function(e){e.back="back",e.forward="forward",e.unknown=""})(Ic||(Ic={}));var Ac;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(Ac||(Ac={}));const z0=Symbol(""),K0=Symbol("");function Vi(){return kn(z0)}function wa(){return kn(K0)}function bt(e){if(typeof e=="string"&&(e=JSON.parse(e)),e!=null&&e.errorMessage)throw new Error(e==null?void 0:e.errorMessage);return e}const xa={xx_ord1__item__c:"xx_ord1__item__c",xx_ord1__sales_price__c:"xx_ord1__negotiated_price__c",xx_ord1__nrc__c:"xx_ord1__nrc_for_new__c",xx_ord1__line_description__c:"xx_ord1__line_description__c",xx_ord1__list_price__c:"xx_ord1__list_price2__c",xx_ord1__cost__c:"xx_ord1__cost2__c",xx_ord1__rate_plan__c:"xx_ord1__rate_plan__c",xx_ord1__allowed_discount__c:"xx_ord1__allowed_discount__c",xx_ord1__billing_period__c:"xx_ord1__billing_period__c",xx_ord1__ship_to_account__c:"xx_ord1__ship_to_account__c",xx_ord1__erp_item_number__c:"xx_ord1__erp_item_number__c",xx_ord1__mrc__c:"xx_ord1__mrc__c",xx_ord1__qty__c:"xx_ord1__qty__c",id:"id"},Tc={xx_ord1__item__c:"xx_ord1__item__c",xx_ord1__negotiated_price__c:"xx_ord1__sales_price__c",xx_ord1__nrc_for_new__c:"xx_ord1__nrc__c",xx_ord1__line_description__c:"xx_ord1__line_description__c",xx_ord1__list_price2__c:"xx_ord1__list_price__c",xx_ord1__cost2__c:"xx_ord1__cost__c",xx_ord1__rate_plan__c:"xx_ord1__rate_plan__c",xx_ord1__allowed_discount__c:"xx_ord1__allowed_discount__c",xx_ord1__billing_period__c:"xx_ord1__billing_period__c",xx_ord1__ship_to_account__c:"xx_ord1__ship_to_account__c",xx_ord1__erp_item_number__c:"xx_ord1__erp_item_number__c",xx_ord1__mrc__c:"xx_ord1__mrc__c",xx_ord1__qty__c:"xx_ord1__qty__c",id:"id"},Z0=e=>{var n;let t=[];for(let r of e)if(r.trim()!=="xx_ord1__item__r.xx_ord1__decimal_precision__c")if(r.includes(".")){let o=r.split(".")[0];o=o.slice(0,-1)+"c";const a=((n=xa[o==null?void 0:o.toLowerCase()])==null?void 0:n.trim())||"";a&&(t.includes(a)||t.push(a||""),t.push(r))}else t.includes(xa[r==null?void 0:r.toLowerCase()])||t.push(xa[r==null?void 0:r.toLowerCase()]||"");return t.filter(r=>r!=="")},Q0=Rt("actions",()=>{const e=Ui(),t=Tn(),n=ae(!1);return{openAdaptiveSearch:(s,l=!1)=>{console.info("openAdaptiveSearch",s),e.chatHistory[e.chatHistory.length-1].links=[],e.sendMessage("Open Adaptive Search",!1,{internalCall:!0}),n.value=l},openQuoteItem:s=>{console.info("openQuoteItem",s),e.chatHistory[e.chatHistory.length-1].links=[],e.sendMessage("Open Quote Item",!1,{internalCall:!0})},openQuoteDocument:s=>{console.info("openQuoteDocument",s),e.chatHistory[e.chatHistory.length-1].links=[],e.chatHistory.push({type:"response",message:"Opening quote document",loading:!0});const p=`/apex/XX_ORD1__Expedite_Commerce?scpq=true&oid=${t.quoteId}&atpverified=true&ecCache=false&origin=AI`;window.location.href=`${a0(window.location.href)}${p}`},undo:()=>{const s=e==null?void 0:e.latestDMLRequest;e.sendMessage(`UNDO-${s}`,!1,{internalCall:!0})},isStaticActionCall:n}}),Nc=Rt("adaptiveSearch",()=>{const e=Tn(),t=ar(),n=Ui(),r=Q0(),i=ae(null),o=ae(null),a=ae(!1),s=ae(!1),l=ae([]),p=ae(""),c=ae(!1),f=ae(null),u=ae(!1),m=ae([]),h=an(),g=ae([]),d=ae(0),v=ae(!1),_=ae({rowLimt:10,paging:!0,offset:0,currentPage:1,totalPages:1});async function C(){a.value=!0;try{const O=JSON.stringify({layoutType:"Search Selection",layoutObject:"xx_ord1__ecatalog_item__c"});let P={};return P=await window.salesforceConnector.getDynamicPageLayout(O),o.value=Ec(P,"Unable to find the Search Selection Layout for your user profile"),_.value.rowLimt=o.value.configuration.rowLimit||10,o.value.configuration.columns.forEach(M=>{!M.field&&M.label==="QTY"&&(M.field="xx_ord1__qty__c")}),a.value=!1,y(),P}catch(O){a.value=!1,h.handleError("Failed to get Adaptive Search Layout. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",O)}}function y(){var O,P,M;f.value=(M=(P=(O=o.value)==null?void 0:O.configuration)==null?void 0:P.dynamicFilters)==null?void 0:M.filters.map(Z=>({...Z,field:Z.field.toLowerCase(),filtervalue:Z.filtervalue||[],filtervaluefrom:Z.filtervaluefrom||"",filtervalueTo:Z.filtervalueTo||""}))}function w(){var P;let O=[];for(const M of o.value.configuration.columns){let Z=M.field;if(O.includes(Z)||O.push(Z),Z!=null&&Z.includes(".")){let B=Z.split(".")[0];B=B.slice(0,-1)+"c",O.includes(B)||O.push(B)}}return(P=o.value.configuration)!=null&&P.cardHeader&&O.push(o.value.configuration.cardHeader.imageField),o.value.configuration.objectName.toLowerCase()==="xx_ord1__ecatalog_item__c"&&O.push("xx_ord1__item__r.xx_ord1__decimal_precision__c"),O=O.filter(M=>!!M),O.filter(M=>M.toLowerCase()!=="xx_ord1__qty__c"&&M.toLowerCase()!=="xx_ord1__competitor_sku__c")}function A(O,P=!1){if(!O||O.includes("undefined"))return!1;const M=/[!@#$%^&*()+=[\]{};':"\\|.<>/?]+/;if(P){const Z=Array.isArray(O)?O:O.split(",");for(const Q of Z){const B=Q.trim();if(M.test(B))return h.handleError(`Invalid character found in value: ${B}`),!1}}else if(M.test(O))return h.handleError("Special characters are not allowed in filter values"),!1;return!0}function I(O,P){return{field:O.field,operator:O.operator||"contains",value:P,dataType:O.dataType.trim()}}function S(O){if(!O.filtervalue)return null;const P=Array.isArray(O.filtervalue),M=P?O.filtervalue.join(","):O.filtervalue.trim();return A(M,P)?M:null}function N(O){var Q,B;const P=(Q=O.filtervaluefrom)==null?void 0:Q.trim(),M=(B=O.filtervalueTo)==null?void 0:B.trim();if(!P||!M)return null;const Z=`${P}, ${M}`;return Z!==", "&&A(Z)?Z:null}function T(O){const P=`${kc(O.filtervaluefrom)}, ${kc(O.filtervalueTo)}`;return P!==", "&&A(P)?P:null}function k(O){var M;const P=(M=O.filtervaluefrom)==null?void 0:M.trim();return A(P)?P:null}function E(O){const P=[];return O.forEach(M=>{const Z=M.dataType.trim();let Q=null;switch(Z){case"PICKLIST":case"MULTIPICKLIST":Q=S(M);break;case"DOUBLE":case"CURRENCY":Q=N(M);break;case"DATETIME":case"DATE":Q=T(M);break;default:Q=k(M)}Q&&P.push(I(M,Q))}),m.value=P,P}async function L(O="",P=[],M=[]){var Q,B,U,D,q,$,H,J,R,z;let Z=[];if(P.length&&(Z=E(P)),!Z.length&&O.trim()===""){l.value=[],c.value=!1;return}try{c.value=!1,s.value=!0;const oe=O.trim();M.length||(M=w());const ce={fields:M,...P.length?{dynamicFilters:Z}:{},searchText:oe||p.value.trim(),accountId:t.accountId,...t.eCatalogId?{catalogId:t.eCatalogId}:{},...t.objectType==="opportunity"?{opportunityId:t.id}:{},...(B=(Q=o.value)==null?void 0:Q.configuration)!=null&&B.sort?{primarySortBy:o.value.configuration.sort.primary.field,primarySortOrder:o.value.configuration.sort.primary.direction,secondarySortBy:o.value.configuration.sort.secondary.field,secondarySortOrder:o.value.configuration.sort.secondary.direction}:{},rowLimt:(D=(U=o.value)==null?void 0:U.configuration)==null?void 0:D.rowLimit,paging:($=(q=o.value)==null?void 0:q.configuration)==null?void 0:$.paging,...((H=_.value)==null?void 0:H.offset)!==0?{offset:_.value.offset}:{},objectName:(R=(J=o.value)==null?void 0:J.configuration)==null?void 0:R.objectName,currencyCode:t.currencyCode},le=await window.salesforceConnector.getItems(JSON.stringify(ce));if(le!=null&&le.errorMessage){h.handleError(le.errorMessage);return}le!=null&&le.itemCount&&(_.value.totalPages=Math.ceil((le==null?void 0:le.itemCount)/_.value.rowLimt)),l.value=$i(le.lstItems,{xx_ord1__qty__c:"1"}),(z=le.lstItems)!=null&&z.length||(c.value=!0),s.value=!1}catch(oe){h.handleError("Failed to fetch Results. Please try again."),s.value=!1,console.info("[ERROR]: Adaptive Search getItems() error = ",oe)}}async function V(O){try{u.value=!0;const P=JSON.stringify({lstQLIRequest:K(O),quoteId:e.quoteId});let M=await window.salesforceConnector.createQLI(P);typeof M=="string"&&(M=JSON.parse(M));let Z=!1;if((M==null?void 0:M.length)>0&&M.forEach(Q=>{Q.errorMessage&&(Z=!0,h.handleError(Q.errorMessage))}),u.value=!1,Z){g.value=M;const Q=g.value.reduce((B,U)=>(B[U.eCatalogItemId]=U.errorMessage,B),{});l.value=l.value.map(B=>({...B,backendError:Q[B.Id]||""}));return}return M}catch(P){h.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addToQuote() error = ",P)}}function K(O){const P=[];for(const M of O)if(!M.addedToQuote&&M.id){const Z=W(M);d.value++,P.push({fields:Z,recordId:M.id,...O.length===1?{maxSequenceNumber:d.value}:{}})}return P}function W(O){const P=[],M=te();return Object.keys(O).forEach(Z=>{if(M.includes(Z)){const Q=Tc[Z.toLowerCase()];Q&&P.push({fieldname:Q,value:O[Z]})}}),P}function te(){const O=[];return o.value.configuration.columns.forEach(P=>{P.field&&!P.field.includes(".")&&P.isEditable&&P.visible&&O.push(P.field)}),O}function fe(){var P,M;const O=[];return o.value.configuration.columns.forEach(Z=>{const Q=Z.field.toLowerCase();O.includes(Q)||O.push(Q)}),(P=o.value.configuration)!=null&&P.dynamicFilters&&o.value.configuration.dynamicFilters.filters.forEach(Z=>{const Q=Z.field.toLowerCase();O.includes(Q)||O.push(Q)}),(M=o.value.configuration)!=null&&M.cardHeader&&O.push(o.value.configuration.cardHeader.imageField),O}async function ee(){var M;const O=fe(),P=((M=o.value.configuration)==null?void 0:M.saveObjectName)||o.value.configuration.objectName;if(P==="xx_ord1__ecatalog_item__c"){const Z=O.indexOf("xx_ord1__qty__c");Z>-1&&O.splice(Z,1)}await e.getFieldsData(O,P),e.fieldsData.xx_ord1__qty__c||e.getFieldsData(["xx_ord1__qty__c"],"xx_ord1__quote_line_item__c")}async function j({searchTerm:O="",filters:P=[]}={}){if(v.value=!0,O&&(p.value=O),P.length&&(m.value=P),await C()){await ee(),v.value=!1;const Z=p.value;Z&&(p.value=Z,await L(Z,e.dynamicFilters)),console.info("actionStore.isStaticActionCall = ",r.isStaticActionCall),r.isStaticActionCall&&(r.isStaticActionCall=!1,n.chatHistory[n.chatHistory.length-1]={type:"response",message:"Adaptive search is now open. Please search for the products you require and add it quote",loading:!1,links:[{action:"quoteItem",label:"Quote Item"},{action:"quoteDocument",label:"Quote Document"}]})}v.value=!1}return{selectedItem:i,AdaptiveSearchLayout:o,searchText:p,loadingAdaptiveLayout:a,getAdaptiveSearchLayout:C,getItems:L,lstItems:l,rowItemsLoading:s,noSearchRecords:c,dynamicFilters:f,setDynamicFilters:y,createQliErrors:g,addToQuote:V,addingToQuote:u,getFieldsData:ee,pagingData:_,appliedDynamicFilters:m,maxSequenceNumber:d,loadingAdaptiveSearch:v,initAdaptiveSearch:j}}),X0="XX_ORD1__Quote__c",J0="xxord1salespricec",Hi="xx_ord1__item__c",W0="xxord1productnrcc",G0=Rt("cartStore",()=>{const e=Tn(),t=Nc(),n=an(),r=ae(""),i=ae("$0"),o=ae("$0"),a=ae(null),s=ae({}),l=ae({}),p=ae({}),c=ae(""),f=ae(""),u=ae({}),m=ae(""),h=ae(""),g=ae({});async function d(){A()}async function v(){try{let N=await window.salesforceConnector.getProductCount(e.quoteId);if(N=bt(N),N!=null&&N.errorMessage){n.handleError(N.errorMessage);return}return r.value=N,N}catch{n.handleError("Failed to get Product Count. Please try again.")}}async function _(){try{let N=await window.salesforceConnector.getQuoteTotal(e.quoteId);if(N=bt(N),N!=null&&N.errorMessage){n.handleError(N.errorMessage);return}return o.value=N.monthlyTotal,i.value=N.onetimeTotal,N}catch{n.handleError("Failed to get Total Amount. Please try again.")}}async function C(N,T,k,E=""){if(!e.sectionDataMap.get(k).parentQLIs[T].removingItem){e.sectionDataMap.get(k).parentQLIs[T].removingItem=!0,h.value=N.id,await y(N.id)==="Success"&&(e.fetchAllQuoteLineItems(),E&&E(N,T,k));let V=e.sectionDataMap.get(k).parentQLIs.filter(K=>K[Hi]===N[Hi]).length;h.value="",t.lstItems.forEach(K=>{K[Hi]===N[Hi]&&(K.addedToQuote===!0&&(K.addedToQuote=!1),V===0&&(K.removedFromQuote=!0))})}}async function y(N){try{let T=await window.salesforceConnector.deleteQLI(N);if(T!=null&&T.errorMessage){n.handleError(T.errorMessage);return}return v(),_(),T}catch{n.handleError("Failed to remove Quote Item. Please try again.")}}function w(N){var E,L;const T=(E=N==null?void 0:N[W0])==null?void 0:E.match(/\.\d+/);T&&(T.value=T[0].length-1);const k=(L=N==null?void 0:N[J0])==null?void 0:L.match(/\.\d+/);return k&&(k.value=k[0].length-1),T||k}function A(N=!0){v(),_(),N&&e.fetchTemplates(X0).then(()=>{e.getFilteredListWithFields()})}function I(N){const T=e.sectionDataMap;for(const[,k]of T.entries())k.parentQLIs.forEach(E=>{E.id===N.id&&(k.columns.forEach(L=>{if(L.dataType==="CURRENCY"){const V=L.field.replace(/_/g,"");E[V]=S(E[V],N[L.field])}}),N!=null&&N.billingPeriodValue&&(N!=null&&N.formattedBillingPeriodValue)&&(E.formattedBillingPeriodValue=S(E.formattedBillingPeriodValue,N.billingPeriodValue)),N!=null&&N.oneTimeValue&&(N!=null&&N.formattedOneTimeValue)&&(E.formattedOneTimeValue=S(E.formattedOneTimeValue,N.oneTimeValue)))})}function S(N,T){const k=Number(T);if(isNaN(k))return N;const E=N.match(/(\d[\d,]*)(\.\d+)?/);if(!E)return N;const L=E[2]||"",V=L.length?L.length-1:0,K=k.toLocaleString("en-US",{minimumFractionDigits:V,maximumFractionDigits:V});return N.replace(E[1]+L,K)}return{initializeCart:d,loadCartState:A,productCount:r,onetimeTotal:i,monthlyTotal:o,filterCartItem:a,billingPeriodValue:c,hasOneTimeValue:f,hasBillingPeriodInList:s,oneTimeFieldAvailable:l,billingPeriodFieldAvailable:p,priceDecimalPrecision:u,cartItemUpdatingId:m,removingItemLoaderId:h,cartItemColumnsMap:g,getProductCount:v,getQuoteTotal:_,removeItem:C,removeQuoteItem:y,getDecimalPrecisionFromSalesPriceOrNRC:w,updateFormattedValues:I,formateCurrencyValue:S}}),Y0=e=>[{title:"Apply Discount",subOptions:[...e.map(t=>`Apply Discount on ${t} for `),"Show Maximum discount allowed","Apply Maximum Discount Allowed",...e.map(t=>`Apply Discount on ${t} for a specific total`)]},{title:"Update Fields",subOptions:["Update the price of","Update the quantity of","Update the term start date to","Update the term end date to","Update the line description for"]},{title:"Price Ramp",subOptions:["Add a price ramp for"]}],e5={salesforceUserLocale:"en_US",chatRoomId:"00DA0000000cDUJMA2__0052G00000AHBNAQA5__a0jKb000004VSaMIAW",status:"SUCCESS",statusCode:200,requestId:"9b1d1f0a9f07aa6cdc",errorMessage:"",payload:{uiModification:{addColumn:[],removeColumn:[],filter:[],groupBy:[{sectionName:"MRC $50 and Above",filters:[{datatype:"currency",field:"XX_ORD1__MRC__c",operator:"greater or equal",value:"50"}],tableId:"4vIEgoK5CbSPrLYPbq"},{sectionName:"MRC Below $50",filters:[{datatype:"currency",field:"XX_ORD1__MRC__c",operator:"less than",value:"50"}],tableId:"BlOPCp7eLBCZ84nDT2"}],showOptions:!0}},agentResponse:{role:"agent",requestId:"9b1d1f0a9f07aa6cdc",content:"Grouped the quote items into two sections: one for MRC $50 and above, and another for MRC below $50.",error:!1,epoch:1759936160464,isDML:!1},redirectObjects:{qliId:"",itemId:"",componentName:"QuoteItem"},actionFunction:"Reload",links:[{action:"quoteDocument",label:"Quote Document"},{action:"addProducts",label:"Add Products"}]},t5=[{label:"Line Description",field:"xx_ord1__line_description__c",isEditable:!0,dataType:"STRING"},{label:"QTY",field:"xx_ord1__qty__c",isEditable:!0,dataType:"DOUBLE"},{label:"Extended Price",field:"xx_ord1__extended_price__c",isEditable:!1,dataType:"CURRENCY"},{label:"Billing Period",field:"xx_ord1__billing_period__c",isEditable:!0,dataType:"PICKLIST",picklistValues:["Monthly","Quarterly","Yearly"]}],Tn=Rt("quote",()=>{const e=an(),t=G0(),n=ar(),r=ae(""),i=ae(""),o=ae(0),a=ae(""),s=ae([]),l=ae({template:!0,filteredList:!1}),p=ae(null),c=ae(new Map),f=ae({}),u=ae(!1),m=ae(!0),h=ae(!1),g=ae({text:"Hide Options",altText:"Show Options",handler:()=>{m.value=!m.value,S()},color:"#136E05",isActive:!1}),d=be(()=>{const j=Array.from(c.value.values()).map(O=>O.sectionName);return Y0(j)});St(a,()=>{l.value.template||I()});function v(){const j=new Map,O=[];for(const[M,Z]of c.value.entries())j.set(M,Z.selected),O.push(Z);const P=JSON.parse(JSON.stringify(O));return P.forEach(M=>{delete M.selected;const Z=new Map,Q=[];M.lineItems.forEach(B=>{B.Selected=j.get(M.tableId).get(B.id)||!1,B.xx_ord1__parent_qli__c?(Z.has(B.xx_ord1__parent_qli__c)||Z.set(B.xx_ord1__parent_qli__c,[]),Z.get(B.xx_ord1__parent_qli__c).push(B)):Q.push(B)}),M.lineItems=Q.map(B=>({...B,options:Z.get(B.id)||[]})),delete M.loading,delete M.parentQLIs,delete M.totalValues}),{showOptions:m.value,sections:P,templateId:a.value}}async function _(j){try{let O=await window.salesforceConnector.getPrimaryQuote(j);O=bt(O),O!==void 0&&(console.info("getPrimaryQuote",JSON.stringify(O)),r.value=O.recordId,console.info("quoteId",r.value),i.value=O.name,a.value=O==null?void 0:O.templateId,o.value=(O==null?void 0:O.lineItemsCount)||0)}catch(O){e.handleError(O.message),console.info("[ERROR]: getPrimaryQuote() error = ",O)}}async function C(j){var O,P;try{l.value.template=!0;let M=await window.salesforceConnector.fetchContentTemplates(JSON.stringify({lstObjectName:[j],templateType:"Document",templateId:null,fetchOnlyDefault:!1}));M=bt(M);const Z=M==null?void 0:M.templates[j];return a.value||(a.value=(O=Z.find(Q=>Q.XX_ORD1__Default__c))==null?void 0:O.Id),a.value||(a.value=(P=Z[0])==null?void 0:P.Id),s.value=Z,l.value.template=!1,s.value}catch(M){e.handleError(M.message),console.info("[ERROR]: fetchTemplates() error = ",M)}}function y(j){if(!j)return null;const O=/\{!\$(\w+):([\w.]+)\}/,P=j.match(O);return P?{function:P[1],apiname:P[2].split(".")[1]}:null}async function w(j){try{const O={Id:r.value,XX_ORD1__Document_Template__c:j};return await window.salesforceConnector.updateQuote(JSON.stringify([O]))}catch(O){e.handleError(O.message),console.info("[ERROR]: updateQuote() error = ",O)}}async function A(){try{l.value.filteredList=!0;let j=await window.salesforceConnector.getQuoteEPageLayout();c.value.clear(),t.cartItemColumnsMap={},j=bt(j);const O=j.map(M=>({label:M.fieldLabel,field:M.fieldName.toLowerCase(),isEditable:M.isEditable,dataType:M.dataType,...M.picklistValues?{picklistValues:M.picklistValues}:{}})),P=or();return c.value.set(P,{loading:!0,lineItems:[],parentQLIs:[],columns:O,tableId:P,sectionName:"All Rows",selected:new Map,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}),t.cartItemColumnsMap[P]=O,g.value.isActive=!1,m.value=!0,p.value={lstCB:[{columns:O,footer:null,title:"All Rows",sectionName:"All Rows",tableId:P,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}]},S(),l.value.filteredList=!1,j}catch(j){e.handleError(j.message),console.info("[ERROR]: getQuoteEPageLayout() error = ",j)}}async function I(){if(s.value.length===0){A();return}try{l.value.filteredList=!0;let j=await window.salesforceConnector.getFilteredListWithFields(JSON.stringify({templateId:a.value}));w(a.value),j=bt(j),console.info("res.lstCB = ",j.lstCB);const O=j==null?void 0:j.objectFieldsMap;return c.value.clear(),t.cartItemColumnsMap={},j.lstCB=j.lstCB.map(P=>{const{fields:M,filters:Z,primarysort:Q,primarysortdesc:B}=JSON.parse(P.XX_ORD1__Block_Properties__c),U=M.map(q=>{var $;return{label:($=O[q.api])==null?void 0:$.label,field:q.api.toLowerCase(),isEditable:q.api.includes(".")?!1:O[q.api].isEditable,dataType:O[q.api].dataType,...O[q.api].picklistValues?{picklistValues:O[q.api].picklistValues}:{}}}),D=P.Id||or();return c.value.set(D,{loading:!0,lineItems:[],parentQLIs:[],columns:U,tableId:D,sectionName:P.Name,selected:new Map,footer:y(P.XX_ORD1__Table_Footer_HTML__c),filters:Z,primarysort:Q,primarysortdesc:B}),t.cartItemColumnsMap[D]=U,g.value.isActive=!1,m.value=!0,{columns:U,footer:y(P.XX_ORD1__Table_Footer_HTML__c),title:P.Name,sectionName:P.Name,tableId:D,filters:Z,primarysort:Q,primarysortdesc:B}}),p.value=j,S(),l.value.filteredList=!1,j}catch(j){e.handleError(j.message),console.info("[ERROR]: getFilteredListWithFields() error = ",j)}}async function S(j=!0){const O=[];for(const[P]of c.value)O.push(k(P,j));return await Promise.all(O),t.getProductCount(),!0}function N(j,O){return c.value.get(j).columns.some(P=>P.field.toLowerCase()===O)||t.cartItemColumnsMap[j].some(P=>P.field.toLowerCase()===O)}function T(j,O){let P=$i(j);const M=n.pricingSchema,Z=N(O,"xx_ord1__nrc__c"),Q=N(O,"xx_ord1__sales_price__c"),B=N(O,"xx_ord1__qty__c");return P=P.map(U=>{let D={};M==="nrc/mrc"&&(U!=null&&U.xx_ord1__billing_period__c)?D={...Q?{billingPeriodValue:(U==null?void 0:U.xx_ord1__sales_price__c)===0?"0":(U==null?void 0:U.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:U==null?void 0:U.xxord1salespricec}:{},...Z?{oneTimeValue:(U==null?void 0:U.xx_ord1__nrc__c)===0?"0":(U==null?void 0:U.xx_ord1__nrc__c)||null,formattedOneTimeValue:U==null?void 0:U.xxord1nrcc}:{}}:M==="nrc/mrc"&&!(U!=null&&U.xx_ord1__billing_period__c)?Q&&(D={oneTimeValue:(U==null?void 0:U.xx_ord1__sales_price__c)===0?"0":(U==null?void 0:U.xx_ord1__sales_price__c)||null,formattedOneTimeValue:U==null?void 0:U.xxord1salespricec}):M!=="nrc/mrc"&&(U!=null&&U.xx_ord1__billing_period__c)?Q&&(D={billingPeriodValue:(U==null?void 0:U.xx_ord1__sales_price__c)===0?"0":(U==null?void 0:U.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:U==null?void 0:U.xxord1salespricec}):M!=="nrc/mrc"&&!(U!=null&&U.xx_ord1__billing_period__c)&&Q&&(D={oneTimeValue:(U==null?void 0:U.xx_ord1__sales_price__c)===0?0:(U==null?void 0:U.xx_ord1__sales_price__c)||null,formattedOneTimeValue:U==null?void 0:U.xxord1salespricec});const{xx_ord1__qty__c:q,xx_ord1__sales_price__c:$,xx_ord1__nrc__c:H,...J}=U,R={...J,id:U.id,description:(U==null?void 0:U.xx_ord1__line_description__c)||"",xx_ord1__billing_period__c:U==null?void 0:U.xx_ord1__billing_period__c,...B?{xx_ord1__qty__c:q}:{},xx_ord1__item__c:U==null?void 0:U.xx_ord1__item__c,"xx_ord1__item__r.xx_ord1__decimal_precision__c":U["xx_ord1__item__r.xx_ord1__decimal_precision__c"]||"0",...D};return R!=null&&R.billingPeriodValue&&(t.hasBillingPeriodInList[O]=!0,t.billingPeriodValue=R==null?void 0:R.xx_ord1__billing_period__c),"oneTimeValue"in R&&(t.oneTimeFieldAvailable[O]=!0),"billingPeriodValue"in R&&(t.billingPeriodFieldAvailable[O]=!0),(R==null?void 0:R.oneTimeValue)!==""&&(R==null?void 0:R.oneTimeValue)!==null&&(t.hasOneTimeValue=!0),R}),P}async function k(j,O=!0){var P,M;try{const Z=c.value.get(j);if(console.info("sectionData = ",Z.sectionName),!Z)return;Z.loading=O,O&&(Z.lineItems=[]);const{columns:Q,filters:B,primarysort:U,primarysortdesc:D,footer:q}=Z,$=Q.map(le=>le.field.toLowerCase());$.includes("xx_ord1__parent_qli__c")||$.push("xx_ord1__parent_qli__c"),$.includes("xx_ord1__item__c")||$.push("xx_ord1__item__c"),$.includes("xx_ord1__sys_configuration_status2__c")||$.push("xx_ord1__sys_configuration_status2__c"),(P=t.cartItemColumnsMap[j])==null||P.forEach(le=>{$.includes(le.field)||$.push(le.field)});const H=await E({fields:$,recordId:r.value,filters:B||[],primarySortBy:U||"",primarySortOrder:D?"DESC":"ASC",includeOptions:m.value,totalFields:q?[q.apiname]:[]}),J=H.lineItems,R=new Map;let z=[];const oe=(M=H.fieldTotals)==null?void 0:M.map(le=>le.totalValue);J.forEach(le=>{le.XX_ORD1__Parent_QLI__c?R.has(le.XX_ORD1__Parent_QLI__c)?R.get(le.XX_ORD1__Parent_QLI__c).push(le):R.set(le.XX_ORD1__Parent_QLI__c,[le]):z.push(le)});const ce=[];return z.forEach(le=>{ce.push(le),R.has(le.Id)&&ce.push(...R.get(le.Id))}),z=T(z,j),Z.lineItems=$i(ce),Z.parentQLIs=z,Z.totalValues=oe,Z.loading=!1,c.value=new Map(c.value),ce}catch(Z){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",Z.message);const Q=c.value.get(j);Q&&(Q.loading=!1)}}async function E(j){try{let O=await window.salesforceConnector.getQuoteLineItemsWithFilteredTable(JSON.stringify(j));return O=bt(O),O}catch(O){e.handleError(O.message),console.info("[ERROR]: getQuoteLineItemsWithFilteredTable() error = ",O)}}async function L(j){try{console.info("updateQli() payload = ",j);let O=await window.salesforceConnector.updateQli(JSON.stringify(j));return O=bt(O),S(!1),O}catch(O){e.handleError(O.message),console.info("[ERROR]: updateQli() error = ",O)}}async function V(j){try{let O=await window.salesforceConnector.deleteQLI(j);return O=bt(O),S(),O}catch(O){e.handleError(O.message),console.info("[ERROR]: deleteQLI() error = ",O)}}async function K(j,O){try{u.value=!0;const P={fields:j};O&&(P.objectName=O),j.includes("xx_ord1__qty__c")&&O==="xx_ord1__ecatalog_item__c"&&(P.fields=P.fields.filter(Z=>Z!=="xx_ord1__qty__c")),j.includes("xx_ord1__sales_price__c")&&O!=="xx_ord1__quote_line_item__c"&&(P.fields=P.fields.filter(Z=>Z!=="xx_ord1__sales_price__c"));let M=await window.salesforceConnector.getFieldsData(JSON.stringify(P));return typeof M=="string"&&(M=JSON.parse(M)),M!=null&&M.errorMessage?(e.handleError(M.errorMessage),null):(f.value={...f.value,...M},console.info("fieldsData.value = ",JSON.stringify(f.value)),M)}catch(P){return e.handleError("Failed to get Fields Data. Please try again."),console.info("[ERROR]: getFieldsData() error = ",P),null}finally{u.value=!1}}function W(j=""){var O;return!j||j.includes(".")?!1:j.includes("xx_ord1__qty__c")?!0:((O=f.value[j])==null?void 0:O.isEditable)||!1}function te(){fe(e5)}async function fe(j){var O,P,M,Z,Q,B,U,D,q;if(j.payload){if((O=j.payload)!=null&&O.uiModification){const $=j.payload.uiModification;if(((P=$.addColumn)==null?void 0:P.length)>0)if($.addColumn.forEach(H=>{H.columns.forEach(J=>{J.field=J.field.toLowerCase()})}),$.addColumn[0].sectionName==="all_section")for(const[H,J]of c.value)J.columns=[...J.columns,...$.addColumn[0].columns];else $.addColumn.forEach(H=>{c.value.get(H.tableId)&&(c.value.get(H.tableId).columns=[...c.value.get(H.tableId).columns,...H.columns])});if(((M=$.removeColumn)==null?void 0:M.length)>0)if($.removeColumn.forEach(H=>{H.columns=H.columns.map(J=>J.toLowerCase())}),$.removeColumn[0].sectionName==="all_section")for(const[H,J]of c.value)J.columns=J.columns.filter(R=>!$.removeColumn[0].columns.includes(R.field));else $.removeColumn.forEach(H=>{c.value.get(H.tableId)&&(c.value.get(H.tableId).columns=c.value.get(H.tableId).columns.filter(J=>!H.columns.includes(J.field)))});if(((Z=$.filter)==null?void 0:Z.length)>0)if($.filter[0].sectionName==="all_section")for(const[H,J]of c.value)J.filters=[...J.filters,...$.filter[0].filters];else $.filter.forEach(H=>{c.value.get(H.tableId)&&(c.value.get(H.tableId).filters=[...c.value.get(H.tableId).filters,...H.filters])});if(((Q=$.groupBy)==null?void 0:Q.length)>0){const H=((B=[...c.value.values()][0])==null?void 0:B.columns)||t5;c.value.clear(),t.cartItemColumnsMap={},$.groupBy.forEach(J=>{t.cartItemColumnsMap[J.tableId]=J.columns||H,c.value.set(J.tableId,{loading:!0,lineItems:[],parentQLIs:[],columns:J.columns||H,tableId:J.tableId,sectionName:J.sectionName,selected:new Map,footer:y(J.footer),filters:J.filters,primarysort:J.primarysort,primarysortdesc:J.primarysortdesc})})}$.showOptions!==void 0&&(m.value=$.showOptions)}if(((D=(U=j.payload)==null?void 0:U.sections)==null?void 0:D.length)>0){const $=(q=j.payload)==null?void 0:q.sections;c.value.clear(),$.forEach(H=>{H.tableId||(H.tableId=or()),H.selected=new Map,c.value.set(H.tableId,H)}),S()}}j.actionFunction==="Reload"&&(S(),console.info("Reloading quote line items"))}async function ee(j){var O,P;try{const M=new Set;for(const Z of c.value.keys())(O=c.value.get(Z).lineItems)==null||O.forEach(B=>{B.attributes=null,M.add(B.id)});if(j){const Z={lineItemIds:[...M]},Q=await window.productManagerController.getLineItemAttributes({request:JSON.stringify(Z)}),B=JSON.parse(Q.data);for(const U of c.value.keys())(P=c.value.get(U).lineItems)==null||P.forEach(q=>{q.attributes=B[q.id]||null})}}catch(M){console.info("[ERROR]: fetchAttributesData() error = ",M)}}return{showAttributes:h,quoteId:r,quoteName:i,templateId:a,templateOptions:s,loading:l,currentTemplateData:p,fieldsData:f,fieldsDataLoading:u,showOptionHeaderButton:g,sectionDataMap:c,promptSuggestions:d,lineItemsCount:o,addColumns:te,getQuoteEPageLayout:A,getPayload:v,getPrimaryQuote:_,fetchTemplates:C,getFilteredListWithFields:I,getQuoteLineItemsWithFilteredTable:E,updateQli:L,getFieldsData:K,deleteQLI:V,performAIAction:fe,isEditableField:W,fetchQuoteLineItems:k,fetchAllQuoteLineItems:S,fetchAttributesData:ee}}),n5=Rt("quickSelection",()=>{const e=an(),t=ar(),n=Tn(),r=ae(null),i=ae(!1),o=ae([]),a=ae([]),s=ae(!1),l=ae({}),p=ae({rowLimit:10,paging:!0,offset:0,currentPage:1,totalPages:1}),c=ae(!1);async function f(){i.value=!0;try{const w=JSON.stringify({layoutType:"Quick Selection",layoutObject:"xx_ord1__ecatalog_item__c",...t.objectType?{contextObject:t.objectType}:{}});let A={};A=await window.salesforceConnector.getDynamicPageLayout(w),r.value=Ec(A,"Unable to find the Quick Selection Layout for your user profile"),console.info("quickSelectionLayout.value = ",r.value),p.value.rowLimit=r.value.configuration.rowLimit||10,r.value.data.columns.forEach(I=>{!I.field&&I.label==="QTY"&&(I.field="xx_ord1__qty__c")}),i.value=!1}catch(w){i.value=!1,e.handleError("Failed to get Page structure data. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",w)}}function u(){const w=new Map;return r.value.data.columns.forEach(A=>{w.set(A.field,!0)}),r.value.data.searchResultColumns.forEach(A=>{w.set(A.field,!0)}),Array.from(w.keys())}async function m(w){var A,I;try{let S=await window.salesforceConnector.saveCompetitorSKU(w);if(S!=null&&S.errorMessage){e.handleError(S.errorMessage);return}if((A=S[0])!=null&&A.errorMessage){e.handleError((I=S[0])==null?void 0:I.errorMessage);return}return S}catch(S){e.handleError("Failed to Match Item. Please try again."),console.info("[ERROR]: saveCompetitorSKU() error = ",S)}}async function h(w="",A=[]){try{let I=r.value.data,S=r.value.configuration;const N=w.trim();if(console.info("searchTextValue.trim() = ",w.trim()),!N)return[];let T=null;console.info("useMappings = ",c.value),c.value?T=Z0(g()):T=g(),console.info("fields before filter = ",T),T=T.filter(V=>V!=="xx_ord1__qty__c"),console.info("fields after filter = ",T);const k={fields:T,...A.length?{dynamicFilters:n.getDynamicFilters(A)}:{},searchText:N,accountId:t.accountId,...t.eCatalogId?{catalogId:t.eCatalogId}:{},...t.objectType==="opportunity"?{opportunityId:t.id}:{},...I!=null&&I.sort?{primarySortBy:I.sort.primary.field,primarySortOrder:I.sort.primary.direction,secondarySortBy:I.sort.secondary.field,secondarySortOrder:I.sort.secondary.direction}:{},rowLimt:(S==null?void 0:S.rowLimit)||20,paging:(S==null?void 0:S.paging)||!1,...p.value.offset!==0?{offset:p.value.offset}:{},objectName:I.objectName,currencyCode:t.currencyCode};console.info("getQuickSelectionItems payload = ",JSON.stringify(k));const E=await window.salesforceConnector.getItems(JSON.stringify(k));if(console.info("getQuickSelectionItems Res = ",JSON.stringify(E)),E!=null&&E.errorMessage){e.handleError(E.errorMessage);return}return E!=null&&E.itemCount&&(p.value.totalPages=Math.ceil((E==null?void 0:E.itemCount)/p.value.rowLimit)),$i(E.lstItems,{xx_ord1__qty__c:"1"})}catch(I){e.handleError("Failed to fetch Results. Please try again."),console.info("[ERROR]: getQuickSelectionItems() error = ",I)}}function g(){let w=[];for(const A of r.value.data.columns){let I=A.field;if(I!=null&&I.includes(".")){w.includes(I)||w.push(I);let N=I.split(".")[0];N=N.slice(0,-1)+"c",w.includes(N)||w.push(N)}else w.includes(I)||w.push(I)}return console.info("getAllQuickSelectionFields() fields = ",w),w.filter(A=>A.toLowerCase()!=="xx_ord1__qty__c")}async function d(w,A,I,S){console.info("searchText:",JSON.stringify(w)),console.info("row:",JSON.stringify(A)),console.info("rowIndex:",JSON.stringify(I)),console.info("column:",JSON.stringify(S));const N=I+(p.value.currentPage-1)*p.value.rowLimit;if(S.field.toLowerCase().includes("xx_ord1__item__r")){if(o.value[N].itemLookupLoading=!0,c.value=!0,a.value=await h(w),a.value.length>0){const T=[];for(let k=0;k<a.value.length;k++)o.value[N].itemDataRetrieved=!0,a.value[k].xx_ord1__item__c&&T.push({name:a.value[k]["xx_ord1__item__r.name"],value:a.value[k].xx_ord1__item__c,label:a.value[k][S.field.toLowerCase()]});o.value[N][S.field.toLowerCase()+"_options"]=T}o.value[N].itemLookupLoading=!1}else if(S.field.toLowerCase().includes("xx_ord1__competitor_item__r")){o.value[N].competitorLookupLoading=!0;const T=await v(w);T!=null&&T.items&&(o.value[N][S.field.toLowerCase()+"_options"]=T.items.map(k=>({name:k.fields[2].value,value:k.fields[1].value,label:k.fields[0].value}))),o.value[N].competitorLookupLoading=!1,console.info("getLookupData:: Search Lookup Handler Response = ",T)}}async function v(w){var I,S;console.info("getLookupData() searchText = ",w);const A={searchText:w,obj:"xx_ord1__competitor_item__c",filters:null,displayFields:["xx_ord1__sku__c"]};try{let N=await window.salesforceConnector.getLookupData(JSON.stringify(A));if(typeof N=="string"&&(N=JSON.parse(N)),N!=null&&N.errorMessage){e.handleError(N.errorMessage);return}if((I=N[0])!=null&&I.errorMessage){e.handleError((S=N[0])==null?void 0:S.errorMessage);return}return N}catch(N){e.handleError("Failed to Search For Item. Please try again."),console.info("[ERROR]: getLookupData() error = ",N)}}async function _(w,A){var S;console.info("Update Other Fields Value = ",w),console.info("Update Other Fields Row Index = ",A);const I=A+(p.value.currentPage-1)*p.value.rowLimit;console.info("actualRowIndex = ",I);try{if(w){const N=a.value.filter(T=>T.xx_ord1__item__c===w)[0];if(N){s.value=!0;const T=r.value.data.columns[1].field;o.value[I][T]&&await C(N,I),(S=o.value[I])!=null&&S.itemDataRetrieved&&(o.value[I].status="New Match Requested",o.value[I].noMatchCleared=!0),Object.keys(N).forEach(k=>{const E=Tc[k.toLowerCase()];console.info("Mapped Key = ",E),E&&(o.value[I][E]=N[k])}),s.value=!1}else o.value[I].status=""}else o.value[I].status="No Match"}catch(N){e.handleError("Unable to request a match for this item please try again."),console.info("Error in updateOtherFields = ",N)}}async function C(w,A){const I=o.value[A],S=r.value.data.columns[1].field,N=[{sku:I[S],name:I[S],productDescription:I.xx_ord1__line_description__c||"",productURL:null,status:"Match Requested",competitorAccountId:null,itemId:w.xx_ord1__item__c}];let T=await m(JSON.stringify(N));console.info("Match Item: ",JSON.stringify(T)),o.value[A][`${S}_options`]=[{value:T[0].competitorItemId,label:T[0].sku}],o.value[A][S]=T[0].competitorItemId}async function y(w){try{let A=await window.salesforceConnector.createQLI(JSON.stringify(w));typeof A=="string"&&(A=JSON.parse(A));let I=!1;if((A==null?void 0:A.length)>0)for(let S=0;S<A.length;S++)A[S].errorMessage&&(I=!0,A[S].errorMessage.includes("Line Description: data value too large")&&(A[S].errorMessage="Error: The description is too long—it must be under 200 characters."));if(I){A.forEach(S=>{l.value[S.eCatalogItemId]=S});return}else l.value=[];return A}catch(A){e.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addAllItemsToQuote() error = ",A)}}return{quickSelectionLayout:r,quickSelectionLayoutLoading:i,processedRecords:o,useMappings:c,currentSearchData:a,createQliErrors:l,getQuickSelectionLayout:f,getAllFieldsForQuickSelectionLayout:u,saveCompetitorSKU:m,getQuickSelectionItems:h,searchLookupHandler:d,updateOtherFields:_,addAllItemsToQuote:y}}),r5="Preparing Your Quote Please Wait...",i5={message:"Your quote is ready! Begin adding products to complete it.",type:"response",requestId:"no-request-id"},o5=18e4,Ui=Rt("ai",()=>{const e=ar(),t=Tn(),n=Nc(),r=n5(),i=sn(),o=wa(),a=ae(""),s=ae(""),l=ae([]),p=ae(""),c=ae([]),f=ae(!1),u=ae(null),m=Vi(),h=ae({}),g=ae(null),d=ae(null),v=ae(null),_=ae(null),C=ae(null),y=ae(r5),w=ae([]),A=be(()=>e.orgId+"__"+e.user.Id+"__"+t.quoteId),I=be(()=>u.value.readyState==WebSocket.OPEN),S=()=>{h.value={salesforceOrgId:e.orgId,salesforceOrgType:e.orgType,salesforceUserId:e.user.Id,userType:"Salesforce",chatRoomId:A.value,requestId:"",prompt:"",initiatedFrom:e.origin||"Quote",internalCall:!1,contextObjectId:t.quoteId,contextObjectType:"Quote",payload:{lineItemsCount:t.lineItemsCount},origin:"Genesis AI",defaultBatchSize:10,actionType:"",packageVersion:e.packageVersion,relatedIds:{eCatalogId:e.eCatalogId,accountId:e.accountId}}};async function N(){const q=s.value+"?chatRoomId="+A.value;u.value=new WebSocket(q),u.value.addEventListener("open",T),u.value.addEventListener("message",L),u.value.addEventListener("close",k),u.value.addEventListener("error",E)}const T=()=>{V(),te()},k=()=>{K()},E=()=>{Z(),K()},L=q=>{var H,J;V();const $=JSON.parse(q.data);if($.status!=="ALIVE"){if($.loading){y.value=$.message;return}else Array.isArray($.messages)?(y.value=null,l.value.push(i5),$.messages.length>0&&O($.messages)):$.agentResponse&&($.errorMessage&&($.agentResponse.content=$.errorMessage,$.agentResponse.error=!0),y.value=null,l.value.push({message:$.agentResponse.content,type:$.agentResponse.role,requestId:$.requestId,epoch:$.agentResponse.epoch,error:$.agentResponse.error,isDML:$.agentResponse.isDML,...(H=$.agentResponse)!=null&&H.filesData?{filesData:(J=$.agentResponse)==null?void 0:J.filesData}:{}}));w.value=$.links||[],B($)}},V=()=>{K(),g.value=setTimeout(()=>{if(I.value){const q={action:"heartbeat"};u.value.send(JSON.stringify(q)),V()}},o5)},K=()=>{g.value&&(clearInterval(g.value),g.value=null)};function W(q){const $={...h.value};$.requestType="Action",$.actionType="Undo",$.undoRequestId=q,$.requestId=or(),j($)}function te(){const q={...h.value};q.requestType="Action",q.actionType="History",q.requestId=or(),j(q)}function fe(q){return o.path.startsWith("/configurator")&&i.isChangedConfiguration?(_.value={save:()=>{i.maintainQuoteConfiguration()}},a.value=q,!0):(a.value="",!1)}function ee(q,$=!0,H=null){if(!fe(q)&&q.trim()){let J={...h.value};J.prompt=q.trim(),J.requestType="Chat",J.requestId=or(),J.internalCall=!1,J.payload=P(),J.componentName=M.value,J.templateId=t.templateId,J.payload.lineItemsCount=t.lineItemsCount,H&&(J={...J,...H}),Q(),$&&l.value.push({message:q.trim(),type:"user",...C.value&&{fileData:[C.value]},requestId:J.requestId}),j(J),V()}}function j(q){const $={action:"prompt",data:q};u.value.send(JSON.stringify($))}const O=q=>{const $=q.filter(({content:H})=>!!H).map(H=>({message:H.content,type:H.role,requestId:H.requestId,epoch:H.epoch,isDML:H.isDML,undone:H.undone}));$.forEach((H,J)=>{H.isDML===!0&&J!==$.length-1&&(H.isDML=!1)}),l.value=[...l.value,...$]};function P(){return o.path==="/quote-item"?t.getPayload():{}}const M=be(()=>o.path==="/quote-item"?"QuoteItem":""),Z=()=>{l.value.push({type:"response",message:"Oops! Something went wrong while processing your request. Please try again later.",error:!0})},Q=()=>{l.value=l.value.map(q=>({...q,links:[]}))};function B(q){var J,R,z;const $=((J=q==null?void 0:q.redirectObjects)==null?void 0:J.componentName)||(q==null?void 0:q.componentName),H=(q==null?void 0:q.redirectObjects)||{};if($==="AdaptiveSearch"){const oe=(R=q==null?void 0:q.payload)==null?void 0:R.searchTerm,ce=(z=q==null?void 0:q.payload)==null?void 0:z.applyFilters;oe&&oe!==n.searchText&&n.initAdaptiveSearch({searchTerm:oe,filters:ce}),m.push("/adaptive-search")}else $==="Configurator"?m.push(`/configurator/${H.itemId}/${H.qliId}`):$==="QuoteReview"?m.push("/quote-item"):$==="QuoteItem"||$==="QuoteList"?(m.push("/quote-item"),t.performAIAction(q)):$==="QuickSelection"&&(r.quickSelectionLayout=q.payload,console.info("Loading QuickSelection data = ",JSON.stringify(r.quickSelectionLayout)),m.push("/match-records"))}function U(){if(I.value){const q={action:"cancel",data:{requestId:h.value.requestId,chatRoomId:A.value}};u.value.send(JSON.stringify(q))}}const D=()=>{d.value&&(clearInterval(d.value),d.value=null),g.value&&(clearInterval(g.value),g.value=null),v.value&&(clearTimeout(v.value),v.value=null)};return Ei(()=>{D()}),{unsavedChanges:_,loadingMessage:y,promptMessage:a,buttonLinks:w,websocketUrl:s,chatHistory:l,latestDMLRequest:p,strikethroughHistory:c,attachmentData:C,dataManuallyChanged:f,undoAction:W,connectSocket:N,sendMessage:ee,setInitialPayload:S,cancelRequest:U}}),ar=Rt("root",()=>{const e=Ui(),t=an(),n=Tn(),r=ae(""),i=ae(""),o=ae("Genesis AI"),a=ae(""),s=ae({}),l=ae(""),p=ae(""),c=ae(""),f=ae(""),u=ae({}),m=ae(""),h=ae(""),g=ae(""),d=ae(""),v=ae(""),_=ae(""),C=ae(""),y=ae("Single"),w=ae("closed"),A=be(()=>n.quoteName),I=be(()=>y.value==="Single");async function S(E){r.value=E||xc("id"),i.value=xc("origin"),await T(),await N()}async function N(){try{console.info("getRecordInfo",r.value);let E=await window.salesforceConnector.getRecordInfo(r.value);return E=bt(E),E!==void 0&&(u.value=E,m.value=E.name,h.value=E.objectType,g.value=E.accountId,d.value=E.eCatalogId,v.value=E.currencyCode,_.value=E.userLocale,C.value=E.opportunityId),(E==null?void 0:E.objectType)==="XX_ORD1__Quote__c"?(n.quoteId=E==null?void 0:E.recordId,n.templateId=E==null?void 0:E.templateId,n.quoteName=E==null?void 0:E.name,n.lineItemsCount=(E==null?void 0:E.lineItemsCount)||0):(E==null?void 0:E.objectType)==="Opportunity"&&await n.getPrimaryQuote(E.recordId),E}catch(E){t.handleError(E.message)}}async function T(){var L,V;console.info("getOrgInformation",r.value);const E=await window.salesforceConnector.getOrgInformation();e.websocketUrl=E.websocketUrl,a.value=(L=E.locale)==null?void 0:L.replace("_","-"),s.value=E.user,l.value=E.orgName,p.value=E.orgId,c.value=E.orgType,f.value=E.packageVersion,y.value=(V=E==null?void 0:E.pricingSchema)==null?void 0:V.toLowerCase()}function k(E){o.value=E,s0(E)}return{id:r,origin:i,title:A,subTitle:o,locale:a,user:s,orgName:l,orgId:p,orgType:c,packageVersion:f,objectType:h,recordInfo:u,name:m,accountId:g,eCatalogId:d,currencyCode:v,userLocale:_,opportunityId:C,pricingSchema:y,isSinglePricingSchema:I,flyoutState:w,start:S,getRecordInfo:N,setSubTitle:k}}),a5="https://api-svc.blink.expedite1.com/api/product-pricing/evaluateConfigurationSelection",s5={productJSON:{productItem:{configRules:[{publishKey:"rule-a1",name:"If latest is optA include optB",priority:1,enforceRule:!0,ruleJson:'{"latestSelected":"optA","actionType":"include","affectedOptions":["optB"]}'}]}},currentConfig:{product:{publishKey:"prod-1",attributes:[]},options:[]},selected:{publishKey:"optA",attributes:[]}};async function l5(e=s5){const t=a5;try{const n=await fetch(t,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`HTTP error! status: ${n.status} ${n.statusText}`);return await n.json()}catch(n){throw console.info("Error fetching data with Fetch API:",n),n}}function c5(e){const t=n=>Math.min(...n.options.map(r=>r.relationshipInfo.primarySortOrder));return e.forEach(n=>{n.itemTypes.forEach(r=>{r.options.sort((i,o)=>i.relationshipInfo.primarySortOrder-o.relationshipInfo.primarySortOrder||i.itemName.localeCompare(o.itemName))}),n.itemTypes.sort((r,i)=>t(r)-t(i)||r.itemTypeName.localeCompare(i.itemTypeName))}),e.sort((n,r)=>{const i=Math.min(...n.itemTypes.map(t)),o=Math.min(...r.itemTypes.map(t));return i-o||n.category.localeCompare(r.category)}),e}const u5=(e,t)=>{const n=(r,i)=>typeof i=="function"?void 0:i;return JSON.stringify(e,n)===JSON.stringify(t,n)},sn=Rt("configurator-main",()=>{const e=wa(),t=ar(),n=Tn(),r=an(),i=Vi(),o=ae(null),a=ae(null),s=ae(null),l=ae(null),p=ae([]),c=ae(null),f=ae(null),u=ae(new Map),m=ae(!1),h=ae({configuration:!1,lineItem:!1,productOptionsPricing:!1,bestOfferPrice:!1,lineItemAttributes:!1,save:!1}),g=ae(!1),d=be(()=>v.value&&!t.isSinglePricingSchema),v=be(()=>{let D=!0,q=!0,$=!0,H=null;for(const J of s.value.categoryOptions)for(const R of J.itemTypes)for(const z of R.options)z.billingPeriod&&(H&&H!==z.billingPeriod&&($=!1),H=z.billingPeriod,!z.yrcPrice&&z.billingPeriod==="Monthly"&&(D=!1),!z.mrcPrice&&z.billingPeriod==="Yearly"&&(q=!1));return D&&q&&$}),_=be(()=>!u5(s.value,l.value)),C=be(()=>{const D=s.value.categoryOptions;return D.forEach(q=>{q.itemTypes.forEach($=>{$.selectedOptions=$.options.filter(H=>$.selected.includes(H.itemId)),$.totalPrice=function(){return $.selectedOptions.reduce((H,J)=>H+J.price*J.qty,0)||0},$.oneTimePrice=function(){return $.selectedOptions.filter(H=>!H.billingPeriod).reduce((H,J)=>H+J.price*J.qty,0)||0},$.recurringPrice=function(){return $.selectedOptions.filter(H=>H.billingPeriod).reduce((H,J)=>H+J.price*J.qty,0)||0}}),q.selectedItemTypes=q.itemTypes.filter($=>$.selected.length>0),q.totalPrice=function(){return q.itemTypes.reduce(($,H)=>$+H.totalPrice(),0)},q.oneTimePrice=function(){return q.itemTypes.reduce(($,H)=>$+H.oneTimePrice(),0)},q.recurringPrice=function(){return q.itemTypes.reduce(($,H)=>$+H.recurringPrice(),0)}}),D.filter(q=>q.itemTypes.filter($=>$.selected.length>0).length>0)}),y=be(()=>C.value.reduce((D,q)=>D+q.totalPrice(),0)),w=be(()=>{const D=C.value.reduce((H,J)=>H+J.totalPrice(),0);let q=C.value.reduce((H,J)=>H+J.oneTimePrice(),0),$=C.value.reduce((H,J)=>H+J.recurringPrice(),0);return s.value.billingPeriod?$=($+s.value.price)*s.value.qty:q=(q+s.value.price)*s.value.qty,{basePrice:s.value.price,addOns:D,oneTimePrice:q,recurringPrice:$,total:s.value.price*s.value.qty+D*s.value.qty+q+$}}),A=be(()=>{const D=new Map;return D.set(c.value.productLineItem.XX_ORD1__Item__c,c.value.productLineItem),c.value.options.forEach(q=>{D.set(q.XX_ORD1__Item__c,q)}),D}),I=be(()=>{const D=new Map;return s.value.categoryOptions.forEach(q=>{q.itemTypes.forEach($=>{$.options.forEach(H=>{D.set(H.relationshipInfo.publishKey,H)})})}),D}),S=be(()=>{const D=new Map;return D.set(f.value.product.XX_ORD1__Item__c,f.value.product),f.value.options.forEach(q=>{D.set(q.XX_ORD1__Item__c,q)}),D});function N(D){s.value.qliId&&(s.value.qliBillingPeriod==="Monthly"&&!D?s.value.price=s.value.qliSalesPrice||s.value.qliMrcPrice:s.value.qliBillingPeriod==="Yearly"&&D&&(s.value.price=s.value.qliSalesPrice)),s.value.categoryOptions.forEach(q=>{q.itemTypes.forEach($=>{$.options.forEach(H=>{H.billingPeriod&&(H.price=(D?H.yrcPrice.offerPrice:H.mrcPrice.offerPrice)||H.price,H.qliId&&(H.qliBillingPeriod==="Monthly"&&!D?H.price=H.qliSalesPrice||H.qliMrcPrice:H.qliBillingPeriod==="Yearly"&&D&&(H.price=H.qliSalesPrice)))})})})}function T(){s.value=null,l.value=null,p.value=[],c.value=null,f.value=null,u.value=new Map,m.value=!1,h.value.configuration=!1,h.value.lineItem=!1,h.value.productOptionsPricing=!1,h.value.bestOfferPrice=!1,h.value.lineItemAttributes=!1,h.value.save=!1}async function k(D,q){T(),o.value=D||e.params.itemId,a.value=q||e.params.qliId,console.info("initConfigurator",o.value,a.value,n.quoteId);const $=await E();await te(),await fe(),s.value=V($);const H=await j();L(H),await W();let J=!1;for(const R of c.value.options)R.XX_ORD1__Billing_Period__c==="Yearly"&&(J=!0);J&&(g.value=!0,N(!0)),l.value=JSON.parse(JSON.stringify(s.value))}async function E(){try{console.info("itemId",o.value);const D=await window.productManagerController.getProductConfiguration({itemId:o.value});console.info("getProductConfiguration:result",D);const q=JSON.parse(D.data).productItem;return q.categoryOptions=c5(q.categoryOptions),q}catch(D){return console.info("error",D.message),!1}}function L(D){const q=new Map;q.set(f.value.product.Id,f.value.product.XX_ORD1__Item__c),f.value.options.forEach(H=>{q.set(H.Id,H.XX_ORD1__Item__c)});const $=new Map;if(D.forEach(H=>{const J={};H.pricingTypes.forEach(R=>{R.appliedOnField==="Catalog Price"?J.catalogPrice=R:R.appliedOnField==="MRC"?J.mrcPrice=R:R.appliedOnField==="YRC"&&(J.yrcPrice=R)}),J.billingPeriod=H.billingPeriod,J.mrcPrice&&!t.isSinglePricingSchema?J.price=J.mrcPrice.offerPrice:J.catalogPrice&&t.isSinglePricingSchema&&(J.price=J.catalogPrice.offerPrice),J.offer={offerDiscount:H.offerDiscount,offerId:H.offerId,offerType:H.offerType},$.set(q.get(H.eCatalogItemId),J)}),$.has(s.value.itemId)){const H=$.get(s.value.itemId),J=s.value.price;Object.assign(s.value,H),s.value.qliId&&(s.value.price=J)}s.value.categoryOptions.forEach(H=>{H.itemTypes.forEach(J=>{J.options.forEach(R=>{if($.has(R.itemId)){const z=$.get(R.itemId),oe=R.price;Object.assign(R,z),R.qliId&&(R.price=oe)}})})})}function V(D){D.isAttributes=D.attributes&&D.attributes.length>0,u.value.set(a.value,D.attributes),p.value=D.configRules;const q=new Set;return p.value.forEach($=>{const H=JSON.parse($.ruleJson);H.optionSelected.forEach(J=>{q.add(J)}),H.affectedOptions.forEach(J=>{q.add(J)})}),K(D),D.categoryOptions.forEach($=>{$.key=$.category.toLowerCase().replace(/\s+/g,"-").replace(/[&]/g,""),$.itemTypes.forEach(H=>{H.selected=[],H.options=H.options.filter(J=>S.value.has(J.itemId)),H.numberOfColumns||(H.numberOfColumns=1),H.numberOfColumns>1&&(H.lightboxAttributes=!0),H.maxNumber||(H.maxNumber=100),H.minNumber||(H.minNumber=0),H.maxQuantity||(H.maxQuantity=1e4),H.minQuantity||(H.minQuantity=1),H.maxNumber===1?(H.isRadio=!0,H.minMessage="Please select 1 option",H.maxMessage="",H.isKit=H.options.some(J=>J.relationshipInfo.relationship==="Kit")):(H.minMessage=`Minimum of ${H.minNumber} selection${H.minNumber!==1?"s":""} required`,H.maxMessage=`Maximum of ${H.maxNumber} selection${H.maxNumber!==1?"s":""} allowed`),H.options.forEach(J=>{$.showImage=$.showImage||!!J.defaultImageURL,J.showAttributesModal=!1,J.calculateRules=q.has(J.relationshipInfo.publishKey),J.qty=H.minQuantity||1,J.getTags=()=>(J.attributes=J.attributes||[],J.attributes.filter(R=>R.value!==null&&R.value!=="").map(R=>({label:R.label,value:R.value}))),Object.defineProperty(J,"isDisabled",{get:function(){return J.relationshipInfo.relationship==="Kit"||(H.isRadio?H.isKit:!H.selected.includes(J.itemId)&&H.maxNumber===H.selected.length)}}),K(J),(A.value.has(J.itemId)||J.relationshipInfo.relationship==="Kit")&&H.selected.push(J.itemId)})})}),D}function K(D){D.isAttributes=D.attributes&&D.attributes.length>0;const q=S.value.get(D.itemId);if(A.value.has(D.itemId)){const $=A.value.get(D.itemId);D.qliId=$.Id,D.qty=$.XX_ORD1__QTY__c,D.itemName=$.XX_ORD1__Line_Description__c,D.billingPeriod=$.XX_ORD1__Billing_Period__c,D.price=$.XX_ORD1__Sales_Price__c,D.billingPeriod?D.price=$.XX_ORD1__Sales_Price__c||$.XX_ORD1__MRC__c:D.price=$.XX_ORD1__NRC__c||$.XX_ORD1__Sales_Price__c,D.qliSalesPrice=$.XX_ORD1__Sales_Price__c,D.qliNrcPrice=$.XX_ORD1__NRC__c,D.qliMrcPrice=$.XX_ORD1__MRC__c,D.qliBillingPeriod=$.XX_ORD1__Billing_Period__c,u.value.set(D.qliId,D.attributes)}else D.itemName=q.XX_ORD1__Line_Description__c||D.itemName,D.price=q.XX_ORD1__Negotiated_Price__c||q.XX_ORD1__NRC_for_New__c,D.nrcPrice=q.XX_ORD1__NRC_for_New__c}async function W(){console.info("getLineItemAttributes"),h.value.lineItemAttributes=!0;const q={lineItemIds:[c.value.productLineItem.Id,...c.value.options.map(J=>J.Id)]},$=await window.productManagerController.getLineItemAttributes({request:JSON.stringify(q)});console.info("getLineItemAttributes:result",$);const H=JSON.parse($.data);for(const[J,R]of Object.entries(H))if(u.value.has(J)){const z=u.value.get(J),oe=new Map;R==null||R.forEach(ce=>{oe.set(ce.apiName,ce)}),z==null||z.forEach(ce=>{oe.get(ce.apiName)&&(ce.value=oe.get(ce.apiName).value||"",ce.dataType==="REFERENCE"&&(ce.referenceRecordId=oe.get(ce.apiName).referenceRecordId||"",ce.referenceRecordId?ce.options=[{Name:ce.value||"",Id:ce.referenceRecordId}]:ce.options=[]))})}h.value.lineItemAttributes=!1}async function te(){h.value.lineItem=!0,console.info("getLineItems",n.quoteId,a.value);try{const D={objectId:n.quoteId,filters:{},additionalFields:["Name","XX_ORD1__Line_Description__c"],primarySort:{field:"CreatedDate",direction:"DESC"},productPage:{recordLimit:200,offset:0,productLineItemId:a.value}},q=await window.productManagerController.getLineItems({request:JSON.stringify(D)});return console.info("getLineItems:result",q),c.value=JSON.parse(q.data).products[0],console.info("result",q),h.value.lineItem=!1,q}catch(D){return console.info("error",D.message),h.value.lineItem=!1,!1}}async function fe(){h.value.productOptionsPricing=!0,console.info("getProductOptionsPricing");try{const D={objectId:n.quoteId,itemId:o.value},q=await window.productManagerController.getProductOptionsPricing({request:JSON.stringify(D)});return console.info("getProductOptionsPricing:result",q),f.value=JSON.parse(q.data),h.value.productOptionsPricing=!1,f.value}catch(D){return console.info("error",D.message),h.value.productOptionsPricing=!1,!1}}async function ee(D){console.info("getRecords");try{const q=await window.productManagerController.getRecords({request:JSON.stringify(D)});return console.info("getRecords:result",q),JSON.parse(q.data)}catch(q){return console.info("error",q.message),!1}}async function j(){h.value.bestOfferPrice=!0,console.info("getBestOfferPrice");const D=[f.value.product.Id];f.value.options.forEach(q=>{D.push(q.Id)});try{const q=await O(D);return h.value.bestOfferPrice=!1,q}catch(q){return console.info("error",q.message),h.value.bestOfferPrice=!1,!1}}async function O(D){const q={accountId:t.accountId,eCatalogItemIds:D,pricePreference:"Heighest Priority"},$=await window.productManagerController.calculateBestOfferPrice({request:JSON.stringify(q)});return console.info("calculateBestOfferPrice:result",$),h.value.bestOfferPrice=!1,JSON.parse($.data)}async function P(){m.value=!0,h.value.save=!0,console.info("maintainQuoteConfiguration");const D=[],q=[];s.value.categoryOptions.forEach(J=>{J.itemTypes.forEach(R=>{R.options.forEach(z=>{R.selected.includes(z.itemId)?D.push(M(z)):z.qliId&&q.push(z.qliId)})})});const $={objectId:n.quoteId,eCatalogId:t.eCatalogId,isGenesisAI:!0,blinkUser:!1,optionsToRemove:q,grandFatheredOptionsToRemove:[],productLineItem:{...M(s.value),optionLineItems:D}};console.info("maintainQuoteConfiguration:request",$);const H=await window.productManagerController.maintainQuoteConfiguration({request:JSON.stringify($)});if(console.info("maintainQuoteConfiguration:result",H),H!=null&&H.error){const J={title:"Unable to Save Configuration",description:H.error,button:{label:"Back to Configuration",action:()=>{m.value=!1}},cancel:{label:"Quote List",action:()=>{i.push("/quote-item?id="+n.quoteId)}}};r.errorPopup=J}else l.value=JSON.parse(JSON.stringify(s.value)),console.info("maintainQuoteConfiguration:result",H);h.value.save=!1}function M(D){const q={};D.isAttributes&&D.attributes.forEach(H=>{H.apiName.includes(".")||(H.dataType==="BOOLEAN"?q[H.apiName]=H.value?"true":"false":H.dataType==="REFERENCE"?q[H.apiName]=H.referenceRecordId:q[H.apiName]=H.value)});const $={attributes:q,itemId:D.itemId,lineItemId:D.qliId,lineDescription:D.itemName,qty:D.qty,billingPeriod:D.billingPeriod,...D.offer};return D.billingPeriod&&v.value&&!t.isSinglePricingSchema&&($.billingPeriod=g.value?"Yearly":"Monthly"),!t.isSinglePricingSchema&&!D.billingPeriod?$.nrcPrice=D.price:($.applyOnField="Catalog Price",$.salesPrice=D.price,$.nrcPrice=D.nrcPrice),$}async function Z(){const D={objectId:t.eCatalogId,productItemId:o.value};try{let q=await window.productManagerController.getProductCrossSells({request:JSON.stringify(D)});if(console.info("getProductCrossSells:result",q),q=q.data?JSON.parse(q.data):{},q.crossSells.length===0)return q;const $=q.crossSells.map(R=>R.Id),H=await O($),J=new Map;return H.forEach(R=>{J.set(R.eCatalogItemId,{...R,...R.pricingTypes[0]})}),q.crossSells.forEach(R=>{R.loading=!1,R.Name=R.XX_ORD1__Line_Description__c||R.XX_ORD1__Item__r.Name,R.Description=R.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,J.has(R.Id)?(R.Price=J.get(R.Id).offerPrice,R.priceFormatted=J.get(R.Id).formattedOfferPrice,R.offer={offerDiscount:J.get(R.Id).offerDiscount,offerId:J.get(R.Id).offerId,offerType:J.get(R.Id).offerType}):(R.Price=R.XX_ORD1__List_Price2__c,R.priceFormatted=R.XX_ORD1__List_Price2__c,R.offer={offerDiscount:0,offerId:null,offerType:null})}),q}catch(q){return console.info("error",q.message),!1}}async function Q(D,q){var R,z;const $={product:{publishKey:s.value.publishKey,lineDescription:s.value.itemName},options:[]};s.value.categoryOptions.forEach(oe=>{oe.itemTypes.forEach(ce=>{ce.options.forEach(le=>{ce.selected.includes(le.itemId)&&$.options.push({publishKey:le.relationshipInfo.publishKey,lineDescription:le.itemName})})})}),console.info("evaluateConfigSelection:currentConfig.options",$.options);const H={productJSON:{productItem:{configRules:p.value}},currentConfig:$,selected:D?{publishKey:(R=D.relationshipInfo)==null?void 0:R.publishKey,attributes:D.attributes,lineDescription:D.itemName}:{},unselected:q?{publishKey:(z=q.relationshipInfo)==null?void 0:z.publishKey,attributes:q.attributes,lineDescription:q.itemName}:{}};return await l5(H)}async function B(){try{const D=["Name","XX_ORD1__Line_Description__c","XX_ORD1__Item__r.XX_ORD1__Product_Description__c","XX_ORD1__Sales_Price__c","XX_ORD1__SYS_Configuration_Status2__c"],$=(await n.getQuoteLineItemsWithFilteredTable({fields:D,recordId:n.quoteId,filters:[],includeOptions:!1,totalFields:[]})).lineItems;return console.info("fetchQuoteLineItems:res",$),$}catch(D){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",D.message)}}async function U(D){const q={quoteId:n.quoteId,lstQLIRequest:[{eCatalogItemId:D.Id,quantity:1,offerApplicable:D.offer}]};try{const $=await window.productManagerController.createQuoteProducts({request:JSON.stringify(q)});console.info("getProductCrossSells:result",$)}catch($){return console.info("error",$.message),!1}}return{itemId:o,configuration:s,_configurationCopy:l,lineItem:c,savedScreen:m,loading:h,summary:C,addOns:y,summaryPrices:w,optionByItemId:A,attributesByQLIId:u,optionByPublishKey:I,showYearlyPricing:g,isYearlyPricingExist:v,isChangedConfiguration:_,isRecurringPricingSchema:d,changePricingScheme:N,createQuoteProducts:U,resetConfigurator:T,fetchQuoteLineItems:B,getRecords:ee,getProductCrossSells:Z,initConfigurator:k,maintainQuoteConfiguration:P,evaluateConfigSelection:Q}}),f5={class:"ect-p-4 ect-flex ect-gap-2 ect-items-center ect-justify-between ect-border-b ect-border-gray-200"},d5={class:"ect-flex ect-items-center ect-gap-3"},h5={class:"ect-text-xl ect-font-semibold ect-text-gray-700 ect-leading-relaxed"},p5={key:0,class:"ect-flex ect-gap-1.5 ect-items-center"},m5=b("span",{class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed"},"Saving configuration...",-1),g5={key:1,class:"ect-flex ect-gap-1.5 ect-items-center"},v5=b("span",{class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed"},"Configuration Saved Successfully",-1),y5={key:1,class:"ect-flex ect-flex-col ect-gap-4 ect-flex-1 ect-overflow-y-auto ect-mb-16"},_5=b("h3",{class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed ect-p-4 ect-pb-0"},"You may consider these products",-1),b5={class:"ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-pt-0 ect-overflow-y-auto"},C5=["data-test-id"],w5={class:"ect-flex-1 ect-flex ect-flex-col ect-gap-2"},x5={class:"ect-text-sm ect-font-semibold ect-text-gray-800 ect-leading-tight"},k5={class:"ect-text-sm ect-font-medium ect-text-gray-600 ect-leading-relaxed ect-line-clamp-2"},E5={class:"ect-flex ect-flex-row ect-justify-between ect-items-center"},O5={class:"ect-text-sm ect-font-semibold ect-text-gray-800"},S5={key:2,class:"ect-flex ect-flex-col ect-gap-4 ect-m-4 ect-flex-1 ect-overflow-y-auto"},I5=b("h3",{class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed"},"What do you want to do next?",-1),A5={class:"ect-flex ect-flex-col ect-gap-4"},T5=["data-test-id","onClick"],N5={class:"ect-flex ect-items-center ect-justify-center"},P5={class:"ect-flex ect-flex-col ect-items-center ect-gap-2 ect-w-full"},L5=["data-test-id"],R5=["data-test-id"],M5={key:3,class:"ect-bg-light-bg-x ect-border-t ect-border-gray-200 ect-flex-shrink-0 ect-sticky ect-bottom-0 ect-pb-4"},q5={class:"ect-flex ect-flex-col ect-gap-4"},j5={class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed ect-p-4 ect-pb-0"},D5={class:"ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-pt-0 ect-overflow-y-auto"},B5={class:"ect-bg-white ect-border ect-border-gray-300 ect-rounded-md ect-p-3 ect-flex ect-flex-col","data-test-id":"configurator-recommend-card-next-product"},$5={class:"ect-flex-1 ect-flex ect-flex-col ect-gap-2"},F5={class:"ect-text-sm ect-font-semibold ect-text-gray-800 ect-leading-tight"},V5={class:"ect-text-sm ect-font-medium ect-text-gray-600 ect-leading-relaxed ect-line-clamp-2"},H5={class:"ect-flex ect-flex-row ect-justify-between ect-items-center"},U5={class:"ect-text-sm ect-font-semibold ect-text-gray-800"},z5={__name:"ConfiguratorRecommend",setup(e){const t=sn(),n=Tn(),r=Vi(),i=be(()=>t.configuration),o=ae(!0),a=ae(""),s=ae([{icon:"configuration",title:"Back to current Product Configuration",description:"Returns to the active product configuration page.",link:"/item/overview",action:"backToConfiguration"},{icon:"menu",title:"Back to Quote List Page",description:"Returns to the main quote list page.",link:"/quote-item",action:"backToQuoteList"}]),l=ae(null),p=ae([]),c=async h=>{h.loading=!0,await t.createQuoteProducts(h),h.disabled=!0,h.loading=!1},f=h=>{h.action==="backToConfiguration"?t.savedScreen=!1:h.action==="backToQuoteList"?r.push("/quote-item?id="+n.quoteId):h.link&&r.push(h.link)};async function u(){const h=await t.fetchQuoteLineItems();console.info("getQuoteLineItems1:_quoteLineItems",h);const g=h.filter(v=>v.XX_ORD1__SYS_Configuration_Status2__c=="Needs Configuration").length;console.info("getQuoteLineItems2:needsConfigurationCount",g),a.value=`(${h.length-g}/${h.length})`;const d=h.find(v=>v.XX_ORD1__SYS_Configuration_Status2__c=="Needs Configuration"&&v.Id!=t.qliId);return console.info("getQuoteLineItems3:result",d),l.value=d?{Name:d.XX_ORD1__Line_Description__c,Description:d.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,Price:d.XX_ORD1__Sales_Price__c,XX_ORD1__Item__c:d.XX_ORD1__Item__c,Id:d.Id}:null,console.info("getQuoteLineItems4:configueredProduct",l.value),h}async function m(){t.resetConfigurator(),r.push({path:"/configurator/"+l.value.XX_ORD1__Item__c+"/"+l.value.Id}),t.initConfigurator(l.value.XX_ORD1__Item__c,l.value.Id)}return wn(async()=>{o.value=!0;const h=await u(),g=await t.getProductCrossSells(),d=new Set;h.forEach(v=>{d.add(v.XX_ORD1__Item__c)}),g.crossSells.forEach(v=>{v.disabled=d.has(v.XX_ORD1__Item__c)}),p.value=g.crossSells||[],o.value=!1}),(h,g)=>(X(),ne(Oe,null,[b("div",f5,[b("div",d5,[_e(Ge,{icon:"arrow",symbol:"",size:12,onClick:g[0]||(g[0]=d=>Xe(t).savedScreen=!1)}),b("h2",h5,ve(i.value.itemName),1)]),Xe(t).loading.save?(X(),ne("div",p5,[_e(Oc,{svg:""}),m5])):(X(),ne("div",g5,[_e(Ge,{icon:"check",color:"#136E05",size:14,"data-test-id":"item-tabs-before-button-icon"}),v5]))]),o.value?(X(),Te(Ca,{key:0,type:"recommendations",rows:4})):p.value.length>0?(X(),ne("div",y5,[_5,b("div",b5,[(X(!0),ne(Oe,null,ze(p.value,(d,v)=>(X(),ne("div",{key:d.Id||v,class:"ect-bg-white ect-border ect-border-gray-300 ect-rounded-md ect-p-3 ect-flex ect-flex-col","data-test-id":`configurator-recommend-card-${d.Id||v}`},[b("div",w5,[b("h4",x5,ve(d.Name),1),b("p",k5,ve(d.Description),1)]),b("div",E5,[b("div",O5,ve(h.$formatCurrency(d.Price)),1),_e(Nt,{btype:d.disabled?"secondary":"primary","button-style":d.disabled?"normal":"outlined",size:"medium",class:Ie({"ect-w-[120px]":d.loading}),loading:d.loading,disabled:d.disabled||d.loading,"data-test-id":`configurator-recommend-button-add-${d.Id||v}`,onClick:_=>c(d)},{default:De(()=>[Fe(ve(d.loading?"":d.disabled?"Added to Quote":"Add to Quote"),1)]),_:2},1032,["btype","button-style","class","loading","disabled","data-test-id","onClick"])])],8,C5))),128))])])):(X(),ne("div",S5,[I5,b("div",A5,[(X(!0),ne(Oe,null,ze(s.value,(d,v)=>(X(),ne("div",{key:d.title||v,class:"ect-bg-white ect-border ect-border-[#DEDEDE] ect-rounded-xl ect-p-4 md:ect-p-5 lg:ect-p-6 ect-flex ect-flex-col ect-items-center ect-gap-4 md:ect-gap-6 lg:ect-gap-8 ect-cursor-pointer ect-transition-all ect-duration-200 hover:ect-shadow-md hover:ect-border-gray-400","data-test-id":`configurator-recommend-redirect-card-${v}`,onClick:_=>f(d)},[b("div",N5,[_e(Ge,{icon:d.icon,size:20,color:"#000000","data-test-id":`configurator-recommend-redirect-icon-${v}`},null,8,["icon","data-test-id"])]),b("div",P5,[b("h4",{class:"ect-text-sm ect-font-semibold ect-text-[#5F5F5F] ect-text-center ect-leading-[1.43]","data-test-id":`configurator-recommend-redirect-title-${v}`},ve(d.title),9,L5),b("p",{class:"ect-text-sm ect-font-normal ect-text-[#828282] ect-text-center ect-leading-[1.71]","data-test-id":`configurator-recommend-redirect-description-${v}`},ve(d.description),9,R5)])],8,T5))),128))])])),l.value?(X(),ne("footer",M5,[b("div",q5,[b("h3",j5," Configuere next product from your quote "+ve(a.value),1),b("div",D5,[b("div",B5,[b("div",$5,[b("h4",F5,ve(l.value.Name),1),b("p",V5,ve(l.value.Description),1)]),b("div",H5,[b("div",U5,ve(h.$formatCurrency(l.value.Price)),1),_e(Nt,{btype:"primary","button-style":"filled",size:"medium","data-test-id":"configurator-recommend-button-add-next-product",onClick:m},{default:De(()=>[Fe(" Configure Now ")]),_:1})])])])])])):ye("",!0)],64))}},K5=["data-test-id"],Z5=Ve({__name:"AppPill",props:{variant:{type:String,default:"",validator:e=>["success","error",""].includes(e)},dataTestId:{type:String,default:""}},setup(e){return(t,n)=>(X(),ne("span",{class:Ie(["ect-pill",{"ect-pill-success":e.variant==="success","ect-pill-error":e.variant==="error","ect-pill-default":!e.variant}]),"data-test-id":e.dataTestId},[Ze(t.$slots,"default",{},void 0,!0)],10,K5))}},[["__scopeId","data-v-c7f05fa0"]]),Q5=["data-test-id"],X5=["data-test-id"],J5=["data-test-id","onClick"],W5=["data-test-id"],G5=Ve({__name:"AppTabsV2",props:{showTabs:{type:Boolean,default:!0},modelValue:{type:String,default:""},border:{type:Boolean,default:!1},tabs:{type:Array,required:!0,validator:e=>e.every(t=>typeof t=="object"&&t.title&&t.key&&(t.sections===void 0||Array.isArray(t.sections)))},dataTestId:{type:String,required:!0}},emits:["update:modelValue","tab-change"],setup(e,{emit:t}){const n=e,r=t,i=be(()=>{var a;return n.modelValue||((a=n.tabs[0])==null?void 0:a.key)||""}),o=a=>{r("update:modelValue",a),r("tab-change",a)};return(a,s)=>(X(),ne("div",{class:"ect-page-tabs","data-test-id":e.dataTestId},[e.showTabs?(X(),ne("div",{key:0,class:Ie(["ect-page-tabs-header",[{"ect-tab-border":e.border}]]),"data-test-id":`${e.dataTestId}-header`},[(X(!0),ne(Oe,null,ze(e.tabs,l=>(X(),ne("button",{key:l.key,class:Ie(["ect-page-tab-button",`ect-page-tab-button${i.value===l.key?"-active":""} ${l.tabClass||""}`]),"data-test-id":`${e.dataTestId}-tab-${l.key}`,onClick:p=>o(l.key)},[Fe(ve(l.title)+" ",1),l.pill!==void 0&&l.pill!==null?(X(),Te(Z5,{key:0,class:"ect-ml-2",variant:l.pillStyle,"data-test-id":`${e.dataTestId}-tab-${l.key}-pill`},{default:De(()=>[Fe(ve(l.pill),1)]),_:2},1032,["variant","data-test-id"])):ye("",!0)],10,J5))),128))],10,X5)):ye("",!0),b("div",{class:"ect-page-tab-content","data-test-id":`${e.dataTestId}-content`},null,8,W5)],8,Q5))}},[["__scopeId","data-v-f22cb1ed"]]),Y5=["data-test-id"],eh=["disabled","data-test-id"],th=["value","disabled","data-test-id"],nh=["disabled","data-test-id"],zi={__name:"CounterButton",props:{value:{type:Number,required:!0,default:null},min:{type:Number,default:1},max:{type:Number,default:999},empty:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},dataTestId:{type:String,required:!0}},emits:["update:value","change"],setup(e,{emit:t}){const n=e,r=t,i=be(()=>n.min==null?0:n.min),o=be(()=>n.max==null?999:n.max),a=(y,w,A)=>Math.min(Math.max(y,w),A),s=y=>{if(y==null||y==="")return NaN;const w=Number(y);return Number.isFinite(w)?w:NaN},l=ae(null),p=ae(n.value??i.value),c=y=>{p.value=a(y,i.value,o.value)};n.value!==null&&c(n.value);const f=be(()=>p.value),u=be(()=>l.value!=null?l.value:String(f.value)),m=be(()=>n.disabled||f.value<=i.value),h=be(()=>n.disabled||f.value>=o.value);function g(y){y!==n.value&&(p.value=y,r("update:value",y),r("change",y))}function d(){if(m.value)return;const y=a(f.value-1,i.value,o.value);l.value=null,g(y)}function v(){if(h.value)return;const y=a(f.value+1,i.value,o.value);l.value=null,g(y)}function _(y){const A=String(y.target.value??"").replace(/\D+/g,"");l.value=A}function C(){const y=s(l.value),w=i.value,A=a(Number.isNaN(y)?w:y,i.value,o.value);l.value=null,g(A)}return(y,w)=>(X(),ne("div",{class:"ect-flex ect-items-center ect-gap-1","data-test-id":e.dataTestId},[b("button",{type:"button",class:Ie(["ect-h-7 ect-w-7 ect-border ect-border-gray ect-rounded-md ect-flex ect-items-center ect-justify-center ect-text-gray-700 ect-text-sm hover:ect-border-gray-400 ect-transition-colors ect-bg-white",{"ect-opacity-50":m.value,"ect-cursor-not-allowed":m.value}]),disabled:m.value,"data-test-id":`${e.dataTestId}-decrement`,onClick:d}," - ",10,eh),b("input",{type:"text",inputmode:"numeric",pattern:"[0-9]*",value:e.empty?"":u.value,disabled:e.disabled,class:"ect-h-7 ect-w-[48px] ect-px-2 ect-border ect-border-gray ect-rounded-md ect-text-center ect-text-sm ect-font-medium ect-text-gray-900 focus:ect-outline-none focus:ect-border-gray-400 ect-bg-white","data-test-id":`${e.dataTestId}-input`,onInput:_,onBlur:C},null,40,th),b("button",{type:"button",class:Ie(["ect-h-7 ect-w-7 ect-border ect-border-gray ect-rounded-md ect-flex ect-items-center ect-justify-center ect-text-gray-700 ect-text-sm hover:ect-border-gray-400 ect-transition-colors ect-bg-white",{"ect-opacity-50":h.value,"ect-cursor-not-allowed":h.value}]),disabled:h.value,"data-test-id":`${e.dataTestId}-increment`,onClick:v}," + ",10,nh)],8,Y5))}},rh={class:"ect-flex ect-justify-end ect-items-center ect-gap-2.5 ect-px-6 ect-pb-6 ect-pt-4 ect-bg-white ect-border-t ect-border-gray-300 ect-shadow-[0_-2px_4px_0px_rgba(0,0,0,0.11)]","data-test-id":"configurator-footer"},ih={"data-test-id":"configurator-footer-quantity"},oh={class:"ect-flex ect-justify-end ect-items-center ect-gap-6 ect-px-8 ect-py-0 ect-flex-1","data-test-id":"configurator-footer-prices"},ah=["data-test-id"],sh=["data-test-id"],lh=["data-test-id"],ch=["data-test-id"],uh={__name:"ConfiguratorFooter",props:{item:{type:Object,required:!0,default:()=>{}},disabled:{type:Boolean,default:!1},btnText:{type:String,default:"Save"}},emits:["update:qty","continue"],setup(e,{emit:t}){const n=sn(),r=e,i=ae(r.item),o=be(()=>{const l=n.summaryPrices,p=[];return n.isRecurringPricingSchema?(p.push({label:"One Time Price",value:l.oneTimePrice,highlight:!1}),p.push({label:n.showYearlyPricing?"Yearly Price":"Monthly Price",value:l.recurringPrice,highlight:!1})):(p.push({label:"Base Price",value:l.basePrice,highlight:!1}),p.push({label:"Add Ons",value:l.addOns,highlight:!1}),p.push({label:"Total Price",value:l.total,highlight:!1})),p}),a=t,s=()=>{r.disabled||a("continue")};return(l,p)=>(X(),ne("footer",rh,[b("div",ih,[_e(zi,{value:i.value.qty,"onUpdate:value":p[0]||(p[0]=c=>i.value.qty=c),min:1,max:999,disabled:e.disabled,"is-selected":!0,"data-test-id":"configurator-footer-counter-button"},null,8,["value","disabled"])]),b("div",oh,[(X(!0),ne(Oe,null,ze(o.value,(c,f)=>(X(),ne(Oe,{key:f},[b("div",{class:"ect-flex ect-flex-col ect-justify-center","data-test-id":`configurator-footer-price-${f}`},[b("span",{class:"ect-text-xs ect-font-normal ect-text-gray-500 ect-text-left","data-test-id":`configurator-footer-price-label-${f}`},ve(c.label),9,sh),b("span",{class:Ie(["ect-text-left",c.highlight?"ect-text-lg ect-font-bold ect-text-green-700":"ect-text-sm ect-font-medium ect-text-gray-800 "]),"data-test-id":`configurator-footer-price-value-${f}`},ve(l.$formatCurrency(c.value)),11,lh)],8,ah),f<o.value.length-1?(X(),ne("div",{key:0,class:"ect-w-0 ect-h-5 ect-border-l ect-border-gray-400","data-test-id":`configurator-footer-divider-${f}`},null,8,ch)):ye("",!0)],64))),128))]),_e(Nt,{class:"ect-min-w-[100px]",btype:e.disabled?"secondary":"primary",disabled:e.disabled,"button-style":"primary",size:"medium","data-test-id":"configurator-footer-button-continue",onClick:s},{default:De(()=>[Fe(ve(e.btnText),1)]),_:1},8,["btype","disabled"])]))}},fh={class:"ect-w-full ect-bg-white ect-mb-4","data-test-id":"configurator-type-section"},dh={class:"ect-sticky ect-top-0 ect-z-30 ect-bg-white ect-shadow-sm ect-p-3 ect-px-4 ect-border-b ect-border-gray-200 ect-flex ect-justify-between ect-items-center","data-test-id":"configurator-type-header-sticky"},hh={class:"ect-flex ect-flex-col"},ph={class:"ect-font-bold ect-text-text-success ect-leading-tight"},mh=["innerHTML"],gh={key:0,class:"ect-flex ect-items-center ect-gap-2 ect-px-2 ect-py-1","data-test-id":"configurator-type-message"},vh={class:"ect-text-xs ect-font-medium ect-text-gray-600 ect-leading-tight ect-min-w-[190px]"},yh={class:"ect-divide-y ect-divide-gray-100 ect-overflow-y-auto"},_h={__name:"ConfiguratorType",props:{title:{type:String,required:!0},description:{type:String,default:""},message:{type:String,default:""}},setup(e){return(t,n)=>(X(),ne("section",fh,[b("header",dh,[b("div",hh,[b("h2",ph,ve(e.title),1),e.description?(X(),ne("p",{key:0,class:"ect-mt-1 ect-text-xs ect-text-gray-500 ect-leading-tight",innerHTML:e.description},null,8,mh)):ye("",!0)]),e.message?(X(),ne("div",gh,[_e(Ge,{icon:"info",symbol:"",color:"#198708",size:14,"data-test-id":"configurator-type-message-icon"}),b("span",vh,ve(e.message),1)])):ye("",!0)]),b("div",yh,[Ze(t.$slots,"default")])]))}},bh={__name:"ShadowDisplay",props:{content:{type:String,required:!0}},setup(e){const t=e,n=ae(null);let r=null;return xn(()=>{n.value&&!r&&(r=n.value.attachShadow({mode:"open"}),r.innerHTML=t.content)}),St(()=>t.content,i=>{r&&(r.innerHTML=i)}),(i,o)=>(X(),ne("div",{ref_key:"host",ref:n},null,512))}},Ch=["data-test-id"],wh=["data-test-id"],xh=["data-test-id"],kh=[b("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[b("g",{id:"Group"},[b("path",{id:"Vector",d:"M7 1.3125V12.6875",stroke:"#A86200","stroke-linecap":"round","stroke-linejoin":"round"}),b("path",{id:"Vector_2",d:"M1.3125 7H12.6875",stroke:"#A86200","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)],Eh=["data-test-id"],Oh=["data-test-id"],Sh=["data-test-id"],Ih=["data-test-id"],Ah=["data-test-id"],Th=["data-test-id","innerHTML"],Zt={__name:"Tag",props:{label:{type:String,default:""},value:{type:String,default:""},addButton:{type:Boolean,default:!1},editButton:{type:Boolean,default:!1},dataTestId:{type:String,default:""}},setup(e){const t=e,n=be(()=>{const r=t.value;if(typeof r!="string")return!1;const i=new DOMParser().parseFromString(r,"text/html");return Array.from(i.body.childNodes).some(o=>o.nodeType===1)});return(r,i)=>e.addButton?(X(),ne("div",{key:0,class:"ect-bg-orange-4 ect-flex ect-gap-1 ect-justify-center ect-items-center ect-px-2 ect-py-0.5 ect-text-xs ect-font-medium ect-text-center ect-rounded-md ect-border ect-border-solid ect-border-orange-secondary","data-test-id":e.dataTestId},[b("span",{class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-orange-secondary ect-flex ect-items-center ect-gap-1","data-test-id":`${e.dataTestId}-content`},[b("div",{"data-test-id":`${e.dataTestId}-add-icon`},kh,8,xh),Fe(" "+ve(e.label),1)],8,wh)],8,Ch)):e.editButton?(X(),ne("div",{key:1,class:"ect-bg-white ect-flex ect-gap-1 ect-justify-center ect-items-center ect-px-2 ect-py-0.5 ect-text-xs ect-font-medium ect-text-center ect-rounded-md ect-border ect-border-solid ect-border-success","data-test-id":e.dataTestId},[b("span",{class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-success ect-flex ect-items-center ect-gap-1","data-test-id":`${e.dataTestId}-content`},ve(e.label),9,Oh)],8,Eh)):(X(),ne("div",{key:2,class:"ect-bg-white ect-px-2 ect-py-0.5 ect-text-xs ect-font-medium ect-rounded-md ect-border ect-border-solid ect-border-neutral-200","data-test-id":e.dataTestId},[b("span",{class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-zinc-500","data-test-id":`${e.dataTestId}-label`},ve(e.label),9,Ih),e.value?(X(),ne("span",{key:0,class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-zinc-500","data-test-id":`${e.dataTestId}-separator`}," : ",8,Ah)):ye("",!0),n.value?(X(),Te(bh,{key:1,content:e.value},null,8,["content"])):e.value?(X(),ne("span",{key:2,class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-neutral-700","data-test-id":`${e.dataTestId}-value`,innerHTML:e.value},null,8,Th)):ye("",!0)],8,Sh))}},Nh=["data-test-id"],Ph=["data-test-id"],Lh=["data-test-id"],Rh=["type","step","min","data-test-id"],ka=Ve({__name:"InputEdit",props:{modelValue:{type:String,required:!0},type:{type:String,default:"string",validator:e=>["string","number","currency"].includes(e)},tag:{type:String,default:"span"},disabled:{type:Boolean,default:!1},dataTestId:{type:String,required:!0}},emits:["update:modelValue","change"],setup(e,{expose:t,emit:n}){const r=e,i=n,o=ae(!1),a=ae(!1),s=ae(""),l=ae(null),p=be(()=>r.type==="currency"?v(r.modelValue):r.type==="number"?_(r.modelValue):r.modelValue),c=be(()=>r.type==="string"?"text":"number"),f=be(()=>r.type==="currency"?"0.01":void 0),u=be(()=>r.type==="currency"?"0":void 0),m=()=>{r.disabled||(r.type==="currency"?s.value=parseFloat(r.modelValue)||"0.00":r.type==="number"?s.value=parseFloat(r.modelValue)||"0":s.value=r.modelValue,o.value=!0,Ut(()=>{l.value&&(l.value.focus(),l.value.select())}))},h=()=>{let C=s.value;if(r.type==="number"||r.type==="currency"){const y=parseFloat(s.value);isNaN(y)?C=r.modelValue:C=r.type==="currency"?y.toFixed(2):y.toString()}C!==r.modelValue&&(i("update:modelValue",C),i("change",C)),o.value=!1},g=()=>{s.value=r.modelValue,o.value=!1},d=()=>{o.value&&h()},v=C=>!C||isNaN(C)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(parseFloat(C)),_=C=>!C||isNaN(C)?"0":new Intl.NumberFormat("en-US").format(parseFloat(C));return St(()=>r.modelValue,C=>{o.value||(s.value=C)}),t({startEditing:m,saveChanges:h,cancelEditing:g}),(C,y)=>{const w=Hf("click-outside");return X(),ne("div",{class:"ect-relative ect-inline-block ect-min-w-[60px] ect-h-[30px]","data-test-id":e.dataTestId,onMouseenter:y[1]||(y[1]=A=>a.value=!0),onMouseleave:y[2]||(y[2]=A=>a.value=!1)},[o.value?Cn((X(),ne("div",{key:1,class:"ect-w-full ect-h-full","data-test-id":`${e.dataTestId}-input-wrapper`},[Cn(b("input",{ref_key:"inputRef",ref:l,"onUpdate:modelValue":y[0]||(y[0]=A=>s.value=A),type:c.value,step:f.value,min:u.value,class:Ie(["ect-w-full ect-h-full ect-px-3 ect-bg-white ect-border ect-border-green-500 ect-rounded-sm ect-text-gray-700 ect-text-base ect-font-sans ect-outline-none ect-duration-200",C.$attrs.class]),"data-test-id":`${e.dataTestId}-input`,onKeyup:[qr(h,["enter"]),qr(g,["esc"])],onBlur:h},null,42,Rh),[[u1,s.value]])],8,Lh)),[[w,d]]):(X(),ne("div",{key:0,class:Ie(["ect-flex ect-items-center ect-gap-2 ect-rounded ect-transition-colors ect-duration-200",{"ect-cursor-pointer":!e.disabled}]),"data-test-id":`${e.dataTestId}-display`,onClick:m},[(X(),Te(bl(e.tag),ua(C.$attrs,{class:"ect-m-0 ect-text-inherit","data-test-id":`${e.dataTestId}-text`}),{default:De(()=>[Fe(ve(p.value)+" ",1),_e(Ge,{class:Ie(a.value&&!e.disabled?"ect-visible":"ect-invisible"),icon:"edit",size:"12",color:"#828282","data-test-id":`${e.dataTestId}-edit-icon`},null,8,["class","data-test-id"])]),_:1},16,["data-test-id"]))],10,Ph))],40,Nh)}}},[["__scopeId","data-v-07416d80"]]),Mh=["data-test-id","data-publish-key"],qh={key:0,class:"ect-text-xs ect-text-gray-500 ect-text-white ect-font-medium ect-leading-tight ect-absolute ect-top-[-.7rem] ect-left-[-1rem] ect-bg-text-success ect-rounded-xl ect-px-2 ect-py-1"},jh={key:1,class:"ect-flex ect-items-start ect-gap-4 ect-p-3 ect-px-4"},Dh={key:0,class:"ect-w-16 ect-h-16 ect-flex ect-items-center ect-justify-center ect-rounded-lg ect-bg-gray-200 ect-flex-shrink-0"},Bh=["src","alt"],$h={class:"ect-flex-1 ect-min-w-0"},Fh={class:"ect-flex ect-gap-4 ect-items-center ect-justify-between"},Vh={class:"ect-flex ect-flex-row ect-gap-3"},Hh=b("div",{class:"ect-w-px ect-h-auto ect-bg-gray-200 ect-mx-2"},null,-1),Uh={class:"ect-flex ect-flex-col ect-max-w-[125px]"},zh={class:"ect-flex ect-items-start ect-justify-center ect-ml-2 ect-mt-0"},Kh=["innerHTML"],Zh={key:0,class:"ect-flex ect-flex-wrap ect-gap-2.5 ect-mt-2"},Qh=["data-test-id"],Xh=["data-test-id"],Jh={key:1,class:"ect-inline-block ect-mb-2"},Wh={key:2,class:"ect-flex ect-flex-col ect-gap-3 ect-p-3 ect-h-full ect-justify-between"},Gh={class:"ect-flex ect-items-start ect-gap-2"},Yh={class:"ect-w-16 ect-h-16 ect-rounded-lg ect-bg-gray-200 ect-flex-shrink-0 ect-overflow-hidden"},e9=["src","alt"],t9={class:"ect-flex-1 ect-min-w-0"},n9={class:"ect-text-sm ect-font-semibold ect-text-gray-900 ect-leading-tight"},r9={class:"ect-mt-1 ect-text-sm ect-text-gray-700 ect-leading-tight"},i9={class:"ect-flex ect-items-start ect-justify-center ect-ml-2 ect-mt-0"},o9={key:0,class:"ect-flex ect-flex-wrap ect-gap-1.5"},a9=["data-test-id"],s9=["data-test-id"],l9={key:1,class:"ect-inline-block ect-mb-2"},c9={class:"ect-flex ect-justify-between ect-items-center"},u9={class:"ect-flex ect-flex-col"},f9=b("p",{class:"ect-text-xs ect-text-gray-500 ect-font-medium ect-leading-tight"},"Price",-1),d9={key:3,"data-test-id":"configurator-item-slot-details",class:"ect-bg-white ect-rounded-md"},h9={__name:"ConfiguratorItem",props:{item:{type:Object,required:!0},name:{type:String,required:!0},description:{type:String,default:""},imageUrl:{type:String,default:""},price:{type:Number,required:!0},quantity:{type:Number,default:1},selected:{type:Boolean,default:!1},tags:{type:Array,default:()=>[]},attributes:{type:Array,default:()=>[]},size:{type:Number,default:1},minQuantity:{type:Number,default:null},maxQuantity:{type:Number,default:null},showImage:{type:Boolean,default:!1},option:{type:Object,default:null},isAttributes:{type:Boolean,default:!1},showAttributes:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:quantity","update:name","edit-attributes"],setup(e,{emit:t}){const n=e,r=t,i=ae(null),o=ae(0),a=ae(n.item),s=be(()=>a.value.relationshipInfo.relationship==="Kit"?"ect-bg-green-3 ect-border-gray-200 ect-border-success":n.disabled?"ect-bg-light-bg-x ect-border-gray-200":n.selected?"ect-bg-green-3 ect-border-gray-200 ect-border-success":"ect-bg-white ect-border-gray-200 hover:ect-border-success"),l=be({get:()=>n.quantity,set:h=>r("update:quantity",h)}),p=be({get:()=>n.name,set:h=>r("update:name",h)}),c=h=>{r("update:quantity",h)},f=be(()=>{if(o.value===0)return n.tags;const g=Math.floor(o.value/120);return n.tags.slice(0,Math.max(1,g))}),u=be(()=>Math.max(0,n.tags.length-f.value.length)),m=()=>{if(i.value){const h=i.value,g=80,d=120,v=32,_=64;o.value=h.offsetWidth-g-d-v-_}};return xn(()=>{Ut(()=>{m()})}),St(()=>n.tags,()=>{Ut(()=>{m()})},{deep:!0}),xn(()=>{window.addEventListener("resize",m)}),(h,g)=>(X(),ne("div",{ref_key:"containerRef",ref:i,class:Ie(["ect-w-full ect-rounded-md ect-border-1 ect-transition-colors ect-relative",s.value]),"data-test-id":`configurator-item-${e.item.itemId}`,"data-publish-key":e.item.publishKey},[e.item.relationshipInfo.relationship==="Kit"?(X(),ne("div",qh," KIT ")):ye("",!0),e.size===1?(X(),ne("div",jh,[e.showImage?(X(),ne("div",Dh,[e.imageUrl?(X(),ne("img",{key:0,src:e.imageUrl,alt:p.value,class:"ect-w-full ect-h-full ect-object-cover"},null,8,Bh)):(X(),Te(Ge,{key:1,disabled:"",icon:"image",symbol:"",size:20,color:"#ACACAC"}))])):ye("",!0),b("div",$h,[b("div",Fh,[_e(ka,{modelValue:p.value,"onUpdate:modelValue":g[0]||(g[0]=d=>p.value=d),tag:"h3",class:"ect-text-sm ect-font-semibold ect-text-gray-900 ect-leading-tight"},null,8,["modelValue"]),b("div",Vh,[b("div",{onClick:g[2]||(g[2]=Tt(()=>{},["stop"]))},[_e(zi,{value:l.value,"onUpdate:value":g[1]||(g[1]=d=>l.value=d),min:e.minQuantity,max:e.maxQuantity,"data-test-id":`configurator-item-counter-${e.item.itemId}`,onChange:c},null,8,["value","min","max","data-test-id"])]),Hh,b("div",Uh,[_e(ka,{modelValue:a.value.price,"onUpdate:modelValue":g[3]||(g[3]=d=>a.value.price=d),tag:"p",type:"currency",class:"ect-text-base ect-font-bold"},null,8,["modelValue"])]),b("div",zh,[Ze(h.$slots,"selection-control")])])]),b("p",{class:"ect-mt-2 ect-text-sm ect-text-gray-700 ect-leading-tight",innerHTML:e.description},null,8,Kh),e.isAttributes&&e.showAttributes&&e.selected?(X(),ne("div",Zh,[a.value.getTags().length>0?(X(),ne(Oe,{key:0},[(X(!0),ne(Oe,null,ze(f.value,(d,v)=>(X(),ne("span",{key:v,class:"ect-inline-block"},[_e(Zt,{label:d.label,value:d.value},null,8,["label","value"])]))),128)),u.value>0?(X(),ne("button",{key:0,type:"button",class:"ect-text-xs ect-text-gray-700 ect-border ect-border-gray-300 ect-rounded-md ect-px-2 ect-py-0.5","data-test-id":`configurator-item-button-more-tags-${e.item.itemId}`,onClick:g[4]||(g[4]=Tt(()=>{},["stop"]))}," +"+ve(u.value)+" more ",9,Qh)):ye("",!0),e.selected?(X(),ne("button",{key:1,"data-test-id":`configurator-item-button-edit-attributes-${e.item.itemId}`,onClick:g[5]||(g[5]=d=>r("edit-attributes"))},[_e(Zt,{label:"Edit attributes","edit-button":""})],8,Xh)):ye("",!0)],64)):(X(),ne("span",Jh,[b("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:g[6]||(g[6]=d=>r("edit-attributes"))},[_e(Zt,{label:"Add attributes","add-button":""})])]))])):ye("",!0)])])):(X(),ne("div",Wh,[b("div",Gh,[b("div",Yh,[e.imageUrl?(X(),ne("img",{key:0,src:e.imageUrl,alt:e.name,class:"ect-w-full ect-h-full ect-object-cover"},null,8,e9)):ye("",!0)]),b("div",t9,[b("h3",n9,ve(e.name),1),b("p",r9,ve(e.description),1)]),b("div",i9,[Ze(h.$slots,"selection-control")])]),e.isAttributes&&e.showAttributes&&e.selected?(X(),ne("div",o9,[a.value.getTags().length>0?(X(),ne(Oe,{key:0},[(X(!0),ne(Oe,null,ze(f.value,(d,v)=>(X(),ne("span",{key:v,class:"ect-inline-block"},[_e(Zt,{label:d.label,value:d.value},null,8,["label","value"])]))),128)),u.value>0?(X(),ne("button",{key:0,type:"button",class:"ect-text-xs ect-text-gray-700 ect-border ect-border-gray-300 ect-rounded-md ect-px-2 ect-py-0.5","data-test-id":`configurator-item-button-more-tags-${e.item.itemId}`,onClick:g[7]||(g[7]=Tt(()=>{},["stop"]))}," +"+ve(u.value)+" more ",9,a9)):ye("",!0),e.selected?(X(),ne("button",{key:1,class:"ect-ml-auto","data-test-id":`configurator-item-button-edit-attributes-${e.item.itemId}`,onClick:g[8]||(g[8]=d=>r("edit-attributes"))},[_e(Zt,{label:"Edit attributes","edit-button":""})],8,s9)):ye("",!0)],64)):(X(),ne("span",l9,[b("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:g[9]||(g[9]=d=>r("edit-attributes"))},[_e(Zt,{label:"Add attributes","add-button":""})])]))])):ye("",!0),b("div",c9,[b("div",{onClick:g[11]||(g[11]=Tt(()=>{},["stop"]))},[_e(zi,{value:l.value,"onUpdate:value":g[10]||(g[10]=d=>l.value=d),min:e.minQuantity,max:e.maxQuantity,"data-test-id":`configurator-item-counter-${e.item.itemId}`,onChange:c},null,8,["value","min","max","data-test-id"])]),b("div",u9,[f9,_e(ka,{modelValue:a.value.price,"onUpdate:modelValue":g[12]||(g[12]=d=>a.value.price=d),tag:"p",type:"currency",class:"ect-w-[125px] ect-text-base ect-font-bold"},null,8,["modelValue"])])])])),e.selected&&e.isAttributes?(X(),ne("div",d9,[Ze(h.$slots,"default")])):ye("",!0)],10,Mh))}},p9={"af-ZA":",","sq-AL":",","ar-DZ":",","ar-BH":"٫","ar-EG":"٫","ar-IQ":"٫","ar-JO":"٫","ar-KW":"٫","ar-LB":"٫","ar-LY":",","ar-MA":",","ar-OM":"٫","ar-QA":"٫","ar-SA":"٫","ar-SD":"٫","ar-SY":"٫","ar-TN":",","ar-AE":"٫","ar-YE":"٫","hy-AM":",","az-AZ":",","bn-BD":".","bn-IN":".","eu-ES":",","be-BY":",","bs-BA":",","bg-BG":",","my-MM":".","ca-ES":",","ca-ES-EURO":",","zh-CN":".","zh-CN-PINYIN":".","zh-CN-STROKE":".","zh-HK":".","zh-HK-STROKE":".","zh-MO":".","zh-SG":".","zh-TW":".","zh-TW-STROKE":".","hr-HR":",","cs-CZ":",","da-DK":",","nl-AW":",","nl-BE":",","nl-NL":",","nl-SR":",","dz-BT":".","en-AG":".","en-AU":".","en-BS":".","en-BB":".","en-BZ":".","en-BM":".","en-BW":".","en-CM":".","en-CA":".","en-DE":",","en-KY":".","en-ER":".","en-FK":".","en-FJ":".","en-GM":".","en-GH":".","en-GI":".","en-GY":".","en-HK":".","en-IN":".","en-ID":".","en-IE":".","en-IE-EURO":".","en-JM":".","en-KE":".","en-LR":".","en-MG":".","en-MW":".","en-MY":".","en-MU":".","en-NA":".","en-NZ":".","en-NG":".","en-PK":".","en-PG":".","en-PH":".","en-RW":".","en-WS":".","en-SC":".","en-SL":".","en-SG":".","en-SX":".","en-SB":".","en-ZA":",","en-SH":".","en-SZ":".","en-TZ":".","en-TO":".","en-TT":".","en-UG":".","en-GB":".","en-US":".","en-VU":".","et-EE":",","fi-FI":",","fi-FI-EURO":",","fr-BE":",","fr-CA":",","fr-KM":",","fr-FR":",","fr-FR-EURO":",","fr-GN":",","fr-HT":",","fr-LU":",","fr-MR":",","fr-MC":",","fr-CH":",","fr-WF":",","ka-GE":",","de-AT":",","de-AT-EURO":",","de-BE":",","de-DE":",","de-DE-EURO":",","de-LU":",","de-LU-EURO":",","de-CH":".","el-GR":",","gu-IN":".","iw-IL":".","hi-IN":".","hu-HU":",","is-IS":",","in-ID":",","ga-IE":".","it-IT":",","it-CH":".","ja-JP":".","kn-IN":".","kk-KZ":",","km-KH":",","ko-KP":".","ko-KR":".","ky-KG":",","lo-LA":",","lv-LV":",","lt-LT":",","lu-CD":",","lb-LU":",","mk-MK":",","ms-BN":",","ms-MY":".","ml-IN":".","mt-MT":".","mi-NZ":".","mr-IN":".","ne-NP":".","no-NO":",","ps-AF":"٫","fa-IR":"٫","pl-PL":",","pt-AO":",","pt-BR":",","pt-CV":",","pt-MZ":",","pt-PT":",","pt-ST":",","ro-MD":",","ro-RO":",","rm-CH":".","rn-BI":",","ru-KZ":",","ru-RU":",","sr-BA":",","sr-RS":",","sh-BA":",","sh-ME":",","sh-ME-USD":",","sh-CS":",","sk-SK":",","sl-SI":",","so-DJ":".","so-SO":".","es-AR":",","es-BO":",","es-CL":",","es-CO":",","es-CR":",","es-CU":".","es-DO":".","es-EC":",","es-SV":".","es-GT":".","es-HN":".","es-MX":".","es-NI":".","es-PA":".","es-PY":",","es-PE":".","es-PR":".","es-ES":",","es-ES-EURO":",","es-US":".","es-UY":",","es-VE":",","sw-KE":".","sv-SE":",","tl-PH":".","tg-TJ":",","ta-IN":".","ta-LK":".","te-IN":".","th-TH":".","ti-ET":".","tr-TR":",","uk-UA":",","ur-PK":".","uz-LATN-UZ":",","vi-VN":",","cy-GB":".","xh-ZA":".","yo-BJ":".","zu-ZA":"."},m9={name:"CustomInput",components:{AppIcon:Ge},props:{editMode:{type:Boolean,default:!0},type:{type:String,default:"text"},max:{type:Number,default:500},label:{type:String,default:""},name:{type:String,default:""},showLabel:{type:Boolean,default:!0},modelValue:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},isReadOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},highlight:{type:Boolean,default:!1},placeholder:{type:String,default:""},error:{type:[Boolean,String],default:!1},cssClass:{type:Object,default:()=>({})},tooltip:{type:String,default:null},locale:{type:String,default:"en-US"},icon:{type:String,default:null},itooltip:{type:String,default:null},icolor:{type:String,default:"#7d7d7d"},ihover:{type:String,default:"#57c046"},icustom:{type:Boolean,default:!1},idisabled:{type:Boolean,default:!1},height:{type:Number,default:32},textAlignment:{type:String,default:"left"},decimalPrecision:{type:Number,default:0},allowNegatives:{type:Boolean,default:!1},size:{type:String,default:"medium"},dataTestId:{type:String,required:!0}},emits:["update:modelValue","iclick","blur"],data(){return{initialValue:"",decimalSeprator:".",ctrl:!1}},computed:{getValue(){return this.modelValue?this.type==="currency"?String(this.modelValue).replace(".",this.decimalSeprator):String(this.modelValue):""},error_message(){return typeof this.error=="string"?this.error:this.error===""?!1:this.error===!0?`${this.label||"Field"} is required`:this.error},isHighlight(){return(this.initialValue===""||this.initialValue===null)&&(this.modelValue===""||this.modelValue===null)?!1:this.initialValue!==this.modelValue}},created(){this.initialValue=this.modelValue,this.decimalSeprator=this.type==="currency"?p9[this.locale]:"."},methods:{handlerInput(e){const t=e.target.value;this.type==="currency"?this.$emit("update:modelValue",t.replace(this.decimalSeprator,".")):this.$emit("update:modelValue",t)},preventNonNumeric(e){if(this.type==="number"){const t=this.decimalPrecision,n=e.target.value,r=e.key;if(["Backspace","ArrowLeft","ArrowRight","Delete","Tab"].includes(r)||this.allowNegatives&&r==="-")return;if(r==="."&&t===0){e.preventDefault();return}if(r==="."&&n.includes(".")){e.preventDefault();return}if(r==="."||n.includes(".")&&!n.endsWith(".")&&r!=="Backspace"){const i=n.split(".");if(i.length>1&&i[1].length>=t){e.preventDefault();return}}if(isNaN(r)&&![".","Backspace","Tab"].includes(r)){e.preventDefault();return}}if(e.key==="Backspace"||this.ctrl)return!0;if(e.key==="Control"&&(this.ctrl=!0),this.type==="currency"||this.type==="number"){if(!this.getValue.includes(this.decimalSeprator)&&e.key===this.decimalSeprator)return!0;/[\deE+\-]/.test(e.key)||e.preventDefault()}return!0},handlerKeyup(e){e.key==="Control"&&(this.ctrl=!1)}}},g9=["data-test-id"],v9=["for","data-test-id"],y9=["data-test-id"],_9=["id","type","name","disabled","placeholder","value","maxlength","readonly","data-test-id"],b9=["data-test-id"],C9=["data-test-id"];function w9(e,t,n,r,i,o){const a=Or("AppIcon");return X(),ne("div",{class:"input","data-test-id":n.dataTestId},[n.label&&n.showLabel?(X(),ne("label",{key:0,class:Ie({error_color:!!n.error}),for:n.label,"data-test-id":`${n.dataTestId}-label`},[Fe(ve(n.label)+" ",1),n.required?(X(),ne("span",{key:0,class:Ie({error_color:!!n.error})},"*",2)):ye("",!0)],10,v9)):ye("",!0),n.editMode?(X(),ne("div",{key:1,class:Ie(["input-wrapper ect-w-full",{errorBorder_color:!!n.error,highlight:o.isHighlight&&n.highlight}]),"data-test-id":`${n.dataTestId}-wrapper`},[n.icon?(X(),Te(a,{key:0,class:"input-wrapper_icon",icon:n.icon,hover:n.ihover,color:n.icolor,size:19,disabled:n.idisabled,custom:n.icustom,tooltip:n.itooltip,"data-test-id":`${n.dataTestId}-icon`,direction:"top-right",onClick:t[0]||(t[0]=s=>e.$emit("iclick"))},null,8,["icon","hover","color","disabled","custom","tooltip","data-test-id"])):ye("",!0),b("input",{id:n.label,class:Ie(`ectheme-input-box ${n.size}`),type:n.type,style:tt({width:n.icon?"calc(100% - 36px)":"100%",height:`${n.height}px`,textAlign:n.textAlignment}),name:n.name,disabled:n.disabled,placeholder:n.placeholder,value:o.getValue,maxlength:n.max,readonly:n.isReadOnly,"data-test-id":`${n.dataTestId}-input`,onInput:t[1]||(t[1]=(...s)=>o.handlerInput&&o.handlerInput(...s)),onKeydown:t[2]||(t[2]=(...s)=>o.preventNonNumeric&&o.preventNonNumeric(...s)),onKeyup:t[3]||(t[3]=(...s)=>o.handlerKeyup&&o.handlerKeyup(...s)),onBlur:t[4]||(t[4]=s=>e.$emit("blur"))},null,46,_9)],10,y9)):ye("",!0),n.editMode?ye("",!0):(X(),ne("p",{key:2,class:"value","data-test-id":`${n.dataTestId}-value`},ve(o.getValue),9,b9)),o.error_message?(X(),ne("div",{key:3,class:"error_tooltip error_tooltip-bottom-right","data-test-id":`${n.dataTestId}-error`},ve(o.error_message),9,C9)):ye("",!0)],8,g9)}const x9=Ve(m9,[["render",w9],["__scopeId","data-v-032ca141"]]),k9={name:"AtomSpinner",props:{dataTestId:{type:String,default:""}}},E9=["data-test-id"];function O9(e,t,n,r,i,o){return X(),ne("div",{class:"spinner","data-test-id":n.dataTestId},null,8,E9)}const S9={name:"CustomDropdown",components:{AppIcon:Ge,AtomSpinner:Ve(k9,[["render",O9],["__scopeId","data-v-771ed032"]])},props:{label:{type:String,default:""},placeholder:{type:String,default:""},options:{type:Array,default:()=>[]},display:{type:Array,default:()=>[]},modelValue:{type:String,default:""},error:{type:[Boolean,String],default:!1},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},select:{type:Boolean,default:!1},lookup:{type:Boolean,default:!1},search:{type:Boolean,default:!1},badge:{type:String,default:void 0},highlight:{type:Boolean,default:!1},property:{type:Object,default:()=>({key:"value",value:"label",assigned:"assigned"})},dropdownTheme:{type:String,default:"light"},icon:{type:String,default:""},size:{type:String,default:"medium"},dataTestId:{type:String,required:!0}},emits:["search","focus-in","focus-out","update:modelValue"],data:()=>({inputFocused:!1,value:"",isHover:!1,highlightedIndex:-1,initialValue:"",teleportStyle:{position:"absolute",top:"0px",left:"0px",width:"0px"}}),computed:{isHighlight(){return(this.initialValue===""||this.initialValue==null)&&(this.modelValue===""||this.modelValue==null)?!1:this.initialValue!==this.modelValue},error_message(){return this.error===""?!1:this.error===!0?`${this.label||"Field"} is required`:this.error},getOptions(){if(this.select&&this.search){const e=this.value.toLowerCase();return this.options.filter(t=>JSON.stringify(t).toLowerCase().includes(e))}else return this.options},getSelected(){let e=null;if(this.modelValue)e=this.options.find(t=>t[this.property.key]===this.modelValue);else if(!this.search){const t=this.options.find(n=>n[this.property.key]==="");t?e=t:this.placeholder?e={[this.property.value]:this.placeholder,[this.property.key]:""}:e={[this.property.value]:"--Select--",[this.property.key]:""}}return e||{[this.property.value]:this.placeholder||"--Select--",[this.property.key]:""}},shouldShowAbove(){if(!this.$refs.triggerElement)return!1;const e=this.$refs.triggerElement.getBoundingClientRect(),t=250,n=window.innerHeight-e.bottom,r=e.top;return n<t&&r>t},dropdownStyle(){if(!this.$refs.triggerElement)return{};const e=this.$refs.triggerElement.getBoundingClientRect(),t=250,n=window.innerHeight-e.bottom,r=e.top,i=n<t&&r>t;return{position:"absolute",top:i?"auto":"100%",bottom:i?"100%":"auto",left:"0",width:"100%",zIndex:1e3}}},created(){this.initialValue=this.modelValue},mounted(){window.addEventListener("resize",this.updateDropdownPosition),window.addEventListener("scroll",this.updateDropdownPosition,!0)},beforeUnmount(){window.removeEventListener("resize",this.updateDropdownPosition),window.removeEventListener("scroll",this.updateDropdownPosition,!0)},methods:{updateDropdownPosition(){if(!this.$refs.triggerElement)return;const e=this.$refs.triggerElement.getBoundingClientRect(),t=200,n=window.innerHeight-e.bottom,r=e.top,i=n<t&&r>t;this.teleportStyle={position:"absolute",top:`${i?e.top-t:e.bottom}px`,left:`${e.left}px`,width:`${e.width}px`,zIndex:9999}},subFieldsText(e){if(!this.display||this.display.length<1)return"";const t=[];return this.display.forEach(n=>{const r=this.subField(e,n);r&&t.push(r)}),t.join(" | ")},subField(e,t){return t?t.split(".").reduce((i,o)=>i[o]||"",e):e},lookupSearchHandler:wc(function(e){this.value=e,this.search&&!this.select&&this.$emit("search",e)}),handlerFocusIn(){!(this.modelValue&&this.search)&&!this.disabled&&(this.inputFocused=!0,this.updateDropdownPosition(),this.$emit("focus-in"))},updateSelected(e){e&&(this.value="",this.$emit("update:modelValue",e[this.property.key]),this.search&&!this.select&&!this.lookup&&this.$emit("search",""),this.onInputFocusedOut(!0))},clear(){this.disabled||(this.value="",this.$emit("update:modelValue",null),this.search&&!this.select&&!this.lookup&&this.$emit("search",""))},onInputFocusedOut(e=!1){(!this.isHover||e)&&!this.disabled&&(e?(this.highlightedIndex=-1,this.inputFocused=!1,this.$emit("focus-out")):setTimeout(()=>{this.highlightedIndex=-1,this.inputFocused=!1,this.$emit("focus-out")},100))},highlightNextOption(){this.highlightedIndex<this.options.length-1&&this.highlightedIndex++},highlightPreviousOption(){this.highlightedIndex>0&&this.highlightedIndex--}}},I9=["data-test-id"],A9=["for","data-test-id"],T9={class:"input-container-box ect-grow ect-w-full"},N9=["data-test-id"],P9=["placeholder","disabled","data-test-id"],L9=["data-test-id"],R9=["title","data-test-id"],M9=["data-test-id"],q9=["data-test-id"],j9=["data-test-id"],D9=["data-test-id"],B9=["data-test-id","onClick"],$9=["data-test-id"],F9={class:"ect-text-font-clr-light ect-flex ect-gap-2 ect-items-center ect-justify-between ect-w-full"},V9=["data-test-id"],H9=["data-test-id"],U9=["data-test-id"],z9=["title","data-test-id"],K9=["data-test-id"];function Z9(e,t,n,r,i,o){const a=Or("AppIcon"),s=Or("AtomSpinner");return X(),ne("div",{ref:"dropdownWrapper",class:Ie(["customdropdown input-container",{dark:n.dropdownTheme==="dark"}]),"data-test-id":n.dataTestId,onMouseenter:t[7]||(t[7]=l=>e.isHover=!0),onMouseleave:t[8]||(t[8]=l=>e.isHover=!1)},[n.label?(X(),ne("label",{key:0,class:Ie(["title_label",{error_color:!!n.error}]),for:n.label,"data-test-id":`${n.dataTestId}-label`},[Fe(ve(n.label)+" ",1),n.required?(X(),ne("span",{key:0,class:Ie({error_color:!!n.error})},"*",2)):ye("",!0)],10,A9)):ye("",!0),b("div",T9,[b("div",{ref:"triggerElement",class:Ie(["input-wrapper ectheme-input-box ect-w-full",{disabled:n.disabled,"input-error":n.error,highlight:o.isHighlight&&n.highlight,"size-large":n.size==="large","size-medium":n.size==="medium"||n.size==="small"}]),"data-test-id":`${n.dataTestId}-trigger`,tabindex:"0",onFocusin:t[2]||(t[2]=(...l)=>o.handlerFocusIn&&o.handlerFocusIn(...l)),onFocusout:t[3]||(t[3]=l=>o.onInputFocusedOut(!1)),onKeydown:[t[4]||(t[4]=qr(l=>o.updateSelected(n.options[e.highlightedIndex]),["enter"])),t[5]||(t[5]=qr(Tt((...l)=>o.highlightPreviousOption&&o.highlightPreviousOption(...l),["prevent"]),["up"])),t[6]||(t[6]=qr(Tt((...l)=>o.highlightNextOption&&o.highlightNextOption(...l),["prevent"]),["down"]))]},[!n.modelValue&&n.search?Cn((X(),ne("input",{key:0,ref:"searchInput","onUpdate:modelValue":t[0]||(t[0]=l=>e.value=l),type:"text",name:"search",placeholder:n.placeholder,autocomplete:"off",disabled:n.disabled,"data-test-id":`${n.dataTestId}-search-input`,onInput:t[1]||(t[1]=Tt(l=>o.lookupSearchHandler(l.target.value),["prevent"]))},null,40,P9)),[[Di,e.value]]):(X(),ne("div",{key:1,class:Ie(["selection-name ect-text-text-primary-dark ect-flex ect-justify-between ect-items-center",{"size-large":n.size==="large","size-medium":n.size==="medium"||n.size==="small"}]),"data-test-id":`${n.dataTestId}-selection`},[o.getSelected?(X(),ne(Oe,{key:0},[b("span",{title:o.getSelected[n.property.value],class:Ie(["ect-flex ect-items-center ect-gap-2 ect-font-medium",{"ect-text-font-clr-light":!n.modelValue}]),"data-test-id":`${n.dataTestId}-selection-value`},[n.icon?(X(),Te(a,{key:0,class:"ect-mr-0",icon:n.icon,size:14,color:"#5F5F5F","data-test-id":`${n.dataTestId}-selection-icon`},null,8,["icon","data-test-id"])):ye("",!0),Fe(" "+ve(o.getSelected[n.property.value]),1)],10,R9),n.badge&&o.getSelected[n.badge]?(X(),ne("span",{key:0,class:"badge ect-bg-btn ect-rounded-[5px] ect-py-[2px] ect-px-[10px] ect-text-white","data-test-id":`${n.dataTestId}-selection-badge`},ve(o.getSelected[n.badge]),9,M9)):ye("",!0)],64)):ye("",!0)],10,L9)),n.search?(X(),ne(Oe,{key:2},[n.loading?(X(),Te(s,{key:0,class:"spinner","data-test-id":`${n.dataTestId}-loading-spinner`},null,8,["data-test-id"])):(X(),ne("div",{key:1,class:"clear-button","data-test-id":`${n.dataTestId}-action-button`},[e.value||n.modelValue?(X(),Te(a,{key:0,disabled:n.disabled,icon:"close",color:"#acacac",size:10,"data-test-id":`${n.dataTestId}-clear-button`,onClick:o.clear},null,8,["disabled","data-test-id","onClick"])):(X(),Te(a,{key:1,icon:"search",size:14,color:"#acacac",disabled:n.disabled,"data-test-id":`${n.dataTestId}-search-button`},null,8,["disabled","data-test-id"]))],8,q9))],64)):(X(),Te(a,{key:3,class:"clear-button",color:o.error_message?"#ff6a6a":"#acacac",icon:"arrow_drop_up",size:12,disabled:n.disabled,"data-test-id":`${n.dataTestId}-dropdown-arrow`},null,8,["color","disabled","data-test-id"]))],42,N9),o.error_message?(X(),ne("div",{key:0,class:"error_tooltip error_tooltip-bottom-right","data-test-id":`${n.dataTestId}-error`},ve(o.error_message),9,j9)):ye("",!0),o.getOptions&&e.inputFocused&&!n.disabled&&(n.select||n.lookup)?(X(),ne("div",{key:1,ref:"dropdown",class:Ie(["dropdown",{"dropdown-above":o.shouldShowAbove}]),style:tt(o.dropdownStyle),"data-test-id":`${n.dataTestId}-dropdown`},[(X(!0),ne(Oe,null,ze(o.getOptions,(l,p)=>(X(),ne("div",{key:l[n.property.key],class:Ie(["dropdown-item",{highlighted:p===e.highlightedIndex,"ect-pointer-events-none":l[n.property.assigned]}]),"data-test-id":`${n.dataTestId}-option-${p}`,onClick:c=>o.updateSelected(l)},[b("div",{class:"name ect-items-center","data-test-id":`${n.dataTestId}-option-${p}-name`},[b("span",F9,[b("span",{class:Ie({"ect-text-zinc-400":l[n.property.assigned]}),"data-test-id":`${n.dataTestId}-option-${p}-value`},ve(l[n.property.value]==null?"Key and Value is Wrong":l[n.property.value]),11,V9),l[n.property.assigned]?(X(),ne("span",{key:0,class:"ect-text-xs ect-leading-4 ect-text-zinc-600","data-test-id":`${n.dataTestId}-option-${p}-assigned`},"Assigned",8,H9)):ye("",!0)]),n.badge?(X(),ne("span",{key:0,class:"badge ect-bg-btn ect-rounded-[5px] ect-py-[2px] ect-px-[10px] ect-text-white","data-test-id":`${n.dataTestId}-option-${p}-badge`},ve(l[n.badge]),9,U9)):ye("",!0)],8,$9),b("div",{class:"info",title:o.subFieldsText(l),"data-test-id":`${n.dataTestId}-option-${p}-info`},[b("span",null,ve(o.subFieldsText(l)),1)],8,z9)],10,B9))),128)),!o.getOptions.length&&!n.loading&&(e.value||n.select)?(X(),ne("div",{key:0,class:"no-items-found","data-test-id":`${n.dataTestId}-no-options`}," no options found ",8,K9)):ye("",!0)],14,D9)):ye("",!0)])],42,I9)}const Pc=Ve(S9,[["render",Z9],["__scopeId","data-v-5ae4f6dc"]]);var ot=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rc={exports:{}};/*!
28
+ */var Sc;(function(e){e.pop="pop",e.push="push"})(Sc||(Sc={}));var Ic;(function(e){e.back="back",e.forward="forward",e.unknown=""})(Ic||(Ic={}));var Ac;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(Ac||(Ac={}));const z0=Symbol(""),K0=Symbol("");function Vi(){return kn(z0)}function wa(){return kn(K0)}function bt(e){if(typeof e=="string"&&(e=JSON.parse(e)),e!=null&&e.errorMessage)throw new Error(e==null?void 0:e.errorMessage);return e}const xa={xx_ord1__item__c:"xx_ord1__item__c",xx_ord1__sales_price__c:"xx_ord1__negotiated_price__c",xx_ord1__nrc__c:"xx_ord1__nrc_for_new__c",xx_ord1__line_description__c:"xx_ord1__line_description__c",xx_ord1__list_price__c:"xx_ord1__list_price2__c",xx_ord1__cost__c:"xx_ord1__cost2__c",xx_ord1__rate_plan__c:"xx_ord1__rate_plan__c",xx_ord1__allowed_discount__c:"xx_ord1__allowed_discount__c",xx_ord1__billing_period__c:"xx_ord1__billing_period__c",xx_ord1__ship_to_account__c:"xx_ord1__ship_to_account__c",xx_ord1__erp_item_number__c:"xx_ord1__erp_item_number__c",xx_ord1__mrc__c:"xx_ord1__mrc__c",xx_ord1__qty__c:"xx_ord1__qty__c",id:"id"},Tc={xx_ord1__item__c:"xx_ord1__item__c",xx_ord1__negotiated_price__c:"xx_ord1__sales_price__c",xx_ord1__nrc_for_new__c:"xx_ord1__nrc__c",xx_ord1__line_description__c:"xx_ord1__line_description__c",xx_ord1__list_price2__c:"xx_ord1__list_price__c",xx_ord1__cost2__c:"xx_ord1__cost__c",xx_ord1__rate_plan__c:"xx_ord1__rate_plan__c",xx_ord1__allowed_discount__c:"xx_ord1__allowed_discount__c",xx_ord1__billing_period__c:"xx_ord1__billing_period__c",xx_ord1__ship_to_account__c:"xx_ord1__ship_to_account__c",xx_ord1__erp_item_number__c:"xx_ord1__erp_item_number__c",xx_ord1__mrc__c:"xx_ord1__mrc__c",xx_ord1__qty__c:"xx_ord1__qty__c",id:"id"},Z0=e=>{var n;let t=[];for(let r of e)if(r.trim()!=="xx_ord1__item__r.xx_ord1__decimal_precision__c")if(r.includes(".")){let o=r.split(".")[0];o=o.slice(0,-1)+"c";const a=((n=xa[o==null?void 0:o.toLowerCase()])==null?void 0:n.trim())||"";a&&(t.includes(a)||t.push(a||""),t.push(r))}else t.includes(xa[r==null?void 0:r.toLowerCase()])||t.push(xa[r==null?void 0:r.toLowerCase()]||"");return t.filter(r=>r!=="")},Q0=Rt("actions",()=>{const e=Ui(),t=Tn(),n=ae(!1);return{openAdaptiveSearch:(s,l=!1)=>{console.info("openAdaptiveSearch",s),e.chatHistory[e.chatHistory.length-1].links=[],e.sendMessage("Open Adaptive Search",!1,{internalCall:!0}),n.value=l},openQuoteItem:s=>{console.info("openQuoteItem",s),e.chatHistory[e.chatHistory.length-1].links=[],e.sendMessage("Open Quote Item",!1,{internalCall:!0})},openQuoteDocument:s=>{console.info("openQuoteDocument",s),e.chatHistory[e.chatHistory.length-1].links=[],e.chatHistory.push({type:"response",message:"Opening quote document",loading:!0});const p=`/apex/XX_ORD1__Expedite_Commerce?scpq=true&oid=${t.quoteId}&atpverified=true&ecCache=false&origin=AI`;window.location.href=`${a0(window.location.href)}${p}`},undo:()=>{const s=e==null?void 0:e.latestDMLRequest;e.sendMessage(`UNDO-${s}`,!1,{internalCall:!0})},isStaticActionCall:n}}),Nc=Rt("adaptiveSearch",()=>{const e=Tn(),t=ar(),n=Ui(),r=Q0(),i=ae(null),o=ae(null),a=ae(!1),s=ae(!1),l=ae([]),p=ae(""),c=ae(!1),f=ae(null),u=ae(!1),m=ae([]),h=an(),g=ae([]),d=ae(0),v=ae(!1),_=ae({rowLimt:10,paging:!0,offset:0,currentPage:1,totalPages:1});async function C(){a.value=!0;try{const O=JSON.stringify({layoutType:"Search Selection",layoutObject:"xx_ord1__ecatalog_item__c"});let P={};return P=await window.salesforceConnector.getDynamicPageLayout(O),o.value=Ec(P,"Unable to find the Search Selection Layout for your user profile"),_.value.rowLimt=o.value.configuration.rowLimit||10,o.value.configuration.columns.forEach(M=>{!M.field&&M.label==="QTY"&&(M.field="xx_ord1__qty__c")}),a.value=!1,y(),P}catch(O){a.value=!1,h.handleError("Failed to get Adaptive Search Layout. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",O)}}function y(){var O,P,M;f.value=(M=(P=(O=o.value)==null?void 0:O.configuration)==null?void 0:P.dynamicFilters)==null?void 0:M.filters.map(Z=>({...Z,field:Z.field.toLowerCase(),filtervalue:Z.filtervalue||[],filtervaluefrom:Z.filtervaluefrom||"",filtervalueTo:Z.filtervalueTo||""}))}function w(){var P;let O=[];for(const M of o.value.configuration.columns){let Z=M.field;if(O.includes(Z)||O.push(Z),Z!=null&&Z.includes(".")){let B=Z.split(".")[0];B=B.slice(0,-1)+"c",O.includes(B)||O.push(B)}}return(P=o.value.configuration)!=null&&P.cardHeader&&O.push(o.value.configuration.cardHeader.imageField),o.value.configuration.objectName.toLowerCase()==="xx_ord1__ecatalog_item__c"&&O.push("xx_ord1__item__r.xx_ord1__decimal_precision__c"),O=O.filter(M=>!!M),O.filter(M=>M.toLowerCase()!=="xx_ord1__qty__c"&&M.toLowerCase()!=="xx_ord1__competitor_sku__c")}function A(O,P=!1){if(!O||O.includes("undefined"))return!1;const M=/[!@#$%^&*()+=[\]{};':"\\|.<>/?]+/;if(P){const Z=Array.isArray(O)?O:O.split(",");for(const Q of Z){const B=Q.trim();if(M.test(B))return h.handleError(`Invalid character found in value: ${B}`),!1}}else if(M.test(O))return h.handleError("Special characters are not allowed in filter values"),!1;return!0}function I(O,P){return{field:O.field,operator:O.operator||"contains",value:P,dataType:O.dataType.trim()}}function S(O){if(!O.filtervalue)return null;const P=Array.isArray(O.filtervalue),M=P?O.filtervalue.join(","):O.filtervalue.trim();return A(M,P)?M:null}function N(O){var Q,B;const P=(Q=O.filtervaluefrom)==null?void 0:Q.trim(),M=(B=O.filtervalueTo)==null?void 0:B.trim();if(!P||!M)return null;const Z=`${P}, ${M}`;return Z!==", "&&A(Z)?Z:null}function T(O){const P=`${kc(O.filtervaluefrom)}, ${kc(O.filtervalueTo)}`;return P!==", "&&A(P)?P:null}function k(O){var M;const P=(M=O.filtervaluefrom)==null?void 0:M.trim();return A(P)?P:null}function E(O){const P=[];return O.forEach(M=>{const Z=M.dataType.trim();let Q=null;switch(Z){case"PICKLIST":case"MULTIPICKLIST":Q=S(M);break;case"DOUBLE":case"CURRENCY":Q=N(M);break;case"DATETIME":case"DATE":Q=T(M);break;default:Q=k(M)}Q&&P.push(I(M,Q))}),m.value=P,P}async function L(O="",P=[],M=[]){var Q,B,U,D,q,$,H,J,R,z;let Z=[];if(P.length&&(Z=E(P)),!Z.length&&O.trim()===""){l.value=[],c.value=!1;return}try{c.value=!1,s.value=!0;const oe=O.trim();M.length||(M=w());const ce={fields:M,...P.length?{dynamicFilters:Z}:{},searchText:oe||p.value.trim(),accountId:t.accountId,...t.eCatalogId?{catalogId:t.eCatalogId}:{},...t.objectType==="opportunity"?{opportunityId:t.id}:{},...(B=(Q=o.value)==null?void 0:Q.configuration)!=null&&B.sort?{primarySortBy:o.value.configuration.sort.primary.field,primarySortOrder:o.value.configuration.sort.primary.direction,secondarySortBy:o.value.configuration.sort.secondary.field,secondarySortOrder:o.value.configuration.sort.secondary.direction}:{},rowLimt:(D=(U=o.value)==null?void 0:U.configuration)==null?void 0:D.rowLimit,paging:($=(q=o.value)==null?void 0:q.configuration)==null?void 0:$.paging,...((H=_.value)==null?void 0:H.offset)!==0?{offset:_.value.offset}:{},objectName:(R=(J=o.value)==null?void 0:J.configuration)==null?void 0:R.objectName,currencyCode:t.currencyCode},le=await window.salesforceConnector.getItems(JSON.stringify(ce));if(le!=null&&le.errorMessage){h.handleError(le.errorMessage);return}le!=null&&le.itemCount&&(_.value.totalPages=Math.ceil((le==null?void 0:le.itemCount)/_.value.rowLimt)),l.value=$i(le.lstItems,{xx_ord1__qty__c:"1"}),(z=le.lstItems)!=null&&z.length||(c.value=!0),s.value=!1}catch(oe){h.handleError("Failed to fetch Results. Please try again."),s.value=!1,console.info("[ERROR]: Adaptive Search getItems() error = ",oe)}}async function V(O){try{u.value=!0;const P=JSON.stringify({lstQLIRequest:K(O),quoteId:e.quoteId});let M=await window.salesforceConnector.createQLI(P);typeof M=="string"&&(M=JSON.parse(M));let Z=!1;if((M==null?void 0:M.length)>0&&M.forEach(Q=>{Q.errorMessage&&(Z=!0,h.handleError(Q.errorMessage))}),u.value=!1,Z){g.value=M;const Q=g.value.reduce((B,U)=>(B[U.eCatalogItemId]=U.errorMessage,B),{});l.value=l.value.map(B=>({...B,backendError:Q[B.Id]||""}));return}return M}catch(P){h.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addToQuote() error = ",P)}}function K(O){const P=[];for(const M of O)if(!M.addedToQuote&&M.id){const Z=W(M);d.value++,P.push({fields:Z,recordId:M.id,...O.length===1?{maxSequenceNumber:d.value}:{}})}return P}function W(O){const P=[],M=te();return Object.keys(O).forEach(Z=>{if(M.includes(Z)){const Q=Tc[Z.toLowerCase()];Q&&P.push({fieldname:Q,value:O[Z]})}}),P}function te(){const O=[];return o.value.configuration.columns.forEach(P=>{P.field&&!P.field.includes(".")&&P.isEditable&&P.visible&&O.push(P.field)}),O}function fe(){var P,M;const O=[];return o.value.configuration.columns.forEach(Z=>{const Q=Z.field.toLowerCase();O.includes(Q)||O.push(Q)}),(P=o.value.configuration)!=null&&P.dynamicFilters&&o.value.configuration.dynamicFilters.filters.forEach(Z=>{const Q=Z.field.toLowerCase();O.includes(Q)||O.push(Q)}),(M=o.value.configuration)!=null&&M.cardHeader&&O.push(o.value.configuration.cardHeader.imageField),O}async function ee(){var M;const O=fe(),P=((M=o.value.configuration)==null?void 0:M.saveObjectName)||o.value.configuration.objectName;if(P==="xx_ord1__ecatalog_item__c"){const Z=O.indexOf("xx_ord1__qty__c");Z>-1&&O.splice(Z,1)}await e.getFieldsData(O,P),e.fieldsData.xx_ord1__qty__c||e.getFieldsData(["xx_ord1__qty__c"],"xx_ord1__quote_line_item__c")}async function j({searchTerm:O="",filters:P=[]}={}){if(v.value=!0,O&&(p.value=O),P.length&&(m.value=P),await C()){await ee(),v.value=!1;const Z=p.value;Z&&(p.value=Z,await L(Z,e.dynamicFilters)),console.info("actionStore.isStaticActionCall = ",r.isStaticActionCall),r.isStaticActionCall&&(r.isStaticActionCall=!1,n.chatHistory[n.chatHistory.length-1]={type:"response",message:"Adaptive search is now open. Please search for the products you require and add it quote",loading:!1,links:[{action:"quoteItem",label:"Quote Item"},{action:"quoteDocument",label:"Quote Document"}]})}v.value=!1}return{selectedItem:i,AdaptiveSearchLayout:o,searchText:p,loadingAdaptiveLayout:a,getAdaptiveSearchLayout:C,getItems:L,lstItems:l,rowItemsLoading:s,noSearchRecords:c,dynamicFilters:f,setDynamicFilters:y,createQliErrors:g,addToQuote:V,addingToQuote:u,getFieldsData:ee,pagingData:_,appliedDynamicFilters:m,maxSequenceNumber:d,loadingAdaptiveSearch:v,initAdaptiveSearch:j}}),X0="XX_ORD1__Quote__c",J0="xxord1salespricec",Hi="xx_ord1__item__c",W0="xxord1productnrcc",G0=Rt("cartStore",()=>{const e=Tn(),t=Nc(),n=an(),r=ae(""),i=ae("$0"),o=ae("$0"),a=ae(null),s=ae({}),l=ae({}),p=ae({}),c=ae(""),f=ae(""),u=ae({}),m=ae(""),h=ae(""),g=ae({});async function d(){A()}async function v(){try{let N=await window.salesforceConnector.getProductCount(e.quoteId);if(N=bt(N),N!=null&&N.errorMessage){n.handleError(N.errorMessage);return}return r.value=N,N}catch{n.handleError("Failed to get Product Count. Please try again.")}}async function _(){try{let N=await window.salesforceConnector.getQuoteTotal(e.quoteId);if(N=bt(N),N!=null&&N.errorMessage){n.handleError(N.errorMessage);return}return o.value=N.monthlyTotal,i.value=N.onetimeTotal,N}catch{n.handleError("Failed to get Total Amount. Please try again.")}}async function C(N,T,k,E=""){if(!e.sectionDataMap.get(k).parentQLIs[T].removingItem){e.sectionDataMap.get(k).parentQLIs[T].removingItem=!0,h.value=N.id,await y(N.id)==="Success"&&(e.fetchAllQuoteLineItems(),E&&E(N,T,k));let V=e.sectionDataMap.get(k).parentQLIs.filter(K=>K[Hi]===N[Hi]).length;h.value="",t.lstItems.forEach(K=>{K[Hi]===N[Hi]&&(K.addedToQuote===!0&&(K.addedToQuote=!1),V===0&&(K.removedFromQuote=!0))})}}async function y(N){try{let T=await window.salesforceConnector.deleteQLI(N);if(T!=null&&T.errorMessage){n.handleError(T.errorMessage);return}return v(),_(),T}catch{n.handleError("Failed to remove Quote Item. Please try again.")}}function w(N){var E,L;const T=(E=N==null?void 0:N[W0])==null?void 0:E.match(/\.\d+/);T&&(T.value=T[0].length-1);const k=(L=N==null?void 0:N[J0])==null?void 0:L.match(/\.\d+/);return k&&(k.value=k[0].length-1),T||k}function A(N=!0){v(),_(),N&&e.fetchTemplates(X0).then(()=>{e.getFilteredListWithFields()})}function I(N){const T=e.sectionDataMap;for(const[,k]of T.entries())k.parentQLIs.forEach(E=>{E.id===N.id&&(k.columns.forEach(L=>{if(L.dataType==="CURRENCY"){const V=L.field.replace(/_/g,"");E[V]=S(E[V],N[L.field])}}),N!=null&&N.billingPeriodValue&&(N!=null&&N.formattedBillingPeriodValue)&&(E.formattedBillingPeriodValue=S(E.formattedBillingPeriodValue,N.billingPeriodValue)),N!=null&&N.oneTimeValue&&(N!=null&&N.formattedOneTimeValue)&&(E.formattedOneTimeValue=S(E.formattedOneTimeValue,N.oneTimeValue)))})}function S(N,T){const k=Number(T);if(isNaN(k))return N;const E=N.match(/(\d[\d,]*)(\.\d+)?/);if(!E)return N;const L=E[2]||"",V=L.length?L.length-1:0,K=k.toLocaleString("en-US",{minimumFractionDigits:V,maximumFractionDigits:V});return N.replace(E[1]+L,K)}return{initializeCart:d,loadCartState:A,productCount:r,onetimeTotal:i,monthlyTotal:o,filterCartItem:a,billingPeriodValue:c,hasOneTimeValue:f,hasBillingPeriodInList:s,oneTimeFieldAvailable:l,billingPeriodFieldAvailable:p,priceDecimalPrecision:u,cartItemUpdatingId:m,removingItemLoaderId:h,cartItemColumnsMap:g,getProductCount:v,getQuoteTotal:_,removeItem:C,removeQuoteItem:y,getDecimalPrecisionFromSalesPriceOrNRC:w,updateFormattedValues:I,formateCurrencyValue:S}}),Y0=e=>[{title:"Apply Discount",subOptions:[...e.map(t=>`Apply Discount on ${t} for `),"Show Maximum discount allowed","Apply Maximum Discount Allowed",...e.map(t=>`Apply Discount on ${t} for a specific total`)]},{title:"Update Fields",subOptions:["Update the price of","Update the quantity of","Update the term start date to","Update the term end date to","Update the line description for"]},{title:"Price Ramp",subOptions:["Add a price ramp for"]}],e5={salesforceUserLocale:"en_US",chatRoomId:"00DA0000000cDUJMA2__0052G00000AHBNAQA5__a0jKb000004VSaMIAW",status:"SUCCESS",statusCode:200,requestId:"9b1d1f0a9f07aa6cdc",errorMessage:"",payload:{uiModification:{addColumn:[],removeColumn:[],filter:[],groupBy:[{sectionName:"MRC $50 and Above",filters:[{datatype:"currency",field:"XX_ORD1__MRC__c",operator:"greater or equal",value:"50"}],tableId:"4vIEgoK5CbSPrLYPbq"},{sectionName:"MRC Below $50",filters:[{datatype:"currency",field:"XX_ORD1__MRC__c",operator:"less than",value:"50"}],tableId:"BlOPCp7eLBCZ84nDT2"}],showOptions:!0}},agentResponse:{role:"agent",requestId:"9b1d1f0a9f07aa6cdc",content:"Grouped the quote items into two sections: one for MRC $50 and above, and another for MRC below $50.",error:!1,epoch:1759936160464,isDML:!1},redirectObjects:{qliId:"",itemId:"",componentName:"QuoteItem"},actionFunction:"Reload",links:[{action:"quoteDocument",label:"Quote Document"},{action:"addProducts",label:"Add Products"}]},t5=[{label:"Line Description",field:"xx_ord1__line_description__c",isEditable:!0,dataType:"STRING"},{label:"QTY",field:"xx_ord1__qty__c",isEditable:!0,dataType:"DOUBLE"},{label:"Extended Price",field:"xx_ord1__extended_price__c",isEditable:!1,dataType:"CURRENCY"},{label:"Billing Period",field:"xx_ord1__billing_period__c",isEditable:!0,dataType:"PICKLIST",picklistValues:["Monthly","Quarterly","Yearly"]}],Tn=Rt("quote",()=>{const e=an(),t=G0(),n=ar(),r=ae(""),i=ae(""),o=ae(0),a=ae(""),s=ae([]),l=ae({template:!0,filteredList:!1}),p=ae(null),c=ae(new Map),f=ae({}),u=ae(!1),m=ae(!0),h=ae(!1),g=ae({text:"Hide Options",altText:"Show Options",handler:()=>{m.value=!m.value,S()},color:"#136E05",isActive:!1}),d=be(()=>{const j=Array.from(c.value.values()).map(O=>O.sectionName);return Y0(j)});St(a,()=>{l.value.template||I()});function v(){const j=new Map,O=[];for(const[M,Z]of c.value.entries())j.set(M,Z.selected),O.push(Z);const P=JSON.parse(JSON.stringify(O));return P.forEach(M=>{delete M.selected;const Z=new Map,Q=[];M.lineItems.forEach(B=>{B.Selected=j.get(M.tableId).get(B.id)||!1,B.xx_ord1__parent_qli__c?(Z.has(B.xx_ord1__parent_qli__c)||Z.set(B.xx_ord1__parent_qli__c,[]),Z.get(B.xx_ord1__parent_qli__c).push(B)):Q.push(B)}),M.lineItems=Q.map(B=>({...B,options:Z.get(B.id)||[]})),delete M.loading,delete M.parentQLIs,delete M.totalValues}),{showOptions:m.value,sections:P,templateId:a.value}}async function _(j){try{let O=await window.salesforceConnector.getPrimaryQuote(j);O=bt(O),O!==void 0&&(console.info("getPrimaryQuote",JSON.stringify(O)),r.value=O.recordId,console.info("quoteId",r.value),i.value=O.name,a.value=O==null?void 0:O.templateId,o.value=(O==null?void 0:O.lineItemsCount)||0)}catch(O){e.handleError(O.message),console.info("[ERROR]: getPrimaryQuote() error = ",O)}}async function C(j){var O,P;try{l.value.template=!0;let M=await window.salesforceConnector.fetchContentTemplates(JSON.stringify({lstObjectName:[j],templateType:"Document",templateId:null,fetchOnlyDefault:!1}));M=bt(M);const Z=M==null?void 0:M.templates[j];return a.value||(a.value=(O=Z.find(Q=>Q.XX_ORD1__Default__c))==null?void 0:O.Id),a.value||(a.value=(P=Z[0])==null?void 0:P.Id),s.value=Z,l.value.template=!1,s.value}catch(M){e.handleError(M.message),console.info("[ERROR]: fetchTemplates() error = ",M)}}function y(j){if(!j)return null;const O=/\{!\$(\w+):([\w.]+)\}/,P=j.match(O);return P?{function:P[1],apiname:P[2].split(".")[1]}:null}async function w(j){try{const O={Id:r.value,XX_ORD1__Document_Template__c:j};return await window.salesforceConnector.updateQuote(JSON.stringify([O]))}catch(O){e.handleError(O.message),console.info("[ERROR]: updateQuote() error = ",O)}}async function A(){try{l.value.filteredList=!0;let j=await window.salesforceConnector.getQuoteEPageLayout();c.value.clear(),t.cartItemColumnsMap={},j=bt(j);const O=j.map(M=>({label:M.fieldLabel,field:M.fieldName.toLowerCase(),isEditable:M.isEditable,dataType:M.dataType,...M.picklistValues?{picklistValues:M.picklistValues}:{}})),P=or();return c.value.set(P,{loading:!0,lineItems:[],parentQLIs:[],columns:O,tableId:P,sectionName:"All Rows",selected:new Map,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}),t.cartItemColumnsMap[P]=O,g.value.isActive=!1,m.value=!0,p.value={lstCB:[{columns:O,footer:null,title:"All Rows",sectionName:"All Rows",tableId:P,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}]},S(),l.value.filteredList=!1,j}catch(j){e.handleError(j.message),console.info("[ERROR]: getQuoteEPageLayout() error = ",j)}}async function I(){if(s.value.length===0){A();return}try{l.value.filteredList=!0;let j=await window.salesforceConnector.getFilteredListWithFields(JSON.stringify({templateId:a.value}));w(a.value),j=bt(j),console.info("res.lstCB = ",j.lstCB);const O=j==null?void 0:j.objectFieldsMap;return c.value.clear(),t.cartItemColumnsMap={},j.lstCB=j.lstCB.map(P=>{const{fields:M,filters:Z,primarysort:Q,primarysortdesc:B}=JSON.parse(P.XX_ORD1__Block_Properties__c),U=M.map(q=>{var $;return{label:($=O[q.api])==null?void 0:$.label,field:q.api.toLowerCase(),isEditable:q.api.includes(".")?!1:O[q.api].isEditable,dataType:O[q.api].dataType,...O[q.api].picklistValues?{picklistValues:O[q.api].picklistValues}:{}}}),D=P.Id||or();return c.value.set(D,{loading:!0,lineItems:[],parentQLIs:[],columns:U,tableId:D,sectionName:P.Name,selected:new Map,footer:y(P.XX_ORD1__Table_Footer_HTML__c),filters:Z,primarysort:Q,primarysortdesc:B}),t.cartItemColumnsMap[D]=U,g.value.isActive=!1,m.value=!0,{columns:U,footer:y(P.XX_ORD1__Table_Footer_HTML__c),title:P.Name,sectionName:P.Name,tableId:D,filters:Z,primarysort:Q,primarysortdesc:B}}),p.value=j,S(),l.value.filteredList=!1,j}catch(j){e.handleError(j.message),console.info("[ERROR]: getFilteredListWithFields() error = ",j)}}async function S(j=!0){const O=[];for(const[P]of c.value)O.push(k(P,j));return await Promise.all(O),t.getProductCount(),!0}function N(j,O){return c.value.get(j).columns.some(P=>P.field.toLowerCase()===O)||t.cartItemColumnsMap[j].some(P=>P.field.toLowerCase()===O)}function T(j,O){let P=$i(j);const M=n.pricingSchema,Z=N(O,"xx_ord1__nrc__c"),Q=N(O,"xx_ord1__sales_price__c"),B=N(O,"xx_ord1__qty__c");return P=P.map(U=>{let D={};M==="nrc/mrc"&&(U!=null&&U.xx_ord1__billing_period__c)?D={...Q?{billingPeriodValue:(U==null?void 0:U.xx_ord1__sales_price__c)===0?"0":(U==null?void 0:U.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:U==null?void 0:U.xxord1salespricec}:{},...Z?{oneTimeValue:(U==null?void 0:U.xx_ord1__nrc__c)===0?"0":(U==null?void 0:U.xx_ord1__nrc__c)||null,formattedOneTimeValue:U==null?void 0:U.xxord1nrcc}:{}}:M==="nrc/mrc"&&!(U!=null&&U.xx_ord1__billing_period__c)?Q&&(D={oneTimeValue:(U==null?void 0:U.xx_ord1__sales_price__c)===0?"0":(U==null?void 0:U.xx_ord1__sales_price__c)||null,formattedOneTimeValue:U==null?void 0:U.xxord1salespricec}):M!=="nrc/mrc"&&(U!=null&&U.xx_ord1__billing_period__c)?Q&&(D={billingPeriodValue:(U==null?void 0:U.xx_ord1__sales_price__c)===0?"0":(U==null?void 0:U.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:U==null?void 0:U.xxord1salespricec}):M!=="nrc/mrc"&&!(U!=null&&U.xx_ord1__billing_period__c)&&Q&&(D={oneTimeValue:(U==null?void 0:U.xx_ord1__sales_price__c)===0?0:(U==null?void 0:U.xx_ord1__sales_price__c)||null,formattedOneTimeValue:U==null?void 0:U.xxord1salespricec});const{xx_ord1__qty__c:q,xx_ord1__sales_price__c:$,xx_ord1__nrc__c:H,...J}=U,R={...J,id:U.id,description:(U==null?void 0:U.xx_ord1__line_description__c)||"",xx_ord1__billing_period__c:U==null?void 0:U.xx_ord1__billing_period__c,...B?{xx_ord1__qty__c:q}:{},xx_ord1__item__c:U==null?void 0:U.xx_ord1__item__c,"xx_ord1__item__r.xx_ord1__decimal_precision__c":U["xx_ord1__item__r.xx_ord1__decimal_precision__c"]||"0",...D};return R!=null&&R.billingPeriodValue&&(t.hasBillingPeriodInList[O]=!0,t.billingPeriodValue=R==null?void 0:R.xx_ord1__billing_period__c),"oneTimeValue"in R&&(t.oneTimeFieldAvailable[O]=!0),"billingPeriodValue"in R&&(t.billingPeriodFieldAvailable[O]=!0),(R==null?void 0:R.oneTimeValue)!==""&&(R==null?void 0:R.oneTimeValue)!==null&&(t.hasOneTimeValue=!0),R}),P}async function k(j,O=!0){var P,M;try{const Z=c.value.get(j);if(console.info("sectionData = ",Z.sectionName),!Z)return;Z.loading=O,O&&(Z.lineItems=[]);const{columns:Q,filters:B,primarysort:U,primarysortdesc:D,footer:q}=Z,$=Q.map(le=>le.field.toLowerCase());$.includes("xx_ord1__parent_qli__c")||$.push("xx_ord1__parent_qli__c"),$.includes("xx_ord1__item__c")||$.push("xx_ord1__item__c"),$.includes("xx_ord1__sys_configuration_status2__c")||$.push("xx_ord1__sys_configuration_status2__c"),(P=t.cartItemColumnsMap[j])==null||P.forEach(le=>{$.includes(le.field)||$.push(le.field)});const H=await E({fields:$,recordId:r.value,filters:B||[],primarySortBy:U||"",primarySortOrder:D?"DESC":"ASC",includeOptions:m.value,totalFields:q?[q.apiname]:[]}),J=H.lineItems,R=new Map;let z=[];const oe=(M=H.fieldTotals)==null?void 0:M.map(le=>le.totalValue);J.forEach(le=>{le.XX_ORD1__Parent_QLI__c?R.has(le.XX_ORD1__Parent_QLI__c)?R.get(le.XX_ORD1__Parent_QLI__c).push(le):R.set(le.XX_ORD1__Parent_QLI__c,[le]):z.push(le)});const ce=[];return z.forEach(le=>{ce.push(le),R.has(le.Id)&&ce.push(...R.get(le.Id))}),z=T(z,j),Z.lineItems=$i(ce),Z.parentQLIs=z,Z.totalValues=oe,Z.loading=!1,c.value=new Map(c.value),ce}catch(Z){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",Z.message);const Q=c.value.get(j);Q&&(Q.loading=!1)}}async function E(j){try{let O=await window.salesforceConnector.getQuoteLineItemsWithFilteredTable(JSON.stringify(j));return O=bt(O),O}catch(O){e.handleError(O.message),console.info("[ERROR]: getQuoteLineItemsWithFilteredTable() error = ",O)}}async function L(j){try{console.info("updateQli() payload = ",j);let O=await window.salesforceConnector.updateQli(JSON.stringify(j));return O=bt(O),S(!1),O}catch(O){e.handleError(O.message),console.info("[ERROR]: updateQli() error = ",O)}}async function V(j){try{let O=await window.salesforceConnector.deleteQLI(j);return O=bt(O),S(),O}catch(O){e.handleError(O.message),console.info("[ERROR]: deleteQLI() error = ",O)}}async function K(j,O){try{u.value=!0;const P={fields:j};O&&(P.objectName=O),j.includes("xx_ord1__qty__c")&&O==="xx_ord1__ecatalog_item__c"&&(P.fields=P.fields.filter(Z=>Z!=="xx_ord1__qty__c")),j.includes("xx_ord1__sales_price__c")&&O!=="xx_ord1__quote_line_item__c"&&(P.fields=P.fields.filter(Z=>Z!=="xx_ord1__sales_price__c"));let M=await window.salesforceConnector.getFieldsData(JSON.stringify(P));return typeof M=="string"&&(M=JSON.parse(M)),M!=null&&M.errorMessage?(e.handleError(M.errorMessage),null):(f.value={...f.value,...M},console.info("fieldsData.value = ",JSON.stringify(f.value)),M)}catch(P){return e.handleError("Failed to get Fields Data. Please try again."),console.info("[ERROR]: getFieldsData() error = ",P),null}finally{u.value=!1}}function W(j=""){var O;return!j||j.includes(".")?!1:j.includes("xx_ord1__qty__c")?!0:((O=f.value[j])==null?void 0:O.isEditable)||!1}function te(){fe(e5)}async function fe(j){var O,P,M,Z,Q,B,U,D,q;if(j.payload){if((O=j.payload)!=null&&O.uiModification){const $=j.payload.uiModification;if(((P=$.addColumn)==null?void 0:P.length)>0)if($.addColumn.forEach(H=>{H.columns.forEach(J=>{J.field=J.field.toLowerCase()})}),$.addColumn[0].sectionName==="all_section")for(const[H,J]of c.value)J.columns=[...J.columns,...$.addColumn[0].columns];else $.addColumn.forEach(H=>{c.value.get(H.tableId)&&(c.value.get(H.tableId).columns=[...c.value.get(H.tableId).columns,...H.columns])});if(((M=$.removeColumn)==null?void 0:M.length)>0)if($.removeColumn.forEach(H=>{H.columns=H.columns.map(J=>J.toLowerCase())}),$.removeColumn[0].sectionName==="all_section")for(const[H,J]of c.value)J.columns=J.columns.filter(R=>!$.removeColumn[0].columns.includes(R.field));else $.removeColumn.forEach(H=>{c.value.get(H.tableId)&&(c.value.get(H.tableId).columns=c.value.get(H.tableId).columns.filter(J=>!H.columns.includes(J.field)))});if(((Z=$.filter)==null?void 0:Z.length)>0)if($.filter[0].sectionName==="all_section")for(const[H,J]of c.value)J.filters=[...J.filters,...$.filter[0].filters];else $.filter.forEach(H=>{c.value.get(H.tableId)&&(c.value.get(H.tableId).filters=[...c.value.get(H.tableId).filters,...H.filters])});if(((Q=$.groupBy)==null?void 0:Q.length)>0){const H=((B=[...c.value.values()][0])==null?void 0:B.columns)||t5;c.value.clear(),t.cartItemColumnsMap={},$.groupBy.forEach(J=>{t.cartItemColumnsMap[J.tableId]=J.columns||H,c.value.set(J.tableId,{loading:!0,lineItems:[],parentQLIs:[],columns:J.columns||H,tableId:J.tableId,sectionName:J.sectionName,selected:new Map,footer:y(J.footer),filters:J.filters,primarysort:J.primarysort,primarysortdesc:J.primarysortdesc})})}$.showOptions!==void 0&&(m.value=$.showOptions)}if(((D=(U=j.payload)==null?void 0:U.sections)==null?void 0:D.length)>0){const $=(q=j.payload)==null?void 0:q.sections;c.value.clear(),$.forEach(H=>{H.tableId||(H.tableId=or()),H.selected=new Map,c.value.set(H.tableId,H)}),S()}}j.actionFunction==="Reload"&&(S(),console.info("Reloading quote line items"))}async function ee(j){var O,P;try{const M=new Set;for(const Z of c.value.keys())(O=c.value.get(Z).lineItems)==null||O.forEach(B=>{B.attributes=null,M.add(B.id)});if(j){const Z={lineItemIds:[...M]},Q=await window.productManagerController.getLineItemAttributes({request:JSON.stringify(Z)}),B=JSON.parse(Q.data);for(const U of c.value.keys())(P=c.value.get(U).lineItems)==null||P.forEach(q=>{q.attributes=B[q.id]||null})}}catch(M){console.info("[ERROR]: fetchAttributesData() error = ",M)}}return{showAttributes:h,quoteId:r,quoteName:i,templateId:a,templateOptions:s,loading:l,currentTemplateData:p,fieldsData:f,fieldsDataLoading:u,showOptionHeaderButton:g,sectionDataMap:c,promptSuggestions:d,lineItemsCount:o,addColumns:te,getQuoteEPageLayout:A,getPayload:v,getPrimaryQuote:_,fetchTemplates:C,getFilteredListWithFields:I,getQuoteLineItemsWithFilteredTable:E,updateQli:L,getFieldsData:K,deleteQLI:V,performAIAction:fe,isEditableField:W,fetchQuoteLineItems:k,fetchAllQuoteLineItems:S,fetchAttributesData:ee}}),n5=Rt("quickSelection",()=>{const e=an(),t=ar(),n=Tn(),r=ae(null),i=ae(!1),o=ae([]),a=ae([]),s=ae(!1),l=ae({}),p=ae({rowLimit:10,paging:!0,offset:0,currentPage:1,totalPages:1}),c=ae(!1);async function f(){i.value=!0;try{const w=JSON.stringify({layoutType:"Quick Selection",layoutObject:"xx_ord1__ecatalog_item__c",...t.objectType?{contextObject:t.objectType}:{}});let A={};A=await window.salesforceConnector.getDynamicPageLayout(w),r.value=Ec(A,"Unable to find the Quick Selection Layout for your user profile"),console.info("quickSelectionLayout.value = ",r.value),p.value.rowLimit=r.value.configuration.rowLimit||10,r.value.data.columns.forEach(I=>{!I.field&&I.label==="QTY"&&(I.field="xx_ord1__qty__c")}),i.value=!1}catch(w){i.value=!1,e.handleError("Failed to get Page structure data. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",w)}}function u(){const w=new Map;return r.value.data.columns.forEach(A=>{w.set(A.field,!0)}),r.value.data.searchResultColumns.forEach(A=>{w.set(A.field,!0)}),Array.from(w.keys())}async function m(w){var A,I;try{let S=await window.salesforceConnector.saveCompetitorSKU(w);if(S!=null&&S.errorMessage){e.handleError(S.errorMessage);return}if((A=S[0])!=null&&A.errorMessage){e.handleError((I=S[0])==null?void 0:I.errorMessage);return}return S}catch(S){e.handleError("Failed to Match Item. Please try again."),console.info("[ERROR]: saveCompetitorSKU() error = ",S)}}async function h(w="",A=[]){try{let I=r.value.data,S=r.value.configuration;const N=w.trim();if(console.info("searchTextValue.trim() = ",w.trim()),!N)return[];let T=null;console.info("useMappings = ",c.value),c.value?T=Z0(g()):T=g(),console.info("fields before filter = ",T),T=T.filter(V=>V!=="xx_ord1__qty__c"),console.info("fields after filter = ",T);const k={fields:T,...A.length?{dynamicFilters:n.getDynamicFilters(A)}:{},searchText:N,accountId:t.accountId,...t.eCatalogId?{catalogId:t.eCatalogId}:{},...t.objectType==="opportunity"?{opportunityId:t.id}:{},...I!=null&&I.sort?{primarySortBy:I.sort.primary.field,primarySortOrder:I.sort.primary.direction,secondarySortBy:I.sort.secondary.field,secondarySortOrder:I.sort.secondary.direction}:{},rowLimt:(S==null?void 0:S.rowLimit)||20,paging:(S==null?void 0:S.paging)||!1,...p.value.offset!==0?{offset:p.value.offset}:{},objectName:I.objectName,currencyCode:t.currencyCode};console.info("getQuickSelectionItems payload = ",JSON.stringify(k));const E=await window.salesforceConnector.getItems(JSON.stringify(k));if(console.info("getQuickSelectionItems Res = ",JSON.stringify(E)),E!=null&&E.errorMessage){e.handleError(E.errorMessage);return}return E!=null&&E.itemCount&&(p.value.totalPages=Math.ceil((E==null?void 0:E.itemCount)/p.value.rowLimit)),$i(E.lstItems,{xx_ord1__qty__c:"1"})}catch(I){e.handleError("Failed to fetch Results. Please try again."),console.info("[ERROR]: getQuickSelectionItems() error = ",I)}}function g(){let w=[];for(const A of r.value.data.columns){let I=A.field;if(I!=null&&I.includes(".")){w.includes(I)||w.push(I);let N=I.split(".")[0];N=N.slice(0,-1)+"c",w.includes(N)||w.push(N)}else w.includes(I)||w.push(I)}return console.info("getAllQuickSelectionFields() fields = ",w),w.filter(A=>A.toLowerCase()!=="xx_ord1__qty__c")}async function d(w,A,I,S){console.info("searchText:",JSON.stringify(w)),console.info("row:",JSON.stringify(A)),console.info("rowIndex:",JSON.stringify(I)),console.info("column:",JSON.stringify(S));const N=I+(p.value.currentPage-1)*p.value.rowLimit;if(S.field.toLowerCase().includes("xx_ord1__item__r")){if(o.value[N].itemLookupLoading=!0,c.value=!0,a.value=await h(w),a.value.length>0){const T=[];for(let k=0;k<a.value.length;k++)o.value[N].itemDataRetrieved=!0,a.value[k].xx_ord1__item__c&&T.push({name:a.value[k]["xx_ord1__item__r.name"],value:a.value[k].xx_ord1__item__c,label:a.value[k][S.field.toLowerCase()]});o.value[N][S.field.toLowerCase()+"_options"]=T}o.value[N].itemLookupLoading=!1}else if(S.field.toLowerCase().includes("xx_ord1__competitor_item__r")){o.value[N].competitorLookupLoading=!0;const T=await v(w);T!=null&&T.items&&(o.value[N][S.field.toLowerCase()+"_options"]=T.items.map(k=>({name:k.fields[2].value,value:k.fields[1].value,label:k.fields[0].value}))),o.value[N].competitorLookupLoading=!1,console.info("getLookupData:: Search Lookup Handler Response = ",T)}}async function v(w){var I,S;console.info("getLookupData() searchText = ",w);const A={searchText:w,obj:"xx_ord1__competitor_item__c",filters:null,displayFields:["xx_ord1__sku__c"]};try{let N=await window.salesforceConnector.getLookupData(JSON.stringify(A));if(typeof N=="string"&&(N=JSON.parse(N)),N!=null&&N.errorMessage){e.handleError(N.errorMessage);return}if((I=N[0])!=null&&I.errorMessage){e.handleError((S=N[0])==null?void 0:S.errorMessage);return}return N}catch(N){e.handleError("Failed to Search For Item. Please try again."),console.info("[ERROR]: getLookupData() error = ",N)}}async function _(w,A){var S;console.info("Update Other Fields Value = ",w),console.info("Update Other Fields Row Index = ",A);const I=A+(p.value.currentPage-1)*p.value.rowLimit;console.info("actualRowIndex = ",I);try{if(w){const N=a.value.filter(T=>T.xx_ord1__item__c===w)[0];if(N){s.value=!0;const T=r.value.data.columns[1].field;o.value[I][T]&&await C(N,I),(S=o.value[I])!=null&&S.itemDataRetrieved&&(o.value[I].status="New Match Requested",o.value[I].noMatchCleared=!0),Object.keys(N).forEach(k=>{const E=Tc[k.toLowerCase()];console.info("Mapped Key = ",E),E&&(o.value[I][E]=N[k])}),s.value=!1}else o.value[I].status=""}else o.value[I].status="No Match"}catch(N){e.handleError("Unable to request a match for this item please try again."),console.info("Error in updateOtherFields = ",N)}}async function C(w,A){const I=o.value[A],S=r.value.data.columns[1].field,N=[{sku:I[S],name:I[S],productDescription:I.xx_ord1__line_description__c||"",productURL:null,status:"Match Requested",competitorAccountId:null,itemId:w.xx_ord1__item__c}];let T=await m(JSON.stringify(N));console.info("Match Item: ",JSON.stringify(T)),o.value[A][`${S}_options`]=[{value:T[0].competitorItemId,label:T[0].sku}],o.value[A][S]=T[0].competitorItemId}async function y(w){try{let A=await window.salesforceConnector.createQLI(JSON.stringify(w));typeof A=="string"&&(A=JSON.parse(A));let I=!1;if((A==null?void 0:A.length)>0)for(let S=0;S<A.length;S++)A[S].errorMessage&&(I=!0,A[S].errorMessage.includes("Line Description: data value too large")&&(A[S].errorMessage="Error: The description is too long—it must be under 200 characters."));if(I){A.forEach(S=>{l.value[S.eCatalogItemId]=S});return}else l.value=[];return A}catch(A){e.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addAllItemsToQuote() error = ",A)}}return{quickSelectionLayout:r,quickSelectionLayoutLoading:i,processedRecords:o,useMappings:c,currentSearchData:a,createQliErrors:l,getQuickSelectionLayout:f,getAllFieldsForQuickSelectionLayout:u,saveCompetitorSKU:m,getQuickSelectionItems:h,searchLookupHandler:d,updateOtherFields:_,addAllItemsToQuote:y}}),r5="Preparing Your Quote Please Wait...",i5={message:"Your quote is ready! Begin adding products to complete it.",type:"response",requestId:"no-request-id"},o5=18e4,Ui=Rt("ai",()=>{const e=ar(),t=Tn(),n=Nc(),r=n5(),i=sn(),o=wa(),a=ae(""),s=ae(""),l=ae([]),p=ae(""),c=ae([]),f=ae(!1),u=ae(null),m=Vi(),h=ae({}),g=ae(null),d=ae(null),v=ae(null),_=ae(null),C=ae(null),y=ae(r5),w=ae([]),A=be(()=>e.orgId+"__"+e.user.Id+"__"+t.quoteId),I=be(()=>u.value.readyState==WebSocket.OPEN),S=()=>{h.value={salesforceOrgId:e.orgId,salesforceOrgType:e.orgType,salesforceUserId:e.user.Id,userType:"Salesforce",chatRoomId:A.value,requestId:"",prompt:"",initiatedFrom:e.origin||"Quote",internalCall:!1,contextObjectId:t.quoteId,contextObjectType:"Quote",payload:{lineItemsCount:t.lineItemsCount},origin:"Genesis AI",defaultBatchSize:10,actionType:"",packageVersion:e.packageVersion,relatedIds:{eCatalogId:e.eCatalogId,accountId:e.accountId}}};async function N(){const q=s.value+"?chatRoomId="+A.value;u.value=new WebSocket(q),u.value.addEventListener("open",T),u.value.addEventListener("message",L),u.value.addEventListener("close",k),u.value.addEventListener("error",E)}const T=()=>{V(),te()},k=()=>{K()},E=()=>{Z(),K()},L=q=>{var H,J;V();const $=JSON.parse(q.data);if($.status!=="ALIVE"){if($.loading){y.value=$.message;return}else Array.isArray($.messages)?(y.value=null,l.value.push(i5),$.messages.length>0&&O($.messages)):$.agentResponse&&($.errorMessage&&($.agentResponse.content=$.errorMessage,$.agentResponse.error=!0),y.value=null,l.value.push({message:$.agentResponse.content,type:$.agentResponse.role,requestId:$.requestId,epoch:$.agentResponse.epoch,error:$.agentResponse.error,isDML:$.agentResponse.isDML,...(H=$.agentResponse)!=null&&H.filesData?{filesData:(J=$.agentResponse)==null?void 0:J.filesData}:{}}));w.value=$.links||[],B($)}},V=()=>{K(),g.value=setTimeout(()=>{if(I.value){const q={action:"heartbeat"};u.value.send(JSON.stringify(q)),V()}},o5)},K=()=>{g.value&&(clearInterval(g.value),g.value=null)};function W(q){const $={...h.value};$.requestType="Action",$.actionType="Undo",$.undoRequestId=q,$.requestId=or(),j($)}function te(){const q={...h.value};q.requestType="Action",q.actionType="History",q.requestId=or(),j(q)}function fe(q){return o.path.startsWith("/configurator")&&i.isChangedConfiguration?(_.value={save:()=>{i.maintainQuoteConfiguration()}},a.value=q,!0):(a.value="",!1)}function ee(q,$=!0,H=null){if(!fe(q)&&q.trim()){let J={...h.value};J.prompt=q.trim(),J.requestType="Chat",J.requestId=or(),J.internalCall=!1,J.payload=P(),J.componentName=M.value,J.templateId=t.templateId,J.payload.lineItemsCount=t.lineItemsCount,H&&(J={...J,...H}),Q(),$&&l.value.push({message:q.trim(),type:"user",...C.value&&{fileData:[C.value]},requestId:J.requestId}),j(J),V()}}function j(q){const $={action:"prompt",data:q};u.value.send(JSON.stringify($))}const O=q=>{const $=q.filter(({content:H})=>!!H).map(H=>({message:H.content,type:H.role,requestId:H.requestId,epoch:H.epoch,isDML:H.isDML,undone:H.undone}));$.forEach((H,J)=>{H.isDML===!0&&J!==$.length-1&&(H.isDML=!1)}),l.value=[...l.value,...$]};function P(){return o.path==="/quote-item"?t.getPayload():{}}const M=be(()=>o.path==="/quote-item"?"QuoteItem":""),Z=()=>{l.value.push({type:"response",message:"Oops! Something went wrong while processing your request. Please try again later.",error:!0})},Q=()=>{l.value=l.value.map(q=>({...q,links:[]}))};function B(q){var J,R,z;const $=((J=q==null?void 0:q.redirectObjects)==null?void 0:J.componentName)||(q==null?void 0:q.componentName),H=(q==null?void 0:q.redirectObjects)||{};if($==="AdaptiveSearch"){const oe=(R=q==null?void 0:q.payload)==null?void 0:R.searchTerm,ce=(z=q==null?void 0:q.payload)==null?void 0:z.applyFilters;oe&&oe!==n.searchText&&n.initAdaptiveSearch({searchTerm:oe,filters:ce}),m.push("/adaptive-search")}else $==="Configurator"?m.push(`/configurator/${H.itemId}/${H.qliId}`):$==="QuoteReview"?m.push("/quote-item"):$==="QuoteItem"||$==="QuoteList"?(m.push("/quote-item"),t.performAIAction(q)):$==="QuickSelection"&&(r.quickSelectionLayout=q.payload,console.info("Loading QuickSelection data = ",JSON.stringify(r.quickSelectionLayout)),m.push("/match-records"))}function U(){if(I.value){const q={action:"cancel",data:{requestId:h.value.requestId,chatRoomId:A.value}};u.value.send(JSON.stringify(q))}}const D=()=>{d.value&&(clearInterval(d.value),d.value=null),g.value&&(clearInterval(g.value),g.value=null),v.value&&(clearTimeout(v.value),v.value=null)};return Ei(()=>{D()}),{unsavedChanges:_,loadingMessage:y,promptMessage:a,buttonLinks:w,websocketUrl:s,chatHistory:l,latestDMLRequest:p,strikethroughHistory:c,attachmentData:C,dataManuallyChanged:f,undoAction:W,connectSocket:N,sendMessage:ee,setInitialPayload:S,cancelRequest:U}}),ar=Rt("root",()=>{const e=Ui(),t=an(),n=Tn(),r=ae(""),i=ae(""),o=ae("Genesis AI"),a=ae(""),s=ae({}),l=ae(""),p=ae(""),c=ae(""),f=ae(""),u=ae({}),m=ae(""),h=ae(""),g=ae(""),d=ae(""),v=ae(""),_=ae(""),C=ae(""),y=ae("Single"),w=ae("closed"),A=be(()=>n.quoteName),I=be(()=>y.value==="Single");async function S(E){r.value=E||xc("id"),i.value=xc("origin"),await T(),await N()}async function N(){try{console.info("getRecordInfo",r.value);let E=await window.salesforceConnector.getRecordInfo(r.value);return E=bt(E),E!==void 0&&(u.value=E,m.value=E.name,h.value=E.objectType,g.value=E.accountId,d.value=E.eCatalogId,v.value=E.currencyCode,_.value=E.userLocale,C.value=E.opportunityId),(E==null?void 0:E.objectType)==="XX_ORD1__Quote__c"?(n.quoteId=E==null?void 0:E.recordId,n.templateId=E==null?void 0:E.templateId,n.quoteName=E==null?void 0:E.name,n.lineItemsCount=(E==null?void 0:E.lineItemsCount)||0):(E==null?void 0:E.objectType)==="Opportunity"&&await n.getPrimaryQuote(E.recordId),E}catch(E){t.handleError(E.message)}}async function T(){var L,V;console.info("getOrgInformation",r.value);const E=await window.salesforceConnector.getOrgInformation();e.websocketUrl=E.websocketUrl,a.value=(L=E.locale)==null?void 0:L.replace("_","-"),s.value=E.user,l.value=E.orgName,p.value=E.orgId,c.value=E.orgType,f.value=E.packageVersion,y.value=(V=E==null?void 0:E.pricingSchema)==null?void 0:V.toLowerCase()}function k(E){o.value=E,s0(E)}return{id:r,origin:i,title:A,subTitle:o,locale:a,user:s,orgName:l,orgId:p,orgType:c,packageVersion:f,objectType:h,recordInfo:u,name:m,accountId:g,eCatalogId:d,currencyCode:v,userLocale:_,opportunityId:C,pricingSchema:y,isSinglePricingSchema:I,flyoutState:w,start:S,getRecordInfo:N,setSubTitle:k}}),a5="https://api-svc.blink.expedite1.com/api/product-pricing/evaluateConfigurationSelection",s5={productJSON:{productItem:{configRules:[{publishKey:"rule-a1",name:"If latest is optA include optB",priority:1,enforceRule:!0,ruleJson:'{"latestSelected":"optA","actionType":"include","affectedOptions":["optB"]}'}]}},currentConfig:{product:{publishKey:"prod-1",attributes:[]},options:[]},selected:{publishKey:"optA",attributes:[]}};async function l5(e=s5){const t=a5;try{const n=await fetch(t,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`HTTP error! status: ${n.status} ${n.statusText}`);return await n.json()}catch(n){throw console.info("Error fetching data with Fetch API:",n),n}}function c5(e){const t=n=>Math.min(...n.options.map(r=>r.relationshipInfo.primarySortOrder));return e.forEach(n=>{n.itemTypes.forEach(r=>{r.options.sort((i,o)=>i.relationshipInfo.primarySortOrder-o.relationshipInfo.primarySortOrder||i.itemName.localeCompare(o.itemName))}),n.itemTypes.sort((r,i)=>t(r)-t(i)||r.itemTypeName.localeCompare(i.itemTypeName))}),e.sort((n,r)=>{const i=Math.min(...n.itemTypes.map(t)),o=Math.min(...r.itemTypes.map(t));return i-o||n.category.localeCompare(r.category)}),e}const u5=(e,t)=>{const n=(r,i)=>typeof i=="function"?void 0:i;return JSON.stringify(e,n)===JSON.stringify(t,n)},sn=Rt("configurator-main",()=>{const e=wa(),t=ar(),n=Tn(),r=an(),i=Vi(),o=ae(null),a=ae(null),s=ae(null),l=ae(null),p=ae([]),c=ae(null),f=ae(null),u=ae(new Map),m=ae(!1),h=ae({configuration:!1,lineItem:!1,productOptionsPricing:!1,bestOfferPrice:!1,lineItemAttributes:!1,save:!1}),g=ae(!1),d=be(()=>v.value&&!t.isSinglePricingSchema),v=be(()=>{let D=!0,q=!0,$=!0,H=null;for(const J of s.value.categoryOptions)for(const R of J.itemTypes)for(const z of R.options)z.billingPeriod&&(H&&H!==z.billingPeriod&&($=!1),H=z.billingPeriod,!z.yrcPrice&&z.billingPeriod==="Monthly"&&(D=!1),!z.mrcPrice&&z.billingPeriod==="Yearly"&&(q=!1));return D&&q&&$}),_=be(()=>!u5(s.value,l.value)),C=be(()=>{const D=s.value.categoryOptions;return D.forEach(q=>{q.itemTypes.forEach($=>{$.selectedOptions=$.options.filter(H=>$.selected.includes(H.itemId)),$.totalPrice=function(){return $.selectedOptions.reduce((H,J)=>H+J.price*J.qty,0)||0},$.oneTimePrice=function(){return $.selectedOptions.filter(H=>!H.billingPeriod).reduce((H,J)=>H+J.price*J.qty,0)||0},$.recurringPrice=function(){return $.selectedOptions.filter(H=>H.billingPeriod).reduce((H,J)=>H+J.price*J.qty,0)||0}}),q.selectedItemTypes=q.itemTypes.filter($=>$.selected.length>0),q.totalPrice=function(){return q.itemTypes.reduce(($,H)=>$+H.totalPrice(),0)},q.oneTimePrice=function(){return q.itemTypes.reduce(($,H)=>$+H.oneTimePrice(),0)},q.recurringPrice=function(){return q.itemTypes.reduce(($,H)=>$+H.recurringPrice(),0)}}),D.filter(q=>q.itemTypes.filter($=>$.selected.length>0).length>0)}),y=be(()=>C.value.reduce((D,q)=>D+q.totalPrice(),0)),w=be(()=>{const D=C.value.reduce((H,J)=>H+J.totalPrice(),0);let q=C.value.reduce((H,J)=>H+J.oneTimePrice(),0),$=C.value.reduce((H,J)=>H+J.recurringPrice(),0);return s.value.billingPeriod?$=($+s.value.price)*s.value.qty:q=(q+s.value.price)*s.value.qty,{basePrice:s.value.price,addOns:D,oneTimePrice:q,recurringPrice:$,total:s.value.price*s.value.qty+D*s.value.qty+q+$}}),A=be(()=>{const D=new Map;return D.set(c.value.productLineItem.XX_ORD1__Item__c,c.value.productLineItem),c.value.options.forEach(q=>{D.set(q.XX_ORD1__Item__c,q)}),D}),I=be(()=>{const D=new Map;return s.value.categoryOptions.forEach(q=>{q.itemTypes.forEach($=>{$.options.forEach(H=>{D.set(H.relationshipInfo.publishKey,H)})})}),D}),S=be(()=>{const D=new Map;return D.set(f.value.product.XX_ORD1__Item__c,f.value.product),f.value.options.forEach(q=>{D.set(q.XX_ORD1__Item__c,q)}),D});function N(D){s.value.qliId&&(s.value.qliBillingPeriod==="Monthly"&&!D?s.value.price=s.value.qliSalesPrice||s.value.qliMrcPrice:s.value.qliBillingPeriod==="Yearly"&&D&&(s.value.price=s.value.qliSalesPrice)),s.value.categoryOptions.forEach(q=>{q.itemTypes.forEach($=>{$.options.forEach(H=>{H.billingPeriod&&(H.price=(D?H.yrcPrice.offerPrice:H.mrcPrice.offerPrice)||H.price,H.qliId&&(H.qliBillingPeriod==="Monthly"&&!D?H.price=H.qliSalesPrice||H.qliMrcPrice:H.qliBillingPeriod==="Yearly"&&D&&(H.price=H.qliSalesPrice)))})})})}function T(){s.value=null,l.value=null,p.value=[],c.value=null,f.value=null,u.value=new Map,m.value=!1,h.value.configuration=!1,h.value.lineItem=!1,h.value.productOptionsPricing=!1,h.value.bestOfferPrice=!1,h.value.lineItemAttributes=!1,h.value.save=!1}async function k(D,q){T(),o.value=D||e.params.itemId,a.value=q||e.params.qliId,console.info("initConfigurator",o.value,a.value,n.quoteId);const $=await E();await te(),await fe(),s.value=V($);const H=await j();L(H),await W();let J=!1;for(const R of c.value.options)R.XX_ORD1__Billing_Period__c==="Yearly"&&(J=!0);J&&(g.value=!0,N(!0)),l.value=JSON.parse(JSON.stringify(s.value))}async function E(){try{console.info("itemId",o.value);const D=await window.productManagerController.getProductConfiguration({itemId:o.value});console.info("getProductConfiguration:result",D);const q=JSON.parse(D.data).productItem;return q.categoryOptions=c5(q.categoryOptions),q}catch(D){return console.info("error",D.message),!1}}function L(D){const q=new Map;q.set(f.value.product.Id,f.value.product.XX_ORD1__Item__c),f.value.options.forEach(H=>{q.set(H.Id,H.XX_ORD1__Item__c)});const $=new Map;if(D.forEach(H=>{const J={};H.pricingTypes.forEach(R=>{R.appliedOnField==="Catalog Price"?J.catalogPrice=R:R.appliedOnField==="MRC"?J.mrcPrice=R:R.appliedOnField==="YRC"&&(J.yrcPrice=R)}),J.billingPeriod=H.billingPeriod,J.mrcPrice&&!t.isSinglePricingSchema?J.price=J.mrcPrice.offerPrice:J.catalogPrice&&t.isSinglePricingSchema&&(J.price=J.catalogPrice.offerPrice),J.offer={offerDiscount:H.offerDiscount,offerId:H.offerId,offerType:H.offerType},$.set(q.get(H.eCatalogItemId),J)}),$.has(s.value.itemId)){const H=$.get(s.value.itemId),J=s.value.price;Object.assign(s.value,H),s.value.qliId&&(s.value.price=J)}s.value.categoryOptions.forEach(H=>{H.itemTypes.forEach(J=>{J.options.forEach(R=>{if($.has(R.itemId)){const z=$.get(R.itemId),oe=R.price;Object.assign(R,z),R.qliId&&(R.price=oe)}})})})}function V(D){D.isAttributes=D.attributes&&D.attributes.length>0,u.value.set(a.value,D.attributes),p.value=D.configRules;const q=new Set;return p.value.forEach($=>{const H=JSON.parse($.ruleJson);H.optionSelected.forEach(J=>{q.add(J)}),H.affectedOptions.forEach(J=>{q.add(J)})}),K(D),D.categoryOptions.forEach($=>{$.key=$.category.toLowerCase().replace(/\s+/g,"-").replace(/[&]/g,""),$.itemTypes.forEach(H=>{H.selected=[],H.options=H.options.filter(J=>S.value.has(J.itemId)),H.numberOfColumns||(H.numberOfColumns=1),H.numberOfColumns>1&&(H.lightboxAttributes=!0),H.maxNumber||(H.maxNumber=100),H.minNumber||(H.minNumber=0),H.maxQuantity||(H.maxQuantity=1e4),H.minQuantity||(H.minQuantity=1),H.maxNumber===1?(H.isRadio=!0,H.minMessage="Please select 1 option",H.maxMessage="",H.isKit=H.options.some(J=>J.relationshipInfo.relationship==="Kit")):(H.minMessage=`Minimum of ${H.minNumber} selection${H.minNumber!==1?"s":""} required`,H.maxMessage=`Maximum of ${H.maxNumber} selection${H.maxNumber!==1?"s":""} allowed`),H.options.forEach(J=>{$.showImage=$.showImage||!!J.defaultImageURL,J.showAttributesModal=!1,J.calculateRules=q.has(J.relationshipInfo.publishKey),J.qty=H.minQuantity||1,J.getTags=()=>(J.attributes=J.attributes||[],J.attributes.filter(R=>R.value!==null&&R.value!=="").map(R=>({label:R.label,value:R.value}))),Object.defineProperty(J,"isDisabled",{get:function(){return J.relationshipInfo.relationship==="Kit"||(H.isRadio?H.isKit:!H.selected.includes(J.itemId)&&H.maxNumber===H.selected.length)}}),K(J),(A.value.has(J.itemId)||J.relationshipInfo.relationship==="Kit")&&H.selected.push(J.itemId)})})}),D}function K(D){D.isAttributes=D.attributes&&D.attributes.length>0;const q=S.value.get(D.itemId);if(A.value.has(D.itemId)){const $=A.value.get(D.itemId);D.qliId=$.Id,D.qty=$.XX_ORD1__QTY__c,D.itemName=$.XX_ORD1__Line_Description__c,D.billingPeriod=$.XX_ORD1__Billing_Period__c,D.price=$.XX_ORD1__Sales_Price__c,D.billingPeriod?D.price=$.XX_ORD1__Sales_Price__c||$.XX_ORD1__MRC__c:D.price=$.XX_ORD1__NRC__c||$.XX_ORD1__Sales_Price__c,D.qliSalesPrice=$.XX_ORD1__Sales_Price__c,D.qliNrcPrice=$.XX_ORD1__NRC__c,D.qliMrcPrice=$.XX_ORD1__MRC__c,D.qliBillingPeriod=$.XX_ORD1__Billing_Period__c,u.value.set(D.qliId,D.attributes)}else D.itemName=q.XX_ORD1__Line_Description__c||D.itemName,D.price=q.XX_ORD1__Negotiated_Price__c||q.XX_ORD1__NRC_for_New__c,D.nrcPrice=q.XX_ORD1__NRC_for_New__c}async function W(){console.info("getLineItemAttributes"),h.value.lineItemAttributes=!0;const q={lineItemIds:[c.value.productLineItem.Id,...c.value.options.map(J=>J.Id)]},$=await window.productManagerController.getLineItemAttributes({request:JSON.stringify(q)});console.info("getLineItemAttributes:result",$);const H=JSON.parse($.data);for(const[J,R]of Object.entries(H))if(u.value.has(J)){const z=u.value.get(J),oe=new Map;R==null||R.forEach(ce=>{oe.set(ce.apiName,ce)}),z==null||z.forEach(ce=>{oe.get(ce.apiName)&&(ce.value=oe.get(ce.apiName).value||"",ce.dataType==="REFERENCE"&&(ce.referenceRecordId=oe.get(ce.apiName).referenceRecordId||"",ce.referenceRecordId?ce.options=[{Name:ce.value||"",Id:ce.referenceRecordId}]:ce.options=[]))})}h.value.lineItemAttributes=!1}async function te(){h.value.lineItem=!0,console.info("getLineItems",n.quoteId,a.value);try{const D={objectId:n.quoteId,filters:{},additionalFields:["Name","XX_ORD1__Line_Description__c"],primarySort:{field:"CreatedDate",direction:"DESC"},productPage:{recordLimit:200,offset:0,productLineItemId:a.value}},q=await window.productManagerController.getLineItems({request:JSON.stringify(D)});return console.info("getLineItems:result",q),c.value=JSON.parse(q.data).products[0],console.info("result",q),h.value.lineItem=!1,q}catch(D){return console.info("error",D.message),h.value.lineItem=!1,!1}}async function fe(){h.value.productOptionsPricing=!0,console.info("getProductOptionsPricing");try{const D={objectId:n.quoteId,itemId:o.value},q=await window.productManagerController.getProductOptionsPricing({request:JSON.stringify(D)});return console.info("getProductOptionsPricing:result",q),f.value=JSON.parse(q.data),h.value.productOptionsPricing=!1,f.value}catch(D){return console.info("error",D.message),h.value.productOptionsPricing=!1,!1}}async function ee(D){console.info("getRecords");try{const q=await window.productManagerController.getRecords({request:JSON.stringify(D)});return console.info("getRecords:result",q),JSON.parse(q.data)}catch(q){return console.info("error",q.message),!1}}async function j(){h.value.bestOfferPrice=!0,console.info("getBestOfferPrice");const D=[f.value.product.Id];f.value.options.forEach(q=>{D.push(q.Id)});try{const q=await O(D);return h.value.bestOfferPrice=!1,q}catch(q){return console.info("error",q.message),h.value.bestOfferPrice=!1,!1}}async function O(D){const q={accountId:t.accountId,eCatalogItemIds:D,pricePreference:"Heighest Priority"},$=await window.productManagerController.calculateBestOfferPrice({request:JSON.stringify(q)});return console.info("calculateBestOfferPrice:result",$),h.value.bestOfferPrice=!1,JSON.parse($.data)}async function P(){m.value=!0,h.value.save=!0,console.info("maintainQuoteConfiguration");const D=[],q=[];s.value.categoryOptions.forEach(J=>{J.itemTypes.forEach(R=>{R.options.forEach(z=>{R.selected.includes(z.itemId)?D.push(M(z)):z.qliId&&q.push(z.qliId)})})});const $={objectId:n.quoteId,eCatalogId:t.eCatalogId,isGenesisAI:!0,blinkUser:!1,optionsToRemove:q,grandFatheredOptionsToRemove:[],productLineItem:{...M(s.value),optionLineItems:D}};console.info("maintainQuoteConfiguration:request",$);const H=await window.productManagerController.maintainQuoteConfiguration({request:JSON.stringify($)});if(console.info("maintainQuoteConfiguration:result",H),H!=null&&H.error){const J={title:"Unable to Save Configuration",description:H.error,button:{label:"Back to Configuration",action:()=>{m.value=!1}},cancel:{label:"Quote List",action:()=>{i.push("/quote-item?id="+n.quoteId)}}};r.errorPopup=J}else l.value=JSON.parse(JSON.stringify(s.value)),console.info("maintainQuoteConfiguration:result",H);h.value.save=!1}function M(D){const q={};D.isAttributes&&D.attributes.forEach(H=>{H.apiName.includes(".")||(H.dataType==="BOOLEAN"?q[H.apiName]=H.value?"true":"false":H.dataType==="REFERENCE"?q[H.apiName]=H.referenceRecordId:q[H.apiName]=H.value)});const $={attributes:q,itemId:D.itemId,lineItemId:D.qliId,lineDescription:D.itemName,qty:D.qty,billingPeriod:D.billingPeriod,...D.offer};return D.billingPeriod&&v.value&&!t.isSinglePricingSchema&&($.billingPeriod=g.value?"Yearly":"Monthly"),!t.isSinglePricingSchema&&!D.billingPeriod?$.nrcPrice=D.price:($.applyOnField="Catalog Price",$.salesPrice=D.price,$.nrcPrice=D.nrcPrice),$}async function Z(){const D={objectId:t.eCatalogId,productItemId:o.value};try{let q=await window.productManagerController.getProductCrossSells({request:JSON.stringify(D)});if(console.info("getProductCrossSells:result",q),q=q.data?JSON.parse(q.data):{},q.crossSells.length===0)return q;const $=q.crossSells.map(R=>R.Id),H=await O($),J=new Map;return H.forEach(R=>{J.set(R.eCatalogItemId,{...R,...R.pricingTypes[0]})}),q.crossSells.forEach(R=>{R.loading=!1,R.Name=R.XX_ORD1__Line_Description__c||R.XX_ORD1__Item__r.Name,R.Description=R.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,J.has(R.Id)?(R.Price=J.get(R.Id).offerPrice,R.priceFormatted=J.get(R.Id).formattedOfferPrice,R.offer={offerDiscount:J.get(R.Id).offerDiscount,offerId:J.get(R.Id).offerId,offerType:J.get(R.Id).offerType}):(R.Price=R.XX_ORD1__List_Price2__c,R.priceFormatted=R.XX_ORD1__List_Price2__c,R.offer={offerDiscount:0,offerId:null,offerType:null})}),q}catch(q){return console.info("error",q.message),!1}}async function Q(D,q){var R,z;const $={product:{publishKey:s.value.publishKey,lineDescription:s.value.itemName},options:[]};s.value.categoryOptions.forEach(oe=>{oe.itemTypes.forEach(ce=>{ce.options.forEach(le=>{ce.selected.includes(le.itemId)&&$.options.push({publishKey:le.relationshipInfo.publishKey,lineDescription:le.itemName})})})}),console.info("evaluateConfigSelection:currentConfig.options",$.options);const H={productJSON:{productItem:{configRules:p.value}},currentConfig:$,selected:D?{publishKey:(R=D.relationshipInfo)==null?void 0:R.publishKey,attributes:D.attributes,lineDescription:D.itemName}:{},unselected:q?{publishKey:(z=q.relationshipInfo)==null?void 0:z.publishKey,attributes:q.attributes,lineDescription:q.itemName}:{}};return await l5(H)}async function B(){try{const D=["Name","XX_ORD1__Line_Description__c","XX_ORD1__Item__r.XX_ORD1__Product_Description__c","XX_ORD1__Sales_Price__c","XX_ORD1__SYS_Configuration_Status2__c"],$=(await n.getQuoteLineItemsWithFilteredTable({fields:D,recordId:n.quoteId,filters:[],includeOptions:!1,totalFields:[]})).lineItems;return console.info("fetchQuoteLineItems:res",$),$}catch(D){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",D.message)}}async function U(D){const q={quoteId:n.quoteId,lstQLIRequest:[{eCatalogItemId:D.Id,quantity:1,offerApplicable:D.offer}]};try{const $=await window.productManagerController.createQuoteProducts({request:JSON.stringify(q)});console.info("getProductCrossSells:result",$)}catch($){return console.info("error",$.message),!1}}return{itemId:o,configuration:s,_configurationCopy:l,lineItem:c,savedScreen:m,loading:h,summary:C,addOns:y,summaryPrices:w,optionByItemId:A,attributesByQLIId:u,optionByPublishKey:I,showYearlyPricing:g,isYearlyPricingExist:v,isChangedConfiguration:_,isRecurringPricingSchema:d,changePricingScheme:N,createQuoteProducts:U,resetConfigurator:T,fetchQuoteLineItems:B,getRecords:ee,getProductCrossSells:Z,initConfigurator:k,maintainQuoteConfiguration:P,evaluateConfigSelection:Q}}),f5={class:"ect-p-4 ect-flex ect-gap-2 ect-items-center ect-justify-between ect-border-b ect-border-gray-200"},d5={class:"ect-flex ect-items-center ect-gap-3"},h5={class:"ect-text-xl ect-font-semibold ect-text-gray-700 ect-leading-relaxed"},p5={key:0,class:"ect-flex ect-gap-1.5 ect-items-center"},m5=b("span",{class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed"},"Saving configuration...",-1),g5={key:1,class:"ect-flex ect-gap-1.5 ect-items-center"},v5=b("span",{class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed"},"Configuration Saved Successfully",-1),y5={key:1,class:"ect-flex ect-flex-col ect-gap-4 ect-flex-1 ect-overflow-y-auto ect-mb-16"},_5=b("h3",{class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed ect-p-4 ect-pb-0"},"You may consider these products",-1),b5={class:"ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-pt-0 ect-overflow-y-auto"},C5=["data-test-id"],w5={class:"ect-flex-1 ect-flex ect-flex-col ect-gap-2"},x5={class:"ect-text-sm ect-font-semibold ect-text-gray-800 ect-leading-tight"},k5={class:"ect-text-sm ect-font-medium ect-text-gray-600 ect-leading-relaxed ect-line-clamp-2"},E5={class:"ect-flex ect-flex-row ect-justify-between ect-items-center"},O5={class:"ect-text-sm ect-font-semibold ect-text-gray-800"},S5={key:2,class:"ect-flex ect-flex-col ect-gap-4 ect-m-4 ect-flex-1 ect-overflow-y-auto"},I5=b("h3",{class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed"},"What do you want to do next?",-1),A5={class:"ect-flex ect-flex-col ect-gap-4"},T5=["data-test-id","onClick"],N5={class:"ect-flex ect-items-center ect-justify-center"},P5={class:"ect-flex ect-flex-col ect-items-center ect-gap-2 ect-w-full"},L5=["data-test-id"],R5=["data-test-id"],M5={key:3,class:"ect-bg-light-bg-x ect-border-t ect-border-gray-200 ect-flex-shrink-0 ect-sticky ect-bottom-0 ect-pb-4"},q5={class:"ect-flex ect-flex-col ect-gap-4"},j5={class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed ect-p-4 ect-pb-0"},D5={class:"ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-pt-0 ect-overflow-y-auto"},B5={class:"ect-bg-white ect-border ect-border-gray-300 ect-rounded-md ect-p-3 ect-flex ect-flex-col","data-test-id":"configurator-recommend-card-next-product"},$5={class:"ect-flex-1 ect-flex ect-flex-col ect-gap-2"},F5={class:"ect-text-sm ect-font-semibold ect-text-gray-800 ect-leading-tight"},V5={class:"ect-text-sm ect-font-medium ect-text-gray-600 ect-leading-relaxed ect-line-clamp-2"},H5={class:"ect-flex ect-flex-row ect-justify-between ect-items-center"},U5={class:"ect-text-sm ect-font-semibold ect-text-gray-800"},z5={__name:"ConfiguratorRecommend",setup(e){const t=sn(),n=Tn(),r=Vi(),i=be(()=>t.configuration),o=ae(!0),a=ae(""),s=ae([{icon:"configuration",title:"Back to current Product Configuration",description:"Returns to the active product configuration page.",link:"/item/overview",action:"backToConfiguration"},{icon:"menu",title:"Back to Quote List Page",description:"Returns to the main quote list page.",link:"/quote-item",action:"backToQuoteList"}]),l=ae(null),p=ae([]),c=async h=>{h.loading=!0,await t.createQuoteProducts(h),h.disabled=!0,h.loading=!1},f=h=>{h.action==="backToConfiguration"?t.savedScreen=!1:h.action==="backToQuoteList"?r.push("/quote-item?id="+n.quoteId):h.link&&r.push(h.link)};async function u(){const h=await t.fetchQuoteLineItems();console.info("getQuoteLineItems1:_quoteLineItems",h);const g=h.filter(v=>v.XX_ORD1__SYS_Configuration_Status2__c=="Needs Configuration").length;console.info("getQuoteLineItems2:needsConfigurationCount",g),a.value=`(${h.length-g}/${h.length})`;const d=h.find(v=>v.XX_ORD1__SYS_Configuration_Status2__c=="Needs Configuration"&&v.Id!=t.qliId);return console.info("getQuoteLineItems3:result",d),l.value=d?{Name:d.XX_ORD1__Line_Description__c,Description:d.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,Price:d.XX_ORD1__Sales_Price__c,XX_ORD1__Item__c:d.XX_ORD1__Item__c,Id:d.Id}:null,console.info("getQuoteLineItems4:configueredProduct",l.value),h}async function m(){t.resetConfigurator(),r.push({path:"/configurator/"+l.value.XX_ORD1__Item__c+"/"+l.value.Id}),t.initConfigurator(l.value.XX_ORD1__Item__c,l.value.Id)}return wn(async()=>{o.value=!0;const h=await u(),g=await t.getProductCrossSells(),d=new Set;h.forEach(v=>{d.add(v.XX_ORD1__Item__c)}),g.crossSells.forEach(v=>{v.disabled=d.has(v.XX_ORD1__Item__c)}),p.value=g.crossSells||[],o.value=!1}),(h,g)=>(X(),ne(Oe,null,[b("div",f5,[b("div",d5,[_e(Ge,{icon:"arrow",symbol:"",size:12,onClick:g[0]||(g[0]=d=>Xe(t).savedScreen=!1)}),b("h2",h5,ve(i.value.itemName),1)]),Xe(t).loading.save?(X(),ne("div",p5,[_e(Oc,{svg:""}),m5])):(X(),ne("div",g5,[_e(Ge,{icon:"check",color:"#136E05",size:14,"data-test-id":"item-tabs-before-button-icon"}),v5]))]),o.value?(X(),Te(Ca,{key:0,type:"recommendations",rows:4})):p.value.length>0?(X(),ne("div",y5,[_5,b("div",b5,[(X(!0),ne(Oe,null,ze(p.value,(d,v)=>(X(),ne("div",{key:d.Id||v,class:"ect-bg-white ect-border ect-border-gray-300 ect-rounded-md ect-p-3 ect-flex ect-flex-col","data-test-id":`configurator-recommend-card-${d.Id||v}`},[b("div",w5,[b("h4",x5,ve(d.Name),1),b("p",k5,ve(d.Description),1)]),b("div",E5,[b("div",O5,ve(h.$formatCurrency(d.Price)),1),_e(Nt,{btype:d.disabled?"secondary":"primary","button-style":d.disabled?"normal":"outlined",size:"medium",class:Ie({"ect-w-[120px]":d.loading}),loading:d.loading,disabled:d.disabled||d.loading,"data-test-id":`configurator-recommend-button-add-${d.Id||v}`,onClick:_=>c(d)},{default:De(()=>[Fe(ve(d.loading?"":d.disabled?"Added to Quote":"Add to Quote"),1)]),_:2},1032,["btype","button-style","class","loading","disabled","data-test-id","onClick"])])],8,C5))),128))])])):(X(),ne("div",S5,[I5,b("div",A5,[(X(!0),ne(Oe,null,ze(s.value,(d,v)=>(X(),ne("div",{key:d.title||v,class:"ect-bg-white ect-border ect-border-[#DEDEDE] ect-rounded-xl ect-p-4 md:ect-p-5 lg:ect-p-6 ect-flex ect-flex-col ect-items-center ect-gap-4 md:ect-gap-6 lg:ect-gap-8 ect-cursor-pointer ect-transition-all ect-duration-200 hover:ect-shadow-md hover:ect-border-gray-400","data-test-id":`configurator-recommend-redirect-card-${v}`,onClick:_=>f(d)},[b("div",N5,[_e(Ge,{icon:d.icon,size:20,color:"#000000","data-test-id":`configurator-recommend-redirect-icon-${v}`},null,8,["icon","data-test-id"])]),b("div",P5,[b("h4",{class:"ect-text-sm ect-font-semibold ect-text-[#5F5F5F] ect-text-center ect-leading-[1.43]","data-test-id":`configurator-recommend-redirect-title-${v}`},ve(d.title),9,L5),b("p",{class:"ect-text-sm ect-font-normal ect-text-[#828282] ect-text-center ect-leading-[1.71]","data-test-id":`configurator-recommend-redirect-description-${v}`},ve(d.description),9,R5)])],8,T5))),128))])])),l.value?(X(),ne("footer",M5,[b("div",q5,[b("h3",j5," Configuere next product from your quote "+ve(a.value),1),b("div",D5,[b("div",B5,[b("div",$5,[b("h4",F5,ve(l.value.Name),1),b("p",V5,ve(l.value.Description),1)]),b("div",H5,[b("div",U5,ve(h.$formatCurrency(l.value.Price)),1),_e(Nt,{btype:"primary","button-style":"filled",size:"medium","data-test-id":"configurator-recommend-button-add-next-product",onClick:m},{default:De(()=>[Fe(" Configure Now ")]),_:1})])])])])])):ye("",!0)],64))}},K5=["data-test-id"],Z5=Ve({__name:"AppPill",props:{variant:{type:String,default:"",validator:e=>["success","error",""].includes(e)},dataTestId:{type:String,default:""}},setup(e){return(t,n)=>(X(),ne("span",{class:Ie(["ect-pill",{"ect-pill-success":e.variant==="success","ect-pill-error":e.variant==="error","ect-pill-default":!e.variant}]),"data-test-id":e.dataTestId},[Ze(t.$slots,"default",{},void 0,!0)],10,K5))}},[["__scopeId","data-v-c7f05fa0"]]),Q5=["data-test-id"],X5=["data-test-id"],J5=["data-test-id","onClick"],W5=["data-test-id"],G5=Ve({__name:"AppTabsV2",props:{showTabs:{type:Boolean,default:!0},modelValue:{type:String,default:""},border:{type:Boolean,default:!1},tabs:{type:Array,required:!0,validator:e=>e.every(t=>typeof t=="object"&&t.title&&t.key&&(t.sections===void 0||Array.isArray(t.sections)))},dataTestId:{type:String,required:!0}},emits:["update:modelValue","tab-change"],setup(e,{emit:t}){const n=e,r=t,i=be(()=>{var a;return n.modelValue||((a=n.tabs[0])==null?void 0:a.key)||""}),o=a=>{r("update:modelValue",a),r("tab-change",a)};return(a,s)=>(X(),ne("div",{class:"ect-page-tabs","data-test-id":e.dataTestId},[e.showTabs?(X(),ne("div",{key:0,class:Ie(["ect-page-tabs-header",[{"ect-tab-border":e.border}]]),"data-test-id":`${e.dataTestId}-header`},[(X(!0),ne(Oe,null,ze(e.tabs,l=>(X(),ne("button",{key:l.key,class:Ie(["ect-page-tab-button",`ect-page-tab-button${i.value===l.key?"-active":""} ${l.tabClass||""}`]),"data-test-id":`${e.dataTestId}-tab-${l.key}`,onClick:p=>o(l.key)},[Fe(ve(l.title)+" ",1),l.pill!==void 0&&l.pill!==null?(X(),Te(Z5,{key:0,class:"ect-ml-2",variant:l.pillStyle,"data-test-id":`${e.dataTestId}-tab-${l.key}-pill`},{default:De(()=>[Fe(ve(l.pill),1)]),_:2},1032,["variant","data-test-id"])):ye("",!0)],10,J5))),128))],10,X5)):ye("",!0),b("div",{class:"ect-page-tab-content","data-test-id":`${e.dataTestId}-content`},null,8,W5)],8,Q5))}},[["__scopeId","data-v-f22cb1ed"]]),Y5=["data-test-id"],eh=["disabled","data-test-id"],th=["value","disabled","data-test-id"],nh=["disabled","data-test-id"],zi={__name:"CounterButton",props:{value:{type:Number,required:!0,default:null},min:{type:Number,default:1},max:{type:Number,default:999},empty:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},dataTestId:{type:String,required:!0}},emits:["update:value","change"],setup(e,{emit:t}){const n=e,r=t,i=be(()=>n.min==null?0:n.min),o=be(()=>n.max==null?999:n.max),a=(y,w,A)=>Math.min(Math.max(y,w),A),s=y=>{if(y==null||y==="")return NaN;const w=Number(y);return Number.isFinite(w)?w:NaN},l=ae(null),p=ae(n.value??i.value),c=y=>{p.value=a(y,i.value,o.value)};n.value!==null&&c(n.value);const f=be(()=>p.value),u=be(()=>l.value!=null?l.value:String(f.value)),m=be(()=>n.disabled||f.value<=i.value),h=be(()=>n.disabled||f.value>=o.value);function g(y){y!==n.value&&(p.value=y,r("update:value",y),r("change",y))}function d(){if(m.value)return;const y=a(f.value-1,i.value,o.value);l.value=null,g(y)}function v(){if(h.value)return;const y=a(f.value+1,i.value,o.value);l.value=null,g(y)}function _(y){const A=String(y.target.value??"").replace(/\D+/g,"");l.value=A}function C(){const y=s(l.value),w=i.value,A=a(Number.isNaN(y)?w:y,i.value,o.value);l.value=null,g(A)}return(y,w)=>(X(),ne("div",{class:"ect-flex ect-items-center ect-gap-1","data-test-id":e.dataTestId},[b("button",{type:"button",class:Ie(["ect-h-7 ect-w-7 ect-border ect-border-gray ect-rounded-md ect-flex ect-items-center ect-justify-center ect-text-gray-700 ect-text-sm hover:ect-border-gray-400 ect-transition-colors ect-bg-white",{"ect-opacity-50":m.value,"ect-cursor-not-allowed":m.value}]),disabled:m.value,"data-test-id":`${e.dataTestId}-decrement`,onClick:d}," - ",10,eh),b("input",{type:"text",inputmode:"numeric",pattern:"[0-9]*",value:e.empty?"":u.value,disabled:e.disabled,class:"ect-h-7 ect-w-[48px] ect-px-2 ect-border ect-border-gray ect-rounded-md ect-text-center ect-text-sm ect-font-medium ect-text-gray-900 focus:ect-outline-none focus:ect-border-gray-400 ect-bg-white","data-test-id":`${e.dataTestId}-input`,onInput:_,onBlur:C},null,40,th),b("button",{type:"button",class:Ie(["ect-h-7 ect-w-7 ect-border ect-border-gray ect-rounded-md ect-flex ect-items-center ect-justify-center ect-text-gray-700 ect-text-sm hover:ect-border-gray-400 ect-transition-colors ect-bg-white",{"ect-opacity-50":h.value,"ect-cursor-not-allowed":h.value}]),disabled:h.value,"data-test-id":`${e.dataTestId}-increment`,onClick:v}," + ",10,nh)],8,Y5))}},rh={class:"ect-flex ect-justify-end ect-items-center ect-gap-2.5 ect-px-6 ect-pb-6 ect-pt-4 ect-bg-white ect-border-t ect-border-gray-300 ect-shadow-[0_-2px_4px_0px_rgba(0,0,0,0.11)]","data-test-id":"configurator-footer"},ih={"data-test-id":"configurator-footer-quantity"},oh={class:"ect-flex ect-justify-end ect-items-center ect-gap-6 ect-px-8 ect-py-0 ect-flex-1","data-test-id":"configurator-footer-prices"},ah=["data-test-id"],sh=["data-test-id"],lh=["data-test-id"],ch=["data-test-id"],uh={__name:"ConfiguratorFooter",props:{item:{type:Object,required:!0,default:()=>{}},disabled:{type:Boolean,default:!1},btnText:{type:String,default:"Save"}},emits:["update:qty","continue"],setup(e,{emit:t}){const n=sn(),r=e,i=ae(r.item),o=be(()=>{const l=n.summaryPrices,p=[];return n.isRecurringPricingSchema?(p.push({label:"One Time Price",value:l.oneTimePrice,highlight:!1}),p.push({label:n.showYearlyPricing?"Yearly Price":"Monthly Price",value:l.recurringPrice,highlight:!1})):(p.push({label:"Base Price",value:l.basePrice,highlight:!1}),p.push({label:"Add Ons",value:l.addOns,highlight:!1}),p.push({label:"Total Price",value:l.total,highlight:!1})),p}),a=t,s=()=>{r.disabled||a("continue")};return(l,p)=>(X(),ne("footer",rh,[b("div",ih,[_e(zi,{value:i.value.qty,"onUpdate:value":p[0]||(p[0]=c=>i.value.qty=c),min:1,max:999,disabled:e.disabled,"is-selected":!0,"data-test-id":"configurator-footer-counter-button"},null,8,["value","disabled"])]),b("div",oh,[(X(!0),ne(Oe,null,ze(o.value,(c,f)=>(X(),ne(Oe,{key:f},[b("div",{class:"ect-flex ect-flex-col ect-justify-center","data-test-id":`configurator-footer-price-${f}`},[b("span",{class:"ect-text-xs ect-font-normal ect-text-gray-500 ect-text-left","data-test-id":`configurator-footer-price-label-${f}`},ve(c.label),9,sh),b("span",{class:Ie(["ect-text-left",c.highlight?"ect-text-lg ect-font-bold ect-text-green-700":"ect-text-sm ect-font-medium ect-text-gray-800 "]),"data-test-id":`configurator-footer-price-value-${f}`},ve(c.value),11,lh)],8,ah),f<o.value.length-1?(X(),ne("div",{key:0,class:"ect-w-0 ect-h-5 ect-border-l ect-border-gray-400","data-test-id":`configurator-footer-divider-${f}`},null,8,ch)):ye("",!0)],64))),128))]),_e(Nt,{class:"ect-min-w-[100px]",btype:e.disabled?"secondary":"primary",disabled:e.disabled,"button-style":"primary",size:"medium","data-test-id":"configurator-footer-button-continue",onClick:s},{default:De(()=>[Fe(ve(e.btnText),1)]),_:1},8,["btype","disabled"])]))}},fh={class:"ect-w-full ect-bg-white ect-mb-4","data-test-id":"configurator-type-section"},dh={class:"ect-sticky ect-top-0 ect-z-30 ect-bg-white ect-shadow-sm ect-p-3 ect-px-4 ect-border-b ect-border-gray-200 ect-flex ect-justify-between ect-items-center","data-test-id":"configurator-type-header-sticky"},hh={class:"ect-flex ect-flex-col"},ph={class:"ect-font-bold ect-text-text-success ect-leading-tight"},mh=["innerHTML"],gh={key:0,class:"ect-flex ect-items-center ect-gap-2 ect-px-2 ect-py-1","data-test-id":"configurator-type-message"},vh={class:"ect-text-xs ect-font-medium ect-text-gray-600 ect-leading-tight ect-min-w-[190px]"},yh={class:"ect-divide-y ect-divide-gray-100 ect-overflow-y-auto"},_h={__name:"ConfiguratorType",props:{title:{type:String,required:!0},description:{type:String,default:""},message:{type:String,default:""}},setup(e){return(t,n)=>(X(),ne("section",fh,[b("header",dh,[b("div",hh,[b("h2",ph,ve(e.title),1),e.description?(X(),ne("p",{key:0,class:"ect-mt-1 ect-text-xs ect-text-gray-500 ect-leading-tight",innerHTML:e.description},null,8,mh)):ye("",!0)]),e.message?(X(),ne("div",gh,[_e(Ge,{icon:"info",symbol:"",color:"#198708",size:14,"data-test-id":"configurator-type-message-icon"}),b("span",vh,ve(e.message),1)])):ye("",!0)]),b("div",yh,[Ze(t.$slots,"default")])]))}},bh={__name:"ShadowDisplay",props:{content:{type:String,required:!0}},setup(e){const t=e,n=ae(null);let r=null;return xn(()=>{n.value&&!r&&(r=n.value.attachShadow({mode:"open"}),r.innerHTML=t.content)}),St(()=>t.content,i=>{r&&(r.innerHTML=i)}),(i,o)=>(X(),ne("div",{ref_key:"host",ref:n},null,512))}},Ch=["data-test-id"],wh=["data-test-id"],xh=["data-test-id"],kh=[b("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[b("g",{id:"Group"},[b("path",{id:"Vector",d:"M7 1.3125V12.6875",stroke:"#A86200","stroke-linecap":"round","stroke-linejoin":"round"}),b("path",{id:"Vector_2",d:"M1.3125 7H12.6875",stroke:"#A86200","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)],Eh=["data-test-id"],Oh=["data-test-id"],Sh=["data-test-id"],Ih=["data-test-id"],Ah=["data-test-id"],Th=["data-test-id","innerHTML"],Zt={__name:"Tag",props:{label:{type:String,default:""},value:{type:String,default:""},addButton:{type:Boolean,default:!1},editButton:{type:Boolean,default:!1},dataTestId:{type:String,default:""}},setup(e){const t=e,n=be(()=>{const r=t.value;if(typeof r!="string")return!1;const i=new DOMParser().parseFromString(r,"text/html");return Array.from(i.body.childNodes).some(o=>o.nodeType===1)});return(r,i)=>e.addButton?(X(),ne("div",{key:0,class:"ect-bg-orange-4 ect-flex ect-gap-1 ect-justify-center ect-items-center ect-px-2 ect-py-0.5 ect-text-xs ect-font-medium ect-text-center ect-rounded-md ect-border ect-border-solid ect-border-orange-secondary","data-test-id":e.dataTestId},[b("span",{class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-orange-secondary ect-flex ect-items-center ect-gap-1","data-test-id":`${e.dataTestId}-content`},[b("div",{"data-test-id":`${e.dataTestId}-add-icon`},kh,8,xh),Fe(" "+ve(e.label),1)],8,wh)],8,Ch)):e.editButton?(X(),ne("div",{key:1,class:"ect-bg-white ect-flex ect-gap-1 ect-justify-center ect-items-center ect-px-2 ect-py-0.5 ect-text-xs ect-font-medium ect-text-center ect-rounded-md ect-border ect-border-solid ect-border-success","data-test-id":e.dataTestId},[b("span",{class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-success ect-flex ect-items-center ect-gap-1","data-test-id":`${e.dataTestId}-content`},ve(e.label),9,Oh)],8,Eh)):(X(),ne("div",{key:2,class:"ect-bg-white ect-px-2 ect-py-0.5 ect-text-xs ect-font-medium ect-rounded-md ect-border ect-border-solid ect-border-neutral-200","data-test-id":e.dataTestId},[b("span",{class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-zinc-500","data-test-id":`${e.dataTestId}-label`},ve(e.label),9,Ih),e.value?(X(),ne("span",{key:0,class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-zinc-500","data-test-id":`${e.dataTestId}-separator`}," : ",8,Ah)):ye("",!0),n.value?(X(),Te(bh,{key:1,content:e.value},null,8,["content"])):e.value?(X(),ne("span",{key:2,class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-neutral-700","data-test-id":`${e.dataTestId}-value`,innerHTML:e.value},null,8,Th)):ye("",!0)],8,Sh))}},Nh=["data-test-id"],Ph=["data-test-id"],Lh=["data-test-id"],Rh=["type","step","min","data-test-id"],ka=Ve({__name:"InputEdit",props:{modelValue:{type:String,required:!0},type:{type:String,default:"string",validator:e=>["string","number","currency"].includes(e)},tag:{type:String,default:"span"},disabled:{type:Boolean,default:!1},dataTestId:{type:String,required:!0}},emits:["update:modelValue","change"],setup(e,{expose:t,emit:n}){const r=e,i=n,o=ae(!1),a=ae(!1),s=ae(""),l=ae(null),p=be(()=>r.type==="currency"?v(r.modelValue):r.type==="number"?_(r.modelValue):r.modelValue),c=be(()=>r.type==="string"?"text":"number"),f=be(()=>r.type==="currency"?"0.01":void 0),u=be(()=>r.type==="currency"?"0":void 0),m=()=>{r.disabled||(r.type==="currency"?s.value=parseFloat(r.modelValue)||"0.00":r.type==="number"?s.value=parseFloat(r.modelValue)||"0":s.value=r.modelValue,o.value=!0,Ut(()=>{l.value&&(l.value.focus(),l.value.select())}))},h=()=>{let C=s.value;if(r.type==="number"||r.type==="currency"){const y=parseFloat(s.value);isNaN(y)?C=r.modelValue:C=r.type==="currency"?y.toFixed(2):y.toString()}C!==r.modelValue&&(i("update:modelValue",C),i("change",C)),o.value=!1},g=()=>{s.value=r.modelValue,o.value=!1},d=()=>{o.value&&h()},v=C=>!C||isNaN(C)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(parseFloat(C)),_=C=>!C||isNaN(C)?"0":new Intl.NumberFormat("en-US").format(parseFloat(C));return St(()=>r.modelValue,C=>{o.value||(s.value=C)}),t({startEditing:m,saveChanges:h,cancelEditing:g}),(C,y)=>{const w=Hf("click-outside");return X(),ne("div",{class:"ect-relative ect-inline-block ect-min-w-[60px] ect-h-[30px]","data-test-id":e.dataTestId,onMouseenter:y[1]||(y[1]=A=>a.value=!0),onMouseleave:y[2]||(y[2]=A=>a.value=!1)},[o.value?Cn((X(),ne("div",{key:1,class:"ect-w-full ect-h-full","data-test-id":`${e.dataTestId}-input-wrapper`},[Cn(b("input",{ref_key:"inputRef",ref:l,"onUpdate:modelValue":y[0]||(y[0]=A=>s.value=A),type:c.value,step:f.value,min:u.value,class:Ie(["ect-w-full ect-h-full ect-px-3 ect-bg-white ect-border ect-border-green-500 ect-rounded-sm ect-text-gray-700 ect-text-base ect-font-sans ect-outline-none ect-duration-200",C.$attrs.class]),"data-test-id":`${e.dataTestId}-input`,onKeyup:[qr(h,["enter"]),qr(g,["esc"])],onBlur:h},null,42,Rh),[[u1,s.value]])],8,Lh)),[[w,d]]):(X(),ne("div",{key:0,class:Ie(["ect-flex ect-items-center ect-gap-2 ect-rounded ect-transition-colors ect-duration-200",{"ect-cursor-pointer":!e.disabled}]),"data-test-id":`${e.dataTestId}-display`,onClick:m},[(X(),Te(bl(e.tag),ua(C.$attrs,{class:"ect-m-0 ect-text-inherit","data-test-id":`${e.dataTestId}-text`}),{default:De(()=>[Fe(ve(p.value)+" ",1),_e(Ge,{class:Ie(a.value&&!e.disabled?"ect-visible":"ect-invisible"),icon:"edit",size:"12",color:"#828282","data-test-id":`${e.dataTestId}-edit-icon`},null,8,["class","data-test-id"])]),_:1},16,["data-test-id"]))],10,Ph))],40,Nh)}}},[["__scopeId","data-v-07416d80"]]),Mh=["data-test-id","data-publish-key"],qh={key:0,class:"ect-text-xs ect-text-gray-500 ect-text-white ect-font-medium ect-leading-tight ect-absolute ect-top-[-.7rem] ect-left-[-1rem] ect-bg-text-success ect-rounded-xl ect-px-2 ect-py-1"},jh={key:1,class:"ect-flex ect-items-start ect-gap-4 ect-p-3 ect-px-4"},Dh={key:0,class:"ect-w-16 ect-h-16 ect-flex ect-items-center ect-justify-center ect-rounded-lg ect-bg-gray-200 ect-flex-shrink-0"},Bh=["src","alt"],$h={class:"ect-flex-1 ect-min-w-0"},Fh={class:"ect-flex ect-gap-4 ect-items-center ect-justify-between"},Vh={class:"ect-flex ect-flex-row ect-gap-3"},Hh=b("div",{class:"ect-w-px ect-h-auto ect-bg-gray-200 ect-mx-2"},null,-1),Uh={class:"ect-flex ect-flex-col ect-max-w-[125px]"},zh={class:"ect-flex ect-items-start ect-justify-center ect-ml-2 ect-mt-0"},Kh=["innerHTML"],Zh={key:0,class:"ect-flex ect-flex-wrap ect-gap-2.5 ect-mt-2"},Qh=["data-test-id"],Xh=["data-test-id"],Jh={key:1,class:"ect-inline-block ect-mb-2"},Wh={key:2,class:"ect-flex ect-flex-col ect-gap-3 ect-p-3 ect-h-full ect-justify-between"},Gh={class:"ect-flex ect-items-start ect-gap-2"},Yh={class:"ect-w-16 ect-h-16 ect-rounded-lg ect-bg-gray-200 ect-flex-shrink-0 ect-overflow-hidden"},e9=["src","alt"],t9={class:"ect-flex-1 ect-min-w-0"},n9={class:"ect-text-sm ect-font-semibold ect-text-gray-900 ect-leading-tight"},r9={class:"ect-mt-1 ect-text-sm ect-text-gray-700 ect-leading-tight"},i9={class:"ect-flex ect-items-start ect-justify-center ect-ml-2 ect-mt-0"},o9={key:0,class:"ect-flex ect-flex-wrap ect-gap-1.5"},a9=["data-test-id"],s9=["data-test-id"],l9={key:1,class:"ect-inline-block ect-mb-2"},c9={class:"ect-flex ect-justify-between ect-items-center"},u9={class:"ect-flex ect-flex-col"},f9=b("p",{class:"ect-text-xs ect-text-gray-500 ect-font-medium ect-leading-tight"},"Price",-1),d9={key:3,"data-test-id":"configurator-item-slot-details",class:"ect-bg-white ect-rounded-md"},h9={__name:"ConfiguratorItem",props:{item:{type:Object,required:!0},name:{type:String,required:!0},description:{type:String,default:""},imageUrl:{type:String,default:""},price:{type:Number,required:!0},quantity:{type:Number,default:1},selected:{type:Boolean,default:!1},tags:{type:Array,default:()=>[]},attributes:{type:Array,default:()=>[]},size:{type:Number,default:1},minQuantity:{type:Number,default:null},maxQuantity:{type:Number,default:null},showImage:{type:Boolean,default:!1},option:{type:Object,default:null},isAttributes:{type:Boolean,default:!1},showAttributes:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:quantity","update:name","edit-attributes"],setup(e,{emit:t}){const n=e,r=t,i=ae(null),o=ae(0),a=ae(n.item),s=be(()=>a.value.relationshipInfo.relationship==="Kit"?"ect-bg-green-3 ect-border-gray-200 ect-border-success":n.disabled?"ect-bg-light-bg-x ect-border-gray-200":n.selected?"ect-bg-green-3 ect-border-gray-200 ect-border-success":"ect-bg-white ect-border-gray-200 hover:ect-border-success"),l=be({get:()=>n.quantity,set:h=>r("update:quantity",h)}),p=be({get:()=>n.name,set:h=>r("update:name",h)}),c=h=>{r("update:quantity",h)},f=be(()=>{if(o.value===0)return n.tags;const g=Math.floor(o.value/120);return n.tags.slice(0,Math.max(1,g))}),u=be(()=>Math.max(0,n.tags.length-f.value.length)),m=()=>{if(i.value){const h=i.value,g=80,d=120,v=32,_=64;o.value=h.offsetWidth-g-d-v-_}};return xn(()=>{Ut(()=>{m()})}),St(()=>n.tags,()=>{Ut(()=>{m()})},{deep:!0}),xn(()=>{window.addEventListener("resize",m)}),(h,g)=>(X(),ne("div",{ref_key:"containerRef",ref:i,class:Ie(["ect-w-full ect-rounded-md ect-border-1 ect-transition-colors ect-relative",s.value]),"data-test-id":`configurator-item-${e.item.itemId}`,"data-publish-key":e.item.publishKey},[e.item.relationshipInfo.relationship==="Kit"?(X(),ne("div",qh," KIT ")):ye("",!0),e.size===1?(X(),ne("div",jh,[e.showImage?(X(),ne("div",Dh,[e.imageUrl?(X(),ne("img",{key:0,src:e.imageUrl,alt:p.value,class:"ect-w-full ect-h-full ect-object-cover"},null,8,Bh)):(X(),Te(Ge,{key:1,disabled:"",icon:"image",symbol:"",size:20,color:"#ACACAC"}))])):ye("",!0),b("div",$h,[b("div",Fh,[_e(ka,{modelValue:p.value,"onUpdate:modelValue":g[0]||(g[0]=d=>p.value=d),tag:"h3",class:"ect-text-sm ect-font-semibold ect-text-gray-900 ect-leading-tight"},null,8,["modelValue"]),b("div",Vh,[b("div",{onClick:g[2]||(g[2]=Tt(()=>{},["stop"]))},[_e(zi,{value:l.value,"onUpdate:value":g[1]||(g[1]=d=>l.value=d),min:e.minQuantity,max:e.maxQuantity,"data-test-id":`configurator-item-counter-${e.item.itemId}`,onChange:c},null,8,["value","min","max","data-test-id"])]),Hh,b("div",Uh,[_e(ka,{modelValue:a.value.price,"onUpdate:modelValue":g[3]||(g[3]=d=>a.value.price=d),tag:"p",type:"currency",class:"ect-text-base ect-font-bold"},null,8,["modelValue"])]),b("div",zh,[Ze(h.$slots,"selection-control")])])]),b("p",{class:"ect-mt-2 ect-text-sm ect-text-gray-700 ect-leading-tight",innerHTML:e.description},null,8,Kh),e.isAttributes&&e.showAttributes&&e.selected?(X(),ne("div",Zh,[a.value.getTags().length>0?(X(),ne(Oe,{key:0},[(X(!0),ne(Oe,null,ze(f.value,(d,v)=>(X(),ne("span",{key:v,class:"ect-inline-block"},[_e(Zt,{label:d.label,value:d.value},null,8,["label","value"])]))),128)),u.value>0?(X(),ne("button",{key:0,type:"button",class:"ect-text-xs ect-text-gray-700 ect-border ect-border-gray-300 ect-rounded-md ect-px-2 ect-py-0.5","data-test-id":`configurator-item-button-more-tags-${e.item.itemId}`,onClick:g[4]||(g[4]=Tt(()=>{},["stop"]))}," +"+ve(u.value)+" more ",9,Qh)):ye("",!0),e.selected?(X(),ne("button",{key:1,"data-test-id":`configurator-item-button-edit-attributes-${e.item.itemId}`,onClick:g[5]||(g[5]=d=>r("edit-attributes"))},[_e(Zt,{label:"Edit attributes","edit-button":""})],8,Xh)):ye("",!0)],64)):(X(),ne("span",Jh,[b("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:g[6]||(g[6]=d=>r("edit-attributes"))},[_e(Zt,{label:"Add attributes","add-button":""})])]))])):ye("",!0)])])):(X(),ne("div",Wh,[b("div",Gh,[b("div",Yh,[e.imageUrl?(X(),ne("img",{key:0,src:e.imageUrl,alt:e.name,class:"ect-w-full ect-h-full ect-object-cover"},null,8,e9)):ye("",!0)]),b("div",t9,[b("h3",n9,ve(e.name),1),b("p",r9,ve(e.description),1)]),b("div",i9,[Ze(h.$slots,"selection-control")])]),e.isAttributes&&e.showAttributes&&e.selected?(X(),ne("div",o9,[a.value.getTags().length>0?(X(),ne(Oe,{key:0},[(X(!0),ne(Oe,null,ze(f.value,(d,v)=>(X(),ne("span",{key:v,class:"ect-inline-block"},[_e(Zt,{label:d.label,value:d.value},null,8,["label","value"])]))),128)),u.value>0?(X(),ne("button",{key:0,type:"button",class:"ect-text-xs ect-text-gray-700 ect-border ect-border-gray-300 ect-rounded-md ect-px-2 ect-py-0.5","data-test-id":`configurator-item-button-more-tags-${e.item.itemId}`,onClick:g[7]||(g[7]=Tt(()=>{},["stop"]))}," +"+ve(u.value)+" more ",9,a9)):ye("",!0),e.selected?(X(),ne("button",{key:1,class:"ect-ml-auto","data-test-id":`configurator-item-button-edit-attributes-${e.item.itemId}`,onClick:g[8]||(g[8]=d=>r("edit-attributes"))},[_e(Zt,{label:"Edit attributes","edit-button":""})],8,s9)):ye("",!0)],64)):(X(),ne("span",l9,[b("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:g[9]||(g[9]=d=>r("edit-attributes"))},[_e(Zt,{label:"Add attributes","add-button":""})])]))])):ye("",!0),b("div",c9,[b("div",{onClick:g[11]||(g[11]=Tt(()=>{},["stop"]))},[_e(zi,{value:l.value,"onUpdate:value":g[10]||(g[10]=d=>l.value=d),min:e.minQuantity,max:e.maxQuantity,"data-test-id":`configurator-item-counter-${e.item.itemId}`,onChange:c},null,8,["value","min","max","data-test-id"])]),b("div",u9,[f9,_e(ka,{modelValue:a.value.price,"onUpdate:modelValue":g[12]||(g[12]=d=>a.value.price=d),tag:"p",type:"currency",class:"ect-w-[125px] ect-text-base ect-font-bold"},null,8,["modelValue"])])])])),e.selected&&e.isAttributes?(X(),ne("div",d9,[Ze(h.$slots,"default")])):ye("",!0)],10,Mh))}},p9={"af-ZA":",","sq-AL":",","ar-DZ":",","ar-BH":"٫","ar-EG":"٫","ar-IQ":"٫","ar-JO":"٫","ar-KW":"٫","ar-LB":"٫","ar-LY":",","ar-MA":",","ar-OM":"٫","ar-QA":"٫","ar-SA":"٫","ar-SD":"٫","ar-SY":"٫","ar-TN":",","ar-AE":"٫","ar-YE":"٫","hy-AM":",","az-AZ":",","bn-BD":".","bn-IN":".","eu-ES":",","be-BY":",","bs-BA":",","bg-BG":",","my-MM":".","ca-ES":",","ca-ES-EURO":",","zh-CN":".","zh-CN-PINYIN":".","zh-CN-STROKE":".","zh-HK":".","zh-HK-STROKE":".","zh-MO":".","zh-SG":".","zh-TW":".","zh-TW-STROKE":".","hr-HR":",","cs-CZ":",","da-DK":",","nl-AW":",","nl-BE":",","nl-NL":",","nl-SR":",","dz-BT":".","en-AG":".","en-AU":".","en-BS":".","en-BB":".","en-BZ":".","en-BM":".","en-BW":".","en-CM":".","en-CA":".","en-DE":",","en-KY":".","en-ER":".","en-FK":".","en-FJ":".","en-GM":".","en-GH":".","en-GI":".","en-GY":".","en-HK":".","en-IN":".","en-ID":".","en-IE":".","en-IE-EURO":".","en-JM":".","en-KE":".","en-LR":".","en-MG":".","en-MW":".","en-MY":".","en-MU":".","en-NA":".","en-NZ":".","en-NG":".","en-PK":".","en-PG":".","en-PH":".","en-RW":".","en-WS":".","en-SC":".","en-SL":".","en-SG":".","en-SX":".","en-SB":".","en-ZA":",","en-SH":".","en-SZ":".","en-TZ":".","en-TO":".","en-TT":".","en-UG":".","en-GB":".","en-US":".","en-VU":".","et-EE":",","fi-FI":",","fi-FI-EURO":",","fr-BE":",","fr-CA":",","fr-KM":",","fr-FR":",","fr-FR-EURO":",","fr-GN":",","fr-HT":",","fr-LU":",","fr-MR":",","fr-MC":",","fr-CH":",","fr-WF":",","ka-GE":",","de-AT":",","de-AT-EURO":",","de-BE":",","de-DE":",","de-DE-EURO":",","de-LU":",","de-LU-EURO":",","de-CH":".","el-GR":",","gu-IN":".","iw-IL":".","hi-IN":".","hu-HU":",","is-IS":",","in-ID":",","ga-IE":".","it-IT":",","it-CH":".","ja-JP":".","kn-IN":".","kk-KZ":",","km-KH":",","ko-KP":".","ko-KR":".","ky-KG":",","lo-LA":",","lv-LV":",","lt-LT":",","lu-CD":",","lb-LU":",","mk-MK":",","ms-BN":",","ms-MY":".","ml-IN":".","mt-MT":".","mi-NZ":".","mr-IN":".","ne-NP":".","no-NO":",","ps-AF":"٫","fa-IR":"٫","pl-PL":",","pt-AO":",","pt-BR":",","pt-CV":",","pt-MZ":",","pt-PT":",","pt-ST":",","ro-MD":",","ro-RO":",","rm-CH":".","rn-BI":",","ru-KZ":",","ru-RU":",","sr-BA":",","sr-RS":",","sh-BA":",","sh-ME":",","sh-ME-USD":",","sh-CS":",","sk-SK":",","sl-SI":",","so-DJ":".","so-SO":".","es-AR":",","es-BO":",","es-CL":",","es-CO":",","es-CR":",","es-CU":".","es-DO":".","es-EC":",","es-SV":".","es-GT":".","es-HN":".","es-MX":".","es-NI":".","es-PA":".","es-PY":",","es-PE":".","es-PR":".","es-ES":",","es-ES-EURO":",","es-US":".","es-UY":",","es-VE":",","sw-KE":".","sv-SE":",","tl-PH":".","tg-TJ":",","ta-IN":".","ta-LK":".","te-IN":".","th-TH":".","ti-ET":".","tr-TR":",","uk-UA":",","ur-PK":".","uz-LATN-UZ":",","vi-VN":",","cy-GB":".","xh-ZA":".","yo-BJ":".","zu-ZA":"."},m9={name:"CustomInput",components:{AppIcon:Ge},props:{editMode:{type:Boolean,default:!0},type:{type:String,default:"text"},max:{type:Number,default:500},label:{type:String,default:""},name:{type:String,default:""},showLabel:{type:Boolean,default:!0},modelValue:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},isReadOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},highlight:{type:Boolean,default:!1},placeholder:{type:String,default:""},error:{type:[Boolean,String],default:!1},cssClass:{type:Object,default:()=>({})},tooltip:{type:String,default:null},locale:{type:String,default:"en-US"},icon:{type:String,default:null},itooltip:{type:String,default:null},icolor:{type:String,default:"#7d7d7d"},ihover:{type:String,default:"#57c046"},icustom:{type:Boolean,default:!1},idisabled:{type:Boolean,default:!1},height:{type:Number,default:32},textAlignment:{type:String,default:"left"},decimalPrecision:{type:Number,default:0},allowNegatives:{type:Boolean,default:!1},size:{type:String,default:"medium"},dataTestId:{type:String,required:!0}},emits:["update:modelValue","iclick","blur"],data(){return{initialValue:"",decimalSeprator:".",ctrl:!1}},computed:{getValue(){return this.modelValue?this.type==="currency"?String(this.modelValue).replace(".",this.decimalSeprator):String(this.modelValue):""},error_message(){return typeof this.error=="string"?this.error:this.error===""?!1:this.error===!0?`${this.label||"Field"} is required`:this.error},isHighlight(){return(this.initialValue===""||this.initialValue===null)&&(this.modelValue===""||this.modelValue===null)?!1:this.initialValue!==this.modelValue}},created(){this.initialValue=this.modelValue,this.decimalSeprator=this.type==="currency"?p9[this.locale]:"."},methods:{handlerInput(e){const t=e.target.value;this.type==="currency"?this.$emit("update:modelValue",t.replace(this.decimalSeprator,".")):this.$emit("update:modelValue",t)},preventNonNumeric(e){if(this.type==="number"){const t=this.decimalPrecision,n=e.target.value,r=e.key;if(["Backspace","ArrowLeft","ArrowRight","Delete","Tab"].includes(r)||this.allowNegatives&&r==="-")return;if(r==="."&&t===0){e.preventDefault();return}if(r==="."&&n.includes(".")){e.preventDefault();return}if(r==="."||n.includes(".")&&!n.endsWith(".")&&r!=="Backspace"){const i=n.split(".");if(i.length>1&&i[1].length>=t){e.preventDefault();return}}if(isNaN(r)&&![".","Backspace","Tab"].includes(r)){e.preventDefault();return}}if(e.key==="Backspace"||this.ctrl)return!0;if(e.key==="Control"&&(this.ctrl=!0),this.type==="currency"||this.type==="number"){if(!this.getValue.includes(this.decimalSeprator)&&e.key===this.decimalSeprator)return!0;/[\deE+\-]/.test(e.key)||e.preventDefault()}return!0},handlerKeyup(e){e.key==="Control"&&(this.ctrl=!1)}}},g9=["data-test-id"],v9=["for","data-test-id"],y9=["data-test-id"],_9=["id","type","name","disabled","placeholder","value","maxlength","readonly","data-test-id"],b9=["data-test-id"],C9=["data-test-id"];function w9(e,t,n,r,i,o){const a=Or("AppIcon");return X(),ne("div",{class:"input","data-test-id":n.dataTestId},[n.label&&n.showLabel?(X(),ne("label",{key:0,class:Ie({error_color:!!n.error}),for:n.label,"data-test-id":`${n.dataTestId}-label`},[Fe(ve(n.label)+" ",1),n.required?(X(),ne("span",{key:0,class:Ie({error_color:!!n.error})},"*",2)):ye("",!0)],10,v9)):ye("",!0),n.editMode?(X(),ne("div",{key:1,class:Ie(["input-wrapper ect-w-full",{errorBorder_color:!!n.error,highlight:o.isHighlight&&n.highlight}]),"data-test-id":`${n.dataTestId}-wrapper`},[n.icon?(X(),Te(a,{key:0,class:"input-wrapper_icon",icon:n.icon,hover:n.ihover,color:n.icolor,size:19,disabled:n.idisabled,custom:n.icustom,tooltip:n.itooltip,"data-test-id":`${n.dataTestId}-icon`,direction:"top-right",onClick:t[0]||(t[0]=s=>e.$emit("iclick"))},null,8,["icon","hover","color","disabled","custom","tooltip","data-test-id"])):ye("",!0),b("input",{id:n.label,class:Ie(`ectheme-input-box ${n.size}`),type:n.type,style:tt({width:n.icon?"calc(100% - 36px)":"100%",height:`${n.height}px`,textAlign:n.textAlignment}),name:n.name,disabled:n.disabled,placeholder:n.placeholder,value:o.getValue,maxlength:n.max,readonly:n.isReadOnly,"data-test-id":`${n.dataTestId}-input`,onInput:t[1]||(t[1]=(...s)=>o.handlerInput&&o.handlerInput(...s)),onKeydown:t[2]||(t[2]=(...s)=>o.preventNonNumeric&&o.preventNonNumeric(...s)),onKeyup:t[3]||(t[3]=(...s)=>o.handlerKeyup&&o.handlerKeyup(...s)),onBlur:t[4]||(t[4]=s=>e.$emit("blur"))},null,46,_9)],10,y9)):ye("",!0),n.editMode?ye("",!0):(X(),ne("p",{key:2,class:"value","data-test-id":`${n.dataTestId}-value`},ve(o.getValue),9,b9)),o.error_message?(X(),ne("div",{key:3,class:"error_tooltip error_tooltip-bottom-right","data-test-id":`${n.dataTestId}-error`},ve(o.error_message),9,C9)):ye("",!0)],8,g9)}const x9=Ve(m9,[["render",w9],["__scopeId","data-v-032ca141"]]),k9={name:"AtomSpinner",props:{dataTestId:{type:String,default:""}}},E9=["data-test-id"];function O9(e,t,n,r,i,o){return X(),ne("div",{class:"spinner","data-test-id":n.dataTestId},null,8,E9)}const S9={name:"CustomDropdown",components:{AppIcon:Ge,AtomSpinner:Ve(k9,[["render",O9],["__scopeId","data-v-771ed032"]])},props:{label:{type:String,default:""},placeholder:{type:String,default:""},options:{type:Array,default:()=>[]},display:{type:Array,default:()=>[]},modelValue:{type:String,default:""},error:{type:[Boolean,String],default:!1},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},select:{type:Boolean,default:!1},lookup:{type:Boolean,default:!1},search:{type:Boolean,default:!1},badge:{type:String,default:void 0},highlight:{type:Boolean,default:!1},property:{type:Object,default:()=>({key:"value",value:"label",assigned:"assigned"})},dropdownTheme:{type:String,default:"light"},icon:{type:String,default:""},size:{type:String,default:"medium"},dataTestId:{type:String,required:!0}},emits:["search","focus-in","focus-out","update:modelValue"],data:()=>({inputFocused:!1,value:"",isHover:!1,highlightedIndex:-1,initialValue:"",teleportStyle:{position:"absolute",top:"0px",left:"0px",width:"0px"}}),computed:{isHighlight(){return(this.initialValue===""||this.initialValue==null)&&(this.modelValue===""||this.modelValue==null)?!1:this.initialValue!==this.modelValue},error_message(){return this.error===""?!1:this.error===!0?`${this.label||"Field"} is required`:this.error},getOptions(){if(this.select&&this.search){const e=this.value.toLowerCase();return this.options.filter(t=>JSON.stringify(t).toLowerCase().includes(e))}else return this.options},getSelected(){let e=null;if(this.modelValue)e=this.options.find(t=>t[this.property.key]===this.modelValue);else if(!this.search){const t=this.options.find(n=>n[this.property.key]==="");t?e=t:this.placeholder?e={[this.property.value]:this.placeholder,[this.property.key]:""}:e={[this.property.value]:"--Select--",[this.property.key]:""}}return e||{[this.property.value]:this.placeholder||"--Select--",[this.property.key]:""}},shouldShowAbove(){if(!this.$refs.triggerElement)return!1;const e=this.$refs.triggerElement.getBoundingClientRect(),t=250,n=window.innerHeight-e.bottom,r=e.top;return n<t&&r>t},dropdownStyle(){if(!this.$refs.triggerElement)return{};const e=this.$refs.triggerElement.getBoundingClientRect(),t=250,n=window.innerHeight-e.bottom,r=e.top,i=n<t&&r>t;return{position:"absolute",top:i?"auto":"100%",bottom:i?"100%":"auto",left:"0",width:"100%",zIndex:1e3}}},created(){this.initialValue=this.modelValue},mounted(){window.addEventListener("resize",this.updateDropdownPosition),window.addEventListener("scroll",this.updateDropdownPosition,!0)},beforeUnmount(){window.removeEventListener("resize",this.updateDropdownPosition),window.removeEventListener("scroll",this.updateDropdownPosition,!0)},methods:{updateDropdownPosition(){if(!this.$refs.triggerElement)return;const e=this.$refs.triggerElement.getBoundingClientRect(),t=200,n=window.innerHeight-e.bottom,r=e.top,i=n<t&&r>t;this.teleportStyle={position:"absolute",top:`${i?e.top-t:e.bottom}px`,left:`${e.left}px`,width:`${e.width}px`,zIndex:9999}},subFieldsText(e){if(!this.display||this.display.length<1)return"";const t=[];return this.display.forEach(n=>{const r=this.subField(e,n);r&&t.push(r)}),t.join(" | ")},subField(e,t){return t?t.split(".").reduce((i,o)=>i[o]||"",e):e},lookupSearchHandler:wc(function(e){this.value=e,this.search&&!this.select&&this.$emit("search",e)}),handlerFocusIn(){!(this.modelValue&&this.search)&&!this.disabled&&(this.inputFocused=!0,this.updateDropdownPosition(),this.$emit("focus-in"))},updateSelected(e){e&&(this.value="",this.$emit("update:modelValue",e[this.property.key]),this.search&&!this.select&&!this.lookup&&this.$emit("search",""),this.onInputFocusedOut(!0))},clear(){this.disabled||(this.value="",this.$emit("update:modelValue",null),this.search&&!this.select&&!this.lookup&&this.$emit("search",""))},onInputFocusedOut(e=!1){(!this.isHover||e)&&!this.disabled&&(e?(this.highlightedIndex=-1,this.inputFocused=!1,this.$emit("focus-out")):setTimeout(()=>{this.highlightedIndex=-1,this.inputFocused=!1,this.$emit("focus-out")},100))},highlightNextOption(){this.highlightedIndex<this.options.length-1&&this.highlightedIndex++},highlightPreviousOption(){this.highlightedIndex>0&&this.highlightedIndex--}}},I9=["data-test-id"],A9=["for","data-test-id"],T9={class:"input-container-box ect-grow ect-w-full"},N9=["data-test-id"],P9=["placeholder","disabled","data-test-id"],L9=["data-test-id"],R9=["title","data-test-id"],M9=["data-test-id"],q9=["data-test-id"],j9=["data-test-id"],D9=["data-test-id"],B9=["data-test-id","onClick"],$9=["data-test-id"],F9={class:"ect-text-font-clr-light ect-flex ect-gap-2 ect-items-center ect-justify-between ect-w-full"},V9=["data-test-id"],H9=["data-test-id"],U9=["data-test-id"],z9=["title","data-test-id"],K9=["data-test-id"];function Z9(e,t,n,r,i,o){const a=Or("AppIcon"),s=Or("AtomSpinner");return X(),ne("div",{ref:"dropdownWrapper",class:Ie(["customdropdown input-container",{dark:n.dropdownTheme==="dark"}]),"data-test-id":n.dataTestId,onMouseenter:t[7]||(t[7]=l=>e.isHover=!0),onMouseleave:t[8]||(t[8]=l=>e.isHover=!1)},[n.label?(X(),ne("label",{key:0,class:Ie(["title_label",{error_color:!!n.error}]),for:n.label,"data-test-id":`${n.dataTestId}-label`},[Fe(ve(n.label)+" ",1),n.required?(X(),ne("span",{key:0,class:Ie({error_color:!!n.error})},"*",2)):ye("",!0)],10,A9)):ye("",!0),b("div",T9,[b("div",{ref:"triggerElement",class:Ie(["input-wrapper ectheme-input-box ect-w-full",{disabled:n.disabled,"input-error":n.error,highlight:o.isHighlight&&n.highlight,"size-large":n.size==="large","size-medium":n.size==="medium"||n.size==="small"}]),"data-test-id":`${n.dataTestId}-trigger`,tabindex:"0",onFocusin:t[2]||(t[2]=(...l)=>o.handlerFocusIn&&o.handlerFocusIn(...l)),onFocusout:t[3]||(t[3]=l=>o.onInputFocusedOut(!1)),onKeydown:[t[4]||(t[4]=qr(l=>o.updateSelected(n.options[e.highlightedIndex]),["enter"])),t[5]||(t[5]=qr(Tt((...l)=>o.highlightPreviousOption&&o.highlightPreviousOption(...l),["prevent"]),["up"])),t[6]||(t[6]=qr(Tt((...l)=>o.highlightNextOption&&o.highlightNextOption(...l),["prevent"]),["down"]))]},[!n.modelValue&&n.search?Cn((X(),ne("input",{key:0,ref:"searchInput","onUpdate:modelValue":t[0]||(t[0]=l=>e.value=l),type:"text",name:"search",placeholder:n.placeholder,autocomplete:"off",disabled:n.disabled,"data-test-id":`${n.dataTestId}-search-input`,onInput:t[1]||(t[1]=Tt(l=>o.lookupSearchHandler(l.target.value),["prevent"]))},null,40,P9)),[[Di,e.value]]):(X(),ne("div",{key:1,class:Ie(["selection-name ect-text-text-primary-dark ect-flex ect-justify-between ect-items-center",{"size-large":n.size==="large","size-medium":n.size==="medium"||n.size==="small"}]),"data-test-id":`${n.dataTestId}-selection`},[o.getSelected?(X(),ne(Oe,{key:0},[b("span",{title:o.getSelected[n.property.value],class:Ie(["ect-flex ect-items-center ect-gap-2 ect-font-medium",{"ect-text-font-clr-light":!n.modelValue}]),"data-test-id":`${n.dataTestId}-selection-value`},[n.icon?(X(),Te(a,{key:0,class:"ect-mr-0",icon:n.icon,size:14,color:"#5F5F5F","data-test-id":`${n.dataTestId}-selection-icon`},null,8,["icon","data-test-id"])):ye("",!0),Fe(" "+ve(o.getSelected[n.property.value]),1)],10,R9),n.badge&&o.getSelected[n.badge]?(X(),ne("span",{key:0,class:"badge ect-bg-btn ect-rounded-[5px] ect-py-[2px] ect-px-[10px] ect-text-white","data-test-id":`${n.dataTestId}-selection-badge`},ve(o.getSelected[n.badge]),9,M9)):ye("",!0)],64)):ye("",!0)],10,L9)),n.search?(X(),ne(Oe,{key:2},[n.loading?(X(),Te(s,{key:0,class:"spinner","data-test-id":`${n.dataTestId}-loading-spinner`},null,8,["data-test-id"])):(X(),ne("div",{key:1,class:"clear-button","data-test-id":`${n.dataTestId}-action-button`},[e.value||n.modelValue?(X(),Te(a,{key:0,disabled:n.disabled,icon:"close",color:"#acacac",size:10,"data-test-id":`${n.dataTestId}-clear-button`,onClick:o.clear},null,8,["disabled","data-test-id","onClick"])):(X(),Te(a,{key:1,icon:"search",size:14,color:"#acacac",disabled:n.disabled,"data-test-id":`${n.dataTestId}-search-button`},null,8,["disabled","data-test-id"]))],8,q9))],64)):(X(),Te(a,{key:3,class:"clear-button",color:o.error_message?"#ff6a6a":"#acacac",icon:"arrow_drop_up",size:12,disabled:n.disabled,"data-test-id":`${n.dataTestId}-dropdown-arrow`},null,8,["color","disabled","data-test-id"]))],42,N9),o.error_message?(X(),ne("div",{key:0,class:"error_tooltip error_tooltip-bottom-right","data-test-id":`${n.dataTestId}-error`},ve(o.error_message),9,j9)):ye("",!0),o.getOptions&&e.inputFocused&&!n.disabled&&(n.select||n.lookup)?(X(),ne("div",{key:1,ref:"dropdown",class:Ie(["dropdown",{"dropdown-above":o.shouldShowAbove}]),style:tt(o.dropdownStyle),"data-test-id":`${n.dataTestId}-dropdown`},[(X(!0),ne(Oe,null,ze(o.getOptions,(l,p)=>(X(),ne("div",{key:l[n.property.key],class:Ie(["dropdown-item",{highlighted:p===e.highlightedIndex,"ect-pointer-events-none":l[n.property.assigned]}]),"data-test-id":`${n.dataTestId}-option-${p}`,onClick:c=>o.updateSelected(l)},[b("div",{class:"name ect-items-center","data-test-id":`${n.dataTestId}-option-${p}-name`},[b("span",F9,[b("span",{class:Ie({"ect-text-zinc-400":l[n.property.assigned]}),"data-test-id":`${n.dataTestId}-option-${p}-value`},ve(l[n.property.value]==null?"Key and Value is Wrong":l[n.property.value]),11,V9),l[n.property.assigned]?(X(),ne("span",{key:0,class:"ect-text-xs ect-leading-4 ect-text-zinc-600","data-test-id":`${n.dataTestId}-option-${p}-assigned`},"Assigned",8,H9)):ye("",!0)]),n.badge?(X(),ne("span",{key:0,class:"badge ect-bg-btn ect-rounded-[5px] ect-py-[2px] ect-px-[10px] ect-text-white","data-test-id":`${n.dataTestId}-option-${p}-badge`},ve(l[n.badge]),9,U9)):ye("",!0)],8,$9),b("div",{class:"info",title:o.subFieldsText(l),"data-test-id":`${n.dataTestId}-option-${p}-info`},[b("span",null,ve(o.subFieldsText(l)),1)],8,z9)],10,B9))),128)),!o.getOptions.length&&!n.loading&&(e.value||n.select)?(X(),ne("div",{key:0,class:"no-items-found","data-test-id":`${n.dataTestId}-no-options`}," no options found ",8,K9)):ye("",!0)],14,D9)):ye("",!0)])],42,I9)}const Pc=Ve(S9,[["render",Z9],["__scopeId","data-v-5ae4f6dc"]]);var ot=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rc={exports:{}};/*!
29
29
  * Quill Editor v1.3.7
30
30
  * https://quilljs.com/
31
31
  * Copyright (c) 2014, Jason Chen