@cimulate/copilot-widget 1.33.1 → 1.33.3
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.
- package/CHANGELOG.md +8 -0
- package/dist/cimulate-copilot-widget.es.js +1 -1
- package/dist/cimulate-copilot-widget.umd.js +1 -1
- package/dist/copilot.es.js +1 -1
- package/dist/copilot.umd.js +1 -1
- package/dist/messaging.es.js +341 -341
- package/dist/messaging.umd.js +13 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
`@cimulate/copilot-widget` follows [Semantic Versioning](https://semver.org/). Each entry is a released `package.json` version (deployed on merge to `master`), newest first.
|
|
4
4
|
|
|
5
|
+
## 1.33.3 — 2026-09-03
|
|
6
|
+
|
|
7
|
+
- Cart and order confirmation totals now show `$0.00` (or the locale equivalent) for tax and shipping when the amount is `0`, instead of the word "Free".
|
|
8
|
+
|
|
9
|
+
## 1.33.2 — 2026-09-03
|
|
10
|
+
|
|
11
|
+
- Increased the default conversation history display window from 1 hour to 24 hours in messaging mode. Shoppers now see up to 24 hours of prior conversation history when resuming a session (still capped at 200 messages by default, configurable via `conversationHistory.limit`). Copilot mode remains at 1 hour to preserve existing behavior for legacy customers.
|
|
12
|
+
|
|
5
13
|
## 1.33.1 — 2026-09-03
|
|
6
14
|
|
|
7
15
|
- Fixed order confirmations emitted through AgentScript not rendering when they use the observed `data.data.orderConfirmation` envelope. The widget continues to prefer the canonical `data.order.orderDetails` envelope when both are present and safely ignores malformed payloads.
|
|
@@ -6312,7 +6312,7 @@ const fP = {
|
|
|
6312
6312
|
showProductCaptions: !!oe,
|
|
6313
6313
|
resetConversationMessage: Y,
|
|
6314
6314
|
conversationHistory: {
|
|
6315
|
-
sinceHours: typeof (H == null ? void 0 : H.sinceHours) == "number" ? H.sinceHours : 1,
|
|
6315
|
+
sinceHours: typeof (H == null ? void 0 : H.sinceHours) == "number" ? H.sinceHours : R ? 24 : 1,
|
|
6316
6316
|
limit: H == null ? void 0 : H.limit
|
|
6317
6317
|
},
|
|
6318
6318
|
features: Ne,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
`);return u===-1?"":s.stack.slice(u+1)})();try{if(!r.stack)r.stack=a;else if(a){const u=a.indexOf(`
|
|
8
8
|
`),c=u===-1?-1:a.indexOf(`
|
|
9
9
|
`,u+1),d=c===-1?"":a.slice(c+1);String(r.stack).endsWith(d)||(r.stack+=`
|
|
10
|
-
`+a)}}catch(u){}}throw r}})}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ts(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:a}=n;r!==void 0&&ll.assertOptions(r,{silentJSONParsing:mn.transitional(mn.boolean),forcedJSONParsing:mn.transitional(mn.boolean),clarifyTimeoutError:mn.transitional(mn.boolean),legacyInterceptorReqResOrdering:mn.transitional(mn.boolean),advertiseZstdAcceptEncoding:mn.transitional(mn.boolean),validateStatusUndefinedResolves:mn.transitional(mn.boolean)},!1),s!=null&&($.isFunction(s)?n.paramsSerializer={serialize:s}:ll.assertOptions(s,{encode:mn.function,serialize:mn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ll.assertOptions(n,{baseUrl:mn.spelling("baseURL"),withXsrfToken:mn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=a&&$.merge(a.common,a[n.method]);a&&$.forEach(["delete","get","head","post","put","patch","query","common"],_=>{delete a[_]}),n.headers=pn.concat(u,a);const c=[];let d=!0;this.interceptors.request.forEach(function(A){if(typeof A.runWhen=="function"&&A.runWhen(n)===!1)return;d=d&&A.synchronous;const v=n.transitional||lf;v&&v.legacyInterceptorReqResOrdering?c.unshift(A.fulfilled,A.rejected):c.push(A.fulfilled,A.rejected)});const f=[];this.interceptors.response.forEach(function(A){f.push(A.fulfilled,A.rejected)});let p,m=0,b;if(!d){const _=[Dg.bind(this),void 0];for(_.unshift(...c),_.push(...f),b=_.length,p=Promise.resolve(n);m<b;)p=p.then(_[m++],_[m++]);return p}b=c.length;let y=n;for(;m<b;){const _=c[m++],A=c[m++];try{y=_(y)}catch(v){A.call(this,v);break}}try{p=Dg.call(this,y)}catch(_){return Promise.reject(_)}for(m=0,b=f.length;m<b;)p=p.then(f[m++],f[m++]);return p}getUri(t){t=ts(this.defaults,t);const n=Ag(t.baseURL,t.url,t.allowAbsoluteUrls,t);return mg(n,t.params,t.paramsSerializer)}};$.forEach(["delete","get","head","options"],function(t){ns.prototype[t]=function(n,r){return this.request(ts(r||{},{method:t,url:n,data:r&&$.hasOwnProp(r,"data")?r.data:void 0}))}}),$.forEach(["post","put","patch","query"],function(t){function n(r){return function(a,u,c){return this.request(ts(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:u}))}}ns.prototype[t]=n(),t!=="query"&&(ns.prototype[t+"Form"]=n(!0))});let nv=class D2{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(s=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](s);r._listeners=null}),this.promise.then=s=>{let a;const u=new Promise(c=>{r.subscribe(c),a=c}).then(s);return u.cancel=function(){r.unsubscribe(a)},u},t(function(a,u,c){r.reason||(r.reason=new da(a,u,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new D2(function(s){t=s}),cancel:t}}};function rv(e){return function(n){return e.apply(null,n)}}function iv(e){return $.isObject(e)&&e.isAxiosError===!0}const gf={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(gf).forEach(([e,t])=>{gf[t]=e});function Fg(e){const t=new ns(e),n=J0(ns.prototype.request,t);return $.extend(n,ns.prototype,t,{allOwnKeys:!0}),$.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Fg(ts(e,s))},n}const Ot=Fg(ca);Ot.Axios=ns,Ot.CanceledError=da,Ot.CancelToken=nv,Ot.isCancel=bg,Ot.VERSION=hf,Ot.toFormData=il,Ot.AxiosError=be,Ot.Cancel=Ot.CanceledError,Ot.all=function(t){return Promise.all(t)},Ot.spread=rv,Ot.isAxiosError=iv,Ot.mergeConfig=ts,Ot.AxiosHeaders=pn,Ot.formToJSON=e=>Tg($.isHTMLForm(e)?new FormData(e):e),Ot.getAdapter=Lg.getAdapter,Ot.HttpStatusCode=gf,Ot.default=Ot;const{Axios:D7,AxiosError:M7,CanceledError:F7,isCancel:B7,CancelToken:U7,VERSION:H7,all:z7,Cancel:j7,isAxiosError:$7,spread:V7,toFormData:q7,AxiosHeaders:Y7,HttpStatusCode:G7,formToJSON:W7,getAdapter:X7,mergeConfig:K7,create:Q7}=Ot;class sv{constructor(t,n,r,s=!1,a,u){Se(this,"CIMULATE_API_HEADER","x-cimulate-api-key");Se(this,"CIMULATE_SEARCH_API_HOST","search.cimulate");Se(this,"CIMULATE_SEARCH_API_PATH","api/v1");Se(this,"baseApiUrl");Se(this,"headers",{});Se(this,"fetchConfig",()=>Ke(this,null,function*(){try{const t=yield Ot.get(`${this.apiUrl}/configs/copilot`,{headers:this.headers}),{customer_config:n}=t.data,r=atob(n);return JSON.parse(r)}catch(t){throw console.error("Error fetching customer config:",t),t}}));Se(this,"_mapCopilotUrlToSearchUrl",(t="",n=!1)=>{if(t.endsWith("io")){const s=new URL(t);return s.hostname=s.hostname.replace(/^copilot\./,"api."),s.origin}return n?`https://staging.${this.CIMULATE_SEARCH_API_HOST}.ai`:`https://prod.${this.CIMULATE_SEARCH_API_HOST}.ai`});if(n&&r||!n&&!r)throw new Error("Provide exactly one authentication method: either 'apiKey' or 'apiToken', but not both.");n?this.headers[this.CIMULATE_API_HEADER]=n:r&&(this.headers.Authorization=`Bearer ${r}`),a&&(this.headers["x-cimulate-customer-id"]=a),u&&(this.headers["Tenant-ID"]=u),this.baseApiUrl=this._mapCopilotUrlToSearchUrl(t,s)}get apiUrl(){return`${this.baseApiUrl}/${this.CIMULATE_SEARCH_API_PATH}`}}class ov{constructor(t,n,r,s=!1,a,u){Se(this,"apiService");Se(this,"config",null);Se(this,"getConfig",()=>Ke(this,null,function*(){if(this.config)return this.config;try{const t=yield this.apiService.fetchConfig();return this.config=t,this.config}catch(t){throw console.error("Failed to fetch customer config:",t),t}}));Se(this,"getPid",t=>this.getProductFieldValue(t,"pidCol"));Se(this,"getName",t=>this.getProductFieldValue(t,"nameCol"));Se(this,"getDescription",t=>this.getProductFieldValue(t,"description"));Se(this,"getBrand",t=>this.getProductFieldValue(t,"productBrandCol"));Se(this,"getPrice",t=>this.getProductFieldValue(t,"priceCol"));Se(this,"getRelativePdp",t=>this.getProductFieldValue(t,"relativePdpCol"));Se(this,"getPdp",t=>this.getProductFieldValue(t,"pdpCol"));Se(this,"getImage",t=>this.getProductFieldValue(t,"imageCol"));Se(this,"getProductHiddenFields",()=>{const t=this.getProductField("productHiddenFields");return Array.isArray(t)?t:[]});Se(this,"getProductField",t=>this.config?this.config[t]:"");Se(this,"getProductFieldValue",(t,n)=>{const r=this.getProductField(n);return r&&t[r]||""});this.apiService=new sv(t,n,r,s,a,u)}getPriceDisplay(t){const n=this.getPrice(t);return n?typeof n=="string"?n.includes("$")?n:`$${n}`:typeof n=="number"?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(n):n:""}}const Ys=(e,t,n,...r)=>{if(!e)return;const s=["background: linear-gradient(90deg,rgba(253, 99, 99, 1) 0%, rgba(245, 139, 35, 1) 65%)","font-weight: bold","color: transparent","background-clip: text","text-fill-color: transparent"].join(";");console[t]("%c[cimulate-widget]",s,n,...r)};class av{constructor(t=!1){Se(this,"isDevelopment");Se(this,"_log",(t,n,...r)=>{Ys(this.isDevelopment,t,n,...r)});this.isDevelopment=t}log(t,...n){this._log("log",t,...n)}warn(t,...n){this._log("warn",t,...n)}error(t,...n){this._log("error",t,...n)}info(t,...n){this._log("info",t,...n)}debug(t,...n){this._log("debug",t,...n)}}const uv={copilot:"Your Search Assistant",messaging:"Commerce Client"},Bg=B.createContext(null),lv=({mode:e,logoUrl:t,headerText:n,headerConfig:r,globalClassName:s="",entryMessage:a,openLinksInNewTab:u=!1,disclaimerText:c,disclaimerMarkdown:d,clientContext:f,baseCatalogParams:p,searchPlaceholder:m,searchButtonLabel:b,searchConfig:y,suggestionButtonConfig:_,progressStepsLimit:A=3,messageAlignment:v="start",autoScroll:w=!0,showProductDescription:N=!1,componentConfig:C,conversationHistory:H,resetConversationMessage:Y="",apiKey:D,apiToken:q,baseUrl:ne,customerId:de,tenantId:V,theme:se,isDevelopment:pe,__features:ve,routingAttributes:re,enableDownloadTranscript:ae=!0,enableEscalationToAgent:xe=!1,showProductCaptions:oe=!1,staticQuestions:Q,staticQuestionsStrategy:ie="append",children:k})=>{const R=e==="messaging",ee=B.useMemo(()=>{const Ye=re==null?void 0:re.isCartMgmtSupported;return Ye===!0||Ye==="true"},[re]),O=B.useMemo(()=>R?{config:null}:new ov(ne,D,q,pe,de,V),[R,ne,D,q,pe,de,V]),_e=B.useMemo(()=>new av(pe),[pe]);B.useEffect(()=>{R||!O||O.config||O.getConfig()},[O,R]);const Be=B.useMemo(()=>fA(se),[se]),ye=B.useMemo(()=>{const Ye=(y==null?void 0:y.placeholder)||m,ht=(y==null?void 0:y.buttonLabel)||b;let $t="icon";return y!=null&&y.buttonType?$t=y.buttonType:b&&($t="text"),fe(F({},y||{}),{placeholder:Ye,buttonLabel:ht,buttonType:$t})},[y,m,b]),De=B.useMemo(()=>fe(F({},r||{}),{logoUrl:t||(r==null?void 0:r.logoUrl),headerText:(r==null?void 0:r.headerText)||n||uv[e!=null?e:"copilot"]}),[r,t,n,e]),Ue=B.useMemo(()=>({configModule:O,mode:e!=null?e:"copilot",headerConfig:De,entryMessage:a,staticQuestions:Q||[],staticQuestionsStrategy:ie,globalClassName:s,openLinksInNewTab:u,disclaimerText:c,disclaimerMarkdown:d,clientContext:f,baseCatalogParams:p,themeVariables:Be,logger:_e,searchConfig:ye,suggestionButtonConfig:_,progressStepsLimit:A,messageAlignment:v,autoScroll:w,showProductDescription:!!N,enableMinimize:!!(C!=null&&C.enableMinimize),enableDownloadTranscript:ae,enableEscalationToAgent:xe,showProductCaptions:!!oe,resetConversationMessage:Y,conversationHistory:{sinceHours:typeof(H==null?void 0:H.sinceHours)=="number"?H.sinceHours:1,limit:H==null?void 0:H.limit},features:ve,isCartMgmtSupported:ee}),[O,e,De,a,Q,ie,s,f,p,c,d,u,ye,_,v,w,N,C,ae,xe,A,oe,Y,_e,Be,H,ve,ee]);return S.jsx(Bg.Provider,{value:Ue,children:k})},tt=()=>{const e=B.useContext(Bg);if(!e)throw new Error("useConfig must be used within a ConfigProvider");return e};class cv{constructor(){Se(this,"initialState",{connected:!1,mode:"embedded",entryType:"search",status:{type:"dialog",isOpen:!1,isMinimized:!1},dialog:{position:"bottom-left",isFullHeight:!1,width:""},modal:{isFullscreen:!1}});Se(this,"connectedProxy");Se(this,"modeProxy");Se(this,"entryTypeProxy");Se(this,"statusProxy");Se(this,"dialogProxy");Se(this,"modalProxy",{isFullscreen:!1});Se(this,"_fullGet",(t,n)=>Reflect.get(t,n));Se(this,"_fullSet",(t,n,r)=>{if(!(n in t))throw new Error(`Property ${n} does not exist on UIState`);return mv(n,r),Reflect.set(t,n,r)});this.connectedProxy=new Proxy({connected:this.initialState.connected},{get:this._fullGet,set:this._fullSet}),this.modeProxy=new Proxy({mode:this.initialState.mode},{get:this._fullGet,set:this._fullSet}),this.entryTypeProxy=new Proxy({entryType:this.initialState.entryType},{get:this._fullGet,set:this._fullSet}),this.statusProxy=new Proxy({type:this.initialState.status.type,isOpen:this.initialState.status.isOpen,isMinimized:this.initialState.status.isMinimized},{get:this._fullGet,set:this._fullSet}),this.dialogProxy=new Proxy({position:this.initialState.dialog.position,isFullHeight:this.initialState.dialog.isFullHeight,width:this.initialState.dialog.width},{get:this._fullGet,set:this._fullSet}),this.modalProxy=new Proxy({isFullscreen:this.initialState.modal.isFullscreen},{get:this._fullGet,set:this._fullSet})}get connected(){return this.connectedProxy.connected}get mode(){return this.modeProxy.mode}get isOpen(){return!!this.statusProxy.isOpen}get isMinimized(){return!!this.statusProxy.isMinimized}get type(){return this.statusProxy.type}get entryType(){return this.entryTypeProxy.entryType}get position(){return this.dialogProxy.position}get state(){return{connected:this.connected,mode:this.mode,entryType:this.entryType,status:{type:this.type,isOpen:this.isOpen,isMinimized:this.isMinimized},dialog:{position:this.position,isFullHeight:this.dialogProxy.isFullHeight,width:this.dialogProxy.width},modal:{isFullscreen:this.modalProxy.isFullscreen}}}}const Je=new cv,rs=()=>Je.connected,fa=()=>Je.isOpen,Ef="cimulate.widget.minimizedOnNav";function dv(){try{const e=sessionStorage.getItem(Ef)==="1";return sessionStorage.removeItem(Ef),e}catch(e){return!1}}function fv(){try{sessionStorage.removeItem(Ef)}catch(e){return}}const hv=e=>{window.addEventListener(Jd,e)},pv=e=>{window.removeEventListener(Jd,e)},mv=(e,t)=>{const n=new CustomEvent(Jd,{detail:{property:e,value:t}});window.dispatchEvent(n)},gv=e=>{Je.connectedProxy.connected=e},ha=e=>{if(!aA(e)){const t=G0.map(r=>`'${r}'`),n=`${t.slice(0,-1).join(", ")}, or ${t[t.length-1]}`;throw new Error(`Invalid entryType: "${e}". Must be ${n}.`)}Je.entryTypeProxy.entryType=e},ei=e=>{const t=Je.statusProxy.isOpen,n=typeof e=="boolean"?e:!t;Je.statusProxy.isOpen=n,n&&(Je.statusProxy.isMinimized=!1,fv())},pa=e=>{const t=Je.statusProxy.isMinimized,n=typeof e=="boolean"?e:!t;Je.statusProxy.isMinimized=n,n&&(Je.statusProxy.isOpen=!1)},yf=e=>{Je.modalProxy.isFullscreen=e},cl=e=>{if(!["chat","dialog","modal"].includes(e))throw new Error(`Invalid type: ${e}. Must be 'chat', 'dialog', or 'modal'.`);Je.statusProxy.type=e,e==="dialog"||e==="chat"?Je.modeProxy.mode="embedded":Je.modeProxy.mode="standalone"},Tf=e=>{const t=["top","top-left","top-right","bottom","bottom-left","bottom-right","left","right","center"];if(!t.includes(e))throw new Error(`Invalid position: ${e}. Must be one of ${t.join(", ")}.`);Je.dialogProxy.position=e},Ev=e=>{const t=Je.dialogProxy.isFullHeight,n=typeof e=="boolean"?e:!t;Je.dialogProxy.isFullHeight=n},yv=({onCopilotEvent:e,children:t,dispatch:n})=>{const{logger:r}=tt(),s=B.useCallback(C=>{n({type:gt.SET_COPILOT,payload:C})},[n]),a=B.useCallback(C=>{gv(C),n({type:gt.SET_CONNECTED,payload:C})},[n]),u=B.useCallback(()=>{n({type:gt.RESET_COPILOT,payload:{}})},[n]),c=B.useCallback(()=>{n({type:gt.RESET_STATE,payload:{}})},[n]),d=B.useCallback(C=>{r==null||r.log(`${C.name} event received`,C),n({type:gt.ADD_MESSAGE,payload:C}),C.bypassHandlers||e==null||e(C)},[e,r,n]),f=B.useCallback(C=>{n({type:gt.ADD_LOADING_MESSAGE,payload:C})},[n]),p=B.useCallback(C=>{n({type:gt.REMOVE_LOADING_MESSAGE,payload:C})},[n]),m=B.useCallback(C=>{d(C),f(C.id)},[d,f]),b=B.useCallback(C=>{n({type:gt.SET_ACTIVE_CONVERSATION_ID,payload:C})},[n]),y=B.useCallback(C=>{n({type:gt.ADD_CONVERSATION_ID,payload:C})},[n]),_=B.useCallback(C=>{n({type:gt.SET_CONVERSATION_IDS,payload:C})},[n]),A=B.useCallback(C=>{n({type:gt.SET_IMAGE_FILE,payload:C})},[n]),v=B.useCallback(C=>{n({type:gt.SET_ASK_CIM_PROMPTS,payload:C})},[n]),w=B.useCallback(C=>{n({type:gt.SET_CONVERSATION_HISTORY_LOADED,payload:C})},[n]),N=B.useMemo(()=>({setCopilot:s,setConnected:a,resetCopilot:u,resetCopilotState:c,addCopilotEvent:d,addLoadingMessage:f,removeLoadingMessage:p,handleCopilotRequestAck:m,setActiveConversationId:b,addConversationId:y,setConversationIds:_,setImageFile:A,setAskCimPrompts:v,setConversationHistoryLoaded:w}),[s,a,u,c,d,f,p,m,b,y,_,A,v,w]);return S.jsx(K0.Provider,{value:N,children:t})};iA();const Tv=(e,t)=>{const{type:n,payload:r}=t;if(n===gt.ADD_MESSAGE){const s=r;if(e.messages.push(s),s.eventSourceId){const a=e.groupedMessages.findIndex(u=>u.eventSourceId===s.eventSourceId);if(a!==-1){let u=e.groupedMessages[a].messages;u||(u=[]);const c=u.findIndex(d=>d.id===s.id);if(c!==-1){u[c]=s;return}u.push(s);return}else{e.groupedMessages.push({type:"group",eventSourceId:s.eventSourceId,messages:[s],createdAt:new Date(s.createdAt)});return}}e.groupedMessages.push({type:"individual",message:s,createdAt:new Date(s.createdAt)});return}switch(n){case gt.RESET_STATE:e.messages=Ji.messages,e.groupedMessages=Ji.groupedMessages,e.loadingMessages=Ji.loadingMessages,e.imageFile=Ji.imageFile,e.askCimPrompts=Ji.askCimPrompts,e.conversationHistoryLoaded=Ji.conversationHistoryLoaded;break;case gt.RESET_COPILOT:e.copilot=null;break;case gt.SET_COPILOT:e.copilot=r;break;case gt.SET_CONNECTED:e.connected=r;break;case gt.ADD_LOADING_MESSAGE:e.loadingMessages.add(r);break;case gt.REMOVE_LOADING_MESSAGE:e.loadingMessages.delete(r);break;case gt.SET_ACTIVE_CONVERSATION_ID:e.activeConversationId=r;break;case gt.ADD_CONVERSATION_ID:{const s=r;e.conversationIds.includes(s)||e.conversationIds.push(s)}break;case gt.SET_CONVERSATION_IDS:e.conversationIds=r;break;case gt.SET_IMAGE_FILE:e.imageFile=r;break;case gt.SET_ASK_CIM_PROMPTS:e.askCimPrompts.requestId=(r==null?void 0:r.requestId)||null,e.askCimPrompts.message=(r==null?void 0:r.message)||null;break;case gt.SET_CONVERSATION_HISTORY_LOADED:e.conversationHistoryLoaded=r;break}},bv=({onCopilotEvent:e,children:t})=>{const[n,r]=q0(Tv,Ji);return S.jsx(X0.Provider,{value:n,children:S.jsx(yv,{onCopilotEvent:e,dispatch:r,children:t})})};function _v(){var e=B.useRef(!0);return e.current?(e.current=!1,!0):e.current}function Sv(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.addEventListener&&e.addEventListener.apply(e,t)}function xv(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.removeEventListener&&e.removeEventListener.apply(e,t)}var bf=typeof window!="undefined",ma=function(e){B.useEffect(e,[])},wv=function(e){var t=B.useRef(e);t.current=e,ma(function(){return function(){return t.current()}})},Av=function(e){var t=B.useRef(0),n=B.useState(e),r=n[0],s=n[1],a=B.useCallback(function(u){cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){s(u)})},[]);return wv(function(){cancelAnimationFrame(t.current)}),[r,a]},Cv=function(e,t){return e===t};function vv(e,t){t===void 0&&(t=Cv);var n=B.useRef(),r=B.useRef(e),s=_v();return!s&&!t(r.current,e)&&(n.current=r.current,r.current=e),n.current}var kv=function(e){var t={},n=t.initialWidth,r=n===void 0?1/0:n,s=t.initialHeight,a=s===void 0?1/0:s,u=t.onChange,c=Av({width:bf?window.innerWidth:r,height:bf?window.innerHeight:a}),d=c[0],f=c[1];return B.useEffect(function(){if(bf){var p=function(){var m=window.innerWidth,b=window.innerHeight;f({width:m,height:b}),u&&u(m,b)};return Sv(window,"resize",p),function(){xv(window,"resize",p)}}},[]),d};class Nv{constructor(){Se(this,"items",[]);Se(this,"add",t=>{const n=this.first();n&&n.context===t.context&&this.remove(),this.items.push(t)});Se(this,"remove",()=>this.items.shift());Se(this,"first",()=>this.items.length>0?this.items[0]:null);Se(this,"clear",()=>{this.items.length=0});Se(this,"processQueue",t=>{new Array(gn.size).fill(1).forEach(()=>{const r=gn.first();r&&(t(r),gn.remove())})})}get size(){return this.items.length}}const gn=new Nv,Ug=e=>{window.addEventListener(Qd,e)},Hg=e=>{window.removeEventListener(Qd,e)},Pv=(e,t,n)=>{const r=new CustomEvent(Qd,{detail:{event:e,property:t,value:n}});window.dispatchEvent(r)},zg=e=>{window.addEventListener(Kd,e)},jg=e=>{window.removeEventListener(Kd,e)},Ov=(e,t,n)=>{const r=new CustomEvent(Kd,{detail:{event:e,property:t,value:n}});window.dispatchEvent(r)},$g=e=>{window.addEventListener(Xd,e)},Vg=e=>{window.removeEventListener(Xd,e)},qg=(e,t,n)=>{const r=new CustomEvent(Xd,{detail:{property:e,value:t,event:n}});window.dispatchEvent(r)},Iv=e=>{window.addEventListener(ef,e)},Rv=e=>{window.removeEventListener(ef,e)},dl=(e,t,n)=>{const r=new CustomEvent(ef,{detail:{property:e,value:t,event:n}});window.dispatchEvent(r)};class Lv{constructor(){Se(this,"initialParams",{categoryId:"",categoryName:"",page:null,pageSize:null,includeFacets:!0,facetFilters:{},rangeFilters:[],catalogSegment:null,pricebooks:null});Se(this,"categoryIdProxy");Se(this,"facetFiltersProxy");Se(this,"rangeFiltersProxy");Se(this,"catalogSegmentProxy");Se(this,"pricebooksProxy");Se(this,"_fullGet",(t,n)=>Reflect.get(t,n));Se(this,"_fullSet",(t,n,r)=>{const s=cA[n];return Ov(s,n,r),Reflect.set(t,n,r)});Se(this,"updateFacetFiltersProxy",t=>new Proxy({facetFilters:t},{get:this._fullGet,set:this._fullSet}));Se(this,"updateRangeFiltersProxy",t=>new Proxy({rangeFilters:t},{get:this._fullGet,set:this._fullSet}));Se(this,"updatePricebooksProxy",t=>new Proxy({pricebooks:t},{get:this._fullGet,set:this._fullSet}));this.categoryIdProxy=new Proxy({categoryId:this.initialParams.categoryId,categoryName:this.initialParams.categoryName},{get:this._fullGet,set:this._fullSet}),this.facetFiltersProxy=this.updateFacetFiltersProxy(this.initialParams.facetFilters||{}),this.rangeFiltersProxy=this.updateRangeFiltersProxy(this.initialParams.rangeFilters||[]),this.catalogSegmentProxy=new Proxy({catalogSegment:this.initialParams.catalogSegment},{get:this._fullGet,set:this._fullSet}),this.pricebooksProxy=this.updatePricebooksProxy(this.initialParams.pricebooks||null)}get categoryId(){return this.categoryIdProxy.categoryId||""}get facetFilters(){return this.facetFiltersProxy.facetFilters||{}}get rangeFilters(){return this.rangeFiltersProxy.rangeFilters||[]}get catalogSegment(){return this.catalogSegmentProxy.catalogSegment||null}get pricebooks(){return this.pricebooksProxy.pricebooks||null}get state(){return{categoryId:this.categoryId,categoryName:this.categoryIdProxy.categoryName,facetFilters:this.facetFilters,rangeFilters:this.rangeFilters,catalogSegment:this.catalogSegment,pricebooks:this.pricebooks,page:this.initialParams.page,pageSize:this.initialParams.pageSize,includeFacets:this.initialParams.includeFacets}}}const ut=new Lv,Yg=(e,t)=>{const n=t.updateFacetFiltersProxy(e);t.facetFiltersProxy.facetFilters=n.facetFilters},Gg=(e,t,n)=>{var u,c;const r=F({},((u=n.facetFiltersProxy)==null?void 0:u.facetFilters)||{});if(!!((c=r[e])!=null&&c.includes(t))){const d=r[e].filter(f=>f!==t);d.length>0?r[e]=d:delete r[e]}else r[e]=r[e]?[...r[e],t]:[t];const a=n.updateFacetFiltersProxy(r);n.facetFiltersProxy.facetFilters=a.facetFilters},Wg=(e,t)=>{const n=t.updateRangeFiltersProxy(e);t.rangeFiltersProxy.rangeFilters=n.rangeFilters},Xg=({field:e,value:t},n)=>{const[r,s]=Array.isArray(t)?t:[];if(typeof r=="undefined"||typeof s=="undefined")throw new Error("Range values must be an array with two numbers for min and max");const a=[...n.rangeFiltersProxy.rangeFilters||[]],u=a.findIndex(d=>d.field===e);if(u!==-1){a[u]={field:e,min:r,max:s},n.rangeFiltersProxy.rangeFilters=a;return}a.push({field:e,min:r,max:s});const c=n.updateRangeFiltersProxy(a);n.rangeFiltersProxy.rangeFilters=c.rangeFilters},Kg=(e,t)=>{t.catalogSegmentProxy.catalogSegment=e},Qg=(e,t)=>{const n=t.updatePricebooksProxy(e);t.pricebooksProxy.pricebooks=n.pricebooks},Dv=e=>{if(!rs()||!fa()){rs()&&gn.clear(),gn.add({context:"browse",payload:fe(F({},ut.state),{categoryId:e})});return}ut.categoryIdProxy.categoryId=e},Jg=e=>{Yg(e,ut)},Mv=(e,t)=>{Gg(e,t,ut)},Zg=e=>{Wg(e,ut)},Fv=({field:e,value:t})=>{Xg({field:e,value:t},ut)},Bv=e=>{Kg(e,ut)},e1=e=>{Qg(e,ut)},t1=e=>{if(!e||!("categoryId"in e))throw new Error("Browse context must include a categoryId");const t=rs(),n=fa();if(!t||!n){t&&gn.clear(),gn.add({context:"browse",payload:F({},e)});return}"facetFilters"in e&&Jg(e.facetFilters||{}),"rangeFilters"in e&&Zg(e.rangeFilters||[]),"catalogSegment"in e&&(ut.catalogSegmentProxy.catalogSegment=e.catalogSegment||null),"pricebooks"in e&&e1(e.pricebooks||[]),"categoryName"in e&&(ut.categoryIdProxy.categoryName=e.categoryName||""),ut.categoryIdProxy.categoryId=e.categoryId},Uv=Object.freeze(Object.defineProperty({__proto__:null,setBrowseContext:t1,updateBrowseCategoryId:Dv,updateCatalogSegment:Bv,updateFacetFilter:Mv,updateFacetFilters:Jg,updatePricebooks:e1,updateRangeFilter:Fv,updateRangeFilters:Zg},Symbol.toStringTag,{value:"Module"}));class Hv{constructor(){Se(this,"initialParams",{productId:"",productName:"",pdpLink:""});Se(this,"proxy");Se(this,"_fullGet",(t,n)=>Reflect.get(t,n));Se(this,"_fullSet",(t,n,r)=>(qg(n,r),Reflect.set(t,n,r)));Se(this,"updateProxy",t=>{t.productId&&(this.proxy=new Proxy({productId:t.productId,productName:t.productName||"",pdpLink:t.pdpLink||""},{get:this._fullGet,set:this._fullSet}))});this.proxy=new Proxy({productId:this.initialParams.productId,productName:this.initialParams.productName,pdpLink:this.initialParams.pdpLink},{get:this._fullGet,set:this._fullSet})}get productId(){return this.proxy.productId}get pdpLink(){return this.proxy.pdpLink}get state(){return{productId:this.productId,productName:this.proxy.productName,pdpLink:this.pdpLink}}}const hr=new Hv,n1=e=>{if(!e||!e.productId)throw new Error("PDP context must include a productId");const t=rs(),n=fa();if(!t||!n){t&&gn.clear(),gn.add({context:"pdp",payload:F({},e)});return}hr.updateProxy(e),qg("pdp-context",e)},zv=e=>{hr.proxy.productId=e,rs()||gn.add({context:"pdp",payload:F({},hr.state)})},jv=e=>{hr.proxy.pdpLink=e};class $v{constructor(){Se(this,"initialState",Q0);Se(this,"promptsStateProxy");Se(this,"promptsParamsProxy");Se(this,"_fullGet",(t,n)=>Reflect.get(t,n));Se(this,"_fullSet",(t,n,r)=>{if(!(n in t))throw new Error(`Property ${n} does not exist on PromptsExtensionState`);return ga(n,r),Reflect.set(t,n,r)});Se(this,"_paramsFullGet",(t,n)=>Reflect.get(t,n));Se(this,"_paramsFullSet",(t,n,r)=>Reflect.set(t,n,r));Se(this,"updatePromptsParamsProxy",t=>new Proxy(F({},t),{get:this._paramsFullGet,set:this._paramsFullSet}));this.promptsStateProxy=new Proxy({isOpen:this.initialState.isOpen,isInline:this.initialState.isInline,elementId:this.initialState.elementId,entryType:this.initialState.entryType},{get:this._fullGet,set:this._fullSet}),this.promptsParamsProxy=this.updatePromptsParamsProxy({})}get isOpen(){return this.promptsStateProxy.isOpen}get isInline(){return this.promptsStateProxy.isInline}get state(){return{isOpen:this.isOpen,isInline:this.isInline}}get params(){return this.promptsParamsProxy}}const Ft=new $v,Vv=e=>{window.addEventListener(Zd,e)},qv=e=>{window.removeEventListener(Zd,e)},ga=(e,t)=>{const n=new CustomEvent(Zd,{detail:{property:e,value:t}});window.dispatchEvent(n)},r1=e=>{const t=Ft.isOpen,n=typeof e=="boolean"?e:!t;Ft.promptsStateProxy.isOpen=n},i1=e=>{const t=Ft.isInline,n=typeof e=="boolean"?e:!t;Ft.promptsStateProxy.isInline=n},Yv=e=>{Ft.promptsParamsProxy=Ft.updatePromptsParamsProxy(e),ga("params",e),Ft.promptsStateProxy.entryType="ask_cim"},Gv=e=>{Ft.promptsParamsProxy=Ft.updatePromptsParamsProxy(e),ga("params",e),Ft.promptsStateProxy.entryType="search"},Wv=e=>{Ft.promptsParamsProxy=Ft.updatePromptsParamsProxy(e),ga("params",e),Ft.promptsStateProxy.entryType="browse"},Xv=e=>{Ft.promptsParamsProxy=Ft.updatePromptsParamsProxy(e),ga("params",e),Ft.promptsStateProxy.entryType="pdp"},Kv=({elementId:e,entryType:t,params:n,isInline:r})=>{Ft.promptsStateProxy.elementId=e,t&&(Ft.promptsStateProxy.entryType=t),typeof r=="boolean"&&i1(r),n&&Ft.updatePromptsParamsProxy(n),Ft.isOpen||r1(!0)},Qv=Object.freeze(Object.defineProperty({__proto__:null,getConversationMessages:({payload:e,callback:t})=>{dl("getConversationMessages",{payload:e,callback:t},Ti.GET_CONVERSATION_MESSAGES)},getSessionInformation:e=>{dl("getSessionInformation",{callback:e},Ti.GET_SESSION_INFORMATION)},loadConversation:e=>{dl("loadConversation",e,Ti.LOAD_CONVERSATION)},resetConversation:()=>{dl("resetConversation",!0,Ti.RESET_CONVERSATION)}},Symbol.toStringTag,{value:"Module"}));class Jv{constructor(){Se(this,"initialParams",{query:"",page:null,pageSize:null,includeFacets:!0,facetFilters:{},rangeFilters:[],catalogSegment:null,pricebooks:null});Se(this,"queryProxy");Se(this,"facetFiltersProxy");Se(this,"rangeFiltersProxy");Se(this,"catalogSegmentProxy");Se(this,"pricebooksProxy");Se(this,"_fullGet",(t,n)=>Reflect.get(t,n));Se(this,"_fullSet",(t,n,r)=>{const s=dA[n];return Pv(s,n,r),Reflect.set(t,n,r)});Se(this,"updateFacetFiltersProxy",t=>new Proxy({facetFilters:t},{get:this._fullGet,set:this._fullSet}));Se(this,"updateRangeFiltersProxy",t=>new Proxy({rangeFilters:t},{get:this._fullGet,set:this._fullSet}));Se(this,"updatePricebooksProxy",t=>new Proxy({pricebooks:t},{get:this._fullGet,set:this._fullSet}));this.queryProxy=new Proxy({query:this.initialParams.query},{get:this._fullGet,set:this._fullSet}),this.facetFiltersProxy=this.updateFacetFiltersProxy(this.initialParams.facetFilters||{}),this.rangeFiltersProxy=this.updateRangeFiltersProxy(this.initialParams.rangeFilters||[]),this.catalogSegmentProxy=new Proxy({catalogSegment:this.initialParams.catalogSegment},{get:this._fullGet,set:this._fullSet}),this.pricebooksProxy=this.updatePricebooksProxy(this.initialParams.pricebooks||null)}get query(){return this.queryProxy.query||""}get facetFilters(){return this.facetFiltersProxy.facetFilters||{}}get rangeFilters(){return this.rangeFiltersProxy.rangeFilters||[]}get catalogSegment(){return this.catalogSegmentProxy.catalogSegment||null}get pricebooks(){return this.pricebooksProxy.pricebooks||null}get state(){return{query:this.query,facetFilters:this.facetFilters,rangeFilters:this.rangeFilters,catalogSegment:this.catalogSegment,pricebooks:this.pricebooks,page:this.initialParams.page,pageSize:this.initialParams.pageSize,includeFacets:this.initialParams.includeFacets}}}const Tt=new Jv,Zv=e=>{const t=fa(),n=rs();if(!n||!t){n&&gn.clear(),gn.add({context:"search",payload:fe(F({},Tt.state),{query:e})});return}Tt.queryProxy.query=e},s1=e=>{Yg(e,Tt)},ek=(e,t)=>{Gg(e,t,Tt)},o1=e=>{Wg(e,Tt)},tk=({field:e,value:t})=>{Xg({field:e,value:t},Tt)},nk=e=>{Kg(e,Tt)},a1=e=>{Qg(e,Tt)},u1=e=>{if(!e||!e.query)throw new Error("Search context must include a query");const t=fa(),n=rs();if(!n||!t){n&&gn.clear(),gn.add({context:"search",payload:F({},e)});return}"facetFilters"in e&&s1(e.facetFilters||{}),"rangeFilters"in e&&o1(e.rangeFilters||[]),"catalogSegment"in e&&(Tt.catalogSegmentProxy.catalogSegment=e.catalogSegment||null),"pricebooks"in e&&a1(e.pricebooks||[]),Tt.queryProxy.query=e.query},rk=Object.freeze(Object.defineProperty({__proto__:null,setSearchContext:u1,updateCatalogSegment:nk,updateFacetFilter:ek,updateFacetFilters:s1,updatePricebooks:a1,updateRangeFilter:tk,updateRangeFilters:o1,updateSearchQuery:Zv},Symbol.toStringTag,{value:"Module"})),ik={categoryId:ut.categoryId,categoryName:ut.categoryIdProxy.categoryName||"",facetFilters:ut.facetFilters,rangeFilters:ut.rangeFilters,catalogSegment:ut.catalogSegment,pricebooks:ut.pricebooks},l1=B.createContext(ik),sk=({children:e})=>{const[t,n]=B.useState(ut.categoryId),[r,s]=B.useState(ut.categoryIdProxy.categoryName||""),[a,u]=B.useState(ut.facetFilters||{}),[c,d]=B.useState(ut.rangeFilters||[]),[f,p]=B.useState(ut.catalogSegment||null),[m,b]=B.useState(ut.pricebooks||null);B.useEffect(()=>{const _=({detail:A})=>{(A==null?void 0:A.property)==="categoryId"&&n(A.value),(A==null?void 0:A.property)==="categoryName"&&s(A.value),(A==null?void 0:A.property)==="facetFilters"&&u(A.value),(A==null?void 0:A.property)==="rangeFilters"&&d(A.value),(A==null?void 0:A.property)==="catalogSegment"&&p(A.value),(A==null?void 0:A.property)==="pricebooks"&&b(A.value)};return zg(_),()=>{jg(_)}},[]);const y=B.useMemo(()=>({categoryId:t,categoryName:r,facetFilters:a,rangeFilters:c,catalogSegment:f,pricebooks:m}),[t,r,a,c,f,m]);return S.jsx(l1.Provider,{value:y,children:e})},ok=()=>{const e=B.useContext(l1);if(!e)throw new Error("useBrowse must be used within a BrowseProvider");return e},ak={searchQuery:Tt.query,facetFilters:Tt.facetFilters,rangeFilters:Tt.rangeFilters,catalogSegment:Tt.catalogSegment,pricebooks:Tt.pricebooks},c1=B.createContext(ak),uk=({children:e})=>{const[t,n]=B.useState(Tt.query),[r,s]=B.useState(Tt.facetFilters),[a,u]=B.useState(Tt.rangeFilters),[c,d]=B.useState(Tt.catalogSegment),[f,p]=B.useState(Tt.pricebooks);B.useEffect(()=>{const b=({detail:y})=>{(y==null?void 0:y.property)==="query"&&n(y.value),(y==null?void 0:y.property)==="facetFilters"&&s(y.value),(y==null?void 0:y.property)==="rangeFilters"&&u(y.value),(y==null?void 0:y.property)==="catalogSegment"&&d(y.value),(y==null?void 0:y.property)==="pricebooks"&&p(y.value)};return Ug(b),()=>{Hg(b)}},[]);const m=B.useMemo(()=>({searchQuery:t,facetFilters:r,rangeFilters:a,catalogSegment:c,pricebooks:f}),[t,r,a,c,f]);return S.jsx(c1.Provider,{value:m,children:e})},lk=()=>{const e=B.useContext(c1);if(!e)throw new Error("useSearch must be used within a SearchProvider");return e},ck={productId:hr.productId,pdpLink:hr.pdpLink},d1=B.createContext(ck),dk=({children:e})=>{const[t,n]=B.useState(hr.productId),[r,s]=B.useState(hr.pdpLink);B.useEffect(()=>{const u=({detail:c})=>{if((c==null?void 0:c.property)==="pdp-context"){const d=c.value;n(d.productId),s(d.pdpLink);return}(c==null?void 0:c.property)==="productId"&&n(c.value),(c==null?void 0:c.property)==="pdpLink"&&s(c.value)};return $g(u),()=>{Vg(u)}},[]);const a=B.useMemo(()=>({productId:t,pdpLink:r}),[t,r]);return S.jsx(d1.Provider,{value:a,children:e})},fk=()=>{const e=B.useContext(d1);if(!e)throw new Error("usePdp must be used within a PdpProvider");return e},f1=B.createContext({mode:Je.modeProxy.mode,entryType:Je.entryType,status:Je.statusProxy,dialogPosition:Je.dialogProxy.position,isDialogFullHeight:Je.dialogProxy.isFullHeight,dialogWidth:Je.dialogProxy.width,isModalFullscreen:Je.modalProxy.isFullscreen,previousComponentType:Je.statusProxy.type}),hk=({entryType:e,componentConfig:t,componentType:n,children:r})=>{const[s,a]=B.useState(e!=null?e:Je.entryTypeProxy.entryType),[u,c]=B.useState(Je.modeProxy.mode),[d,f]=B.useState({type:n||Je.statusProxy.type,isOpen:t&&"isOpen"in t?!!t.isOpen:Je.statusProxy.isOpen,isMinimized:t&&"isMinimized"in t?!!t.isMinimized:Je.statusProxy.isMinimized}),[p,m]=B.useState(Je.dialogProxy.position),[b,y]=B.useState(Je.dialogProxy.isFullHeight),[_,A]=B.useState(Je.dialogProxy.width),[v,w]=B.useState(Je.modalProxy.isFullscreen),N=B.useRef(!1),C=vv(d.type);B.useEffect(()=>{const Y=D=>{const{property:q,value:ne}=D.detail||{};if(!(!q||ne===void 0)){if(q==="mode"){c(ne);return}if(q==="entryType"){a(ne);return}if(q==="isMinimized"){f(de=>fe(F({},de),{isMinimized:ne}));return}if(q==="isOpen"){f(de=>fe(F({},de),{isOpen:ne}));return}if(q==="type"){f(de=>fe(F({},de),{type:ne}));return}if(q==="position"){m(ne);return}if(q==="isFullHeight"){y(ne);return}if(q==="width"){A(ne);return}if(q==="isFullscreen"){w(ne);return}}};return hv(Y),()=>{pv(Y)}},[]),ma(()=>{e&&ha(e)}),ma(()=>{if(N.current)return;N.current=!0;const Y=n||(t==null?void 0:t.type);Y&&cl(Y);const D=dv();t&&"isOpen"in t&&ei(!!t.isOpen),t&&"isMinimized"in t&&pa(!!t.isMinimized),D&&pa(!0)}),ma(()=>{if(!(t!=null&&t.options))return;const{dialogPosition:Y}=t.options;Y&&Tf(Y),"dialogFullHeight"in t.options&&Ev(!!t.options.dialogFullHeight),"dialogWidth"in t.options&&t.options.dialogWidth&&A(t.options.dialogWidth),"isModalFullscreen"in t.options&&yf(!!t.options.isModalFullscreen)});const H=B.useMemo(()=>({mode:u,entryType:s,status:d,previousComponentType:C||"dialog",dialogPosition:p,isDialogFullHeight:b,dialogWidth:_,isModalFullscreen:v}),[u,s,d,C,p,b,_,v]);return S.jsx(f1.Provider,{value:H,children:r})},Zn=()=>{const e=B.useContext(f1);if(!e)throw new Error("useUIState must be used within a UIStateProvider");return e},h1=B.createContext(null),p1=B.createContext(null),_f=()=>{const e=B.useContext(p1);if(!e)throw new Error("usePromptsExtensionDispatch must be used within a PromptsExtensionProvider");return e||{}},ti=()=>{const e=B.useContext(h1);if(!e)throw new Error("usePromptsExtensionState must be used within a PromptsExtensionProvider");return e||{}},Gs=()=>{const e=B.useContext(K0);if(!e)throw new Error("useCopilotDispatch must be used within a CopilotProvider");return e},er=()=>{const e=B.useContext(X0);if(!e)throw new Error("useCopilotState must be used within a CopilotProvider");return e},pk=({copilot:e})=>{const{logger:t,conversationHistory:n}=tt(),{isInline:r}=ti(),{addCopilotEvent:s,setConversationHistoryLoaded:a}=Gs(),{activeConversationId:u}=er(),c=B.useCallback(f=>{e&&e.requestSessionInformation(p=>{t==null||t.log("Retrieved session information: ",p),f==null||f(p)})},[e,t]),d=B.useCallback((f,p)=>{e&&f.conversationId&&e.getConversationEvents(f,m=>{t==null||t.log("Retrieved conversation messages: ",m),p==null||p(m)})},[e,t]);return B.useEffect(()=>{if(r||!u)return;if(n.sinceHours===0||(n==null?void 0:n.limit)===0){a(!0);return}const f=3600*1e3*n.sinceHours,p=new Date(Date.now()-f).toISOString(),m={conversationId:u,since:p,excludeEvents:["done","error","connection_error","refined_browse","refined_search","conversation_reset"]};typeof n.limit=="number"&&(m.limit=n.limit),d(m,b=>{const y=[];[...b.reverse()||[]].forEach(A=>{var w;const v=b.find(N=>N.id===A.eventSourceId);(w=v==null?void 0:v.name)!=null&&w.endsWith("_suggestions")||(A.bypassHandlers=!0,y.unshift(A))}),y.forEach(A=>{s(A)}),a(!0)})},[t,r,u,d,s,a,n]),{getSessionInformation:c,getConversationMessages:d}},m1=B.createContext({copilot:null,messages:[],groupedMessages:[],isLoading:!1,isResponseLoading:()=>!1,handleAskCim:()=>{},handleSearch:()=>{},handleBrowse:()=>{},handlePdp:()=>{},handleSuggestion:()=>{},handleUserInput:()=>{},handleCancel:()=>{},resetConversation:()=>{},getSessionInformation:()=>{},getConversationMessages:()=>{}}),mk=({apiKey:e,apiToken:t,baseUrl:n,customerId:r,tenantId:s,isDevelopment:a,onConnect:u,onRefinedSearch:c,onRefinedBrowse:d,children:f})=>{const{logger:p,clientContext:m,baseCatalogParams:b}=tt(),on=lk(),{searchQuery:y}=on,_=dn(on,["searchQuery"]),Mn=ok(),{categoryId:A}=Mn,v=dn(Mn,["categoryId"]),{productId:w,pdpLink:N}=fk(),{setCopilot:C,setConnected:H,resetCopilot:Y,resetCopilotState:D,addCopilotEvent:q,removeLoadingMessage:ne,handleCopilotRequestAck:de,setActiveConversationId:V,setConversationIds:se,setAskCimPrompts:pe}=Gs(),{connected:ve,copilot:re,messages:ae,groupedMessages:xe,loadingMessages:oe,askCimPrompts:Q}=er(),{status:ie,entryType:k}=Zn(),{isInline:R}=ti(),{getConversationMessages:ee,getSessionInformation:O}=pk({copilot:re}),_e=B.useMemo(()=>oe.size>0,[oe]),Be=B.useCallback(we=>oe.has(we),[oe]),ye=B.useCallback(({query:we,facetFilters:Pe,rangeFilters:Me,catalogSegment:rt,pricebooks:pt,userPrompt:J,imageFile:ge})=>{if(!re){p==null||p.error("Copilot is not initialized");return}if(!we)return;const Ce={searchParams:{query:we}};J&&(Ce.userPrompt=J),ge&&(Ce.attachments={image:ge}),Pe&&Object.keys(Pe).length>0&&(Ce.searchParams.facetFilters=Pe),Me&&Me.length>0&&(Ce.searchParams.rangeFilters=Me),rt&&(Ce.searchParams.catalogSegment=rt),pt&&(Ce.searchParams.pricebooks=pt),m&&(Ce.clientContext=m),ha("search"),re.search(Ce,Ve=>{const Ie=F({},Ve);de(Ie)})},[p,de,re,m]),De=B.useCallback(({categoryId:we,categoryName:Pe,facetFilters:Me,rangeFilters:rt,catalogSegment:pt,pricebooks:J,userPrompt:ge,imageFile:Ce})=>{if(!re){p==null||p.error("Copilot is not initialized");return}const Ve=Me&&Object.keys(Me).length>0;if(we===""&&!Ve){p==null||p.error("Browse event must include facetFilters when categoryId is empty");return}const Ie={browseParams:{categoryId:we||""}};ge&&(Ie.userPrompt=ge),Ce&&(Ie.attachments={image:Ce}),Ve&&(Ie.browseParams.facetFilters=Me),rt&&rt.length>0&&(Ie.browseParams.rangeFilters=rt),pt&&(Ie.browseParams.catalogSegment=pt),Array.isArray(J)&&J.length>0&&(Ie.browseParams.pricebooks=J),(m||Pe)&&(Ie.clientContext={},m&&(Ie.clientContext=F({},m)),Pe&&(Ie.clientContext.cimLabel=Pe)),ha("browse"),re.browse(Ie,lt=>{var $r;const Vt=F({},lt),Ut=(($r=Vt.request)==null?void 0:$r.clientContext)||{},an=(Ut==null?void 0:Ut.cimLabel)||Pe;an&&Vt.request&&(Vt.request.label=an),de(Vt)})},[p,de,re,m]),Ue=B.useCallback(({productId:we,productName:Pe,pdpLink:Me,userPrompt:rt,imageFile:pt})=>{if(!re){p==null||p.error("Copilot is not initialized");return}if(!we)return;const J={productId:we};rt&&(J.userPrompt=rt),Me&&(J.pdpLink=Me),pt&&(J.attachments={image:pt}),(m||Pe)&&(J.clientContext={},m&&(J.clientContext=F({},m)),Pe&&(J.clientContext.cimLabel=Pe)),b&&(J.baseCatalogParams=b),ha("pdp"),re.productView(J,ge=>{var lt;const Ce=F({},ge),Ve=((lt=Ce.request)==null?void 0:lt.clientContext)||{},Ie=(Ve==null?void 0:Ve.cimLabel)||Pe;Ie&&Ce.request&&(Ce.request.label=Ie),de(Ce)})},[p,re,de,m,b]),Ye=B.useCallback(({userPrompt:we,imageFile:Pe})=>{if(!re){p==null||p.error("Copilot is not initialized");return}if(!we)return;const Me={userPrompt:we};Pe&&(Me.attachments={image:Pe}),m&&(Me.clientContext=m),b&&(Me.baseCatalogParams=b),re.askCim(Me,rt=>{const pt=F({},rt);de(pt)})},[p,re,de,m,b]),ht=B.useCallback(we=>{q(we),c==null||c(we)},[q,c]),$t=B.useCallback(we=>{q(we),d==null||d(we)},[q,d]),sn=B.useCallback(we=>{u==null||u(we),H(!0)},[u,H]);B.useEffect(()=>{!re||!ve||!ie.isOpen||gn.size>0&&gn.processQueue(we=>{if(we.context==="search"){const Pe=F({},we.payload);u1(Pe)}if(we.context==="browse"){const Pe=F({},we.payload);t1(Pe)}if(we.context==="pdp"){const Pe=F({},we.payload);n1(Pe)}})},[ie.isOpen,re,ve]);const Tr=B.useCallback(we=>{const Pe=Me=>{const rt=fe(F({},Me),{id:Me.inquiryLinkId||Me.id});q(rt)};we.on("connect_ack",sn),we.on("partial_inquiry",Pe),we.on("display_products",q),we.on("progress",q),we.on("refined_search",ht),we.on("refined_browse",$t),we.on("done",Me=>{ne(Me.eventSourceId)}),we.on("error",Me=>{q(Me),ne(Me.eventSourceId)}),we.onDisconnect(Me=>{const rt=["io server disconnect","transport error","server shutting down"];if(p==null||p.log("Connection disconnected with reason: ",Me),!rt.includes(Me)){H(!1);return}p==null||p.log("De-registering event listeners");const pt=new Date().toISOString();q({name:"error",message:"Connection was lost. Please try again.",createdAt:pt,id:`error-${pt}`,sessionId:"session"}),we.off()})},[p,H,ne,ht,$t,q,sn]);B.useEffect(()=>{if(!re)return;const we=Pe=>{if(!R){if(!Pe.message&&Pe.eventSourceId&&Pe.eventSourceId===Q.requestId){pe({requestId:Pe.eventSourceId,message:Pe});return}q(Pe)}};return re.on("follow_up",we),()=>{re.off("follow_up",we)}},[re,ae,Q.requestId,R,q,pe]),B.useEffect(()=>{if(!re)return;const we=Pe=>{if(R)return;const Me=fe(F({},Pe),{id:Pe.inquiryLinkId||Pe.id});q(Me)};return re.on("inquiry",we),()=>{re.off("inquiry",we)}},[re,R,q]),ma(()=>{let we;n?we=n:we=a?"https://staging.copilot.search.cimulate.ai":"https://prod.copilot.search.cimulate.ai";const Pe={baseUrl:we};e?Pe.apiKey=e:t&&(Pe.apiToken=t),r&&(Pe.customerId=r),s&&(Pe.tenantId=s);const Me=new Ww(Pe);return C(Me),Tr(Me),Me.connect(),Me.requestSessionInformation(rt=>{p==null||p.log("Session Information: ",rt);const{activeConversationId:pt,conversationIds:J}=rt.data||{};pt&&V(pt),J!=null&&J.length&&se(J)}),()=>{Me.disconnect(),Me.off(),Y()}});const ir=B.useCallback(we=>{if(!re)return;const Pe={eventId:we,reason:"User cancelled the request"};re.cancelRequest(Pe,Me=>{q(Me),ne(we)})},[q,ne,re]),Jt=B.useCallback(()=>{re&&re.conversationReset({},we=>{D(),q(we),re.requestSessionInformation(Pe=>{p==null||p.log("Session Information: ",Pe);const{activeConversationId:Me,conversationIds:rt}=Pe.data||{};Me&&V(Me),rt!=null&&rt.length&&se(rt)})})},[re,p,q,D,V,se]),$e=B.useCallback((we,Pe)=>{if(!we)return;const Me={userPrompt:we};switch(Pe&&(Me.imageFile=Pe),k){case"ask_cim":Ye(Me);return;case"search":y?ye(F(F({query:y},_),Me)):Ye(Me);return;case"browse":De(F(F({categoryId:A},v),Me));return;case"pdp":w?Ue(F({productId:w,pdpLink:N||""},Me)):Ye(Me);return}},[k,y,_,ye,Ye,A,v,De,Ue,w,N]),vt=B.useCallback((we,Pe)=>{var ge,Ce,Ve;const rt=we.params.userPrompt||"";if(!rt)return;const pt=ae.find(Ie=>Ie.id===Pe);if(!pt)return;const J=pt.name.replace("_suggestions","");if(J==="ask_cim"){Ye({userPrompt:rt});return}if(J==="copilot_search"){const Ie=((ge=pt.request)==null?void 0:ge.searchParams)||{},Vt=Ie.query===y;ye(fe(F({query:Ie.query||y},Vt?_:{}),{userPrompt:rt}));return}if(J==="copilot_browse"){const Ie=pt.request,lt=Ie.browseParams||{},Ut=lt.categoryId===A,an=((Ce=Ie.clientContext)==null?void 0:Ce.cimLabel)||"";De(fe(F({categoryId:lt.categoryId||A||""},Ut?v:{}),{categoryName:an,userPrompt:rt}));return}if(J==="product_view"){const Ie=pt.request||{},lt=Ie.productId,Vt=lt===w,Ut=((Ve=Ie.clientContext)==null?void 0:Ve.cimLabel)||"";let an="";Vt?an=N||"":an=Ie.pdpLink||"",Ue({productId:lt||w,pdpLink:an,productName:Ut,userPrompt:rt})}},[ae,y,_,ye,Ye,A,v,De,Ue,w,N]),vn=B.useMemo(()=>({copilot:re,messages:ae,groupedMessages:xe,isLoading:_e,isResponseLoading:Be,handleAskCim:Ye,handleSearch:ye,handleBrowse:De,handlePdp:Ue,handleUserInput:$e,handleSuggestion:vt,handleCancel:ir,resetConversation:Jt,getSessionInformation:O,getConversationMessages:ee}),[re,ae,xe,_e,Be,Ye,ye,De,Ue,$e,vt,ir,Jt,O,ee]);return S.jsx(m1.Provider,{value:vn,children:f})},g1=()=>{const{copilot:e}=er(),{addCopilotEvent:t}=Gs();return{getCopilotSuggestions:B.useCallback((r,s,a)=>{if(!e||!s||!r)return;const u=c=>{t(c),a(c)};switch(s){case"ask_cim":e.askCimSuggestions(r,u);break;case"search":e.searchSuggestions({searchParams:r},u);break;case"browse":e.browseSuggestions({browseParams:r},u);break;case"pdp":e.productViewSuggestions({productId:r.productId},u);break}},[e,t])}},Or=()=>{const e=B.useContext(m1);if(!e)throw new Error("useCopilot must be used within a CopilotProvider");return e},gk=()=>{const{copilot:e,activeConversationId:t,askCimPrompts:n,conversationHistoryLoaded:r}=er(),{entryType:s}=Zn(),{resetCopilotState:a,addCopilotEvent:u,setAskCimPrompts:c}=Gs(),{handleSearch:d,handleBrowse:f,handlePdp:p,resetConversation:m,getSessionInformation:b,getConversationMessages:y}=Or(),{getCopilotSuggestions:_}=g1();B.useEffect(()=>{!e||!s||!t||!r||n.requestId||s==="ask_cim"&&_({},s,N=>{c({requestId:N.id,message:null})})},[e,t,n.requestId,s,r,_,c]);const A=B.useCallback(({query:N})=>{if(!e||!N)return;const{facetFilters:C}=Tt.facetFiltersProxy,{rangeFilters:H}=Tt.rangeFiltersProxy,{catalogSegment:Y}=Tt.catalogSegmentProxy,{pricebooks:D}=Tt.pricebooksProxy,q={query:N};q.facetFilters=C||{},q.rangeFilters=H||[],q.catalogSegment=Y||"",q.pricebooks=D||[],d(F({},q))},[e,d]),v=B.useCallback(({categoryId:N})=>{if(!e)return;const C=ut.categoryIdProxy.categoryName,{facetFilters:H}=ut.facetFiltersProxy,{rangeFilters:Y}=ut.rangeFiltersProxy,{catalogSegment:D}=ut.catalogSegmentProxy,{pricebooks:q}=ut.pricebooksProxy,ne={categoryId:N};ne.categoryName=C||"",ne.facetFilters=H||{},ne.rangeFilters=Y||[],ne.catalogSegment=D||"",ne.pricebooks=q||[],f(F({},ne))},[e,f]),w=B.useCallback(({productId:N})=>{if(!e||!N)return;const C={productId:N,pdpLink:hr.pdpLink,productName:hr.proxy.productName||""};p(C)},[e,p]);return B.useEffect(()=>{const N=({detail:C})=>{(C==null?void 0:C.property)==="query"&&A({query:C.value})};return Ug(N),()=>{Hg(N)}},[A]),B.useEffect(()=>{const N=({detail:C})=>{if((C==null?void 0:C.property)==="pdp-context"){const H=C.value;w({productId:H.productId});return}(C==null?void 0:C.property)==="productId"&&w({productId:C.value})};return $g(N),()=>{Vg(N)}},[w]),B.useEffect(()=>{const N=({detail:C})=>{(C==null?void 0:C.property)==="categoryId"&&v({categoryId:C.value})};return zg(N),()=>{jg(N)}},[v]),B.useEffect(()=>{const N=({detail:C})=>{if((C==null?void 0:C.event)==Ti.RESET_CONVERSATION&&m(),(C==null?void 0:C.event)==Ti.GET_SESSION_INFORMATION){const H=C.value.callback;b(H)}if((C==null?void 0:C.event)==Ti.GET_CONVERSATION_MESSAGES){const{payload:H,callback:Y}=C.value;if(!H.conversationId||typeof Y!="function")return;y(H,Y)}if((C==null?void 0:C.event)==Ti.LOAD_CONVERSATION){const H=C.value;if(!H.conversationId)return;y(H,D=>{a(),D.forEach(q=>{u(q)})})}};return Iv(N),()=>{Rv(N)}},[m,b,y,a,u]),null},Ek=({apiKey:e,apiToken:t,baseUrl:n,customerId:r,tenantId:s,isDevelopment:a,onConnect:u,onRefinedSearch:c,onRefinedBrowse:d,children:f})=>S.jsxs(mk,{apiKey:e,apiToken:t,baseUrl:n,customerId:r,tenantId:s,isDevelopment:a,onConnect:u,onRefinedSearch:c,onRefinedBrowse:d,children:[S.jsx(gk,{}),f]}),yk=({children:e,dispatch:t})=>{const n=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_INITIALIZED,payload:_})},[t]),r=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_OPEN,payload:_})},[t]),s=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_INLINE,payload:_})},[t]),a=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_ELEMENT_ID,payload:_})},[t]),u=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_ENTRY_TYPE,payload:_})},[t]),c=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID,payload:_})},[t]),d=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_USER_PROMPT,payload:_})},[t]),f=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_PARAMS,payload:_})},[t]),p=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE,payload:_})},[t]),m=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE,payload:_})},[t]),b=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_RESPONSE_LOADING,payload:_})},[t]),y=B.useMemo(()=>({setIsInitialized:n,setIsOpen:r,setIsInline:s,setElementId:a,setEntryType:u,setActivePromptsId:c,setUserPrompt:d,setParams:f,setPromptsMessage:p,setResponseMessage:m,setIsResponseLoading:b}),[n,r,s,a,u,c,d,f,p,m,b]);return S.jsx(p1.Provider,{value:y,children:e})},Tk=(e,t)=>{const{type:n,payload:r}=t;switch(n){case Et.SET_PROMPTS_EXTENSION_INITIALIZED:e.isInitialized=r;break;case Et.SET_PROMPTS_EXTENSION_OPEN:e.isOpen=r;break;case Et.SET_PROMPTS_EXTENSION_INLINE:e.isInline=r;break;case Et.SET_PROMPTS_EXTENSION_ELEMENT_ID:e.elementId=r;break;case Et.SET_PROMPTS_EXTENSION_ENTRY_TYPE:e.entryType=r;break;case Et.SET_PROMPTS_EXTENSION_PARAMS:e.params=r;break;case Et.RESET_PROMPTS_EXTENSION_PARAMS:e.params=null;break;case Et.SET_PROMPTS_EXTENSION_USER_PROMPT:e.userPrompt=r;break;case Et.SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:e.activePromptsId=r;break;case Et.RESET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:e.activePromptsId=null;break;case Et.SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:e.promptsMessage=r;break;case Et.RESET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:e.promptsMessage=null;break;case Et.SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:e.responseMessage=r;break;case Et.RESET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:e.responseMessage=null;break;case Et.SET_PROMPTS_EXTENSION_RESPONSE_LOADING:e.isResponseLoading=r;break}},bk=({promptsConfig:e,children:t})=>{const[n,r]=q0(Tk,fe(F(F({},Q0),e||{}),{staticQuestions:R0((e==null?void 0:e.staticQuestions)||[])}));return S.jsx(h1.Provider,{value:n,children:S.jsx(yk,{dispatch:r,children:t})})},E1=({mode:e,apiKey:t,apiToken:n,baseUrl:r,customerId:s,tenantId:a,logoUrl:u,headerText:c,headerConfig:d,theme:f,openLinksInNewTab:p,globalClassName:m,isDevelopment:b=!1,componentType:y,componentConfig:_,entryType:A,initialEntry:v,entryMessage:w,disclaimerText:N,disclaimerMarkdown:C,clientContext:H,baseCatalogParams:Y,searchPlaceholder:D,searchButtonLabel:q,searchConfig:ne,suggestionButtonConfig:de,messageAlignment:V,autoScroll:se,promptsConfig:pe,resetConversationMessage:ve,conversationHistory:re,onConnect:ae,onCopilotEvent:xe,onRefinedSearch:oe,onRefinedBrowse:Q,__features:ie,children:k})=>{const R=v==null?void 0:v.params;return S.jsx(lv,{mode:e,baseUrl:r,apiKey:t,apiToken:n,customerId:s,tenantId:a,logoUrl:u,headerText:c,headerConfig:d,entryMessage:w,staticQuestions:R0(R==null?void 0:R.staticQuestions),staticQuestionsStrategy:R==null?void 0:R.staticQuestionsStrategy,theme:f,globalClassName:m,openLinksInNewTab:p,searchPlaceholder:D,searchButtonLabel:q,searchConfig:ne,suggestionButtonConfig:de,messageAlignment:V,autoScroll:se,componentConfig:_,clientContext:H,baseCatalogParams:Y,disclaimerMarkdown:C,disclaimerText:N,resetConversationMessage:ve,conversationHistory:re,isDevelopment:b,__features:ie,children:S.jsx(hk,{entryType:A!=null?A:v==null?void 0:v.type,componentConfig:_,componentType:y,children:S.jsx(bv,{onCopilotEvent:xe,children:S.jsx(dk,{children:S.jsx(sk,{children:S.jsx(uk,{children:S.jsx(bk,{promptsConfig:pe,children:S.jsx(Ek,{apiKey:t,apiToken:n,baseUrl:r,customerId:s,tenantId:a,isDevelopment:b,entryType:A,onConnect:ae,onRefinedSearch:oe,onRefinedBrowse:Q,onCopilotEvent:xe,children:k})})})})})})})})};var Sf={exports:{}},On={},xf={exports:{}},wf={};var y1;function _k(){return y1||(y1=1,(function(e){function t(Q,ie){var k=Q.length;Q.push(ie);e:for(;0<k;){var R=k-1>>>1,ee=Q[R];if(0<s(ee,ie))Q[R]=ie,Q[k]=ee,k=R;else break e}}function n(Q){return Q.length===0?null:Q[0]}function r(Q){if(Q.length===0)return null;var ie=Q[0],k=Q.pop();if(k!==ie){Q[0]=k;e:for(var R=0,ee=Q.length,O=ee>>>1;R<O;){var _e=2*(R+1)-1,Be=Q[_e],ye=_e+1,De=Q[ye];if(0>s(Be,k))ye<ee&&0>s(De,Be)?(Q[R]=De,Q[ye]=k,R=ye):(Q[R]=Be,Q[_e]=k,R=_e);else if(ye<ee&&0>s(De,k))Q[R]=De,Q[ye]=k,R=ye;else break e}}return ie}function s(Q,ie){var k=Q.sortIndex-ie.sortIndex;return k!==0?k:Q.id-ie.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var u=Date,c=u.now();e.unstable_now=function(){return u.now()-c}}var d=[],f=[],p=1,m=null,b=3,y=!1,_=!1,A=!1,v=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate!="undefined"?setImmediate:null;typeof navigator!="undefined"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(Q){for(var ie=n(f);ie!==null;){if(ie.callback===null)r(f);else if(ie.startTime<=Q)r(f),ie.sortIndex=ie.expirationTime,t(d,ie);else break;ie=n(f)}}function H(Q){if(A=!1,C(Q),!_)if(n(d)!==null)_=!0,xe(Y);else{var ie=n(f);ie!==null&&oe(H,ie.startTime-Q)}}function Y(Q,ie){_=!1,A&&(A=!1,w(ne),ne=-1),y=!0;var k=b;try{for(C(ie),m=n(d);m!==null&&(!(m.expirationTime>ie)||Q&&!se());){var R=m.callback;if(typeof R=="function"){m.callback=null,b=m.priorityLevel;var ee=R(m.expirationTime<=ie);ie=e.unstable_now(),typeof ee=="function"?m.callback=ee:m===n(d)&&r(d),C(ie)}else r(d);m=n(d)}if(m!==null)var O=!0;else{var _e=n(f);_e!==null&&oe(H,_e.startTime-ie),O=!1}return O}finally{m=null,b=k,y=!1}}var D=!1,q=null,ne=-1,de=5,V=-1;function se(){return!(e.unstable_now()-V<de)}function pe(){if(q!==null){var Q=e.unstable_now();V=Q;var ie=!0;try{ie=q(!0,Q)}finally{ie?ve():(D=!1,q=null)}}else D=!1}var ve;if(typeof N=="function")ve=function(){N(pe)};else if(typeof MessageChannel!="undefined"){var re=new MessageChannel,ae=re.port2;re.port1.onmessage=pe,ve=function(){ae.postMessage(null)}}else ve=function(){v(pe,0)};function xe(Q){q=Q,D||(D=!0,ve())}function oe(Q,ie){ne=v(function(){Q(e.unstable_now())},ie)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Q){Q.callback=null},e.unstable_continueExecution=function(){_||y||(_=!0,xe(Y))},e.unstable_forceFrameRate=function(Q){0>Q||125<Q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):de=0<Q?Math.floor(1e3/Q):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(Q){switch(b){case 1:case 2:case 3:var ie=3;break;default:ie=b}var k=b;b=ie;try{return Q()}finally{b=k}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Q,ie){switch(Q){case 1:case 2:case 3:case 4:case 5:break;default:Q=3}var k=b;b=Q;try{return ie()}finally{b=k}},e.unstable_scheduleCallback=function(Q,ie,k){var R=e.unstable_now();switch(typeof k=="object"&&k!==null?(k=k.delay,k=typeof k=="number"&&0<k?R+k:R):k=R,Q){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=k+ee,Q={id:p++,callback:ie,priorityLevel:Q,startTime:k,expirationTime:ee,sortIndex:-1},k>R?(Q.sortIndex=k,t(f,Q),n(d)===null&&Q===n(f)&&(A?(w(ne),ne=-1):A=!0,oe(H,k-R))):(Q.sortIndex=ee,t(d,Q),_||y||(_=!0,xe(Y))),Q},e.unstable_shouldYield=se,e.unstable_wrapCallback=function(Q){var ie=b;return function(){var k=b;b=ie;try{return Q.apply(this,arguments)}finally{b=k}}}})(wf)),wf}var T1;function Sk(){return T1||(T1=1,xf.exports=_k()),xf.exports}var b1;function xk(){if(b1)return On;b1=1;var e=hn(),t=Sk();function n(i){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+i,l=1;l<arguments.length;l++)o+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+i+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,s={};function a(i,o){u(i,o),u(i+"Capture",o)}function u(i,o){for(s[i]=o,i=0;i<o.length;i++)r.add(o[i])}var c=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),d=Object.prototype.hasOwnProperty,f=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},m={};function b(i){return d.call(m,i)?!0:d.call(p,i)?!1:f.test(i)?m[i]=!0:(p[i]=!0,!1)}function y(i,o,l,h){if(l!==null&&l.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return h?!1:l!==null?!l.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function _(i,o,l,h){if(o===null||typeof o=="undefined"||y(i,o,l,h))return!0;if(h)return!1;if(l!==null)switch(l.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function A(i,o,l,h,E,T,x){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=h,this.attributeNamespace=E,this.mustUseProperty=l,this.propertyName=i,this.type=o,this.sanitizeURL=T,this.removeEmptyString=x}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){v[i]=new A(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var o=i[0];v[o]=new A(o,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){v[i]=new A(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){v[i]=new A(i,2,!1,i,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(i){v[i]=new A(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){v[i]=new A(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){v[i]=new A(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){v[i]=new A(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){v[i]=new A(i,5,!1,i.toLowerCase(),null,!1,!1)});var w=/[\-:]([a-z])/g;function N(i){return i[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(i){var o=i.replace(w,N);v[o]=new A(o,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var o=i.replace(w,N);v[o]=new A(o,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var o=i.replace(w,N);v[o]=new A(o,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){v[i]=new A(i,1,!1,i.toLowerCase(),null,!1,!1)}),v.xlinkHref=new A("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){v[i]=new A(i,1,!1,i.toLowerCase(),null,!0,!0)});function C(i,o,l,h){var E=v.hasOwnProperty(o)?v[o]:null;(E!==null?E.type!==0:h||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(_(o,l,E,h)&&(l=null),h||E===null?b(o)&&(l===null?i.removeAttribute(o):i.setAttribute(o,""+l)):E.mustUseProperty?i[E.propertyName]=l===null?E.type===3?!1:"":l:(o=E.attributeName,h=E.attributeNamespace,l===null?i.removeAttribute(o):(E=E.type,l=E===3||E===4&&l===!0?"":""+l,h?i.setAttributeNS(h,o,l):i.setAttribute(o,l))))}var H=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Y=Symbol.for("react.element"),D=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),ne=Symbol.for("react.strict_mode"),de=Symbol.for("react.profiler"),V=Symbol.for("react.provider"),se=Symbol.for("react.context"),pe=Symbol.for("react.forward_ref"),ve=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),xe=Symbol.for("react.lazy"),oe=Symbol.for("react.offscreen"),Q=Symbol.iterator;function ie(i){return i===null||typeof i!="object"?null:(i=Q&&i[Q]||i["@@iterator"],typeof i=="function"?i:null)}var k=Object.assign,R;function ee(i){if(R===void 0)try{throw Error()}catch(l){var o=l.stack.trim().match(/\n( *(at )?)/);R=o&&o[1]||""}return`
|
|
10
|
+
`+a)}}catch(u){}}throw r}})}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ts(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:a}=n;r!==void 0&&ll.assertOptions(r,{silentJSONParsing:mn.transitional(mn.boolean),forcedJSONParsing:mn.transitional(mn.boolean),clarifyTimeoutError:mn.transitional(mn.boolean),legacyInterceptorReqResOrdering:mn.transitional(mn.boolean),advertiseZstdAcceptEncoding:mn.transitional(mn.boolean),validateStatusUndefinedResolves:mn.transitional(mn.boolean)},!1),s!=null&&($.isFunction(s)?n.paramsSerializer={serialize:s}:ll.assertOptions(s,{encode:mn.function,serialize:mn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ll.assertOptions(n,{baseUrl:mn.spelling("baseURL"),withXsrfToken:mn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=a&&$.merge(a.common,a[n.method]);a&&$.forEach(["delete","get","head","post","put","patch","query","common"],_=>{delete a[_]}),n.headers=pn.concat(u,a);const c=[];let d=!0;this.interceptors.request.forEach(function(A){if(typeof A.runWhen=="function"&&A.runWhen(n)===!1)return;d=d&&A.synchronous;const v=n.transitional||lf;v&&v.legacyInterceptorReqResOrdering?c.unshift(A.fulfilled,A.rejected):c.push(A.fulfilled,A.rejected)});const f=[];this.interceptors.response.forEach(function(A){f.push(A.fulfilled,A.rejected)});let p,m=0,b;if(!d){const _=[Dg.bind(this),void 0];for(_.unshift(...c),_.push(...f),b=_.length,p=Promise.resolve(n);m<b;)p=p.then(_[m++],_[m++]);return p}b=c.length;let y=n;for(;m<b;){const _=c[m++],A=c[m++];try{y=_(y)}catch(v){A.call(this,v);break}}try{p=Dg.call(this,y)}catch(_){return Promise.reject(_)}for(m=0,b=f.length;m<b;)p=p.then(f[m++],f[m++]);return p}getUri(t){t=ts(this.defaults,t);const n=Ag(t.baseURL,t.url,t.allowAbsoluteUrls,t);return mg(n,t.params,t.paramsSerializer)}};$.forEach(["delete","get","head","options"],function(t){ns.prototype[t]=function(n,r){return this.request(ts(r||{},{method:t,url:n,data:r&&$.hasOwnProp(r,"data")?r.data:void 0}))}}),$.forEach(["post","put","patch","query"],function(t){function n(r){return function(a,u,c){return this.request(ts(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:u}))}}ns.prototype[t]=n(),t!=="query"&&(ns.prototype[t+"Form"]=n(!0))});let nv=class D2{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(s=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](s);r._listeners=null}),this.promise.then=s=>{let a;const u=new Promise(c=>{r.subscribe(c),a=c}).then(s);return u.cancel=function(){r.unsubscribe(a)},u},t(function(a,u,c){r.reason||(r.reason=new da(a,u,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new D2(function(s){t=s}),cancel:t}}};function rv(e){return function(n){return e.apply(null,n)}}function iv(e){return $.isObject(e)&&e.isAxiosError===!0}const gf={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(gf).forEach(([e,t])=>{gf[t]=e});function Fg(e){const t=new ns(e),n=J0(ns.prototype.request,t);return $.extend(n,ns.prototype,t,{allOwnKeys:!0}),$.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Fg(ts(e,s))},n}const Ot=Fg(ca);Ot.Axios=ns,Ot.CanceledError=da,Ot.CancelToken=nv,Ot.isCancel=bg,Ot.VERSION=hf,Ot.toFormData=il,Ot.AxiosError=be,Ot.Cancel=Ot.CanceledError,Ot.all=function(t){return Promise.all(t)},Ot.spread=rv,Ot.isAxiosError=iv,Ot.mergeConfig=ts,Ot.AxiosHeaders=pn,Ot.formToJSON=e=>Tg($.isHTMLForm(e)?new FormData(e):e),Ot.getAdapter=Lg.getAdapter,Ot.HttpStatusCode=gf,Ot.default=Ot;const{Axios:D7,AxiosError:M7,CanceledError:F7,isCancel:B7,CancelToken:U7,VERSION:H7,all:z7,Cancel:j7,isAxiosError:$7,spread:V7,toFormData:q7,AxiosHeaders:Y7,HttpStatusCode:G7,formToJSON:W7,getAdapter:X7,mergeConfig:K7,create:Q7}=Ot;class sv{constructor(t,n,r,s=!1,a,u){Se(this,"CIMULATE_API_HEADER","x-cimulate-api-key");Se(this,"CIMULATE_SEARCH_API_HOST","search.cimulate");Se(this,"CIMULATE_SEARCH_API_PATH","api/v1");Se(this,"baseApiUrl");Se(this,"headers",{});Se(this,"fetchConfig",()=>Ke(this,null,function*(){try{const t=yield Ot.get(`${this.apiUrl}/configs/copilot`,{headers:this.headers}),{customer_config:n}=t.data,r=atob(n);return JSON.parse(r)}catch(t){throw console.error("Error fetching customer config:",t),t}}));Se(this,"_mapCopilotUrlToSearchUrl",(t="",n=!1)=>{if(t.endsWith("io")){const s=new URL(t);return s.hostname=s.hostname.replace(/^copilot\./,"api."),s.origin}return n?`https://staging.${this.CIMULATE_SEARCH_API_HOST}.ai`:`https://prod.${this.CIMULATE_SEARCH_API_HOST}.ai`});if(n&&r||!n&&!r)throw new Error("Provide exactly one authentication method: either 'apiKey' or 'apiToken', but not both.");n?this.headers[this.CIMULATE_API_HEADER]=n:r&&(this.headers.Authorization=`Bearer ${r}`),a&&(this.headers["x-cimulate-customer-id"]=a),u&&(this.headers["Tenant-ID"]=u),this.baseApiUrl=this._mapCopilotUrlToSearchUrl(t,s)}get apiUrl(){return`${this.baseApiUrl}/${this.CIMULATE_SEARCH_API_PATH}`}}class ov{constructor(t,n,r,s=!1,a,u){Se(this,"apiService");Se(this,"config",null);Se(this,"getConfig",()=>Ke(this,null,function*(){if(this.config)return this.config;try{const t=yield this.apiService.fetchConfig();return this.config=t,this.config}catch(t){throw console.error("Failed to fetch customer config:",t),t}}));Se(this,"getPid",t=>this.getProductFieldValue(t,"pidCol"));Se(this,"getName",t=>this.getProductFieldValue(t,"nameCol"));Se(this,"getDescription",t=>this.getProductFieldValue(t,"description"));Se(this,"getBrand",t=>this.getProductFieldValue(t,"productBrandCol"));Se(this,"getPrice",t=>this.getProductFieldValue(t,"priceCol"));Se(this,"getRelativePdp",t=>this.getProductFieldValue(t,"relativePdpCol"));Se(this,"getPdp",t=>this.getProductFieldValue(t,"pdpCol"));Se(this,"getImage",t=>this.getProductFieldValue(t,"imageCol"));Se(this,"getProductHiddenFields",()=>{const t=this.getProductField("productHiddenFields");return Array.isArray(t)?t:[]});Se(this,"getProductField",t=>this.config?this.config[t]:"");Se(this,"getProductFieldValue",(t,n)=>{const r=this.getProductField(n);return r&&t[r]||""});this.apiService=new sv(t,n,r,s,a,u)}getPriceDisplay(t){const n=this.getPrice(t);return n?typeof n=="string"?n.includes("$")?n:`$${n}`:typeof n=="number"?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(n):n:""}}const Ys=(e,t,n,...r)=>{if(!e)return;const s=["background: linear-gradient(90deg,rgba(253, 99, 99, 1) 0%, rgba(245, 139, 35, 1) 65%)","font-weight: bold","color: transparent","background-clip: text","text-fill-color: transparent"].join(";");console[t]("%c[cimulate-widget]",s,n,...r)};class av{constructor(t=!1){Se(this,"isDevelopment");Se(this,"_log",(t,n,...r)=>{Ys(this.isDevelopment,t,n,...r)});this.isDevelopment=t}log(t,...n){this._log("log",t,...n)}warn(t,...n){this._log("warn",t,...n)}error(t,...n){this._log("error",t,...n)}info(t,...n){this._log("info",t,...n)}debug(t,...n){this._log("debug",t,...n)}}const uv={copilot:"Your Search Assistant",messaging:"Commerce Client"},Bg=B.createContext(null),lv=({mode:e,logoUrl:t,headerText:n,headerConfig:r,globalClassName:s="",entryMessage:a,openLinksInNewTab:u=!1,disclaimerText:c,disclaimerMarkdown:d,clientContext:f,baseCatalogParams:p,searchPlaceholder:m,searchButtonLabel:b,searchConfig:y,suggestionButtonConfig:_,progressStepsLimit:A=3,messageAlignment:v="start",autoScroll:w=!0,showProductDescription:N=!1,componentConfig:C,conversationHistory:H,resetConversationMessage:Y="",apiKey:D,apiToken:q,baseUrl:ne,customerId:de,tenantId:V,theme:se,isDevelopment:pe,__features:ve,routingAttributes:re,enableDownloadTranscript:ae=!0,enableEscalationToAgent:xe=!1,showProductCaptions:oe=!1,staticQuestions:Q,staticQuestionsStrategy:ie="append",children:k})=>{const R=e==="messaging",ee=B.useMemo(()=>{const Ye=re==null?void 0:re.isCartMgmtSupported;return Ye===!0||Ye==="true"},[re]),O=B.useMemo(()=>R?{config:null}:new ov(ne,D,q,pe,de,V),[R,ne,D,q,pe,de,V]),_e=B.useMemo(()=>new av(pe),[pe]);B.useEffect(()=>{R||!O||O.config||O.getConfig()},[O,R]);const Be=B.useMemo(()=>fA(se),[se]),ye=B.useMemo(()=>{const Ye=(y==null?void 0:y.placeholder)||m,ht=(y==null?void 0:y.buttonLabel)||b;let $t="icon";return y!=null&&y.buttonType?$t=y.buttonType:b&&($t="text"),fe(F({},y||{}),{placeholder:Ye,buttonLabel:ht,buttonType:$t})},[y,m,b]),De=B.useMemo(()=>fe(F({},r||{}),{logoUrl:t||(r==null?void 0:r.logoUrl),headerText:(r==null?void 0:r.headerText)||n||uv[e!=null?e:"copilot"]}),[r,t,n,e]),Ue=B.useMemo(()=>({configModule:O,mode:e!=null?e:"copilot",headerConfig:De,entryMessage:a,staticQuestions:Q||[],staticQuestionsStrategy:ie,globalClassName:s,openLinksInNewTab:u,disclaimerText:c,disclaimerMarkdown:d,clientContext:f,baseCatalogParams:p,themeVariables:Be,logger:_e,searchConfig:ye,suggestionButtonConfig:_,progressStepsLimit:A,messageAlignment:v,autoScroll:w,showProductDescription:!!N,enableMinimize:!!(C!=null&&C.enableMinimize),enableDownloadTranscript:ae,enableEscalationToAgent:xe,showProductCaptions:!!oe,resetConversationMessage:Y,conversationHistory:{sinceHours:typeof(H==null?void 0:H.sinceHours)=="number"?H.sinceHours:R?24:1,limit:H==null?void 0:H.limit},features:ve,isCartMgmtSupported:ee}),[O,e,De,a,Q,ie,s,f,p,c,d,u,ye,_,v,w,N,C,ae,xe,A,oe,Y,_e,Be,H,ve,ee]);return S.jsx(Bg.Provider,{value:Ue,children:k})},tt=()=>{const e=B.useContext(Bg);if(!e)throw new Error("useConfig must be used within a ConfigProvider");return e};class cv{constructor(){Se(this,"initialState",{connected:!1,mode:"embedded",entryType:"search",status:{type:"dialog",isOpen:!1,isMinimized:!1},dialog:{position:"bottom-left",isFullHeight:!1,width:""},modal:{isFullscreen:!1}});Se(this,"connectedProxy");Se(this,"modeProxy");Se(this,"entryTypeProxy");Se(this,"statusProxy");Se(this,"dialogProxy");Se(this,"modalProxy",{isFullscreen:!1});Se(this,"_fullGet",(t,n)=>Reflect.get(t,n));Se(this,"_fullSet",(t,n,r)=>{if(!(n in t))throw new Error(`Property ${n} does not exist on UIState`);return mv(n,r),Reflect.set(t,n,r)});this.connectedProxy=new Proxy({connected:this.initialState.connected},{get:this._fullGet,set:this._fullSet}),this.modeProxy=new Proxy({mode:this.initialState.mode},{get:this._fullGet,set:this._fullSet}),this.entryTypeProxy=new Proxy({entryType:this.initialState.entryType},{get:this._fullGet,set:this._fullSet}),this.statusProxy=new Proxy({type:this.initialState.status.type,isOpen:this.initialState.status.isOpen,isMinimized:this.initialState.status.isMinimized},{get:this._fullGet,set:this._fullSet}),this.dialogProxy=new Proxy({position:this.initialState.dialog.position,isFullHeight:this.initialState.dialog.isFullHeight,width:this.initialState.dialog.width},{get:this._fullGet,set:this._fullSet}),this.modalProxy=new Proxy({isFullscreen:this.initialState.modal.isFullscreen},{get:this._fullGet,set:this._fullSet})}get connected(){return this.connectedProxy.connected}get mode(){return this.modeProxy.mode}get isOpen(){return!!this.statusProxy.isOpen}get isMinimized(){return!!this.statusProxy.isMinimized}get type(){return this.statusProxy.type}get entryType(){return this.entryTypeProxy.entryType}get position(){return this.dialogProxy.position}get state(){return{connected:this.connected,mode:this.mode,entryType:this.entryType,status:{type:this.type,isOpen:this.isOpen,isMinimized:this.isMinimized},dialog:{position:this.position,isFullHeight:this.dialogProxy.isFullHeight,width:this.dialogProxy.width},modal:{isFullscreen:this.modalProxy.isFullscreen}}}}const Je=new cv,rs=()=>Je.connected,fa=()=>Je.isOpen,Ef="cimulate.widget.minimizedOnNav";function dv(){try{const e=sessionStorage.getItem(Ef)==="1";return sessionStorage.removeItem(Ef),e}catch(e){return!1}}function fv(){try{sessionStorage.removeItem(Ef)}catch(e){return}}const hv=e=>{window.addEventListener(Jd,e)},pv=e=>{window.removeEventListener(Jd,e)},mv=(e,t)=>{const n=new CustomEvent(Jd,{detail:{property:e,value:t}});window.dispatchEvent(n)},gv=e=>{Je.connectedProxy.connected=e},ha=e=>{if(!aA(e)){const t=G0.map(r=>`'${r}'`),n=`${t.slice(0,-1).join(", ")}, or ${t[t.length-1]}`;throw new Error(`Invalid entryType: "${e}". Must be ${n}.`)}Je.entryTypeProxy.entryType=e},ei=e=>{const t=Je.statusProxy.isOpen,n=typeof e=="boolean"?e:!t;Je.statusProxy.isOpen=n,n&&(Je.statusProxy.isMinimized=!1,fv())},pa=e=>{const t=Je.statusProxy.isMinimized,n=typeof e=="boolean"?e:!t;Je.statusProxy.isMinimized=n,n&&(Je.statusProxy.isOpen=!1)},yf=e=>{Je.modalProxy.isFullscreen=e},cl=e=>{if(!["chat","dialog","modal"].includes(e))throw new Error(`Invalid type: ${e}. Must be 'chat', 'dialog', or 'modal'.`);Je.statusProxy.type=e,e==="dialog"||e==="chat"?Je.modeProxy.mode="embedded":Je.modeProxy.mode="standalone"},Tf=e=>{const t=["top","top-left","top-right","bottom","bottom-left","bottom-right","left","right","center"];if(!t.includes(e))throw new Error(`Invalid position: ${e}. Must be one of ${t.join(", ")}.`);Je.dialogProxy.position=e},Ev=e=>{const t=Je.dialogProxy.isFullHeight,n=typeof e=="boolean"?e:!t;Je.dialogProxy.isFullHeight=n},yv=({onCopilotEvent:e,children:t,dispatch:n})=>{const{logger:r}=tt(),s=B.useCallback(C=>{n({type:gt.SET_COPILOT,payload:C})},[n]),a=B.useCallback(C=>{gv(C),n({type:gt.SET_CONNECTED,payload:C})},[n]),u=B.useCallback(()=>{n({type:gt.RESET_COPILOT,payload:{}})},[n]),c=B.useCallback(()=>{n({type:gt.RESET_STATE,payload:{}})},[n]),d=B.useCallback(C=>{r==null||r.log(`${C.name} event received`,C),n({type:gt.ADD_MESSAGE,payload:C}),C.bypassHandlers||e==null||e(C)},[e,r,n]),f=B.useCallback(C=>{n({type:gt.ADD_LOADING_MESSAGE,payload:C})},[n]),p=B.useCallback(C=>{n({type:gt.REMOVE_LOADING_MESSAGE,payload:C})},[n]),m=B.useCallback(C=>{d(C),f(C.id)},[d,f]),b=B.useCallback(C=>{n({type:gt.SET_ACTIVE_CONVERSATION_ID,payload:C})},[n]),y=B.useCallback(C=>{n({type:gt.ADD_CONVERSATION_ID,payload:C})},[n]),_=B.useCallback(C=>{n({type:gt.SET_CONVERSATION_IDS,payload:C})},[n]),A=B.useCallback(C=>{n({type:gt.SET_IMAGE_FILE,payload:C})},[n]),v=B.useCallback(C=>{n({type:gt.SET_ASK_CIM_PROMPTS,payload:C})},[n]),w=B.useCallback(C=>{n({type:gt.SET_CONVERSATION_HISTORY_LOADED,payload:C})},[n]),N=B.useMemo(()=>({setCopilot:s,setConnected:a,resetCopilot:u,resetCopilotState:c,addCopilotEvent:d,addLoadingMessage:f,removeLoadingMessage:p,handleCopilotRequestAck:m,setActiveConversationId:b,addConversationId:y,setConversationIds:_,setImageFile:A,setAskCimPrompts:v,setConversationHistoryLoaded:w}),[s,a,u,c,d,f,p,m,b,y,_,A,v,w]);return S.jsx(K0.Provider,{value:N,children:t})};iA();const Tv=(e,t)=>{const{type:n,payload:r}=t;if(n===gt.ADD_MESSAGE){const s=r;if(e.messages.push(s),s.eventSourceId){const a=e.groupedMessages.findIndex(u=>u.eventSourceId===s.eventSourceId);if(a!==-1){let u=e.groupedMessages[a].messages;u||(u=[]);const c=u.findIndex(d=>d.id===s.id);if(c!==-1){u[c]=s;return}u.push(s);return}else{e.groupedMessages.push({type:"group",eventSourceId:s.eventSourceId,messages:[s],createdAt:new Date(s.createdAt)});return}}e.groupedMessages.push({type:"individual",message:s,createdAt:new Date(s.createdAt)});return}switch(n){case gt.RESET_STATE:e.messages=Ji.messages,e.groupedMessages=Ji.groupedMessages,e.loadingMessages=Ji.loadingMessages,e.imageFile=Ji.imageFile,e.askCimPrompts=Ji.askCimPrompts,e.conversationHistoryLoaded=Ji.conversationHistoryLoaded;break;case gt.RESET_COPILOT:e.copilot=null;break;case gt.SET_COPILOT:e.copilot=r;break;case gt.SET_CONNECTED:e.connected=r;break;case gt.ADD_LOADING_MESSAGE:e.loadingMessages.add(r);break;case gt.REMOVE_LOADING_MESSAGE:e.loadingMessages.delete(r);break;case gt.SET_ACTIVE_CONVERSATION_ID:e.activeConversationId=r;break;case gt.ADD_CONVERSATION_ID:{const s=r;e.conversationIds.includes(s)||e.conversationIds.push(s)}break;case gt.SET_CONVERSATION_IDS:e.conversationIds=r;break;case gt.SET_IMAGE_FILE:e.imageFile=r;break;case gt.SET_ASK_CIM_PROMPTS:e.askCimPrompts.requestId=(r==null?void 0:r.requestId)||null,e.askCimPrompts.message=(r==null?void 0:r.message)||null;break;case gt.SET_CONVERSATION_HISTORY_LOADED:e.conversationHistoryLoaded=r;break}},bv=({onCopilotEvent:e,children:t})=>{const[n,r]=q0(Tv,Ji);return S.jsx(X0.Provider,{value:n,children:S.jsx(yv,{onCopilotEvent:e,dispatch:r,children:t})})};function _v(){var e=B.useRef(!0);return e.current?(e.current=!1,!0):e.current}function Sv(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.addEventListener&&e.addEventListener.apply(e,t)}function xv(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.removeEventListener&&e.removeEventListener.apply(e,t)}var bf=typeof window!="undefined",ma=function(e){B.useEffect(e,[])},wv=function(e){var t=B.useRef(e);t.current=e,ma(function(){return function(){return t.current()}})},Av=function(e){var t=B.useRef(0),n=B.useState(e),r=n[0],s=n[1],a=B.useCallback(function(u){cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){s(u)})},[]);return wv(function(){cancelAnimationFrame(t.current)}),[r,a]},Cv=function(e,t){return e===t};function vv(e,t){t===void 0&&(t=Cv);var n=B.useRef(),r=B.useRef(e),s=_v();return!s&&!t(r.current,e)&&(n.current=r.current,r.current=e),n.current}var kv=function(e){var t={},n=t.initialWidth,r=n===void 0?1/0:n,s=t.initialHeight,a=s===void 0?1/0:s,u=t.onChange,c=Av({width:bf?window.innerWidth:r,height:bf?window.innerHeight:a}),d=c[0],f=c[1];return B.useEffect(function(){if(bf){var p=function(){var m=window.innerWidth,b=window.innerHeight;f({width:m,height:b}),u&&u(m,b)};return Sv(window,"resize",p),function(){xv(window,"resize",p)}}},[]),d};class Nv{constructor(){Se(this,"items",[]);Se(this,"add",t=>{const n=this.first();n&&n.context===t.context&&this.remove(),this.items.push(t)});Se(this,"remove",()=>this.items.shift());Se(this,"first",()=>this.items.length>0?this.items[0]:null);Se(this,"clear",()=>{this.items.length=0});Se(this,"processQueue",t=>{new Array(gn.size).fill(1).forEach(()=>{const r=gn.first();r&&(t(r),gn.remove())})})}get size(){return this.items.length}}const gn=new Nv,Ug=e=>{window.addEventListener(Qd,e)},Hg=e=>{window.removeEventListener(Qd,e)},Pv=(e,t,n)=>{const r=new CustomEvent(Qd,{detail:{event:e,property:t,value:n}});window.dispatchEvent(r)},zg=e=>{window.addEventListener(Kd,e)},jg=e=>{window.removeEventListener(Kd,e)},Ov=(e,t,n)=>{const r=new CustomEvent(Kd,{detail:{event:e,property:t,value:n}});window.dispatchEvent(r)},$g=e=>{window.addEventListener(Xd,e)},Vg=e=>{window.removeEventListener(Xd,e)},qg=(e,t,n)=>{const r=new CustomEvent(Xd,{detail:{property:e,value:t,event:n}});window.dispatchEvent(r)},Iv=e=>{window.addEventListener(ef,e)},Rv=e=>{window.removeEventListener(ef,e)},dl=(e,t,n)=>{const r=new CustomEvent(ef,{detail:{property:e,value:t,event:n}});window.dispatchEvent(r)};class Lv{constructor(){Se(this,"initialParams",{categoryId:"",categoryName:"",page:null,pageSize:null,includeFacets:!0,facetFilters:{},rangeFilters:[],catalogSegment:null,pricebooks:null});Se(this,"categoryIdProxy");Se(this,"facetFiltersProxy");Se(this,"rangeFiltersProxy");Se(this,"catalogSegmentProxy");Se(this,"pricebooksProxy");Se(this,"_fullGet",(t,n)=>Reflect.get(t,n));Se(this,"_fullSet",(t,n,r)=>{const s=cA[n];return Ov(s,n,r),Reflect.set(t,n,r)});Se(this,"updateFacetFiltersProxy",t=>new Proxy({facetFilters:t},{get:this._fullGet,set:this._fullSet}));Se(this,"updateRangeFiltersProxy",t=>new Proxy({rangeFilters:t},{get:this._fullGet,set:this._fullSet}));Se(this,"updatePricebooksProxy",t=>new Proxy({pricebooks:t},{get:this._fullGet,set:this._fullSet}));this.categoryIdProxy=new Proxy({categoryId:this.initialParams.categoryId,categoryName:this.initialParams.categoryName},{get:this._fullGet,set:this._fullSet}),this.facetFiltersProxy=this.updateFacetFiltersProxy(this.initialParams.facetFilters||{}),this.rangeFiltersProxy=this.updateRangeFiltersProxy(this.initialParams.rangeFilters||[]),this.catalogSegmentProxy=new Proxy({catalogSegment:this.initialParams.catalogSegment},{get:this._fullGet,set:this._fullSet}),this.pricebooksProxy=this.updatePricebooksProxy(this.initialParams.pricebooks||null)}get categoryId(){return this.categoryIdProxy.categoryId||""}get facetFilters(){return this.facetFiltersProxy.facetFilters||{}}get rangeFilters(){return this.rangeFiltersProxy.rangeFilters||[]}get catalogSegment(){return this.catalogSegmentProxy.catalogSegment||null}get pricebooks(){return this.pricebooksProxy.pricebooks||null}get state(){return{categoryId:this.categoryId,categoryName:this.categoryIdProxy.categoryName,facetFilters:this.facetFilters,rangeFilters:this.rangeFilters,catalogSegment:this.catalogSegment,pricebooks:this.pricebooks,page:this.initialParams.page,pageSize:this.initialParams.pageSize,includeFacets:this.initialParams.includeFacets}}}const ut=new Lv,Yg=(e,t)=>{const n=t.updateFacetFiltersProxy(e);t.facetFiltersProxy.facetFilters=n.facetFilters},Gg=(e,t,n)=>{var u,c;const r=F({},((u=n.facetFiltersProxy)==null?void 0:u.facetFilters)||{});if(!!((c=r[e])!=null&&c.includes(t))){const d=r[e].filter(f=>f!==t);d.length>0?r[e]=d:delete r[e]}else r[e]=r[e]?[...r[e],t]:[t];const a=n.updateFacetFiltersProxy(r);n.facetFiltersProxy.facetFilters=a.facetFilters},Wg=(e,t)=>{const n=t.updateRangeFiltersProxy(e);t.rangeFiltersProxy.rangeFilters=n.rangeFilters},Xg=({field:e,value:t},n)=>{const[r,s]=Array.isArray(t)?t:[];if(typeof r=="undefined"||typeof s=="undefined")throw new Error("Range values must be an array with two numbers for min and max");const a=[...n.rangeFiltersProxy.rangeFilters||[]],u=a.findIndex(d=>d.field===e);if(u!==-1){a[u]={field:e,min:r,max:s},n.rangeFiltersProxy.rangeFilters=a;return}a.push({field:e,min:r,max:s});const c=n.updateRangeFiltersProxy(a);n.rangeFiltersProxy.rangeFilters=c.rangeFilters},Kg=(e,t)=>{t.catalogSegmentProxy.catalogSegment=e},Qg=(e,t)=>{const n=t.updatePricebooksProxy(e);t.pricebooksProxy.pricebooks=n.pricebooks},Dv=e=>{if(!rs()||!fa()){rs()&&gn.clear(),gn.add({context:"browse",payload:fe(F({},ut.state),{categoryId:e})});return}ut.categoryIdProxy.categoryId=e},Jg=e=>{Yg(e,ut)},Mv=(e,t)=>{Gg(e,t,ut)},Zg=e=>{Wg(e,ut)},Fv=({field:e,value:t})=>{Xg({field:e,value:t},ut)},Bv=e=>{Kg(e,ut)},e1=e=>{Qg(e,ut)},t1=e=>{if(!e||!("categoryId"in e))throw new Error("Browse context must include a categoryId");const t=rs(),n=fa();if(!t||!n){t&&gn.clear(),gn.add({context:"browse",payload:F({},e)});return}"facetFilters"in e&&Jg(e.facetFilters||{}),"rangeFilters"in e&&Zg(e.rangeFilters||[]),"catalogSegment"in e&&(ut.catalogSegmentProxy.catalogSegment=e.catalogSegment||null),"pricebooks"in e&&e1(e.pricebooks||[]),"categoryName"in e&&(ut.categoryIdProxy.categoryName=e.categoryName||""),ut.categoryIdProxy.categoryId=e.categoryId},Uv=Object.freeze(Object.defineProperty({__proto__:null,setBrowseContext:t1,updateBrowseCategoryId:Dv,updateCatalogSegment:Bv,updateFacetFilter:Mv,updateFacetFilters:Jg,updatePricebooks:e1,updateRangeFilter:Fv,updateRangeFilters:Zg},Symbol.toStringTag,{value:"Module"}));class Hv{constructor(){Se(this,"initialParams",{productId:"",productName:"",pdpLink:""});Se(this,"proxy");Se(this,"_fullGet",(t,n)=>Reflect.get(t,n));Se(this,"_fullSet",(t,n,r)=>(qg(n,r),Reflect.set(t,n,r)));Se(this,"updateProxy",t=>{t.productId&&(this.proxy=new Proxy({productId:t.productId,productName:t.productName||"",pdpLink:t.pdpLink||""},{get:this._fullGet,set:this._fullSet}))});this.proxy=new Proxy({productId:this.initialParams.productId,productName:this.initialParams.productName,pdpLink:this.initialParams.pdpLink},{get:this._fullGet,set:this._fullSet})}get productId(){return this.proxy.productId}get pdpLink(){return this.proxy.pdpLink}get state(){return{productId:this.productId,productName:this.proxy.productName,pdpLink:this.pdpLink}}}const hr=new Hv,n1=e=>{if(!e||!e.productId)throw new Error("PDP context must include a productId");const t=rs(),n=fa();if(!t||!n){t&&gn.clear(),gn.add({context:"pdp",payload:F({},e)});return}hr.updateProxy(e),qg("pdp-context",e)},zv=e=>{hr.proxy.productId=e,rs()||gn.add({context:"pdp",payload:F({},hr.state)})},jv=e=>{hr.proxy.pdpLink=e};class $v{constructor(){Se(this,"initialState",Q0);Se(this,"promptsStateProxy");Se(this,"promptsParamsProxy");Se(this,"_fullGet",(t,n)=>Reflect.get(t,n));Se(this,"_fullSet",(t,n,r)=>{if(!(n in t))throw new Error(`Property ${n} does not exist on PromptsExtensionState`);return ga(n,r),Reflect.set(t,n,r)});Se(this,"_paramsFullGet",(t,n)=>Reflect.get(t,n));Se(this,"_paramsFullSet",(t,n,r)=>Reflect.set(t,n,r));Se(this,"updatePromptsParamsProxy",t=>new Proxy(F({},t),{get:this._paramsFullGet,set:this._paramsFullSet}));this.promptsStateProxy=new Proxy({isOpen:this.initialState.isOpen,isInline:this.initialState.isInline,elementId:this.initialState.elementId,entryType:this.initialState.entryType},{get:this._fullGet,set:this._fullSet}),this.promptsParamsProxy=this.updatePromptsParamsProxy({})}get isOpen(){return this.promptsStateProxy.isOpen}get isInline(){return this.promptsStateProxy.isInline}get state(){return{isOpen:this.isOpen,isInline:this.isInline}}get params(){return this.promptsParamsProxy}}const Ft=new $v,Vv=e=>{window.addEventListener(Zd,e)},qv=e=>{window.removeEventListener(Zd,e)},ga=(e,t)=>{const n=new CustomEvent(Zd,{detail:{property:e,value:t}});window.dispatchEvent(n)},r1=e=>{const t=Ft.isOpen,n=typeof e=="boolean"?e:!t;Ft.promptsStateProxy.isOpen=n},i1=e=>{const t=Ft.isInline,n=typeof e=="boolean"?e:!t;Ft.promptsStateProxy.isInline=n},Yv=e=>{Ft.promptsParamsProxy=Ft.updatePromptsParamsProxy(e),ga("params",e),Ft.promptsStateProxy.entryType="ask_cim"},Gv=e=>{Ft.promptsParamsProxy=Ft.updatePromptsParamsProxy(e),ga("params",e),Ft.promptsStateProxy.entryType="search"},Wv=e=>{Ft.promptsParamsProxy=Ft.updatePromptsParamsProxy(e),ga("params",e),Ft.promptsStateProxy.entryType="browse"},Xv=e=>{Ft.promptsParamsProxy=Ft.updatePromptsParamsProxy(e),ga("params",e),Ft.promptsStateProxy.entryType="pdp"},Kv=({elementId:e,entryType:t,params:n,isInline:r})=>{Ft.promptsStateProxy.elementId=e,t&&(Ft.promptsStateProxy.entryType=t),typeof r=="boolean"&&i1(r),n&&Ft.updatePromptsParamsProxy(n),Ft.isOpen||r1(!0)},Qv=Object.freeze(Object.defineProperty({__proto__:null,getConversationMessages:({payload:e,callback:t})=>{dl("getConversationMessages",{payload:e,callback:t},Ti.GET_CONVERSATION_MESSAGES)},getSessionInformation:e=>{dl("getSessionInformation",{callback:e},Ti.GET_SESSION_INFORMATION)},loadConversation:e=>{dl("loadConversation",e,Ti.LOAD_CONVERSATION)},resetConversation:()=>{dl("resetConversation",!0,Ti.RESET_CONVERSATION)}},Symbol.toStringTag,{value:"Module"}));class Jv{constructor(){Se(this,"initialParams",{query:"",page:null,pageSize:null,includeFacets:!0,facetFilters:{},rangeFilters:[],catalogSegment:null,pricebooks:null});Se(this,"queryProxy");Se(this,"facetFiltersProxy");Se(this,"rangeFiltersProxy");Se(this,"catalogSegmentProxy");Se(this,"pricebooksProxy");Se(this,"_fullGet",(t,n)=>Reflect.get(t,n));Se(this,"_fullSet",(t,n,r)=>{const s=dA[n];return Pv(s,n,r),Reflect.set(t,n,r)});Se(this,"updateFacetFiltersProxy",t=>new Proxy({facetFilters:t},{get:this._fullGet,set:this._fullSet}));Se(this,"updateRangeFiltersProxy",t=>new Proxy({rangeFilters:t},{get:this._fullGet,set:this._fullSet}));Se(this,"updatePricebooksProxy",t=>new Proxy({pricebooks:t},{get:this._fullGet,set:this._fullSet}));this.queryProxy=new Proxy({query:this.initialParams.query},{get:this._fullGet,set:this._fullSet}),this.facetFiltersProxy=this.updateFacetFiltersProxy(this.initialParams.facetFilters||{}),this.rangeFiltersProxy=this.updateRangeFiltersProxy(this.initialParams.rangeFilters||[]),this.catalogSegmentProxy=new Proxy({catalogSegment:this.initialParams.catalogSegment},{get:this._fullGet,set:this._fullSet}),this.pricebooksProxy=this.updatePricebooksProxy(this.initialParams.pricebooks||null)}get query(){return this.queryProxy.query||""}get facetFilters(){return this.facetFiltersProxy.facetFilters||{}}get rangeFilters(){return this.rangeFiltersProxy.rangeFilters||[]}get catalogSegment(){return this.catalogSegmentProxy.catalogSegment||null}get pricebooks(){return this.pricebooksProxy.pricebooks||null}get state(){return{query:this.query,facetFilters:this.facetFilters,rangeFilters:this.rangeFilters,catalogSegment:this.catalogSegment,pricebooks:this.pricebooks,page:this.initialParams.page,pageSize:this.initialParams.pageSize,includeFacets:this.initialParams.includeFacets}}}const Tt=new Jv,Zv=e=>{const t=fa(),n=rs();if(!n||!t){n&&gn.clear(),gn.add({context:"search",payload:fe(F({},Tt.state),{query:e})});return}Tt.queryProxy.query=e},s1=e=>{Yg(e,Tt)},ek=(e,t)=>{Gg(e,t,Tt)},o1=e=>{Wg(e,Tt)},tk=({field:e,value:t})=>{Xg({field:e,value:t},Tt)},nk=e=>{Kg(e,Tt)},a1=e=>{Qg(e,Tt)},u1=e=>{if(!e||!e.query)throw new Error("Search context must include a query");const t=fa(),n=rs();if(!n||!t){n&&gn.clear(),gn.add({context:"search",payload:F({},e)});return}"facetFilters"in e&&s1(e.facetFilters||{}),"rangeFilters"in e&&o1(e.rangeFilters||[]),"catalogSegment"in e&&(Tt.catalogSegmentProxy.catalogSegment=e.catalogSegment||null),"pricebooks"in e&&a1(e.pricebooks||[]),Tt.queryProxy.query=e.query},rk=Object.freeze(Object.defineProperty({__proto__:null,setSearchContext:u1,updateCatalogSegment:nk,updateFacetFilter:ek,updateFacetFilters:s1,updatePricebooks:a1,updateRangeFilter:tk,updateRangeFilters:o1,updateSearchQuery:Zv},Symbol.toStringTag,{value:"Module"})),ik={categoryId:ut.categoryId,categoryName:ut.categoryIdProxy.categoryName||"",facetFilters:ut.facetFilters,rangeFilters:ut.rangeFilters,catalogSegment:ut.catalogSegment,pricebooks:ut.pricebooks},l1=B.createContext(ik),sk=({children:e})=>{const[t,n]=B.useState(ut.categoryId),[r,s]=B.useState(ut.categoryIdProxy.categoryName||""),[a,u]=B.useState(ut.facetFilters||{}),[c,d]=B.useState(ut.rangeFilters||[]),[f,p]=B.useState(ut.catalogSegment||null),[m,b]=B.useState(ut.pricebooks||null);B.useEffect(()=>{const _=({detail:A})=>{(A==null?void 0:A.property)==="categoryId"&&n(A.value),(A==null?void 0:A.property)==="categoryName"&&s(A.value),(A==null?void 0:A.property)==="facetFilters"&&u(A.value),(A==null?void 0:A.property)==="rangeFilters"&&d(A.value),(A==null?void 0:A.property)==="catalogSegment"&&p(A.value),(A==null?void 0:A.property)==="pricebooks"&&b(A.value)};return zg(_),()=>{jg(_)}},[]);const y=B.useMemo(()=>({categoryId:t,categoryName:r,facetFilters:a,rangeFilters:c,catalogSegment:f,pricebooks:m}),[t,r,a,c,f,m]);return S.jsx(l1.Provider,{value:y,children:e})},ok=()=>{const e=B.useContext(l1);if(!e)throw new Error("useBrowse must be used within a BrowseProvider");return e},ak={searchQuery:Tt.query,facetFilters:Tt.facetFilters,rangeFilters:Tt.rangeFilters,catalogSegment:Tt.catalogSegment,pricebooks:Tt.pricebooks},c1=B.createContext(ak),uk=({children:e})=>{const[t,n]=B.useState(Tt.query),[r,s]=B.useState(Tt.facetFilters),[a,u]=B.useState(Tt.rangeFilters),[c,d]=B.useState(Tt.catalogSegment),[f,p]=B.useState(Tt.pricebooks);B.useEffect(()=>{const b=({detail:y})=>{(y==null?void 0:y.property)==="query"&&n(y.value),(y==null?void 0:y.property)==="facetFilters"&&s(y.value),(y==null?void 0:y.property)==="rangeFilters"&&u(y.value),(y==null?void 0:y.property)==="catalogSegment"&&d(y.value),(y==null?void 0:y.property)==="pricebooks"&&p(y.value)};return Ug(b),()=>{Hg(b)}},[]);const m=B.useMemo(()=>({searchQuery:t,facetFilters:r,rangeFilters:a,catalogSegment:c,pricebooks:f}),[t,r,a,c,f]);return S.jsx(c1.Provider,{value:m,children:e})},lk=()=>{const e=B.useContext(c1);if(!e)throw new Error("useSearch must be used within a SearchProvider");return e},ck={productId:hr.productId,pdpLink:hr.pdpLink},d1=B.createContext(ck),dk=({children:e})=>{const[t,n]=B.useState(hr.productId),[r,s]=B.useState(hr.pdpLink);B.useEffect(()=>{const u=({detail:c})=>{if((c==null?void 0:c.property)==="pdp-context"){const d=c.value;n(d.productId),s(d.pdpLink);return}(c==null?void 0:c.property)==="productId"&&n(c.value),(c==null?void 0:c.property)==="pdpLink"&&s(c.value)};return $g(u),()=>{Vg(u)}},[]);const a=B.useMemo(()=>({productId:t,pdpLink:r}),[t,r]);return S.jsx(d1.Provider,{value:a,children:e})},fk=()=>{const e=B.useContext(d1);if(!e)throw new Error("usePdp must be used within a PdpProvider");return e},f1=B.createContext({mode:Je.modeProxy.mode,entryType:Je.entryType,status:Je.statusProxy,dialogPosition:Je.dialogProxy.position,isDialogFullHeight:Je.dialogProxy.isFullHeight,dialogWidth:Je.dialogProxy.width,isModalFullscreen:Je.modalProxy.isFullscreen,previousComponentType:Je.statusProxy.type}),hk=({entryType:e,componentConfig:t,componentType:n,children:r})=>{const[s,a]=B.useState(e!=null?e:Je.entryTypeProxy.entryType),[u,c]=B.useState(Je.modeProxy.mode),[d,f]=B.useState({type:n||Je.statusProxy.type,isOpen:t&&"isOpen"in t?!!t.isOpen:Je.statusProxy.isOpen,isMinimized:t&&"isMinimized"in t?!!t.isMinimized:Je.statusProxy.isMinimized}),[p,m]=B.useState(Je.dialogProxy.position),[b,y]=B.useState(Je.dialogProxy.isFullHeight),[_,A]=B.useState(Je.dialogProxy.width),[v,w]=B.useState(Je.modalProxy.isFullscreen),N=B.useRef(!1),C=vv(d.type);B.useEffect(()=>{const Y=D=>{const{property:q,value:ne}=D.detail||{};if(!(!q||ne===void 0)){if(q==="mode"){c(ne);return}if(q==="entryType"){a(ne);return}if(q==="isMinimized"){f(de=>fe(F({},de),{isMinimized:ne}));return}if(q==="isOpen"){f(de=>fe(F({},de),{isOpen:ne}));return}if(q==="type"){f(de=>fe(F({},de),{type:ne}));return}if(q==="position"){m(ne);return}if(q==="isFullHeight"){y(ne);return}if(q==="width"){A(ne);return}if(q==="isFullscreen"){w(ne);return}}};return hv(Y),()=>{pv(Y)}},[]),ma(()=>{e&&ha(e)}),ma(()=>{if(N.current)return;N.current=!0;const Y=n||(t==null?void 0:t.type);Y&&cl(Y);const D=dv();t&&"isOpen"in t&&ei(!!t.isOpen),t&&"isMinimized"in t&&pa(!!t.isMinimized),D&&pa(!0)}),ma(()=>{if(!(t!=null&&t.options))return;const{dialogPosition:Y}=t.options;Y&&Tf(Y),"dialogFullHeight"in t.options&&Ev(!!t.options.dialogFullHeight),"dialogWidth"in t.options&&t.options.dialogWidth&&A(t.options.dialogWidth),"isModalFullscreen"in t.options&&yf(!!t.options.isModalFullscreen)});const H=B.useMemo(()=>({mode:u,entryType:s,status:d,previousComponentType:C||"dialog",dialogPosition:p,isDialogFullHeight:b,dialogWidth:_,isModalFullscreen:v}),[u,s,d,C,p,b,_,v]);return S.jsx(f1.Provider,{value:H,children:r})},Zn=()=>{const e=B.useContext(f1);if(!e)throw new Error("useUIState must be used within a UIStateProvider");return e},h1=B.createContext(null),p1=B.createContext(null),_f=()=>{const e=B.useContext(p1);if(!e)throw new Error("usePromptsExtensionDispatch must be used within a PromptsExtensionProvider");return e||{}},ti=()=>{const e=B.useContext(h1);if(!e)throw new Error("usePromptsExtensionState must be used within a PromptsExtensionProvider");return e||{}},Gs=()=>{const e=B.useContext(K0);if(!e)throw new Error("useCopilotDispatch must be used within a CopilotProvider");return e},er=()=>{const e=B.useContext(X0);if(!e)throw new Error("useCopilotState must be used within a CopilotProvider");return e},pk=({copilot:e})=>{const{logger:t,conversationHistory:n}=tt(),{isInline:r}=ti(),{addCopilotEvent:s,setConversationHistoryLoaded:a}=Gs(),{activeConversationId:u}=er(),c=B.useCallback(f=>{e&&e.requestSessionInformation(p=>{t==null||t.log("Retrieved session information: ",p),f==null||f(p)})},[e,t]),d=B.useCallback((f,p)=>{e&&f.conversationId&&e.getConversationEvents(f,m=>{t==null||t.log("Retrieved conversation messages: ",m),p==null||p(m)})},[e,t]);return B.useEffect(()=>{if(r||!u)return;if(n.sinceHours===0||(n==null?void 0:n.limit)===0){a(!0);return}const f=3600*1e3*n.sinceHours,p=new Date(Date.now()-f).toISOString(),m={conversationId:u,since:p,excludeEvents:["done","error","connection_error","refined_browse","refined_search","conversation_reset"]};typeof n.limit=="number"&&(m.limit=n.limit),d(m,b=>{const y=[];[...b.reverse()||[]].forEach(A=>{var w;const v=b.find(N=>N.id===A.eventSourceId);(w=v==null?void 0:v.name)!=null&&w.endsWith("_suggestions")||(A.bypassHandlers=!0,y.unshift(A))}),y.forEach(A=>{s(A)}),a(!0)})},[t,r,u,d,s,a,n]),{getSessionInformation:c,getConversationMessages:d}},m1=B.createContext({copilot:null,messages:[],groupedMessages:[],isLoading:!1,isResponseLoading:()=>!1,handleAskCim:()=>{},handleSearch:()=>{},handleBrowse:()=>{},handlePdp:()=>{},handleSuggestion:()=>{},handleUserInput:()=>{},handleCancel:()=>{},resetConversation:()=>{},getSessionInformation:()=>{},getConversationMessages:()=>{}}),mk=({apiKey:e,apiToken:t,baseUrl:n,customerId:r,tenantId:s,isDevelopment:a,onConnect:u,onRefinedSearch:c,onRefinedBrowse:d,children:f})=>{const{logger:p,clientContext:m,baseCatalogParams:b}=tt(),on=lk(),{searchQuery:y}=on,_=dn(on,["searchQuery"]),Mn=ok(),{categoryId:A}=Mn,v=dn(Mn,["categoryId"]),{productId:w,pdpLink:N}=fk(),{setCopilot:C,setConnected:H,resetCopilot:Y,resetCopilotState:D,addCopilotEvent:q,removeLoadingMessage:ne,handleCopilotRequestAck:de,setActiveConversationId:V,setConversationIds:se,setAskCimPrompts:pe}=Gs(),{connected:ve,copilot:re,messages:ae,groupedMessages:xe,loadingMessages:oe,askCimPrompts:Q}=er(),{status:ie,entryType:k}=Zn(),{isInline:R}=ti(),{getConversationMessages:ee,getSessionInformation:O}=pk({copilot:re}),_e=B.useMemo(()=>oe.size>0,[oe]),Be=B.useCallback(we=>oe.has(we),[oe]),ye=B.useCallback(({query:we,facetFilters:Pe,rangeFilters:Me,catalogSegment:rt,pricebooks:pt,userPrompt:J,imageFile:ge})=>{if(!re){p==null||p.error("Copilot is not initialized");return}if(!we)return;const Ce={searchParams:{query:we}};J&&(Ce.userPrompt=J),ge&&(Ce.attachments={image:ge}),Pe&&Object.keys(Pe).length>0&&(Ce.searchParams.facetFilters=Pe),Me&&Me.length>0&&(Ce.searchParams.rangeFilters=Me),rt&&(Ce.searchParams.catalogSegment=rt),pt&&(Ce.searchParams.pricebooks=pt),m&&(Ce.clientContext=m),ha("search"),re.search(Ce,Ve=>{const Ie=F({},Ve);de(Ie)})},[p,de,re,m]),De=B.useCallback(({categoryId:we,categoryName:Pe,facetFilters:Me,rangeFilters:rt,catalogSegment:pt,pricebooks:J,userPrompt:ge,imageFile:Ce})=>{if(!re){p==null||p.error("Copilot is not initialized");return}const Ve=Me&&Object.keys(Me).length>0;if(we===""&&!Ve){p==null||p.error("Browse event must include facetFilters when categoryId is empty");return}const Ie={browseParams:{categoryId:we||""}};ge&&(Ie.userPrompt=ge),Ce&&(Ie.attachments={image:Ce}),Ve&&(Ie.browseParams.facetFilters=Me),rt&&rt.length>0&&(Ie.browseParams.rangeFilters=rt),pt&&(Ie.browseParams.catalogSegment=pt),Array.isArray(J)&&J.length>0&&(Ie.browseParams.pricebooks=J),(m||Pe)&&(Ie.clientContext={},m&&(Ie.clientContext=F({},m)),Pe&&(Ie.clientContext.cimLabel=Pe)),ha("browse"),re.browse(Ie,lt=>{var $r;const Vt=F({},lt),Ut=(($r=Vt.request)==null?void 0:$r.clientContext)||{},an=(Ut==null?void 0:Ut.cimLabel)||Pe;an&&Vt.request&&(Vt.request.label=an),de(Vt)})},[p,de,re,m]),Ue=B.useCallback(({productId:we,productName:Pe,pdpLink:Me,userPrompt:rt,imageFile:pt})=>{if(!re){p==null||p.error("Copilot is not initialized");return}if(!we)return;const J={productId:we};rt&&(J.userPrompt=rt),Me&&(J.pdpLink=Me),pt&&(J.attachments={image:pt}),(m||Pe)&&(J.clientContext={},m&&(J.clientContext=F({},m)),Pe&&(J.clientContext.cimLabel=Pe)),b&&(J.baseCatalogParams=b),ha("pdp"),re.productView(J,ge=>{var lt;const Ce=F({},ge),Ve=((lt=Ce.request)==null?void 0:lt.clientContext)||{},Ie=(Ve==null?void 0:Ve.cimLabel)||Pe;Ie&&Ce.request&&(Ce.request.label=Ie),de(Ce)})},[p,re,de,m,b]),Ye=B.useCallback(({userPrompt:we,imageFile:Pe})=>{if(!re){p==null||p.error("Copilot is not initialized");return}if(!we)return;const Me={userPrompt:we};Pe&&(Me.attachments={image:Pe}),m&&(Me.clientContext=m),b&&(Me.baseCatalogParams=b),re.askCim(Me,rt=>{const pt=F({},rt);de(pt)})},[p,re,de,m,b]),ht=B.useCallback(we=>{q(we),c==null||c(we)},[q,c]),$t=B.useCallback(we=>{q(we),d==null||d(we)},[q,d]),sn=B.useCallback(we=>{u==null||u(we),H(!0)},[u,H]);B.useEffect(()=>{!re||!ve||!ie.isOpen||gn.size>0&&gn.processQueue(we=>{if(we.context==="search"){const Pe=F({},we.payload);u1(Pe)}if(we.context==="browse"){const Pe=F({},we.payload);t1(Pe)}if(we.context==="pdp"){const Pe=F({},we.payload);n1(Pe)}})},[ie.isOpen,re,ve]);const Tr=B.useCallback(we=>{const Pe=Me=>{const rt=fe(F({},Me),{id:Me.inquiryLinkId||Me.id});q(rt)};we.on("connect_ack",sn),we.on("partial_inquiry",Pe),we.on("display_products",q),we.on("progress",q),we.on("refined_search",ht),we.on("refined_browse",$t),we.on("done",Me=>{ne(Me.eventSourceId)}),we.on("error",Me=>{q(Me),ne(Me.eventSourceId)}),we.onDisconnect(Me=>{const rt=["io server disconnect","transport error","server shutting down"];if(p==null||p.log("Connection disconnected with reason: ",Me),!rt.includes(Me)){H(!1);return}p==null||p.log("De-registering event listeners");const pt=new Date().toISOString();q({name:"error",message:"Connection was lost. Please try again.",createdAt:pt,id:`error-${pt}`,sessionId:"session"}),we.off()})},[p,H,ne,ht,$t,q,sn]);B.useEffect(()=>{if(!re)return;const we=Pe=>{if(!R){if(!Pe.message&&Pe.eventSourceId&&Pe.eventSourceId===Q.requestId){pe({requestId:Pe.eventSourceId,message:Pe});return}q(Pe)}};return re.on("follow_up",we),()=>{re.off("follow_up",we)}},[re,ae,Q.requestId,R,q,pe]),B.useEffect(()=>{if(!re)return;const we=Pe=>{if(R)return;const Me=fe(F({},Pe),{id:Pe.inquiryLinkId||Pe.id});q(Me)};return re.on("inquiry",we),()=>{re.off("inquiry",we)}},[re,R,q]),ma(()=>{let we;n?we=n:we=a?"https://staging.copilot.search.cimulate.ai":"https://prod.copilot.search.cimulate.ai";const Pe={baseUrl:we};e?Pe.apiKey=e:t&&(Pe.apiToken=t),r&&(Pe.customerId=r),s&&(Pe.tenantId=s);const Me=new Ww(Pe);return C(Me),Tr(Me),Me.connect(),Me.requestSessionInformation(rt=>{p==null||p.log("Session Information: ",rt);const{activeConversationId:pt,conversationIds:J}=rt.data||{};pt&&V(pt),J!=null&&J.length&&se(J)}),()=>{Me.disconnect(),Me.off(),Y()}});const ir=B.useCallback(we=>{if(!re)return;const Pe={eventId:we,reason:"User cancelled the request"};re.cancelRequest(Pe,Me=>{q(Me),ne(we)})},[q,ne,re]),Jt=B.useCallback(()=>{re&&re.conversationReset({},we=>{D(),q(we),re.requestSessionInformation(Pe=>{p==null||p.log("Session Information: ",Pe);const{activeConversationId:Me,conversationIds:rt}=Pe.data||{};Me&&V(Me),rt!=null&&rt.length&&se(rt)})})},[re,p,q,D,V,se]),$e=B.useCallback((we,Pe)=>{if(!we)return;const Me={userPrompt:we};switch(Pe&&(Me.imageFile=Pe),k){case"ask_cim":Ye(Me);return;case"search":y?ye(F(F({query:y},_),Me)):Ye(Me);return;case"browse":De(F(F({categoryId:A},v),Me));return;case"pdp":w?Ue(F({productId:w,pdpLink:N||""},Me)):Ye(Me);return}},[k,y,_,ye,Ye,A,v,De,Ue,w,N]),vt=B.useCallback((we,Pe)=>{var ge,Ce,Ve;const rt=we.params.userPrompt||"";if(!rt)return;const pt=ae.find(Ie=>Ie.id===Pe);if(!pt)return;const J=pt.name.replace("_suggestions","");if(J==="ask_cim"){Ye({userPrompt:rt});return}if(J==="copilot_search"){const Ie=((ge=pt.request)==null?void 0:ge.searchParams)||{},Vt=Ie.query===y;ye(fe(F({query:Ie.query||y},Vt?_:{}),{userPrompt:rt}));return}if(J==="copilot_browse"){const Ie=pt.request,lt=Ie.browseParams||{},Ut=lt.categoryId===A,an=((Ce=Ie.clientContext)==null?void 0:Ce.cimLabel)||"";De(fe(F({categoryId:lt.categoryId||A||""},Ut?v:{}),{categoryName:an,userPrompt:rt}));return}if(J==="product_view"){const Ie=pt.request||{},lt=Ie.productId,Vt=lt===w,Ut=((Ve=Ie.clientContext)==null?void 0:Ve.cimLabel)||"";let an="";Vt?an=N||"":an=Ie.pdpLink||"",Ue({productId:lt||w,pdpLink:an,productName:Ut,userPrompt:rt})}},[ae,y,_,ye,Ye,A,v,De,Ue,w,N]),vn=B.useMemo(()=>({copilot:re,messages:ae,groupedMessages:xe,isLoading:_e,isResponseLoading:Be,handleAskCim:Ye,handleSearch:ye,handleBrowse:De,handlePdp:Ue,handleUserInput:$e,handleSuggestion:vt,handleCancel:ir,resetConversation:Jt,getSessionInformation:O,getConversationMessages:ee}),[re,ae,xe,_e,Be,Ye,ye,De,Ue,$e,vt,ir,Jt,O,ee]);return S.jsx(m1.Provider,{value:vn,children:f})},g1=()=>{const{copilot:e}=er(),{addCopilotEvent:t}=Gs();return{getCopilotSuggestions:B.useCallback((r,s,a)=>{if(!e||!s||!r)return;const u=c=>{t(c),a(c)};switch(s){case"ask_cim":e.askCimSuggestions(r,u);break;case"search":e.searchSuggestions({searchParams:r},u);break;case"browse":e.browseSuggestions({browseParams:r},u);break;case"pdp":e.productViewSuggestions({productId:r.productId},u);break}},[e,t])}},Or=()=>{const e=B.useContext(m1);if(!e)throw new Error("useCopilot must be used within a CopilotProvider");return e},gk=()=>{const{copilot:e,activeConversationId:t,askCimPrompts:n,conversationHistoryLoaded:r}=er(),{entryType:s}=Zn(),{resetCopilotState:a,addCopilotEvent:u,setAskCimPrompts:c}=Gs(),{handleSearch:d,handleBrowse:f,handlePdp:p,resetConversation:m,getSessionInformation:b,getConversationMessages:y}=Or(),{getCopilotSuggestions:_}=g1();B.useEffect(()=>{!e||!s||!t||!r||n.requestId||s==="ask_cim"&&_({},s,N=>{c({requestId:N.id,message:null})})},[e,t,n.requestId,s,r,_,c]);const A=B.useCallback(({query:N})=>{if(!e||!N)return;const{facetFilters:C}=Tt.facetFiltersProxy,{rangeFilters:H}=Tt.rangeFiltersProxy,{catalogSegment:Y}=Tt.catalogSegmentProxy,{pricebooks:D}=Tt.pricebooksProxy,q={query:N};q.facetFilters=C||{},q.rangeFilters=H||[],q.catalogSegment=Y||"",q.pricebooks=D||[],d(F({},q))},[e,d]),v=B.useCallback(({categoryId:N})=>{if(!e)return;const C=ut.categoryIdProxy.categoryName,{facetFilters:H}=ut.facetFiltersProxy,{rangeFilters:Y}=ut.rangeFiltersProxy,{catalogSegment:D}=ut.catalogSegmentProxy,{pricebooks:q}=ut.pricebooksProxy,ne={categoryId:N};ne.categoryName=C||"",ne.facetFilters=H||{},ne.rangeFilters=Y||[],ne.catalogSegment=D||"",ne.pricebooks=q||[],f(F({},ne))},[e,f]),w=B.useCallback(({productId:N})=>{if(!e||!N)return;const C={productId:N,pdpLink:hr.pdpLink,productName:hr.proxy.productName||""};p(C)},[e,p]);return B.useEffect(()=>{const N=({detail:C})=>{(C==null?void 0:C.property)==="query"&&A({query:C.value})};return Ug(N),()=>{Hg(N)}},[A]),B.useEffect(()=>{const N=({detail:C})=>{if((C==null?void 0:C.property)==="pdp-context"){const H=C.value;w({productId:H.productId});return}(C==null?void 0:C.property)==="productId"&&w({productId:C.value})};return $g(N),()=>{Vg(N)}},[w]),B.useEffect(()=>{const N=({detail:C})=>{(C==null?void 0:C.property)==="categoryId"&&v({categoryId:C.value})};return zg(N),()=>{jg(N)}},[v]),B.useEffect(()=>{const N=({detail:C})=>{if((C==null?void 0:C.event)==Ti.RESET_CONVERSATION&&m(),(C==null?void 0:C.event)==Ti.GET_SESSION_INFORMATION){const H=C.value.callback;b(H)}if((C==null?void 0:C.event)==Ti.GET_CONVERSATION_MESSAGES){const{payload:H,callback:Y}=C.value;if(!H.conversationId||typeof Y!="function")return;y(H,Y)}if((C==null?void 0:C.event)==Ti.LOAD_CONVERSATION){const H=C.value;if(!H.conversationId)return;y(H,D=>{a(),D.forEach(q=>{u(q)})})}};return Iv(N),()=>{Rv(N)}},[m,b,y,a,u]),null},Ek=({apiKey:e,apiToken:t,baseUrl:n,customerId:r,tenantId:s,isDevelopment:a,onConnect:u,onRefinedSearch:c,onRefinedBrowse:d,children:f})=>S.jsxs(mk,{apiKey:e,apiToken:t,baseUrl:n,customerId:r,tenantId:s,isDevelopment:a,onConnect:u,onRefinedSearch:c,onRefinedBrowse:d,children:[S.jsx(gk,{}),f]}),yk=({children:e,dispatch:t})=>{const n=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_INITIALIZED,payload:_})},[t]),r=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_OPEN,payload:_})},[t]),s=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_INLINE,payload:_})},[t]),a=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_ELEMENT_ID,payload:_})},[t]),u=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_ENTRY_TYPE,payload:_})},[t]),c=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID,payload:_})},[t]),d=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_USER_PROMPT,payload:_})},[t]),f=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_PARAMS,payload:_})},[t]),p=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE,payload:_})},[t]),m=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE,payload:_})},[t]),b=B.useCallback(_=>{t({type:Et.SET_PROMPTS_EXTENSION_RESPONSE_LOADING,payload:_})},[t]),y=B.useMemo(()=>({setIsInitialized:n,setIsOpen:r,setIsInline:s,setElementId:a,setEntryType:u,setActivePromptsId:c,setUserPrompt:d,setParams:f,setPromptsMessage:p,setResponseMessage:m,setIsResponseLoading:b}),[n,r,s,a,u,c,d,f,p,m,b]);return S.jsx(p1.Provider,{value:y,children:e})},Tk=(e,t)=>{const{type:n,payload:r}=t;switch(n){case Et.SET_PROMPTS_EXTENSION_INITIALIZED:e.isInitialized=r;break;case Et.SET_PROMPTS_EXTENSION_OPEN:e.isOpen=r;break;case Et.SET_PROMPTS_EXTENSION_INLINE:e.isInline=r;break;case Et.SET_PROMPTS_EXTENSION_ELEMENT_ID:e.elementId=r;break;case Et.SET_PROMPTS_EXTENSION_ENTRY_TYPE:e.entryType=r;break;case Et.SET_PROMPTS_EXTENSION_PARAMS:e.params=r;break;case Et.RESET_PROMPTS_EXTENSION_PARAMS:e.params=null;break;case Et.SET_PROMPTS_EXTENSION_USER_PROMPT:e.userPrompt=r;break;case Et.SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:e.activePromptsId=r;break;case Et.RESET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:e.activePromptsId=null;break;case Et.SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:e.promptsMessage=r;break;case Et.RESET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:e.promptsMessage=null;break;case Et.SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:e.responseMessage=r;break;case Et.RESET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:e.responseMessage=null;break;case Et.SET_PROMPTS_EXTENSION_RESPONSE_LOADING:e.isResponseLoading=r;break}},bk=({promptsConfig:e,children:t})=>{const[n,r]=q0(Tk,fe(F(F({},Q0),e||{}),{staticQuestions:R0((e==null?void 0:e.staticQuestions)||[])}));return S.jsx(h1.Provider,{value:n,children:S.jsx(yk,{dispatch:r,children:t})})},E1=({mode:e,apiKey:t,apiToken:n,baseUrl:r,customerId:s,tenantId:a,logoUrl:u,headerText:c,headerConfig:d,theme:f,openLinksInNewTab:p,globalClassName:m,isDevelopment:b=!1,componentType:y,componentConfig:_,entryType:A,initialEntry:v,entryMessage:w,disclaimerText:N,disclaimerMarkdown:C,clientContext:H,baseCatalogParams:Y,searchPlaceholder:D,searchButtonLabel:q,searchConfig:ne,suggestionButtonConfig:de,messageAlignment:V,autoScroll:se,promptsConfig:pe,resetConversationMessage:ve,conversationHistory:re,onConnect:ae,onCopilotEvent:xe,onRefinedSearch:oe,onRefinedBrowse:Q,__features:ie,children:k})=>{const R=v==null?void 0:v.params;return S.jsx(lv,{mode:e,baseUrl:r,apiKey:t,apiToken:n,customerId:s,tenantId:a,logoUrl:u,headerText:c,headerConfig:d,entryMessage:w,staticQuestions:R0(R==null?void 0:R.staticQuestions),staticQuestionsStrategy:R==null?void 0:R.staticQuestionsStrategy,theme:f,globalClassName:m,openLinksInNewTab:p,searchPlaceholder:D,searchButtonLabel:q,searchConfig:ne,suggestionButtonConfig:de,messageAlignment:V,autoScroll:se,componentConfig:_,clientContext:H,baseCatalogParams:Y,disclaimerMarkdown:C,disclaimerText:N,resetConversationMessage:ve,conversationHistory:re,isDevelopment:b,__features:ie,children:S.jsx(hk,{entryType:A!=null?A:v==null?void 0:v.type,componentConfig:_,componentType:y,children:S.jsx(bv,{onCopilotEvent:xe,children:S.jsx(dk,{children:S.jsx(sk,{children:S.jsx(uk,{children:S.jsx(bk,{promptsConfig:pe,children:S.jsx(Ek,{apiKey:t,apiToken:n,baseUrl:r,customerId:s,tenantId:a,isDevelopment:b,entryType:A,onConnect:ae,onRefinedSearch:oe,onRefinedBrowse:Q,onCopilotEvent:xe,children:k})})})})})})})})};var Sf={exports:{}},On={},xf={exports:{}},wf={};var y1;function _k(){return y1||(y1=1,(function(e){function t(Q,ie){var k=Q.length;Q.push(ie);e:for(;0<k;){var R=k-1>>>1,ee=Q[R];if(0<s(ee,ie))Q[R]=ie,Q[k]=ee,k=R;else break e}}function n(Q){return Q.length===0?null:Q[0]}function r(Q){if(Q.length===0)return null;var ie=Q[0],k=Q.pop();if(k!==ie){Q[0]=k;e:for(var R=0,ee=Q.length,O=ee>>>1;R<O;){var _e=2*(R+1)-1,Be=Q[_e],ye=_e+1,De=Q[ye];if(0>s(Be,k))ye<ee&&0>s(De,Be)?(Q[R]=De,Q[ye]=k,R=ye):(Q[R]=Be,Q[_e]=k,R=_e);else if(ye<ee&&0>s(De,k))Q[R]=De,Q[ye]=k,R=ye;else break e}}return ie}function s(Q,ie){var k=Q.sortIndex-ie.sortIndex;return k!==0?k:Q.id-ie.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var u=Date,c=u.now();e.unstable_now=function(){return u.now()-c}}var d=[],f=[],p=1,m=null,b=3,y=!1,_=!1,A=!1,v=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate!="undefined"?setImmediate:null;typeof navigator!="undefined"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(Q){for(var ie=n(f);ie!==null;){if(ie.callback===null)r(f);else if(ie.startTime<=Q)r(f),ie.sortIndex=ie.expirationTime,t(d,ie);else break;ie=n(f)}}function H(Q){if(A=!1,C(Q),!_)if(n(d)!==null)_=!0,xe(Y);else{var ie=n(f);ie!==null&&oe(H,ie.startTime-Q)}}function Y(Q,ie){_=!1,A&&(A=!1,w(ne),ne=-1),y=!0;var k=b;try{for(C(ie),m=n(d);m!==null&&(!(m.expirationTime>ie)||Q&&!se());){var R=m.callback;if(typeof R=="function"){m.callback=null,b=m.priorityLevel;var ee=R(m.expirationTime<=ie);ie=e.unstable_now(),typeof ee=="function"?m.callback=ee:m===n(d)&&r(d),C(ie)}else r(d);m=n(d)}if(m!==null)var O=!0;else{var _e=n(f);_e!==null&&oe(H,_e.startTime-ie),O=!1}return O}finally{m=null,b=k,y=!1}}var D=!1,q=null,ne=-1,de=5,V=-1;function se(){return!(e.unstable_now()-V<de)}function pe(){if(q!==null){var Q=e.unstable_now();V=Q;var ie=!0;try{ie=q(!0,Q)}finally{ie?ve():(D=!1,q=null)}}else D=!1}var ve;if(typeof N=="function")ve=function(){N(pe)};else if(typeof MessageChannel!="undefined"){var re=new MessageChannel,ae=re.port2;re.port1.onmessage=pe,ve=function(){ae.postMessage(null)}}else ve=function(){v(pe,0)};function xe(Q){q=Q,D||(D=!0,ve())}function oe(Q,ie){ne=v(function(){Q(e.unstable_now())},ie)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Q){Q.callback=null},e.unstable_continueExecution=function(){_||y||(_=!0,xe(Y))},e.unstable_forceFrameRate=function(Q){0>Q||125<Q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):de=0<Q?Math.floor(1e3/Q):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(Q){switch(b){case 1:case 2:case 3:var ie=3;break;default:ie=b}var k=b;b=ie;try{return Q()}finally{b=k}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Q,ie){switch(Q){case 1:case 2:case 3:case 4:case 5:break;default:Q=3}var k=b;b=Q;try{return ie()}finally{b=k}},e.unstable_scheduleCallback=function(Q,ie,k){var R=e.unstable_now();switch(typeof k=="object"&&k!==null?(k=k.delay,k=typeof k=="number"&&0<k?R+k:R):k=R,Q){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=k+ee,Q={id:p++,callback:ie,priorityLevel:Q,startTime:k,expirationTime:ee,sortIndex:-1},k>R?(Q.sortIndex=k,t(f,Q),n(d)===null&&Q===n(f)&&(A?(w(ne),ne=-1):A=!0,oe(H,k-R))):(Q.sortIndex=ee,t(d,Q),_||y||(_=!0,xe(Y))),Q},e.unstable_shouldYield=se,e.unstable_wrapCallback=function(Q){var ie=b;return function(){var k=b;b=ie;try{return Q.apply(this,arguments)}finally{b=k}}}})(wf)),wf}var T1;function Sk(){return T1||(T1=1,xf.exports=_k()),xf.exports}var b1;function xk(){if(b1)return On;b1=1;var e=hn(),t=Sk();function n(i){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+i,l=1;l<arguments.length;l++)o+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+i+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,s={};function a(i,o){u(i,o),u(i+"Capture",o)}function u(i,o){for(s[i]=o,i=0;i<o.length;i++)r.add(o[i])}var c=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),d=Object.prototype.hasOwnProperty,f=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},m={};function b(i){return d.call(m,i)?!0:d.call(p,i)?!1:f.test(i)?m[i]=!0:(p[i]=!0,!1)}function y(i,o,l,h){if(l!==null&&l.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return h?!1:l!==null?!l.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function _(i,o,l,h){if(o===null||typeof o=="undefined"||y(i,o,l,h))return!0;if(h)return!1;if(l!==null)switch(l.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function A(i,o,l,h,E,T,x){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=h,this.attributeNamespace=E,this.mustUseProperty=l,this.propertyName=i,this.type=o,this.sanitizeURL=T,this.removeEmptyString=x}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){v[i]=new A(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var o=i[0];v[o]=new A(o,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){v[i]=new A(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){v[i]=new A(i,2,!1,i,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(i){v[i]=new A(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){v[i]=new A(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){v[i]=new A(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){v[i]=new A(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){v[i]=new A(i,5,!1,i.toLowerCase(),null,!1,!1)});var w=/[\-:]([a-z])/g;function N(i){return i[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(i){var o=i.replace(w,N);v[o]=new A(o,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var o=i.replace(w,N);v[o]=new A(o,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var o=i.replace(w,N);v[o]=new A(o,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){v[i]=new A(i,1,!1,i.toLowerCase(),null,!1,!1)}),v.xlinkHref=new A("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){v[i]=new A(i,1,!1,i.toLowerCase(),null,!0,!0)});function C(i,o,l,h){var E=v.hasOwnProperty(o)?v[o]:null;(E!==null?E.type!==0:h||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(_(o,l,E,h)&&(l=null),h||E===null?b(o)&&(l===null?i.removeAttribute(o):i.setAttribute(o,""+l)):E.mustUseProperty?i[E.propertyName]=l===null?E.type===3?!1:"":l:(o=E.attributeName,h=E.attributeNamespace,l===null?i.removeAttribute(o):(E=E.type,l=E===3||E===4&&l===!0?"":""+l,h?i.setAttributeNS(h,o,l):i.setAttribute(o,l))))}var H=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Y=Symbol.for("react.element"),D=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),ne=Symbol.for("react.strict_mode"),de=Symbol.for("react.profiler"),V=Symbol.for("react.provider"),se=Symbol.for("react.context"),pe=Symbol.for("react.forward_ref"),ve=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),xe=Symbol.for("react.lazy"),oe=Symbol.for("react.offscreen"),Q=Symbol.iterator;function ie(i){return i===null||typeof i!="object"?null:(i=Q&&i[Q]||i["@@iterator"],typeof i=="function"?i:null)}var k=Object.assign,R;function ee(i){if(R===void 0)try{throw Error()}catch(l){var o=l.stack.trim().match(/\n( *(at )?)/);R=o&&o[1]||""}return`
|
|
11
11
|
`+R+i}var O=!1;function _e(i,o){if(!i||O)return"";O=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(Z){var h=Z}Reflect.construct(i,[],o)}else{try{o.call()}catch(Z){h=Z}i.call(o.prototype)}else{try{throw Error()}catch(Z){h=Z}i()}}catch(Z){if(Z&&h&&typeof Z.stack=="string"){for(var E=Z.stack.split(`
|
|
12
12
|
`),T=h.stack.split(`
|
|
13
13
|
`),x=E.length-1,L=T.length-1;1<=x&&0<=L&&E[x]!==T[L];)L--;for(;1<=x&&0<=L;x--,L--)if(E[x]!==T[L]){if(x!==1||L!==1)do if(x--,L--,0>L||E[x]!==T[L]){var U=`
|
package/dist/copilot.es.js
CHANGED
|
@@ -6312,7 +6312,7 @@ const aP = {
|
|
|
6312
6312
|
showProductCaptions: !!oe,
|
|
6313
6313
|
resetConversationMessage: Y,
|
|
6314
6314
|
conversationHistory: {
|
|
6315
|
-
sinceHours: typeof (H == null ? void 0 : H.sinceHours) == "number" ? H.sinceHours : 1,
|
|
6315
|
+
sinceHours: typeof (H == null ? void 0 : H.sinceHours) == "number" ? H.sinceHours : R ? 24 : 1,
|
|
6316
6316
|
limit: H == null ? void 0 : H.limit
|
|
6317
6317
|
},
|
|
6318
6318
|
features: Ne,
|